We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我有自定义ClientHelloSpec的需求,用SetTLSHandshake能解决,但能否新增一个设置ClientHelloSpec的方法,类似于下面这样:
utls.HelloCustom 支持自定义ClientHelloSpec
func (c *Client) SetTLSClientHelloSpec(spec *utls.ClientHelloSpec) *Client { fn := func(ctx context.Context, addr string, plainConn net.Conn) (conn net.Conn, tlsState *tls.ConnectionState, err error) { colonPos := strings.LastIndex(addr, ":") if colonPos == -1 { colonPos = len(addr) } hostname := addr[:colonPos] tlsConfig := c.GetTLSClientConfig() utlsConfig := &utls.Config{ ServerName: hostname, Rand: tlsConfig.Rand, Time: tlsConfig.Time, RootCAs: tlsConfig.RootCAs, NextProtos: tlsConfig.NextProtos, ClientCAs: tlsConfig.ClientCAs, InsecureSkipVerify: tlsConfig.InsecureSkipVerify, CipherSuites: tlsConfig.CipherSuites, SessionTicketsDisabled: tlsConfig.SessionTicketsDisabled, MinVersion: tlsConfig.MinVersion, MaxVersion: tlsConfig.MaxVersion, DynamicRecordSizingDisabled: tlsConfig.DynamicRecordSizingDisabled, KeyLogWriter: tlsConfig.KeyLogWriter, } uconn := &uTLSConn{utls.UClient(plainConn, utlsConfig, utls.HelloCustom)} err = uconn.ApplyPreset(spec) if err != nil { return } err = uconn.BuildHandshakeState() if err != nil { return } err = uconn.HandshakeContext(ctx) if err != nil { return } cs := uconn.Conn.ConnectionState() conn = uconn tlsState = &tls.ConnectionState{ Version: cs.Version, HandshakeComplete: cs.HandshakeComplete, DidResume: cs.DidResume, CipherSuite: cs.CipherSuite, NegotiatedProtocol: cs.NegotiatedProtocol, NegotiatedProtocolIsMutual: cs.NegotiatedProtocolIsMutual, ServerName: cs.ServerName, PeerCertificates: cs.PeerCertificates, VerifiedChains: cs.VerifiedChains, SignedCertificateTimestamps: cs.SignedCertificateTimestamps, OCSPResponse: cs.OCSPResponse, TLSUnique: cs.TLSUnique, } return } c.Transport.SetTLSHandshake(fn) return c }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我有自定义ClientHelloSpec的需求,用SetTLSHandshake能解决,但能否新增一个设置ClientHelloSpec的方法,类似于下面这样:
utls.HelloCustom 支持自定义ClientHelloSpec
The text was updated successfully, but these errors were encountered: