Compare commits

..

No commits in common. "main" and "v0.0.5-20250411151652" have entirely different histories.

17 changed files with 55 additions and 679 deletions

View File

@ -7,45 +7,25 @@ jobs:
test: test:
strategy: strategy:
matrix: matrix:
go: ['1.22.x'] go: [ '1.22.x' ]
os: [ubuntu-latest] os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: ${{ matrix.go }} go-version: ${{ matrix.go }}
- name: Test - name: Test
run: go test ./... -coverprofile=coverage.txt run: go test ./... -coverprofile=coverage.txt
- name: Create Tag - name: Create Tag
if: success() if: success() # 仅在测试成功时运行
run: | run: |
git config --global user.name 'github-actions' git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com' git config --global user.email 'github-actions@github.com'
TAG="v0.0.5-$(date +'%Y%m%d%H%M%S')" TAG="v0.0.5-$(date +'%Y%m%d%H%M%S')"
git tag $TAG git tag $TAG
git push origin $TAG git push origin $TAG
echo "TAG=$TAG" >> $GITHUB_ENV
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update README.md
if: success()
run: |
sed -i "s|go get github.com/oneclickvirt/backtrace@.*|go get github.com/oneclickvirt/backtrace@${TAG}|" README.md
env:
TAG: ${{ env.TAG }}
- name: Commit and Push README.md
if: success()
run: |
git add README.md
git commit -m "Update README.md with new tag ${TAG}"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -55,12 +55,7 @@ jobs:
run: | run: |
mkdir -p bin mkdir -p bin
cd cmd cd cmd
CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build \ CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ../bin/backtrace-${{ matrix.goos }}-${{ matrix.goarch }} -v -ldflags="-extldflags=-static" .
-o ../bin/backtrace-${{ matrix.goos }}-${{ matrix.goarch }} \
-v \
-ldflags="-extldflags=-static -s -w" \
-trimpath \
.
- name: Upload New Assets - name: Upload New Assets
run: | run: |

View File

@ -74,7 +74,7 @@ rm -rf /usr/bin/backtrace
## 在Golang中使用 ## 在Golang中使用
``` ```
go get github.com/oneclickvirt/backtrace@v0.0.5-20250629024536 go get github.com/oneclickvirt/backtrace@latest
``` ```
## 概览图 ## 概览图

View File

@ -17,6 +17,7 @@
2a04:f581:110b 2a04:f581:110b
2a04:f581:a123 2a04:f581:a123
2a04:f581:a125 2a04:f581:a125
2a0f:7806:fffc
2c0f:f7a8:1 2c0f:f7a8:1
2c0f:f7a8:29 2c0f:f7a8:29
2c0f:f7a8:37 2c0f:f7a8:37

View File

@ -1,9 +1,11 @@
2400:9380:8001 2400:9380:8001
2400:9380:8003 2400:9380:8003
2400:9380:8021 2400:9380:8021
2400:9380:8030
2400:9380:8040 2400:9380:8040
2400:9380:8140 2400:9380:8140
2400:9380:8201 2400:9380:8201
2400:9380:8221
2400:9380:8301 2400:9380:8301
240e 240e
240e:1 240e:1
@ -64,6 +66,7 @@
240e:426 240e:426
240e:427 240e:427
240e:42:4000 240e:42:4000
240e:42:8010
240e:43 240e:43
240e:43:8000 240e:43:8000
240e:44 240e:44

View File

