fix dtls connection

This commit is contained in:
ginuerzh
2022-12-23 18:56:58 +08:00
parent fb29d5c80e
commit bb106e2d89
11 changed files with 249 additions and 58 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/go-gost/core/dialer"
"github.com/go-gost/core/logger"
md "github.com/go-gost/core/metadata"
xdtls "github.com/go-gost/x/internal/util/dtls"
"github.com/go-gost/x/registry"
"github.com/pion/dtls/v2"
)
@ -65,5 +66,9 @@ func (d *dtlsDialer) Dial(ctx context.Context, addr string, opts ...dialer.DialO
MTU: d.md.mtu,
}
return dtls.ClientWithContext(ctx, conn, &config)
c, err := dtls.ClientWithContext(ctx, conn, &config)
if err != nil {
return nil, err
}
return xdtls.Conn(c, d.md.bufferSize), nil
}