From 36507ad3b5d0bd6c8b2da87447e7935b3d4049aa Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Thu, 23 Nov 2023 10:23:30 +0800 Subject: [PATCH 1/7] =?UTF-8?q?reporter.go=20=E6=9C=AA=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E9=80=A0=E6=88=90=E7=9A=84=E8=B6=8A=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reporter/reporter.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/reporter/reporter.go b/reporter/reporter.go index 1d084b6..1342573 100644 --- a/reporter/reporter.go +++ b/reporter/reporter.go @@ -114,11 +114,13 @@ func (r *reporter) InitialBaseData() Reporter { r.targetTTL = uint16(len(r.routeResult.Hops)) for i := uint16(0); i < r.targetTTL; i++ { - traceHop := r.routeResult.Hops[i][0] - if traceHop.Success { - currentIP := traceHop.Address.String() - r.wg.Add(1) - go r.generateRouteReportNode(currentIP, *traceHop.Geo, i) + if i < uint16(len(r.routeResult.Hops)) && len(r.routeResult.Hops[i]) > 0 { + traceHop := r.routeResult.Hops[i][0] + if traceHop.Success { + currentIP := traceHop.Address.String() + r.wg.Add(1) + go r.generateRouteReportNode(currentIP, *traceHop.Geo, i) + } } } From b32947a8246f00910cd03438fc360803e2bbab25 Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Thu, 30 Nov 2023 16:12:47 +0800 Subject: [PATCH 2/7] update credit --- printer/basic.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/printer/basic.go b/printer/basic.go index 8ff5c98..a298251 100644 --- a/printer/basic.go +++ b/printer/basic.go @@ -25,7 +25,7 @@ func Version() { func CopyRight() { sponsor() - fmt.Fprintf(color.Output, "\n%s\n%s %s\n%s %s\n%s %s, %s, %s, %s\n%s %s\n%s %s\n", + fmt.Fprintf(color.Output, "\n%s\n%s %s\n%s %s\n%s %s, %s, %s, %s\n%s %s\n", color.New(color.FgCyan, color.Bold).Sprintf("%s", "NextTrace CopyRight"), //color.New(color.FgGreen, color.Bold).Sprintf("%s", "Contact Us"), //color.New(color.FgWhite, color.Bold).Sprintf("%s", "Feedback Email:"), @@ -48,8 +48,8 @@ func CopyRight() { //color.New(color.FgHiBlack, color.Bold).Sprintf("%s", "tsosunchia@gmail.com"), color.New(color.FgWhite, color.Bold).Sprintf("%s", "Infra Maintainer:"), color.New(color.FgHiBlue, color.Bold).Sprintf("%s", "Tso"), - color.New(color.FgWhite, color.Bold).Sprintf("%s", "NOC Manager:"), - color.New(color.FgHiBlue, color.Bold).Sprintf("%s", "YekongTAT"), + //color.New(color.FgWhite, color.Bold).Sprintf("%s", "NOC Manager:"), + //color.New(color.FgHiBlue, color.Bold).Sprintf("%s", "YekongTAT"), //color.New(color.FgHiBlack, color.Bold).Sprintf("%s", "tsosunchia@gmail.com"), ) //PluginCopyRight() From f5d1a606b38fcadfcbe38c2caa30eb37f5a2ebe3 Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Thu, 30 Nov 2023 17:11:14 +0800 Subject: [PATCH 3/7] add param: support disable color output --- cmd/cmd.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/cmd.go b/cmd/cmd.go index f78c951..4c1ec87 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -3,6 +3,7 @@ package cmd import ( "encoding/json" "fmt" + "github.com/fatih/color" "log" "net" "os" @@ -70,6 +71,7 @@ func Excute() { lang := parser.Selector("g", "language", []string{"en", "cn"}, &argparse.Options{Default: "cn", Help: "Choose the language for displaying [en, cn]"}) file := parser.String("", "file", &argparse.Options{Help: "Read IP Address or domain name from file"}) + nocolor := parser.Flag("C", "nocolor", &argparse.Options{Help: "Disable Colorful Output"}) err := parser.Parse(os.Args) if err != nil { @@ -86,6 +88,12 @@ func Excute() { os.Exit(0) } + if *nocolor { + color.NoColor = true + } else { + color.NoColor = false + } + domain := *str if *port == 0 { From fc88c9be5c3d6fba06b947f734aa7564133d6ba4 Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Thu, 30 Nov 2023 17:14:50 +0800 Subject: [PATCH 4/7] update readme --- README.md | 8 +++++++- README_zh_CN.md | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d673a6c..aa30529 100644 --- a/README.md +++ b/README.md @@ -250,6 +250,11 @@ nexttrace --psize 1024 example.com # ╭╯ # ╰AS37963 Aliyun「ALIDNS.COM『ALIDNS.COM』」 nexttrace --route-path www.time.com.my + +# Disable color output +nexttrace --nocolor 1.1.1.1 +# or use ENV +export NO_COLOR=1 ``` `NextTrace` supports users to select their own IP API (currently supports: `LeoMoeAPI`, `IP.SB`, `IPInfo`, `IPInsight`, `IPAPI.com`, `Ip2region`, `IPInfoLocal`, `CHUNZHEN`) @@ -317,7 +322,7 @@ Usage: nexttrace [-h|--help] [-4|--ipv4] [-6|--ipv6] [-T|--tcp] [-U|--udp] [--timeout ] [--psize ] [_positionalArg_nexttrace_32 ""] [--dot-server (dnssb|aliyun|dnspod|google|cloudflare)] [-g|--language - (en|cn)] [--file ""] + (en|cn)] [--file ""] [-C|--nocolor] Arguments: @@ -393,6 +398,7 @@ Arguments: -g --language Choose the language for displaying [en, cn]. Default: cn --file Read IP Address or domain name from file + -C --nocolor Disable Colorful Output ``` ## Project screenshot diff --git a/README_zh_CN.md b/README_zh_CN.md index f49c198..d46ec5b 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -266,6 +266,10 @@ nexttrace --psize 1024 example.com # ╭╯ # ╰AS37963 阿里云「ALIDNS.COM『ALIDNS.COM』」 nexttrace --route-path www.time.com.my +# 禁止色彩输出 +nexttrace --nocolor 1.1.1.1 +# 或者使用环境变量 +export NO_COLOR=1 ``` `NextTrace`支持用户自主选择 IP 数据库(目前支持:`LeoMoeAPI`, `IP.SB`, `IPInfo`, `IPInsight`, `IPAPI.com`, `Ip2region`, `IPInfoLocal`, `CHUNZHEN`) @@ -317,7 +321,7 @@ Usage: nexttrace [-h|--help] [-4|--ipv4] [-6|--ipv6] [-T|--tcp] [-U|--udp] [--timeout ] [--psize ] [_positionalArg_nexttrace_32 ""] [--dot-server (dnssb|aliyun|dnspod|google|cloudflare)] [-g|--language - (en|cn)] [--file ""] + (en|cn)] [--file ""] [-C|--nocolor] Arguments: @@ -393,6 +397,7 @@ Arguments: -g --language Choose the language for displaying [en, cn]. Default: cn --file Read IP Address or domain name from file + -C --nocolor Disable Colorful Output ``` ## 项目截图 From faa3daa0c4812ec351691645cef21d73b39b859f Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Fri, 1 Dec 2023 11:15:17 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=ACSSL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- README_zh_CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index aa30529..7217c2d 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Please note, there are exceptions to this synchronization. If a version of NTrac * One-click installation script ```shell - bash -c "$(curl http://nexttrace-io-leomoe-api-a0.shop/nt_install_v1.sh)" + curl nxtrace.org/nt |bash ``` * Arch Linux AUR installation command * Directly download bin package (only supports amd64) diff --git a/README_zh_CN.md b/README_zh_CN.md index d46ec5b..9ebc93f 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -71,7 +71,7 @@ Document Language: [English](README.md) | 简体中文 * 一键安装脚本 ```shell - bash -c "$(curl http://nexttrace-io-leomoe-api-a0.shop/nt_install_v1.sh)" + curl nxtrace.org/nt | bash ``` * Arch Linux AUR 安装命令 From c0455ca8e71b9f282ce32e37d7e3578bffae01cd Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Fri, 1 Dec 2023 16:32:44 +0800 Subject: [PATCH 6/7] =?UTF-8?q?api=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++--- README_zh_CN.md | 8 ++--- cmd/cmd.go | 6 ++-- fast_trace/basic.go | 76 ++++++++++++++++++++++---------------------- pow/pow_test.go | 2 +- tracemap/tracemap.go | 4 +-- util/dns_test.go | 4 +-- util/latency.go | 11 +++++-- util/latency_test.go | 2 +- util/util.go | 4 +-- wshandle/client.go | 2 +- 11 files changed, 67 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index 7217c2d..e5cc014 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ nexttrace 2606:4700:4700::1111 # Disable Path Visualization With the -M parameter nexttrace koreacentral.blob.core.windows.net -# MapTrace URL: https://api.leo.moe/tracemap/html/c14e439e-3250-5310-8965-42a1e3545266.html +# MapTrace URL: https://api.nxtrace.org/tracemap/html/c14e439e-3250-5310-8965-42a1e3545266.html # Disable MPLS display using the --disable-mpls / -e parameter or the NEXTTRACE_DISABLEMPLS environment variable nexttrace --disable-mpls example.com @@ -313,7 +313,7 @@ Usage: nexttrace [-h|--help] [-4|--ipv4] [-6|--ipv6] [-T|--tcp] [-U|--udp] ] [--parallel-requests ] [-m|--max-hops ] [-d|--data-provider (Ip2region|ip2region|IP.SB|ip.sb|IPInfo|ipinfo|IPInsight|ipinsight|IPAPI.com|ip-api.com|IPInfoLocal|ipinfolocal|chunzhen|LeoMoeAPI|leomoeapi|disable-geoip)] - [--pow-provider (api.leo.moe|sakura)] [-n|--no-rdns] + [--pow-provider (api.nxtrace.org|sakura)] [-n|--no-rdns] [-a|--always-rdns] [-P|--route-path] [-r|--report] [--dn42] [-o|--output] [-t|--table] [--raw] [-j|--json] [-c|--classic] [-f|--first ] [-M|--map] [-e|--disable-mpls] @@ -353,9 +353,9 @@ Arguments: IPInfo, IPInsight, IP-API.com, Ip2region, IPInfoLocal, CHUNZHEN, disable-geoip]. Default: LeoMoeAPI - --pow-provider Choose PoW Provider [api.leo.moe, sakura] + --pow-provider Choose PoW Provider [api.nxtrace.org, sakura] For China mainland users, please use - sakura. Default: api.leo.moe + sakura. Default: api.nxtrace.org -n --no-rdns Do not resolve IP addresses to their domain names -a --always-rdns Always resolve IP addresses to their diff --git a/README_zh_CN.md b/README_zh_CN.md index 9ebc93f..a71890d 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -173,7 +173,7 @@ nexttrace 2606:4700:4700::1111 # 禁用路径可视化 使用 --map / -M 参数 nexttrace koreacentral.blob.core.windows.net -# MapTrace URL: https://api.leo.moe/tracemap/html/c14e439e-3250-5310-8965-42a1e3545266.html +# MapTrace URL: https://api.nxtrace.org/tracemap/html/c14e439e-3250-5310-8965-42a1e3545266.html # 禁用MPLS显示 使用 --disable-mpls / -e 参数 或 NEXTTRACE_DISABLEMPLS 环境变量 nexttrace --disable-mpls example.com @@ -312,7 +312,7 @@ Usage: nexttrace [-h|--help] [-4|--ipv4] [-6|--ipv6] [-T|--tcp] [-U|--udp] ] [--parallel-requests ] [-m|--max-hops ] [-d|--data-provider (Ip2region|ip2region|IP.SB|ip.sb|IPInfo|ipinfo|IPInsight|ipinsight|IPAPI.com|ip-api.com|IPInfoLocal|ipinfolocal|chunzhen|LeoMoeAPI|leomoeapi|disable-geoip)] - [--pow-provider (api.leo.moe|sakura)] [-n|--no-rdns] + [--pow-provider (api.nxtrace.org|sakura)] [-n|--no-rdns] [-a|--always-rdns] [-P|--route-path] [-r|--report] [--dn42] [-o|--output] [-t|--table] [--raw] [-j|--json] [-c|--classic] [-f|--first ] [-M|--map] [-e|--disable-mpls] @@ -352,9 +352,9 @@ Arguments: IPInfo, IPInsight, IP-API.com, Ip2region, IPInfoLocal, CHUNZHEN, disable-geoip]. Default: LeoMoeAPI - --pow-provider Choose PoW Provider [api.leo.moe, sakura] + --pow-provider Choose PoW Provider [api.nxtrace.org, sakura] For China mainland users, please use - sakura. Default: api.leo.moe + sakura. Default: api.nxtrace.org -n --no-rdns Do not resolve IP addresses to their domain names -a --always-rdns Always resolve IP addresses to their diff --git a/cmd/cmd.go b/cmd/cmd.go index 4c1ec87..731b0f2 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -42,8 +42,8 @@ func Excute() { maxHops := parser.Int("m", "max-hops", &argparse.Options{Default: 30, Help: "Set the max number of hops (max TTL to be reached)"}) dataOrigin := parser.Selector("d", "data-provider", []string{"Ip2region", "ip2region", "IP.SB", "ip.sb", "IPInfo", "ipinfo", "IPInsight", "ipinsight", "IPAPI.com", "ip-api.com", "IPInfoLocal", "ipinfolocal", "chunzhen", "LeoMoeAPI", "leomoeapi", "disable-geoip"}, &argparse.Options{Default: "LeoMoeAPI", Help: "Choose IP Geograph Data Provider [IP.SB, IPInfo, IPInsight, IP-API.com, Ip2region, IPInfoLocal, CHUNZHEN, disable-geoip]"}) - powProvider := parser.Selector("", "pow-provider", []string{"api.leo.moe", "sakura"}, &argparse.Options{Default: "api.leo.moe", - Help: "Choose PoW Provider [api.leo.moe, sakura] For China mainland users, please use sakura"}) + powProvider := parser.Selector("", "pow-provider", []string{"api.nxtrace.org", "sakura"}, &argparse.Options{Default: "api.nxtrace.org", + Help: "Choose PoW Provider [api.nxtrace.org, sakura] For China mainland users, please use sakura"}) noRdns := parser.Flag("n", "no-rdns", &argparse.Options{Help: "Do not resolve IP addresses to their domain names"}) alwaysRdns := parser.Flag("a", "always-rdns", &argparse.Options{Help: "Always resolve IP addresses to their domain names"}) routePath := parser.Flag("P", "route-path", &argparse.Options{Help: "Print traceroute hop path by ASN and location"}) @@ -173,7 +173,7 @@ func Excute() { // defer wg.Done() if strings.ToUpper(*dataOrigin) == "LEOMOEAPI" { val, ok := os.LookupEnv("NEXTTRACE_DATAPROVIDER") - if strings.ToUpper(*powProvider) != "API.LEO.MOE" { + if strings.ToUpper(*powProvider) != "API.NXTRACE.ORG" { util.PowProviderParam = *powProvider } if ok { diff --git a/fast_trace/basic.go b/fast_trace/basic.go index 5b88081..7801be0 100644 --- a/fast_trace/basic.go +++ b/fast_trace/basic.go @@ -49,36 +49,36 @@ var Beijing = BackBoneCollection{ Location: "北京", CT163: ISPCollection{ ISPName: CT163, - IP: "ipv4.pek-4134.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.pek-4134.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.pek-4134.endpoint.nxtrace.org.", + IPv6: "ipv6.pek-4134.endpoint.nxtrace.org.", }, CU169: ISPCollection{ ISPName: CU169, - IP: "ipv4.pek-4837.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.pek-4837.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.pek-4837.endpoint.nxtrace.org.", + IPv6: "ipv6.pek-4837.endpoint.nxtrace.org.", }, CU9929: ISPCollection{ ISPName: CU9929, - IP: "ipv4.pek-9929.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.pek-9929.endpoint.nxtrace.org.", }, CM: ISPCollection{ ISPName: CM, - IP: "ipv4.pek-9808.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.pek-9808.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.pek-9808.endpoint.nxtrace.org.", + IPv6: "ipv6.pek-9808.endpoint.nxtrace.org.", }, CMIN2: ISPCollection{ ISPName: CMIN2, - IP: "ipv4.pek-58807.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.pek-58807.endpoint.nxtrace.org.", }, EDU: ISPCollection{ ISPName: EDU, - IP: "ipv4.pek-4538.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.pek-4538.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.pek-4538.endpoint.nxtrace.org.", + IPv6: "ipv6.pek-4538.endpoint.nxtrace.org.", }, } @@ -86,42 +86,42 @@ var Shanghai = BackBoneCollection{ Location: "上海", CT163: ISPCollection{ ISPName: CT163, - IP: "ipv4.sha-4134.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.sha-4134.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.sha-4134.endpoint.nxtrace.org.", + IPv6: "ipv6.sha-4134.endpoint.nxtrace.org.", }, CTCN2: ISPCollection{ ISPName: CTCN2, - IP: "ipv4.sha-4809.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.sha-4809.endpoint.nxtrace.org.", }, CU169: ISPCollection{ ISPName: CU169, - IP: "ipv4.sha-4837.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.sha-4837.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.sha-4837.endpoint.nxtrace.org.", + IPv6: "ipv6.sha-4837.endpoint.nxtrace.org.", }, CU9929: ISPCollection{ ISPName: CU9929, - IP: "ipv4.sha-9929.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.sha-9929.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.sha-9929.endpoint.nxtrace.org.", + IPv6: "ipv6.sha-9929.endpoint.nxtrace.org.", }, CM: ISPCollection{ ISPName: CM, - IP: "ipv4.sha-9808.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.sha-9808.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.sha-9808.endpoint.nxtrace.org.", + IPv6: "ipv6.sha-9808.endpoint.nxtrace.org.", }, CMIN2: ISPCollection{ ISPName: CMIN2, - IP: "ipv4.sha-58807.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.sha-58807.endpoint.nxtrace.org.", }, EDU: ISPCollection{ ISPName: EDU, - IP: "ipv4.sha-4538.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.sha-4538.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.sha-4538.endpoint.nxtrace.org.", + IPv6: "ipv6.sha-4538.endpoint.nxtrace.org.", }, } @@ -129,20 +129,20 @@ var Guangzhou = BackBoneCollection{ Location: "广州", CT163: ISPCollection{ ISPName: CT163, - IP: "ipv4.can-4134.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.can-4134.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.can-4134.endpoint.nxtrace.org.", + IPv6: "ipv6.can-4134.endpoint.nxtrace.org.", }, CU169: ISPCollection{ ISPName: CU169, - IP: "ipv4.can-4837.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.can-4837.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.can-4837.endpoint.nxtrace.org.", + IPv6: "ipv6.can-4837.endpoint.nxtrace.org.", }, CM: ISPCollection{ ISPName: CM, - IP: "ipv4.can-9808.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.can-9808.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.can-9808.endpoint.nxtrace.org.", + IPv6: "ipv6.can-9808.endpoint.nxtrace.org.", }, } @@ -150,23 +150,23 @@ var Hangzhou = BackBoneCollection{ Location: "杭州", CT163: ISPCollection{ ISPName: CT163, - IP: "ipv4.hgh-4134.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.hgh-4134.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.hgh-4134.endpoint.nxtrace.org.", + IPv6: "ipv6.hgh-4134.endpoint.nxtrace.org.", }, CU169: ISPCollection{ ISPName: CU169, - IP: "ipv4.hgh-4837.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.hgh-4837.endpoint.nxtrace.org.", }, CM: ISPCollection{ ISPName: CM, - IP: "ipv4.hgh-9808.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.hgh-9808.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.hgh-9808.endpoint.nxtrace.org.", + IPv6: "ipv6.hgh-9808.endpoint.nxtrace.org.", }, // 浙江大学 教育网 EDU: ISPCollection{ ISPName: EDU, - IP: "ipv4.hgh-4538.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.hgh-4538.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.hgh-4538.endpoint.nxtrace.org.", + IPv6: "ipv6.hgh-4538.endpoint.nxtrace.org.", }, } @@ -175,12 +175,12 @@ var Hefei = BackBoneCollection{ // 中国科学技术大学 教育网 EDU: ISPCollection{ ISPName: EDU, - IP: "ipv4.hfe-4538.nexttrace-io-fasttrace-endpoint.win.", - IPv6: "ipv6.hfe-4538.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.hfe-4538.endpoint.nxtrace.org.", + IPv6: "ipv6.hfe-4538.endpoint.nxtrace.org.", }, // 中国科学技术大学 科技网 CST: ISPCollection{ ISPName: "中国科学技术大学 科技网 AS7497", - IP: "ipv4.hfe-7497.nexttrace-io-fasttrace-endpoint.win.", + IP: "ipv4.hfe-7497.endpoint.nxtrace.org.", }, } diff --git a/pow/pow_test.go b/pow/pow_test.go index 26c5370..87a80b1 100644 --- a/pow/pow_test.go +++ b/pow/pow_test.go @@ -10,7 +10,7 @@ import ( func TestGetToken(t *testing.T) { // 计时开始 start := time.Now() - token, err := GetToken("api.leo.moe", "api.leo.moe", "443") + token, err := GetToken("origin-fallback.nxtrace.org", "origin-fallback.nxtrace.org", "443") // 计时结束 end := time.Now() fmt.Println("耗时:", end.Sub(start)) diff --git a/tracemap/tracemap.go b/tracemap/tracemap.go index 8195faf..1668326 100644 --- a/tracemap/tracemap.go +++ b/tracemap/tracemap.go @@ -16,14 +16,14 @@ import ( func GetMapUrl(r string) (string, error) { host, port := util.GetHostAndPort() - fastIp := "api.leo.moe" + fastIp := "origin-fallback.nxtrace.org" // 如果 host 是一个 IP 使用默认域名 if valid := net.ParseIP(host); valid != nil { fastIp = host if len(strings.Split(fastIp, ":")) > 1 { fastIp = "[" + fastIp + "]" } - host = "api.leo.moe" + host = "origin-fallback.nxtrace.org" } else { // 默认配置完成,开始寻找最优 IP fastIp = util.GetFastIP(host, port, false) diff --git a/util/dns_test.go b/util/dns_test.go index fb5d6a8..1844a50 100644 --- a/util/dns_test.go +++ b/util/dns_test.go @@ -13,8 +13,8 @@ func TestDNS(t *testing.T) { } func TestDomainLookUp(t *testing.T) { - ips, _ := DomainLookUp("pek-4134.nexttrace-io-fasttrace-endpoint.win.", "all", "", false) + ips, _ := DomainLookUp("pek-4134.endpoint.nxtrace.org.", "all", "", false) fmt.Println(ips) - ips, _ = DomainLookUp("pek-4134.nexttrace-io-fasttrace-endpoint.win.", "4", "", false) + ips, _ = DomainLookUp("pek-4134.endpoint.nxtrace.org.", "4", "", false) fmt.Println(ips) } diff --git a/util/latency.go b/util/latency.go index 1f86af8..7d69366 100644 --- a/util/latency.go +++ b/util/latency.go @@ -28,13 +28,20 @@ var FastIpCache = "" func GetFastIP(domain string, port string, enableOutput bool) string { proxyUrl := GetProxy() if proxyUrl != nil { - return "api.leo.moe" + return "origin-fallback.nxtrace.org" } if FastIpCache != "" { return FastIpCache } - ips, err := net.LookupIP(domain) + var ips []net.IP + var err error + if domain == "origin-fallback.nxtrace.org" { + ips, err = net.LookupIP("api.nxtrace.org") + } else { + ips, err = net.LookupIP(domain) + } + if err != nil { log.Fatal("DNS resolution failed, please check your system DNS Settings") } diff --git a/util/latency_test.go b/util/latency_test.go index e7088f6..659f286 100644 --- a/util/latency_test.go +++ b/util/latency_test.go @@ -2,5 +2,5 @@ package util //github action test 不支持v6 这里会报错 //func TestGetFastIP(t *testing.T) { -// GetFastIP("api.leo.moe", "443", true) +// GetFastIP("origin-fallback.nxtrace.org", "443", true) //} diff --git a/util/util.go b/util/util.go index 15a0839..d844b9f 100644 --- a/util/util.go +++ b/util/util.go @@ -168,7 +168,7 @@ func GetenvDefault(key, defVal string) string { } func GetHostAndPort() (host string, port string) { - var hostP = GetenvDefault("NEXTTRACE_HOSTPORT", "api.leo.moe") + var hostP = GetenvDefault("NEXTTRACE_HOSTPORT", "origin-fallback.nxtrace.org") // 解析域名 hostArr := strings.Split(hostP, ":") // 判断是否有指定端口 @@ -210,7 +210,7 @@ func GetProxy() *url.URL { func GetPowProvider() string { var powProvider = "" if PowProviderParam == "" { - powProvider = GetenvDefault("NEXTTRACE_POWPROVIDER", "api.leo.moe") + powProvider = GetenvDefault("NEXTTRACE_POWPROVIDER", "api.nxtrace.org") } else { powProvider = PowProviderParam } diff --git a/wshandle/client.go b/wshandle/client.go index ad2d3e8..1813254 100644 --- a/wshandle/client.go +++ b/wshandle/client.go @@ -192,7 +192,7 @@ func createWsConn() *WsConn { if len(strings.Split(fastIp, ":")) > 1 { fastIp = "[" + fastIp + "]" } - host = "api.leo.moe" + host = "origin-fallback.nxtrace.org" } else { // 默认配置完成,开始寻找最优 IP fastIp = util.GetFastIP(host, port, true) From ffa7bb1d286948a07d93a05cc6bb8acfd358a3b8 Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Fri, 1 Dec 2023 18:34:42 +0800 Subject: [PATCH 7/7] update credit --- README.md | 10 +++++----- README_zh_CN.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e5cc014..4351890 100644 --- a/README.md +++ b/README.md @@ -446,15 +446,15 @@ We hope you can give us as much feedback as possible on IP geolocation errors (s ## Credits -[sjlleo](https://github.com/sjlleo) The perpetual leader, founder, and core contributors of the NextTrace Project - [BGP.TOOLS](https://bgp.tools) provided some data support for this project. And we would like to express our sincere gratitude. -[Vincent Young](https://github.com/missuo) (i@yyt.moe) +[sjlleo](https://github.com/sjlleo) The perpetual leader, founder, and core contributors -[Sam Sam](https://github.com/samleong123) (samsam123@samsam123.name.my) +[tsosunchia](https://github.com/tsosunchia) The project chair, infra maintainer, and core contributors -[tsosunchia](https://github.com/tsosunchia) +[Vincent Young](https://github.com/missuo) + +[Sam Sam](https://github.com/samleong123) [waiting4new](https://github.com/waiting4new) diff --git a/README_zh_CN.md b/README_zh_CN.md index a71890d..722016c 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -445,15 +445,15 @@ nexttrace --pow-provider sakura ## Credits -[sjlleo](https://github.com/sjlleo) NextTrace 项目永远的领导者、创始人及核心贡献者 - [BGP.TOOLS](https://bgp.tools) 提供了本项目的一些数据支持,在此表示由衷地感谢。 -[Vincent Young](https://github.com/missuo) (i@yyt.moe) +[sjlleo](https://github.com/sjlleo) 项目永远的领导者、创始人及核心贡献者 -[Sam Sam](https://github.com/samleong123) (samsam123@samsam123.name.my) +[tsosunchia](https://github.com/tsosunchia) 项目现任管理、基础设施运维及核心贡献者 -[tsosunchia](https://github.com/tsosunchia) +[Vincent Young](https://github.com/missuo) + +[Sam Sam](https://github.com/samleong123) [waiting4new](https://github.com/waiting4new)