[test]core 1.8

This commit is contained in:
Mazeorz
2021-11-17 15:00:32 +08:00
parent 5d510eb5aa
commit 1f3968bd50
6 changed files with 763 additions and 0 deletions

25
transport/vless/xtls.go Normal file
View File

@ -0,0 +1,25 @@
package vless
import (
"net"
xtls "github.com/xtls/go"
)
type XTLSConfig struct {
Host string
SkipCertVerify bool
NextProtos []string
}
func StreamXTLSConn(conn net.Conn, cfg *XTLSConfig) (net.Conn, error) {
xtlsConfig := &xtls.Config{
ServerName: cfg.Host,
InsecureSkipVerify: cfg.SkipCertVerify,
NextProtos: cfg.NextProtos,
}
xtlsConn := xtls.Client(conn, xtlsConfig)
err := xtlsConn.Handshake()
return xtlsConn, err
}