@ -1,3 +1,4 @@
2400:9380:9000
2400:9380:9001 2400:9380:9001
2400:9380:9002 2400:9380:9002
2400:9380:9005 2400:9380:9005
@ -5,14 +6,20 @@
2400:9380:900a 2400:9380:900a
2400:9380:9020 2400:9380:9020
2400:9380:9021 2400:9380:9021
2400:9380:9030
2400:9380:9031
2400:9380:9040 2400:9380:9040
2400:9380:9041 2400:9380:9041
2400:9380:9050 2400:9380:9050
2400:9380:9051 2400:9380:9051
2400:9380:9060 2400:9380:9060
2400:9380:9061
2400:9380:9070
2400:9380:9071 2400:9380:9071
2400:9380:9080 2400:9380:9080
2400:9380:9081 2400:9380:9081
2400:9380:90a0
2400:9380:90a1
2400:9380:90b0 2400:9380:90b0
2400:9380:90b1 2400:9380:90b1
2400:9380:90b2 2400:9380:90b2
@ -26,18 +33,26 @@
2400:9380:9121 2400:9380:9121
2400:9380:9201 2400:9380:9201
2400:9380:9202 2400:9380:9202
2400:9380:9205
2400:9380:9220 2400:9380:9220
2400:9380:9221 2400:9380:9221
2400:9380:9230
2400:9380:9231
2400:9380:9240 2400:9380:9240
2400:9380:9241 2400:9380:9241
2400:9380:9250 2400:9380:9250
2400:9380:9251 2400:9380:9251
2400:9380:9252
2400:9380:9260 2400:9380:9260
2400:9380:9261
2400:9380:9270
2400:9380:9271 2400:9380:9271
2400:9380:9272 2400:9380:9272
2400:9380:9280 2400:9380:9280
2400:9380:9281 2400:9380:9281
2400:9380:9282 2400:9380:9282
2400:9380:92a0
2400:9380:92a1
2400:9380:92b0 2400:9380:92b0
2400:9380:92b1 2400:9380:92b1
2400:9380:92b2 2400:9380:92b2
@ -101,11 +116,16 @@
2605:9d80:9023 2605:9d80:9023
2605:9d80:9033 2605:9d80:9033
2605:9d80:9042 2605:9d80:9042
2605:9d80:9052
2605:9d80:9061
2605:9d80:9071 2605:9d80:9071
2605:9d80:9092 2605:9d80:9092
2804:1e48 2804:1e48
2804:1e48:9001 2804:1e48:9001
2804:1e48:9002 2804:1e48:9002
2a04:f580:9000
2a04:f580:9001
2a04:f580:9002
2a04:f580:9010 2a04:f580:9010
2a04:f580:9012 2a04:f580:9012
2a04:f580:9013 2a04:f580:9013
@ -117,6 +137,9 @@
2a04:f580:9070 2a04:f580:9070
2a04:f580:9080 2a04:f580:9080
2a04:f580:9090 2a04:f580:9090
2a04:f580:9200
2a04:f580:9201
2a04:f580:9202
2a04:f580:9210 2a04:f580:9210
2a04:f580:9212 2a04:f580:9212
2a04:f580:9213 2a04:f580:9213

View File

@ -1,9 +1,11 @@
2400:73e0:201
2402:f140:ff13 2402:f140:ff13
2402:f140:ff14 2402:f140:ff14
2404:6500:dcb3 2404:6500:dcb3
2405:1480 2405:1480
2406:1e40 2406:1e40
2406:cac0 2406:cac0
2407:37c0:ffff
2407:6c40 2407:6c40
2407:6c40:1500 2407:6c40:1500
2408 2408
@ -15,11 +17,13 @@
2408:8001 2408:8001
2408:802a 2408:802a
2408:802c 2408:802c
2408:8034
2408:803e 2408:803e
2408:8056 2408:8056
2408:80c2 2408:80c2
2408:80c5 2408:80c5
2408:80e2 2408:80e2
2408:80e3
2408:80e9 2408:80e9
2408:80f5 2408:80f5
2408:80f9 2408:80f9
@ -69,9 +73,9 @@
2408:8252 2408:8252
2408:8253 2408:8253
2408:8254 2408:8254
2408:8255
2408:825c 2408:825c
2408:825d 2408:825d
2408:825f
2408:8260 2408:8260
2408:8262 2408:8262
2408:8263 2408:8263
@ -272,9 +276,9 @@
2408:8651 2408:8651
2408:8652 2408:8652
2408:8653 2408:8653
2408:8654
2408:865c 2408:865c
2408:865d 2408:865d
2408:865f
2408:8660 2408:8660
2408:8662 2408:8662
2408:8663 2408:8663
@ -357,6 +361,7 @@
2408:8814 2408:8814
2408:8815 2408:8815
2408:8816 2408:8816
2408:8817
2408:8818 2408:8818
2408:8819 2408:8819
2408:882c 2408:882c

View File

@ -1,3 +1,6 @@
2400:8800:1f0e:5f
2400:8800:1f11:13
2401:cf80:620f:1
2402:4f00 2402:4f00
2402:4f00:3000 2402:4f00:3000
2402:4f00:4000:4 2402:4f00:4000:4

View File

@ -32,7 +32,6 @@
2409:8004:3820 2409:8004:3820
2409:8004:3821 2409:8004:3821
2409:8004:3822 2409:8004:3822
2409:8004:3841
2409:8004:38c0 2409:8004:38c0
2409:8004:801 2409:8004:801
2409:8004:807 2409:8004:807
@ -59,7 +58,6 @@
2409:800b:2905 2409:800b:2905
2409:800b:2906 2409:800b:2906
2409:800b:2908 2409:800b:2908
2409:800b:290e
2409:800b:290f 2409:800b:290f
2409:800b:2b03 2409:800b:2b03
2409:800b:2b05 2409:800b:2b05
@ -75,7 +73,6 @@
2409:8013:2905 2409:8013:2905
2409:8013:2907 2409:8013:2907
2409:8013:2908 2409:8013:2908
2409:8013:290a
2409:8013:2b01 2409:8013:2b01
2409:8013:2b02 2409:8013:2b02
2409:8013:2b04 2409:8013:2b04
@ -89,7 +86,6 @@
2409:8017:2903 2409:8017:2903
2409:8017:2904 2409:8017:2904
2409:8017:2905 2409:8017:2905
2409:8017:2907
2409:8017:2b01 2409:8017:2b01
2409:8017:2b03 2409:8017:2b03
2409:8017:2b05 2409:8017:2b05
@ -238,8 +234,6 @@
2409:8034:1 2409:8034:1
2409:8038 2409:8038
2409:8038:3005 2409:8038:3005
2409:8038:3007
2409:8038:3008
2409:8038:3950 2409:8038:3950
2409:8038:3970 2409:8038:3970
2409:803c:3006 2409:803c:3006
@ -248,7 +242,6 @@
2409:803c:300b 2409:803c:300b
2409:803c:3090 2409:803c:3090
2409:803c:3098 2409:803c:3098
2409:803c:30a0
2409:803c:30b0 2409:803c:30b0
2409:803c:30c0 2409:803c:30c0
2409:8043:2901 2409:8043:2901
@ -257,7 +250,6 @@
2409:8043:2905 2409:8043:2905
2409:8043:2907 2409:8043:2907
2409:8043:2908 2409:8043:2908
2409:8043:290b
2409:8043:290c 2409:8043:290c
2409:8043:2b01 2409:8043:2b01
2409:8043:2b02 2409:8043:2b02
@ -311,14 +303,6 @@
2409:804d 2409:804d
2409:804e 2409:804e
2409:804f 2409:804f
2409:8053:2909
2409:8053:290a
2409:8053:2b09
2409:8053:2b0a
2409:8053:807
2409:8053:808
2409:8053:809
2409:8053:80a
2409:8054:10 2409:8054:10
2409:8054:18 2409:8054:18
2409:8054:20 2409:8054:20
@ -481,7 +465,6 @@
2409:8061:2904 2409:8061:2904
2409:8061:2905 2409:8061:2905
2409:8061:2906 2409:8061:2906
2409:8061:2907
2409:8061:2a01 2409:8061:2a01
2409:8061:2a02 2409:8061:2a02
2409:8061:2a04 2409:8061:2a04
@ -720,8 +703,6 @@
2409:8087:8015 2409:8087:8015
2409:8087:8016 2409:8087:8016
2409:8087:8017 2409:8087:8017
2409:8087:8018
2409:8087:8019
2409:8087:8106 2409:8087:8106
2409:8089:1020 2409:8089:1020
2409:815c 2409:815c
@ -770,18 +751,10 @@
2409:874e 2409:874e
2409:874f 2409:874f
2409:8754 2409:8754
2409:8754:3250
2409:8754:34b0
2409:8754:34c0
2409:8754:34d0
2409:8754:34e0
2409:8754:3e61
2409:875c 2409:875c
2409:875c:ff01 2409:875c:ff01
2409:875c:ff02 2409:875c:ff02
2409:875e 2409:875e
2409:875e:a031
2409:875e:a032
2409:875f 2409:875f
2409:8760 2409:8760
2409:8760:ea00 2409:8760:ea00
@ -806,201 +779,7 @@
2409:877a 2409:877a
2409:877c 2409:877c
2409:877e 2409:877e
2409:877e:1
2409:877e:1201
2409:877e:1202
2409:877e:1203
2409:877e:1204
2409:877e:1205
2409:877e:1206
2409:877e:1207
2409:877e:1501
2409:877e:1502
2409:877e:1503
2409:877e:1504
2409:877e:1505
2409:877e:1506
2409:877e:1507
2409:877e:1801
2409:877e:1802
2409:877e:1b01
2409:877e:1b02
2409:877e:1e01
2409:877e:1e02
2409:877e:2
2409:877e:2101
2409:877e:2102
2409:877e:2401
2409:877e:2402
2409:877e:2701
2409:877e:2702
2409:877e:2a01
2409:877e:2a02
2409:877e:2d01
2409:877e:2d02
2409:877e:3
2409:877e:3001
2409:877e:3002
2409:877e:301
2409:877e:302
2409:877e:303
2409:877e:304
2409:877e:305
2409:877e:306
2409:877e:307
2409:877e:3301
2409:877e:3302
2409:877e:3601
2409:877e:3602
2409:877e:3901
2409:877e:3902
2409:877e:3c01
2409:877e:3c02
2409:877e:3f01
2409:877e:3f02
2409:877e:4
2409:877e:4201
2409:877e:4202
2409:877e:4501
2409:877e:4502
2409:877e:4801
2409:877e:4802
2409:877e:4b01
2409:877e:4b02
2409:877e:4e01
2409:877e:4e02
2409:877e:5
2409:877e:5101
2409:877e:5102
2409:877e:5401
2409:877e:5402
2409:877e:5701
2409:877e:5702
2409:877e:5a01
2409:877e:5a02
2409:877e:5d01
2409:877e:5d02
2409:877e:6
2409:877e:6001
2409:877e:6002
2409:877e:601
2409:877e:602
2409:877e:603
2409:877e:604
2409:877e:605
2409:877e:606
2409:877e:607
2409:877e:6301
2409:877e:6302
2409:877e:6602
2409:877e:6901
2409:877e:6902
2409:877e:6c01
2409:877e:6c02
2409:877e:6f01
2409:877e:6f02
2409:877e:7
2409:877e:7201
2409:877e:7202
2409:877e:7501
2409:877e:7502
2409:877e:7801
2409:877e:7802
2409:877e:7b01
2409:877e:7b02
2409:877e:7e01
2409:877e:7e02
2409:877e:8101
2409:877e:8102
2409:877e:8401
2409:877e:8402
2409:877e:8701
2409:877e:8702
2409:877e:8a01
2409:877e:8a02
2409:877e:8d01
2409:877e:8d02
2409:877e:9001
2409:877e:9002
2409:877e:901
2409:877e:902
2409:877e:903
2409:877e:904
2409:877e:905
2409:877e:906
2409:877e:907
2409:877e:9301
2409:877e:9302
2409:877e:9313
2409:877e:9601
2409:877e:9602
2409:877e:9901
2409:877e:9902
2409:877e:9c01
2409:877e:9c02
2409:877e:9f01
2409:877e:9f02
2409:877e:a201
2409:877e:a202
2409:877e:a501
2409:877e:a502
2409:877e:a801
2409:877e:a802
2409:877e:ab01
2409:877e:ab02
2409:877e:ae01
2409:877e:ae02
2409:877e:b101
2409:877e:b102
2409:877e:b401
2409:877e:b402
2409:877e:b701
2409:877e:b702
2409:877e:ba01
2409:877e:ba02
2409:877e:bd01
2409:877e:bd02
2409:877e:c001
2409:877e:c002
2409:877e:c01
2409:877e:c02
2409:877e:c03
2409:877e:c04
2409:877e:c05
2409:877e:c06
2409:877e:c07
2409:877e:c301
2409:877e:c302
2409:877e:c601
2409:877e:c602
2409:877e:c901
2409:877e:c902
2409:877e:cc01
2409:877e:cc02
2409:877e:cf01
2409:877e:cf02
2409:877e:d201
2409:877e:d202
2409:877e:d501
2409:877e:d502
2409:877e:d801
2409:877e:d802
2409:877e:db01
2409:877e:db02
2409:877e:de01
2409:877e:de02
2409:877e:f01
2409:877e:f02
2409:877e:f03
2409:877e:f04
2409:877e:f05
2409:877e:f06
2409:877e:f07
2409:877f 2409:877f
2409:877f:13
2409:877f:14
2409:877f:2
2409:877f:5
2409:8810 2409:8810
2409:8830 2409:8830
2409:8831 2409:8831
@ -1039,9 +818,6 @@
2409:8931:ff11 2409:8931:ff11
2409:8931:ff12 2409:8931:ff12
2409:8931:ff13 2409:8931:ff13
2409:8931:ff21
2409:8931:ff22
2409:8931:ff23
2409:8934 2409:8934
2409:8938 2409:8938
2409:8938:48c4 2409:8938:48c4
@ -1056,7 +832,6 @@
2409:8959 2409:8959
2409:895a 2409:895a
2409:895c 2409:895c
2409:895c:f900
2409:895c:fc5a 2409:895c:fc5a
2409:895e 2409:895e
2409:895e:ffa0 2409:895e:ffa0
@ -1199,15 +974,11 @@
2409:8962:fcdd 2409:8962:fcdd
2409:8963 2409:8963
2409:896a 2409:896a
2409:896a:1d4e
2409:896a:1d7e
2409:896a:fffd 2409:896a:fffd
2409:896a:fffe 2409:896a:fffe
2409:896b 2409:896b
2409:896c 2409:896c
2409:896d 2409:896d
2409:896d:fff7
2409:896d:fff8
2409:896d:fff9 2409:896d:fff9
2409:896d:fffa 2409:896d:fffa
2409:896d:fffb 2409:896d:fffb
@ -1219,8 +990,6 @@
2409:8970 2409:8970
2409:8970:135f 2409:8970:135f
2409:8970:137f 2409:8970:137f
2409:8970:992f
2409:8970:996f
2409:8974 2409:8974
2409:8975 2409:8975
2409:8978 2409:8978
@ -1265,215 +1034,6 @@
2409:8a7a 2409:8a7a
2409:8a7c 2409:8a7c
2409:8a7e 2409:8a7e
2409:8a7e:1
2409:8a7e:1201
2409:8a7e:1202
2409:8a7e:1203
2409:8a7e:1204
2409:8a7e:1205
2409:8a7e:1206
2409:8a7e:1207
2409:8a7e:1208
2409:8a7e:1501
2409:8a7e:1502
2409:8a7e:1503
2409:8a7e:1504
2409:8a7e:1505
2409:8a7e:1506
2409:8a7e:1507
2409:8a7e:1508
2409:8a7e:1801
2409:8a7e:1802
2409:8a7e:1803
2409:8a7e:1804
2409:8a7e:1b01
2409:8a7e:1b02
2409:8a7e:1e01
2409:8a7e:1e02
2409:8a7e:2
2409:8a7e:2101
2409:8a7e:2102
2409:8a7e:2401
2409:8a7e:2402
2409:8a7e:2701
2409:8a7e:2702
2409:8a7e:2a01
2409:8a7e:2a02
2409:8a7e:2d01
2409:8a7e:2d02
2409:8a7e:3
2409:8a7e:3001
2409:8a7e:3002
2409:8a7e:301
2409:8a7e:302
2409:8a7e:303
2409:8a7e:304
2409:8a7e:305
2409:8a7e:306
2409:8a7e:307
2409:8a7e:308
2409:8a7e:3301
2409:8a7e:3302
2409:8a7e:3601
2409:8a7e:3602
2409:8a7e:3901
2409:8a7e:3902
2409:8a7e:3903
2409:8a7e:3904
2409:8a7e:3c01
2409:8a7e:3c02
2409:8a7e:3f01
2409:8a7e:3f02
2409:8a7e:4
2409:8a7e:4201
2409:8a7e:4202
2409:8a7e:4501
2409:8a7e:4502
2409:8a7e:4801
2409:8a7e:4802
2409:8a7e:4b01
2409:8a7e:4b02
2409:8a7e:4e01
2409:8a7e:4e02
2409:8a7e:5
2409:8a7e:5101
2409:8a7e:5102
2409:8a7e:5401
2409:8a7e:5402
2409:8a7e:5701
2409:8a7e:5702
2409:8a7e:5a01
2409:8a7e:5a02
2409:8a7e:5d03
2409:8a7e:5d04
2409:8a7e:6
2409:8a7e:6001
2409:8a7e:6002
2409:8a7e:601
2409:8a7e:602
2409:8a7e:603
2409:8a7e:604
2409:8a7e:605
2409:8a7e:606
2409:8a7e:607
2409:8a7e:608
2409:8a7e:6301
2409:8a7e:6302
2409:8a7e:6601
2409:8a7e:6602
2409:8a7e:6901
2409:8a7e:6902
2409:8a7e:6c01
2409:8a7e:6c02
2409:8a7e:6f01
2409:8a7e:6f02
2409:8a7e:7
2409:8a7e:7201
2409:8a7e:7202
2409:8a7e:7501
2409:8a7e:7502
2409:8a7e:7801
2409:8a7e:7802
2409:8a7e:7b01
2409:8a7e:7b02
2409:8a7e:7e01
2409:8a7e:7e02
2409:8a7e:8
2409:8a7e:8101
2409:8a7e:8102
2409:8a7e:8401
2409:8a7e:8402
2409:8a7e:8701
2409:8a7e:8702
2409:8a7e:8a01
2409:8a7e:8a02
2409:8a7e:8d01
2409:8a7e:8d02
2409:8a7e:9
2409:8a7e:9001
2409:8a7e:9002
2409:8a7e:901
2409:8a7e:902
2409:8a7e:903
2409:8a7e:904
2409:8a7e:905
2409:8a7e:906
2409:8a7e:907
2409:8a7e:908
2409:8a7e:9301
2409:8a7e:9302
2409:8a7e:9303
2409:8a7e:9304
2409:8a7e:9601
2409:8a7e:9602
2409:8a7e:9901
2409:8a7e:9902
2409:8a7e:9c01
2409:8a7e:9c02
2409:8a7e:9f01
2409:8a7e:9f02
2409:8a7e:a201
2409:8a7e:a202
2409:8a7e:a501
2409:8a7e:a502
2409:8a7e:a801
2409:8a7e:a802
2409:8a7e:ab01
2409:8a7e:ab02
2409:8a7e:ae01
2409:8a7e:ae02
2409:8a7e:b101
2409:8a7e:b102
2409:8a7e:b401
2409:8a7e:b402
2409:8a7e:b403
2409:8a7e:b404
2409:8a7e:b701
2409:8a7e:b702
2409:8a7e:ba01
2409:8a7e:ba02
2409:8a7e:bd01
2409:8a7e:bd02
2409:8a7e:c001
2409:8a7e:c002
2409:8a7e:c01
2409:8a7e:c02
2409:8a7e:c04
2409:8a7e:c05
2409:8a7e:c06
2409:8a7e:c07
2409:8a7e:c08
2409:8a7e:c301
2409:8a7e:c302
2409:8a7e:c601
2409:8a7e:c602
2409:8a7e:c901
2409:8a7e:c902
2409:8a7e:c903
2409:8a7e:c905
2409:8a7e:c906
2409:8a7e:cc01
2409:8a7e:cc02
2409:8a7e:cf01
2409:8a7e:cf02
2409:8a7e:d201
2409:8a7e:d202
2409:8a7e:d501
2409:8a7e:d502
2409:8a7e:d801
2409:8a7e:d802
2409:8a7e:db01
2409:8a7e:db02
2409:8a7e:de01
2409:8a7e:de02
2409:8a7e:f01
2409:8a7e:f02
2409:8a7e:f03
2409:8a7e:f04
2409:8a7e:f05
2409:8a7e:f06
2409:8a7e:f07
2409:8a7e:f08
2409:8b10 2409:8b10
2409:8b30 2409:8b30
2409:8b34 2409:8b34
@ -1506,9 +1066,7 @@
2409:8c14 2409:8c14
2409:8c15 2409:8c15
2409:8c1e 2409:8c1e
2409:8c1e:3410
2409:8c1e:68f0 2409:8c1e:68f0
2409:8c1e:8f60
2409:8c1f 2409:8c1f
2409:8c20:1833 2409:8c20:1833
2409:8c2f:3800 2409:8c2f:3800
@ -1549,7 +1107,6 @@
2409:8c4e 2409:8c4e
2409:8c4f 2409:8c4f
2409:8c54 2409:8c54
2409:8c54:813
2409:8c5b:ffff 2409:8c5b:ffff
2409:8c5c 2409:8c5c
2409:8c5e 2409:8c5e
@ -1590,12 +1147,10 @@
2409:8c7a 2409:8c7a
2409:8c7c 2409:8c7c
2409:8c7e 2409:8c7e
2409:8c7e:9301
2409:8c85 2409:8c85
2409:8c85:1 2409:8c85:1
2409:8c85:1000 2409:8c85:1000
2409:8c85:1001 2409:8c85:1001
2409:8c85:1e00
2409:8c85:2 2409:8c85:2
2409:8c85:200 2409:8c85:200
2409:8c85:2028 2409:8c85:2028

