From 51e4330b8c67b07acb46e9f4533277042d8a5f12 Mon Sep 17 00:00:00 2001 From: dyhkwong <50692134+dyhkwong@users.noreply.github.com> Date: Wed, 23 Jul 2025 17:51:39 +0800 Subject: [PATCH] Fix disable_sni nil time func --- common/tls/std_client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/tls/std_client.go b/common/tls/std_client.go index 2a77ed0c..0f855228 100644 --- a/common/tls/std_client.go +++ b/common/tls/std_client.go @@ -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 }