-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: swtich
RtlGetNtVersionNumbers
to RtlGetVersion
- Loading branch information
Showing
4 changed files
with
19 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
package ca | ||
|
||
import ( | ||
"golang.org/x/sys/windows" | ||
"github.com/metacubex/mihomo/constant/features" | ||
) | ||
|
||
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 { | ||
if features.WindowsMajorVersion < 10 && len(_CaCertificates) > 0 { | ||
DisableSystemCa = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package features | ||
|
||
var WindowsMajorVersion uint32 | ||
var WindowsMinorVersion uint32 | ||
var WindowsBuildNumber uint32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package features | ||
|
||
import "golang.org/x/sys/windows" | ||
|
||
func init() { | ||
version := windows.RtlGetVersion() | ||
WindowsMajorVersion = version.MajorVersion | ||
WindowsMinorVersion = version.MinorVersion | ||
WindowsBuildNumber = version.MinorVersion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters