优化CNAME查询程序

This commit is contained in:
GoEdgeLab
2023-03-21 11:41:40 +08:00
parent 1025204257
commit ff9f9181b6
5 changed files with 56 additions and 10 deletions
+19
View File
@@ -2,6 +2,11 @@
package teaconst
import (
"os"
"strings"
)
var (
IsRecoverMode = false
@@ -10,4 +15,18 @@ var (
NewVersionCode = "" // 有新的版本
NewVersionDownloadURL = "" // 新版本下载地址
IsMain = checkMain()
)
// 检查是否为主程序
func checkMain() bool {
if len(os.Args) == 1 ||
(len(os.Args) >= 2 && os.Args[1] == "pprof") {
return true
}
exe, _ := os.Executable()
return strings.HasSuffix(exe, ".test") ||
strings.HasSuffix(exe, ".test.exe") ||
strings.Contains(exe, "___")
}