mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-12 07:08:41 +00:00
Add uTLS support for shadowtls
This commit is contained in:
parent
6fb673aee4
commit
0188c2d67d
10 changed files with 55 additions and 31 deletions
|
@ -24,7 +24,7 @@ import (
|
|||
"time"
|
||||
"unsafe"
|
||||
|
||||
utls "github.com/refraction-networking/utls"
|
||||
utls "github.com/sagernet/utls"
|
||||
"github.com/xtls/reality"
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
|
|
|
@ -25,7 +25,7 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||
tlsConfig := config.GetTLSConfig(tls.WithDestination(dest))
|
||||
customClient, loaded := tls.CustomClientFromContext(ctx)
|
||||
if loaded {
|
||||
conn = customClient(conn, tlsConfig)
|
||||
conn = customClient(conn, config, tlsConfig)
|
||||
} else {
|
||||
if fingerprint := tls.GetFingerprint(config.Fingerprint); fingerprint != nil {
|
||||
conn = tls.UClient(conn, tlsConfig, fingerprint)
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
type customClientKey struct{}
|
||||
|
||||
type CustomClientFunc func(conn net.Conn, config *tls.Config) net.Conn
|
||||
type CustomClientFunc func(conn net.Conn, xrayConfig *Config, config *tls.Config) net.Conn
|
||||
|
||||
func CustomClientFromContext(ctx context.Context) (CustomClientFunc, bool) {
|
||||
client, loaded := ctx.Value(customClientKey{}).(CustomClientFunc)
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"net/url"
|
||||
"strconv"
|
||||
|
||||
utls "github.com/refraction-networking/utls"
|
||||
utls "github.com/sagernet/utls"
|
||||
"google.golang.org/grpc/credentials"
|
||||
)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"crypto/tls"
|
||||
"math/big"
|
||||
|
||||
utls "github.com/refraction-networking/utls"
|
||||
utls "github.com/sagernet/utls"
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue