diff --git a/basic/basiccheck.go b/basic/basiccheck.go index 1ba5db4..0baf048 100644 --- a/basic/basiccheck.go +++ b/basic/basiccheck.go @@ -7,7 +7,7 @@ import ( "strings" ) -// 本包不在main中使用,仅做测试使用 +// 本包不在main中使用,仅做测试使用,真正调用的在 utils 中的 BasicsAndSecurityCheck func Basic(language string) { ipInfo, _, _ := network.NetworkCheck("both", false, language) systemInfo := system.CheckSystemInfo(language) diff --git a/goecs.go b/goecs.go index 795af59..248df29 100644 --- a/goecs.go +++ b/goecs.go @@ -39,7 +39,7 @@ import ( ) var ( - ecsVersion = "v0.0.83" + ecsVersion = "v0.0.84" menuMode bool onlyChinaTest bool input, choice string @@ -340,7 +340,7 @@ func main() { if basicStatus { utils.PrintCenteredTitle("系统基础信息", width) } - basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus) + basicInfo, securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, nt3CheckType, securityTestStatus) if basicStatus { fmt.Printf(basicInfo) } else if (input == "6" || input == "9") && securityTestStatus { @@ -481,7 +481,7 @@ func main() { if basicStatus { utils.PrintCenteredTitle("System-Basic-Information", width) } - basicInfo, securityInfo, nt3CheckType = utils.SecurityCheck(language, nt3CheckType, securityTestStatus) + basicInfo, securityInfo, nt3CheckType = utils.BasicsAndSecurityCheck(language, nt3CheckType, securityTestStatus) if basicStatus { fmt.Printf(basicInfo) } else if (input == "6" || input == "9") && securityTestStatus { diff --git a/utils/utils.go b/utils/utils.go index f1a142d..69350f5 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/imroc/req/v3" "github.com/oneclickvirt/UnlockTests/uts" + "github.com/oneclickvirt/basics/ipv6" "github.com/oneclickvirt/basics/system" . "github.com/oneclickvirt/defaultset" "github.com/oneclickvirt/security/network" @@ -128,12 +129,12 @@ func CheckChina(enableLogger bool) bool { return selectChina } -// SecurityCheck 执行安全检查 -func SecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (string, string, string) { +// BasicsAndSecurityCheck 执行安全检查 +func BasicsAndSecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (string, string, string) { var wgt sync.WaitGroup var ipInfo, securityInfo, systemInfo string var err error - wgt.Add(2) + wgt.Add(1) go func() { defer wgt.Done() ipInfo, securityInfo, err = network.NetworkCheck("both", securtyCheckStatus, language) @@ -141,12 +142,17 @@ func SecurityCheck(language, nt3CheckType string, securtyCheckStatus bool) (stri fmt.Println(err.Error()) } }() + wgt.Add(1) go func() { defer wgt.Done() systemInfo = system.CheckSystemInfo(language) }() wgt.Wait() + ipv6Info, errv6 := ipv6.GetIPv6Mask(language) basicInfo := systemInfo + ipInfo + if errv6 == nil && ipv6Info != "" { + basicInfo += ipv6Info + } if strings.Contains(ipInfo, "IPV4") && strings.Contains(ipInfo, "IPV6") { uts.IPV4 = true uts.IPV6 = true