mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-08-22 17:46:48 +08:00
Add uTLS fingerprints support (#451)
This commit is contained in:
@@ -3,6 +3,8 @@ package tls
|
||||
import (
|
||||
"crypto/tls"
|
||||
|
||||
utls "github.com/refraction-networking/utls"
|
||||
|
||||
"github.com/xtls/xray-core/common/buf"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
)
|
||||
@@ -41,23 +43,24 @@ func Client(c net.Conn, config *tls.Config) net.Conn {
|
||||
return &Conn{Conn: tlsConn}
|
||||
}
|
||||
|
||||
/*
|
||||
func copyConfig(c *tls.Config) *utls.Config {
|
||||
var Fingerprints = map[string]utls.ClientHelloID{
|
||||
"chrome": utls.HelloChrome_Auto,
|
||||
"firefox": utls.HelloFirefox_Auto,
|
||||
"safari": utls.HelloIOS_Auto,
|
||||
"randomized": utls.HelloRandomized,
|
||||
}
|
||||
|
||||
func CopyConfig(c *tls.Config) *utls.Config {
|
||||
return &utls.Config{
|
||||
RootCAs: c.RootCAs,
|
||||
NextProtos: c.NextProtos,
|
||||
ServerName: c.ServerName,
|
||||
InsecureSkipVerify: c.InsecureSkipVerify,
|
||||
MinVersion: utls.VersionTLS12,
|
||||
MaxVersion: utls.VersionTLS12,
|
||||
MinVersion: c.MinVersion,
|
||||
MaxVersion: c.MaxVersion,
|
||||
}
|
||||
}
|
||||
|
||||
func UClient(c net.Conn, config *tls.Config) net.Conn {
|
||||
uConfig := copyConfig(config)
|
||||
return utls.Client(c, uConfig)
|
||||
}
|
||||
*/
|
||||
|
||||
// Server initiates a TLS server handshake on the given connection.
|
||||
func Server(c net.Conn, config *tls.Config) net.Conn {
|
||||
tlsConn := tls.Server(c, config)
|
||||
|
Reference in New Issue
Block a user