mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
fix: x509 error in windows7/8
This commit is contained in:
parent
619f34119e
commit
b840eae4c6
|
@ -67,9 +67,6 @@ func ResetCertificate() {
|
|||
}
|
||||
|
||||
func getCertPool() *x509.CertPool {
|
||||
if len(trustCerts) == 0 {
|
||||
return nil
|
||||
}
|
||||
if globalCertPool == nil {
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
|
|
15
component/ca/fix_windows.go
Normal file
15
component/ca/fix_windows.go
Normal file
|
@ -0,0 +1,15 @@
|
|||
package ca
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
func init() {
|
||||
majorVersion, _, _ := windows.RtlGetNtVersionNumbers()
|
||||
// crypto/x509: certificate validation in Windows fails to validate IP in SAN
|
||||
// https://github.com/golang/go/issues/37176
|
||||
// As far as I can tell this is still the case on most older versions of Windows (but seems to be fixed in 10)
|
||||
if majorVersion < 10 && len(_CaCertificates) > 0 {
|
||||
DisableSystemCa = true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user