chore: add some comments for the fingerprint verifier

This commit is contained in:
wwqgtxx
2026-02-05 10:14:30 +08:00
parent 558b3840ea
commit 3bca69c745

View File

@@ -103,6 +103,9 @@ func GetTLSConfig(opt Option) (tlsConfig *tls.Config, err error) {
return nil, err
}
tlsConfig.VerifyConnection = func(state tls.ConnectionState) error {
// [ConnectionState.ServerName] can return the actual ServerName needed for verification,
// avoiding inconsistencies caused by [tlsConfig.ServerName] being modified after the [NewFingerprintVerifier] call.
// https://github.com/golang/go/issues/36736#issuecomment-587925536
return verifier(state.PeerCertificates, state.ServerName)
}
tlsConfig.InsecureSkipVerify = true