View File

@ -12,11 +12,8 @@
2408:862e:2ff 2408:862e:2ff
2408:8638:116 2408:8638:116
2408:8649:2a00 2408:8649:2a00
2408:8652:ff00
2408:8656:a52 2408:8656:a52
2408:8660:100 2408:8660:100
2408:8660:ab00
2408:866c:ff00
2408:8678:1400 2408:8678:1400
2408:8756:3efd 2408:8756:3efd
2408:8a00 2408:8a00
@ -27,5 +24,3 @@
2408:8a06:1 2408:8a06:1
2408:8a06:100 2408:8a06:100
2408:8a06:101 2408:8a06:101
2408:8a26:ee10
2408:8a26:f950

View File

@ -70,7 +70,6 @@ func trace(ch chan Result, i int) {
Logger.Error(fmt.Sprintf("追踪 %s (%s) 失败: %v", model.Ipv4Names[i], model.Ipv4s[i], err)) Logger.Error(fmt.Sprintf("追踪 %s (%s) 失败: %v", model.Ipv4Names[i], model.Ipv4s[i], err))
} }
ch <- Result{i, s} ch <- Result{i, s}
return
} }
asns := extractIpv4ASNsFromHops(hops, model.EnableLoger) asns := extractIpv4ASNsFromHops(hops, model.EnableLoger)
// 如果没有找到ASN尝试备选IP // 如果没有找到ASN尝试备选IP

