Skip to content

Commit

Permalink
增加对应的子网掩码检测调用
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritysdx committed Nov 8, 2024
1 parent 20c8063 commit 9c9dbc6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion basic/basiccheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
)

// 本包不在main中使用,仅做测试使用
// 本包不在main中使用,仅做测试使用,真正调用的在 utils 中的 BasicsAndSecurityCheck
func Basic(language string) {
ipInfo, _, _ := network.NetworkCheck("both", false, language)
systemInfo := system.CheckSystemInfo(language)
Expand Down
6 changes: 3 additions & 3 deletions goecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
)

var (
ecsVersion = "v0.0.83"
ecsVersion = "v0.0.84"
menuMode bool
onlyChinaTest bool
input, choice string
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
12 changes: 9 additions & 3 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -128,25 +129,30 @@ 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)
if err != nil {
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
Expand Down

0 comments on commit 9c9dbc6

Please sign in to comment.