mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 01:08:33 +00:00
Add uTLS fingerprints support (#451)
This commit is contained in:
parent
e564d9ef7e
commit
a9e11075d1
7 changed files with 50 additions and 29 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue