mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-12 03:19:36 +03:00
Added utls to http2 transport
This commit is contained in:
@ -34,6 +34,11 @@ func (c *Conn) HandshakeAddress() net.Address {
|
||||
return net.ParseAddress(state.ServerName)
|
||||
}
|
||||
|
||||
func (c *Conn) NegotiatedProtocol() (name string, mutual bool) {
|
||||
state := c.ConnectionState()
|
||||
return state.NegotiatedProtocol, state.NegotiatedProtocolIsMutual
|
||||
}
|
||||
|
||||
// Client initiates a TLS client handshake on the given connection.
|
||||
func Client(c net.Conn, config *tls.Config) net.Conn {
|
||||
tlsConn := tls.Client(c, config)
|
||||
@ -61,6 +66,11 @@ func (c *UConn) HandshakeAddress() net.Address {
|
||||
return net.ParseAddress(state.ServerName)
|
||||
}
|
||||
|
||||
func (c *UConn) NegotiatedProtocol() (name string, mutual bool) {
|
||||
state := c.ConnectionState()
|
||||
return state.NegotiatedProtocol, state.NegotiatedProtocolIsMutual
|
||||
}
|
||||
|
||||
func UClient(c net.Conn, config *tls.Config, fingerprint *utls.ClientHelloID) net.Conn {
|
||||
utlsConn := utls.UClient(c, copyConfig(config), *fingerprint)
|
||||
return &UConn{UConn: utlsConn}
|
||||
@ -80,3 +90,10 @@ var Fingerprints = map[string]*utls.ClientHelloID{
|
||||
"safari": &utls.HelloIOS_Auto,
|
||||
"randomized": &utls.HelloRandomized,
|
||||
}
|
||||
|
||||
type Interface interface {
|
||||
net.Conn
|
||||
Handshake() error
|
||||
VerifyHostname(host string) error
|
||||
NegotiatedProtocol() (name string, mutual bool)
|
||||
}
|
||||
|
Reference in New Issue
Block a user