SetTLSFingerprint set the tls fingerprint for tls handshake, will use utls (https://github.com/refraction-networking/utls) to perform the tls handshake, which uses the specified clientHelloID to simulate the tls fingerprint. Note this is valid for HTTP1 and HTTP2, not HTTP3.
(clientHelloID utls.ClientHelloID)
| 1225 | // which uses the specified clientHelloID to simulate the tls fingerprint. |
| 1226 | // Note this is valid for HTTP1 and HTTP2, not HTTP3. |
| 1227 | func (c *Client) SetTLSFingerprint(clientHelloID utls.ClientHelloID) *Client { |
| 1228 | c.setTLSFingerprint(clientHelloID, nil) |
| 1229 | return c |
| 1230 | } |
| 1231 | func (c *Client) setTLSFingerprint(clientHelloID utls.ClientHelloID, uTLSConnApply func(*uTLSConn) error) *Client { |
| 1232 | fn := func(ctx context.Context, addr string, plainConn net.Conn) (conn net.Conn, tlsState *tls.ConnectionState, err error) { |
| 1233 | colonPos := strings.LastIndex(addr, ":") |
no test coverage detected