mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2025-08-12 06:26:39 +00:00
提供不间断运行环境变量
This commit is contained in:
@@ -236,6 +236,15 @@ func Excute() {
|
||||
conf.AsyncPrinter = nil
|
||||
}
|
||||
|
||||
if util.Uninterrupted != "" || *rawPrint {
|
||||
for {
|
||||
_, err := trace.Traceroute(m, conf)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
res, err := trace.Traceroute(m, conf)
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -58,7 +58,7 @@ func receiveParse() {
|
||||
m := make(map[string][]string)
|
||||
err := json.Unmarshal([]byte(res.Get("router").String()), &m)
|
||||
if err != nil {
|
||||
return
|
||||
// 此处是正常的,因为有些IP没有路由信息
|
||||
}
|
||||
|
||||
lat, _ := strconv.ParseFloat(res.Get("lat").String(), 32)
|
||||
|
||||
@@ -14,8 +14,12 @@ var (
|
||||
result string
|
||||
results = make(chan string)
|
||||
)
|
||||
var FastIpCache = ""
|
||||
|
||||
func GetFastIP(domain string, port string, enableOutput bool) string {
|
||||
if FastIpCache != "" {
|
||||
return FastIpCache
|
||||
}
|
||||
|
||||
ips, err := net.LookupIP(domain)
|
||||
if err != nil {
|
||||
@@ -44,7 +48,7 @@ func GetFastIP(domain string, port string, enableOutput bool) string {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
FastIpCache = res[0]
|
||||
return res[0]
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
var Uninterrupted = GetenvDefault("NEXTTRACE_UNINTERRUPTED", "")
|
||||
var EnvToken = GetenvDefault("NEXTTRACE_TOKEN", "")
|
||||
var UserAgent = fmt.Sprintf("NextTrace %s/%s/%s", config.Version, runtime.GOOS, runtime.GOARCH)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user