This commit is contained in:
spiritysdx
2024-06-30 19:49:25 +08:00
parent c611946a9c
commit ab91735695
8 changed files with 31 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
package basic
package basic1
import "testing"

View File

@@ -1,4 +1,4 @@
package basic
package basic1
import (
"fmt"
@@ -10,7 +10,7 @@ import (
// 使用gopsutil查询可能会特别慢执行命令查询反而更快
// TODO
// 迁移Shell的完整检测逻辑使用执行命令的方式查询最后都失败才使用gopsutil查询
// 本包在main中
// 本包在main中使
func Basic(language string) {
ipInfo, _, _ := network.NetworkCheck("both", false, language)
systemInfo := system.CheckSystemInfo(language)

2
go.mod
View File

@@ -14,7 +14,7 @@ require (
github.com/oneclickvirt/nt3 v0.0.1-20240627070009
github.com/oneclickvirt/portchecker v0.0.1-20240624155429
github.com/oneclickvirt/security v0.0.1-20240630101628
github.com/oneclickvirt/speedtest v0.0.5-20240630045424
github.com/oneclickvirt/speedtest v0.0.6-20240630114816
)
require (

2
go.sum
View File

@@ -121,6 +121,8 @@ github.com/oneclickvirt/speedtest v0.0.4-20240629100548 h1:DQA0R/EdtmLJrQBb9JvQB
github.com/oneclickvirt/speedtest v0.0.4-20240629100548/go.mod h1:JNIxUbEJD12w81b7754RLHD55fsH6wHj+fCV2PqBDhk=
github.com/oneclickvirt/speedtest v0.0.5-20240630045424 h1:LXvoAgCAJVGci0Tzm3cDgvNaezncS8R5nOn8s+p+kNA=
github.com/oneclickvirt/speedtest v0.0.5-20240630045424/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
github.com/oneclickvirt/speedtest v0.0.6-20240630114816 h1:gI2hqV0IwcvGqYzLhlt4w2oZvYhCL+73jftUuJYBsuI=
github.com/oneclickvirt/speedtest v0.0.6-20240630114816/go.mod h1:zd5ZgIGslmtQLQehEfRjyumlvgDHTpCSMchKfKXoASI=
github.com/onsi/ginkgo/v2 v2.16.0 h1:7q1w9frJDzninhXxjZd+Y/x54XNjG/UlRLIYPZafsPM=
github.com/onsi/ginkgo/v2 v2.16.0/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs=
github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=

View File

@@ -18,20 +18,20 @@ import (
"time"
)
var (
ecsVersion = "2024.06.30"
showVersion bool
language string
cpuTestMethod, cpuTestThreadMode string
memoryTestMethod string
diskTestMethod, diskTestPath string
diskMultiCheck bool
nt3CheckType, nt3Location string
spNum int
width = 84
)
func main() {
var (
ecsVersion = "2024.06.30"
showVersion bool
language string
cpuTestMethod, cpuTestThreadMode string
memoryTestMethod string
diskTestMethod, diskTestPath string
diskMultiCheck bool
nt3CheckType, nt3Location string
spNum int
width = 84
)
flag.BoolVar(&showVersion, "v", false, "Show version information")
flag.StringVar(&language, "l", "zh", "Specify language (supported: en, zh)")
flag.StringVar(&cpuTestMethod, "cpum", "sysbench", "Specify CPU test method (supported: sysbench, geekbench, winsat)")
@@ -49,9 +49,11 @@ func main() {
return
}
startTime := time.Now()
var wg sync.WaitGroup
var basicInfo, securityInfo, emailInfo, mediaInfo string
var output, tempOutput string
var (
wg sync.WaitGroup
basicInfo, securityInfo, emailInfo, mediaInfo string
output, tempOutput string
)
if language == "zh" {
output = utils.PrintAndCapture(func() {
utils.PrintHead(language, width, ecsVersion)
@@ -94,12 +96,12 @@ func main() {
fmt.Printf(securityInfo)
utils.PrintCenteredTitle("邮件端口检测", width)
fmt.Println(emailInfo)
utils.PrintCenteredTitle("三网回程", width)
}, tempOutput, output)
output = utils.PrintAndCapture(func() {
backtrace.BackTrace()
}, tempOutput, output)
if runtime.GOOS != "windows" {
output = utils.PrintAndCapture(func() {
utils.PrintCenteredTitle("三网回程", width)
backtrace.BackTrace()
}, tempOutput, output)
// nexttrace 在win上不支持检测报错 bind: An invalid argument was supplied.
output = utils.PrintAndCapture(func() {
utils.PrintCenteredTitle("路由检测", width)

View File

@@ -1,4 +1,4 @@
package network
package network1
import "github.com/oneclickvirt/security/network"

View File

@@ -1,4 +1,4 @@
package network
package network1
import (
"fmt"

View File

@@ -6,6 +6,7 @@ import (
)
// 常用端口阻断检测 TCP/UDP/ICMP 协议
// 本包不在main中使用
func EmailCheck() {
res := email.EmailCheck()
fmt.Println(res)