utls
This commit is contained in:
@ -174,8 +174,13 @@ func (d *mwsDialer) initSession(ctx context.Context, host string, conn net.Conn,
|
||||
})
|
||||
}
|
||||
}
|
||||
client := tls.UClient(conn, utlsConf, tls.HelloCustom)
|
||||
client.ApplyPreset(util.NewWsSpec())
|
||||
var client *tls.UConn
|
||||
if d.md.useH2 {
|
||||
client = tls.UClient(conn, utlsConf, tls.HelloChrome_Auto)
|
||||
} else {
|
||||
client = tls.UClient(conn, utlsConf, tls.HelloCustom)
|
||||
client.ApplyPreset(util.NewWsSpec())
|
||||
}
|
||||
err := client.Handshake()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -27,6 +27,9 @@ type metadata struct {
|
||||
header http.Header
|
||||
keepaliveInterval time.Duration
|
||||
muxCfg *mux.Config
|
||||
|
||||
//Evan Enhanced
|
||||
useH2 bool
|
||||
}
|
||||
|
||||
func (d *mwsDialer) parseMetadata(md mdata.Metadata) (err error) {
|
||||
@ -67,5 +70,6 @@ func (d *mwsDialer) parseMetadata(md mdata.Metadata) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
d.md.useH2 = mdutil.GetBool(md, "h2")
|
||||
return
|
||||
}
|
||||
|
@ -111,8 +111,13 @@ func (d *wsDialer) Handshake(ctx context.Context, conn net.Conn, options ...dial
|
||||
})
|
||||
}
|
||||
}
|
||||
client := tls.UClient(conn, utlsConf, tls.HelloCustom)
|
||||
client.ApplyPreset(util.NewWsSpec())
|
||||
var client *tls.UConn
|
||||
if d.md.useH2 {
|
||||
client = tls.UClient(conn, utlsConf, tls.HelloChrome_Auto)
|
||||
} else {
|
||||
client = tls.UClient(conn, utlsConf, tls.HelloCustom)
|
||||
client.ApplyPreset(util.NewWsSpec())
|
||||
}
|
||||
err := client.Handshake()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -25,6 +25,9 @@ type metadata struct {
|
||||
|
||||
header http.Header
|
||||
keepaliveInterval time.Duration
|
||||
|
||||
//Evan Enhance
|
||||
useH2 bool
|
||||
}
|
||||
|
||||
func (d *wsDialer) parseMetadata(md mdata.Metadata) (err error) {
|
||||
@ -56,5 +59,6 @@ func (d *wsDialer) parseMetadata(md mdata.Metadata) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
d.md.useH2 = mdutil.GetBool(md, "h2")
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user