Fix disable_sni nil time func

This commit is contained in:
dyhkwong 2025-07-23 17:51:39 +08:00 committed by 世界
parent 0f2035149c
commit 9dd9fb27cd
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -87,13 +87,15 @@ func NewSTDClient(ctx context.Context, serverAddress string, options option.Outb
tlsConfig.VerifyConnection = func(state tls.ConnectionState) error {
verifyOptions := x509.VerifyOptions{
Roots: tlsConfig.RootCAs,
CurrentTime: tlsConfig.Time(),
DNSName: serverName,
Intermediates: x509.NewCertPool(),
}
for _, cert := range state.PeerCertificates[1:] {
verifyOptions.Intermediates.AddCert(cert)
}
if tlsConfig.Time != nil {
verifyOptions.CurrentTime = tlsConfig.Time()
}
_, err := state.PeerCertificates[0].Verify(verifyOptions)
return err
}