fix: 拆分main函数,分函数方便后续维护,添加前置检测自动切换离线模式

This commit is contained in:
spiritlhl
2025-06-29 06:27:59 +00:00
parent 7a439f7095
commit ac33e00e0a
10 changed files with 757 additions and 437 deletions

17
utils/utils_test.go Normal file
View File

@@ -0,0 +1,17 @@
package utils
import (
"fmt"
"testing"
"time"
)
func TestCheckPublicAccess(t *testing.T) {
timeout := 3 * time.Second
result := CheckPublicAccess(timeout)
if result.Connected {
fmt.Printf("✅ 本机有公网连接,类型: %s\n", result.StackType)
} else {
fmt.Println("❌ 本机未检测到公网连接")
}
}