github.com/TeaOSLab/EdgeNode@v1.3.8/internal/const/vars.go (about) 1 // Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. 2 3 package teaconst 4 5 import ( 6 "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" 7 "os" 8 "strings" 9 ) 10 11 var ( 12 // 流量统计 13 14 InTrafficBytes = uint64(0) 15 OutTrafficBytes = uint64(0) 16 17 NodeId int64 = 0 18 NodeIdString = "" 19 IsMain = checkMain() 20 21 GlobalProductName = nodeconfigs.DefaultProductName 22 23 IsQuiting = false // 是否正在退出 24 EnableDBStat = false // 是否开启本地数据库统计 25 ) 26 27 // 检查是否为主程序 28 func checkMain() bool { 29 if len(os.Args) == 1 || 30 (len(os.Args) >= 2 && os.Args[1] == "pprof") { 31 return true 32 } 33 exe, _ := os.Executable() 34 return strings.HasSuffix(exe, ".test") || 35 strings.HasSuffix(exe, ".test.exe") || 36 strings.Contains(exe, "___") 37 }