Skip to content

Commit

Permalink
bump deps, fix ipBlacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
honwen committed Jun 24, 2024
1 parent 47a33ba commit bd6835a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ go 1.22.4
require (
// locked before tracing/logging https://github.com/denverdino/aliyungo/commits/master/go.mod
github.com/denverdino/aliyungo v0.0.0-20230411124812-ab98a9173ace
github.com/honwen/golibs v0.5.5
github.com/honwen/ip2loc v0.4.2
github.com/honwen/golibs v0.6.0
github.com/honwen/ip2loc v0.4.3
github.com/urfave/cli v1.22.15
github.com/ysmood/got v0.40.0
)

require (
github.com/AdguardTeam/golibs v0.24.0 // indirect
github.com/AdguardTeam/golibs v0.24.1 // indirect
github.com/PuerkitoBio/goquery v1.9.2 // indirect
github.com/Workiva/go-datastructures v1.1.5 // indirect
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/AdguardTeam/golibs v0.24.0 h1:qAnOq7BQtwSVo7Co9q703/n+nZ2Ap6smkugU9G9MomY=
github.com/AdguardTeam/golibs v0.24.0/go.mod h1:9/vJcYznW7RlmCT/Qzi8XNZGj+ZbWfHZJmEXKnRpCAU=
github.com/AdguardTeam/golibs v0.24.1 h1:/ulkfm65wi33p72ybxiOt3lSdP0nr1GggSoaT4sHbns=
github.com/AdguardTeam/golibs v0.24.1/go.mod h1:9/vJcYznW7RlmCT/Qzi8XNZGj+ZbWfHZJmEXKnRpCAU=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE=
github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk=
Expand Down Expand Up @@ -33,10 +33,10 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20240618054019-d3b898a103f8 h1:ASJ/LAqdCHOyMYI+dwNxn7Rd8FscNkMyTr1KZU1JI/M=
github.com/google/pprof v0.0.0-20240618054019-d3b898a103f8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/honwen/golibs v0.5.5 h1:KIj/nHmk6/t1FBA54R4epLQC4wVHggTb9GZWZtlAoZQ=
github.com/honwen/golibs v0.5.5/go.mod h1:qmmI/fJXIucorbmfYnyboRhGDx18dryUpmZymaDFptI=
github.com/honwen/ip2loc v0.4.2 h1:GDnHyuc0BnzXnVjyXB5x3sHhU5CgYCeyj0qT2miB/Vg=
github.com/honwen/ip2loc v0.4.2/go.mod h1:KGX5SIb1L6jT74GeprHpWfHGqXiUEUcEnZ+sWYWbuVw=
github.com/honwen/golibs v0.6.0 h1:FOWC+HHuYY4FXvNFPb89Bb3nzMY2woGwfFJF5wisXuw=
github.com/honwen/golibs v0.6.0/go.mod h1:1Zfra5tdQBRLfFbOecq6PqykQ1gXiDi3L0NP+i4s7hQ=
github.com/honwen/ip2loc v0.4.3 h1:1RKKdMQujoz5/NEJWzXK2dvnKFChJ+uMvVYgJL90Rzg=
github.com/honwen/ip2loc v0.4.3/go.mod h1:KGX5SIb1L6jT74GeprHpWfHGqXiUEUcEnZ+sWYWbuVw=
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs=
github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ=
Expand Down
2 changes: 1 addition & 1 deletion utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func myip() (ip string) {
for _, r := range result {
ip = r.String()
for _, it := range ipBlacklist {
ok, _ := containsCIDRString(it, ip)
ok, _ := containsCIDRString(it, ip+`/32`)
if ok {
ip = ""
break
Expand Down
9 changes: 9 additions & 0 deletions utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ import (
"github.com/ysmood/got"
)

func TestContainsCIDRString(t *testing.T) {
_, err := containsCIDRString("127.0.0.0/8", "128.0.0.1")
got.T(t).NotNil(err)
is, _ := containsCIDRString("127.0.0.0/8", "128.0.0.1/32")
got.T(t).False(is)
is, _ = containsCIDRString("127.0.0.0/8", "127.0.0.99/32")
got.T(t).True(is)
}

func TestGetIPv4(t *testing.T) {
funcs["myip"] = cip.MyIPv4
ip4 := myip()
Expand Down

0 comments on commit bd6835a

Please sign in to comment.