View File

@ -85,16 +85,15 @@ func traceIPv6(ch chan Result, i int, offset int) {
Logger.Warn(fmt.Sprintf("%s (%s) 检测不到回程路由节点的IP地址", model.Ipv6Names[i], model.Ipv6s[i])) Logger.Warn(fmt.Sprintf("%s (%s) 检测不到回程路由节点的IP地址", model.Ipv6Names[i], model.Ipv6s[i]))
} }
ch <- Result{i + offset, s} ch <- Result{i + offset, s}
return
} }
asns := extractIpv6ASNsFromHops(hops, model.EnableLoger) asns := extractIpv6ASNsFromHops(hops, model.EnableLoger)
// 如果没有找到ASN尝试备选IP // 如果没有找到ASN尝试备选IP
if len(asns) == 0 { if len(asns) == 0 {
// 尝试从IcmpTargets获取备选IP // 尝试从IcmpTargets获取备选IP
if tryAltIPs := tryAlternativeIPs(model.Ipv6Names[i], "v6"); len(tryAltIPs) > 0 { if tryAltIPs := tryAlternativeIPs(model.Ipv4Names[i], "v4"); len(tryAltIPs) > 0 {
for _, altIP := range tryAltIPs { for _, altIP := range tryAltIPs {
if model.EnableLoger { if model.EnableLoger {
Logger.Info(fmt.Sprintf("尝试备选IP %s 追踪 %s", altIP, model.Ipv6Names[i])) Logger.Info(fmt.Sprintf("尝试备选IP %s 追踪 %s", altIP, model.Ipv4Names[i]))
} }
hops, err = Trace(net.ParseIP(altIP)) hops, err = Trace(net.ParseIP(altIP))
if err == nil && len(hops) > 0 { if err == nil && len(hops) > 0 {

View File

@ -70,11 +70,17 @@ func getData(endpoint string) string {
// parseIcmpTargets 解析ICMP目标数据 // parseIcmpTargets 解析ICMP目标数据
func parseIcmpTargets(jsonData string) []model.IcmpTarget { func parseIcmpTargets(jsonData string) []model.IcmpTarget {
// 确保JSON数据格式正确如果返回的是数组需要添加[和]
if !strings.HasPrefix(jsonData, "[") {
jsonData = "[" + jsonData + "]"
}
// 如果JSON数据中的对象没有正确用逗号分隔修复它
jsonData = strings.ReplaceAll(jsonData, "}{", "},{")
var targets []model.IcmpTarget var targets []model.IcmpTarget
err := json.Unmarshal([]byte(jsonData), &targets) err := json.Unmarshal([]byte(jsonData), &targets)
if err != nil { if err != nil {
if model.EnableLoger { if model.EnableLoger {
Logger.Info(fmt.Sprintf("解析ICMP目标失败: %s", err.Error())) Logger.Error(fmt.Sprintf("Failed to parse ICMP targets: %v", err))
} }
return nil return nil
} }

View File

@ -7,11 +7,9 @@ import (
"net/http" "net/http"
"os" "os"
"runtime" "runtime"
"time"
backtrace "github.com/oneclickvirt/backtrace/bk" backtrace "github.com/oneclickvirt/backtrace/bk"
"github.com/oneclickvirt/backtrace/model" "github.com/oneclickvirt/backtrace/model"
"github.com/oneclickvirt/backtrace/utils"
. "github.com/oneclickvirt/defaultset" . "github.com/oneclickvirt/defaultset"
) )
@ -27,7 +25,7 @@ func main() {
go func() { go func() {
http.Get("https://hits.spiritlhl.net/backtrace.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false") http.Get("https://hits.spiritlhl.net/backtrace.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false")
}() }()
fmt.Println(Green("Repo:"), Yellow("https://github.com/oneclickvirt/backtrace")) fmt.Println(Green("项目地址:"), Yellow("https://github.com/oneclickvirt/backtrace"))
var showVersion, showIpInfo, help, ipv6 bool var showVersion, showIpInfo, help, ipv6 bool
backtraceFlag := flag.NewFlagSet("backtrace", flag.ContinueOnError) backtraceFlag := flag.NewFlagSet("backtrace", flag.ContinueOnError)
backtraceFlag.BoolVar(&help, "h", false, "Show help information") backtraceFlag.BoolVar(&help, "h", false, "Show help information")
@ -60,16 +58,7 @@ func main() {
} }
} }
} }
preCheck := utils.CheckPublicAccess(3 * time.Second) backtrace.BackTrace(ipv6)
if preCheck.Connected && preCheck.StackType == "DualStack" {
backtrace.BackTrace(ipv6)
} else if preCheck.Connected && preCheck.StackType == "IPv4" {
backtrace.BackTrace(false)
} else if preCheck.Connected && preCheck.StackType == "IPv6" {
backtrace.BackTrace(true)
} else {
fmt.Println(Red("PreCheck IP Type Failed"))
}
fmt.Println(Yellow("准确线路自行查看详细路由,本测试结果仅作参考")) fmt.Println(Yellow("准确线路自行查看详细路由,本测试结果仅作参考"))
fmt.Println(Yellow("同一目标地址多个线路时,可能检测已越过汇聚层,除了第一个线路外,后续信息可能无效")) fmt.Println(Yellow("同一目标地址多个线路时,可能检测已越过汇聚层,除了第一个线路外,后续信息可能无效"))
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {

View File

@ -15,7 +15,7 @@ type IcmpTarget struct {
} }
var ( var (
IcmpTargets = "https://raw.githubusercontent.com/spiritLHLS/icmp_targets/main/nodes.json" IcmpTargets = "https://raw.githubusercontent.com/spiritLHLS/icmp_targets/refs/heads/main/nodes.json"
CdnList = []string{ CdnList = []string{
"http://cdn1.spiritlhl.net/", "http://cdn1.spiritlhl.net/",
"http://cdn2.spiritlhl.net/", "http://cdn2.spiritlhl.net/",

View File

@ -1,160 +0,0 @@
package utils
import (
"context"
"net"
"net/http"
"sync"
"time"
)
type NetCheckResult struct {
HasIPv4 bool
HasIPv6 bool
Connected bool
StackType string // "IPv4", "IPv6", "DualStack", "None"
}
func makeResolver(proto, dnsAddr string) *net.Resolver {
return &net.Resolver{
PreferGo: true,
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
d := net.Dialer{
Timeout: 5 * time.Second,
}
return d.DialContext(ctx, proto, dnsAddr)
},
}
}
func CheckPublicAccess(timeout time.Duration) NetCheckResult {
if timeout < 2*time.Second {
timeout = 2 * time.Second
}
var wg sync.WaitGroup
resultChan := make(chan string, 8)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
checks := []struct {
Tag string
Addr string
Kind string // udp4, udp6, http4, http6
}{
// UDP DNS
{"IPv4", "223.5.5.5:53", "udp4"}, // 阿里 DNS
{"IPv4", "8.8.8.8:53", "udp4"}, // Google DNS
{"IPv6", "[2400:3200::1]:53", "udp6"}, // 阿里 IPv6 DNS
{"IPv6", "[2001:4860:4860::8888]:53", "udp6"}, // Google IPv6 DNS
// HTTP HEAD
{"IPv4", "https://www.baidu.com", "http4"}, // 百度
{"IPv4", "https://1.1.1.1", "http4"}, // Cloudflare
{"IPv6", "https://[2400:3200::1]", "http6"}, // 阿里 IPv6
{"IPv6", "https://[2606:4700::1111]", "http6"}, // Cloudflare IPv6
}
for _, check := range checks {
wg.Add(1)
go func(tag, addr, kind string) {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
}
}()
switch kind {
case "udp4", "udp6":
dialer := &net.Dialer{
Timeout: timeout / 4,
}
conn, err := dialer.DialContext(ctx, kind, addr)
if err == nil && conn != nil {
conn.Close()
select {
case resultChan <- tag:
case <-ctx.Done():
return
}
}
case "http4", "http6":
var resolver *net.Resolver
if kind == "http4" {
resolver = makeResolver("udp4", "223.5.5.5:53")
} else {
resolver = makeResolver("udp6", "[2400:3200::1]:53")
}
dialer := &net.Dialer{
Timeout: timeout / 4,
Resolver: resolver,
}
transport := &http.Transport{
DialContext: dialer.DialContext,
MaxIdleConns: 1,
MaxIdleConnsPerHost: 1,
IdleConnTimeout: time.Second,
TLSHandshakeTimeout: timeout / 4,
ResponseHeaderTimeout: timeout / 4,
DisableKeepAlives: true,
}
client := &http.Client{
Timeout: timeout / 4,
Transport: transport,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
req, err := http.NewRequestWithContext(ctx, "HEAD", addr, nil)
if err != nil {
return
}
resp, err := client.Do(req)
if err == nil && resp != nil {
if resp.Body != nil {
resp.Body.Close()
}
if resp.StatusCode < 500 {
select {
case resultChan <- tag:
case <-ctx.Done():
return
}
}
}
}
}(check.Tag, check.Addr, check.Kind)
}
go func() {
wg.Wait()
close(resultChan)
}()
hasV4 := false
hasV6 := false
for {
select {
case res, ok := <-resultChan:
if !ok {
goto result
}
if res == "IPv4" {
hasV4 = true
}
if res == "IPv6" {
hasV6 = true
}
case <-ctx.Done():
goto result
}
}
result:
stack := "None"
if hasV4 && hasV6 {
stack = "DualStack"
} else if hasV4 {
stack = "IPv4"
} else if hasV6 {
stack = "IPv6"
}
return NetCheckResult{
HasIPv4: hasV4,
HasIPv6: hasV6,
Connected: hasV4 || hasV6,
StackType: stack,
}
}

View File

@ -1,17 +0,0 @@
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("❌ 本机未检测到公网连接")
}
}