diff --git a/.github/docker/Dockerfile b/.github/docker/Dockerfile index e85706922..1295b7684 100644 --- a/.github/docker/Dockerfile +++ b/.github/docker/Dockerfile @@ -9,8 +9,8 @@ ARG TARGETARCH RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -o xray -trimpath -buildvcs=false -gcflags="all=-l=4" -ldflags "-s -w -buildid=" ./main # Download geodat into a staging directory -ADD https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geoip.dat /tmp/geodat/geoip.dat -ADD https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat /tmp/geodat/geosite.dat +ADD https://raw.githubusercontent.com/XTLS/Xray-rules-dat/release/geoip/geoip-full.dat /tmp/geodat/geoip.dat +ADD https://raw.githubusercontent.com/XTLS/Xray-rules-dat/release/geosite/geosite-expand.dat /tmp/geodat/geosite.dat RUN mkdir -p /tmp/empty diff --git a/.github/docker/Dockerfile.usa b/.github/docker/Dockerfile.usa index 8aa096f8a..09e5da816 100644 --- a/.github/docker/Dockerfile.usa +++ b/.github/docker/Dockerfile.usa @@ -9,8 +9,8 @@ ARG TARGETARCH RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -o xray -trimpath -buildvcs=false -gcflags="all=-l=4" -ldflags "-s -w -buildid=" ./main # Download geodat into a staging directory -ADD https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geoip.dat /tmp/geodat/geoip.dat -ADD https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat /tmp/geodat/geosite.dat +ADD https://raw.githubusercontent.com/XTLS/Xray-rules-dat/release/geoip/geoip-full.dat /tmp/geodat/geoip.dat +ADD https://raw.githubusercontent.com/XTLS/Xray-rules-dat/release/geosite/geosite-expand.dat /tmp/geodat/geosite.dat RUN mkdir -p /tmp/empty diff --git a/.github/workflows/scheduled-assets-update.yml b/.github/workflows/scheduled-assets-update.yml index cb92ceadc..230be722d 100644 --- a/.github/workflows/scheduled-assets-update.yml +++ b/.github/workflows/scheduled-assets-update.yml @@ -40,7 +40,7 @@ jobs: max_attempts: 60 command: | [ -d 'resources' ] || mkdir resources - LIST=('Loyalsoldier v2ray-rules-dat geoip geoip' 'Loyalsoldier v2ray-rules-dat geosite geosite') + LIST=('XTLS Xray-rules-dat geoip/geoip-lite geoip' 'XTLS Xray-rules-dat geosite/geosite geosite') for i in "${LIST[@]}" do INFO=($(echo $i | awk 'BEGIN{FS=" ";OFS=" "} {print $1,$2,$3,$4}')) diff --git a/app/dns/script_test.go b/app/dns/script_test.go index 506a79b13..ae6f16294 100644 --- a/app/dns/script_test.go +++ b/app/dns/script_test.go @@ -128,7 +128,7 @@ func TestDNSScriptGeoIPFallback(t *testing.T) { t.Setenv("xray.location.asset", filepath.Join("..", "..", "resources")) script := ` local servers = require("xray.dns").Servers -local us_ips = require("xray.geodata").BuildIPMatcher("geoip:us") +local ru_ips = require("xray.geodata").BuildIPMatcher("geoip:ru") local by_id = {} for _, server in ipairs(servers) do @@ -138,7 +138,7 @@ assert(by_id.primary and by_id.fallback, "primary and fallback DNS servers are r function HandleDNSQuery(domain, ipv4, ipv6, fake) local ips, ttl, err = by_id.primary:Query(domain, ipv4, ipv6, fake) - if not err and us_ips:AnyMatch(ips) then + if not err and ru_ips:AnyMatch(ips) then return ips, ttl, nil end return by_id.fallback:Query(domain, ipv4, ipv6, fake) @@ -152,7 +152,7 @@ end primary := &scriptNameServer{ name: "primary", answers: map[string]net.IP{ - "us.example": net.ParseIP("2001:4860:4860::8888"), + "ru.example": net.ParseIP("2a02:6b8::feed:0ff"), "other.example": net.ParseIP("127.0.0.1"), }, ttl: 30, @@ -191,7 +191,7 @@ end ip net.IP ttl uint32 }{ - {"Us.Example.", net.ParseIP("2001:4860:4860::8888"), 30}, + {"Ru.Example.", net.ParseIP("2a02:6b8::feed:0ff"), 30}, {"other.example", net.ParseIP("9.9.9.9"), 60}, } { ips, ttl, err := server.LookupIP(tc.domain, option) diff --git a/app/router/condition_test.go b/app/router/condition_test.go index 510be8b47..8e2222f72 100644 --- a/app/router/condition_test.go +++ b/app/router/condition_test.go @@ -415,7 +415,7 @@ func BenchmarkMphDomainMatcher(b *testing.B) { func BenchmarkMultiGeoIPMatcher(b *testing.B) { b.Setenv("xray.location.asset", filepath.Join("..", "..", "resources")) - rules, err := geodata.ParseIPRules([]string{"geoip:cn", "geoip:jp", "geoip:ca", "geoip:us"}) + rules, err := geodata.ParseIPRules([]string{"geoip:cn", "geoip:ir", "geoip:ru"}) common.Must(err) matcher, err := NewIPMatcher(rules, MatcherAsType_Target) diff --git a/common/geodata/ip_matcher_test.go b/common/geodata/ip_matcher_test.go index fc6a016dd..1a21e9ab9 100644 --- a/common/geodata/ip_matcher_test.go +++ b/common/geodata/ip_matcher_test.go @@ -400,13 +400,13 @@ func TestIPMatcher4CN(t *testing.T) { } } -func TestIPMatcher6US(t *testing.T) { +func TestIPMatcher6RU(t *testing.T) { t.Setenv("xray.location.asset", filepath.Join("..", "..", "resources")) - matcher := buildIPMatcher("geoip:us") + matcher := buildIPMatcher("geoip:ru") - if !matcher.Match(xnet.ParseAddress("2001:4860:4860::8888").IP()) { - t.Error("expect US geoip contain 2001:4860:4860::8888, but actually not") + if !matcher.Match(xnet.ParseAddress("2a02:6b8::feed:0ff").IP()) { + t.Error("expect RU geoip contain 2a02:6b8::feed:0ff, but actually not") } } @@ -423,11 +423,11 @@ func BenchmarkIPMatcher4CN(b *testing.B) { } } -func BenchmarkIPMatcher6US(b *testing.B) { +func BenchmarkIPMatcher6RU(b *testing.B) { b.Setenv("xray.location.asset", filepath.Join("..", "..", "resources")) - matcher := buildIPMatcher("geoip:us") - ip := xnet.ParseAddress("2001:4860:4860::8888").IP() + matcher := buildIPMatcher("geoip:ru") + ip := xnet.ParseAddress("2a02:6b8::feed:0ff").IP() b.ResetTimer() diff --git a/common/geodata/rule_parser_test.go b/common/geodata/rule_parser_test.go index 7aaf44c5c..32715a54d 100644 --- a/common/geodata/rule_parser_test.go +++ b/common/geodata/rule_parser_test.go @@ -11,7 +11,7 @@ func TestParseIPRules(t *testing.T) { t.Setenv("xray.location.asset", filepath.Join("..", "..", "resources")) rules := []string{ - "geoip:us", + "geoip:ru", "geoip:cn", "!geoip:cn", "!!geoip:cn", @@ -20,9 +20,9 @@ func TestParseIPRules(t *testing.T) { "!geoip:!cn", "ext:geoip.dat:!cn", "ext:geoip.dat:!!cn", - "ext:geoip.dat:ca", + "ext:geoip.dat:ir", "ext-ip:geoip.dat:!cn", - "ext-ip:geoip.dat:!ca", + "ext-ip:geoip.dat:!ir", "192.168.0.0/24", "!192.168.0.0/24", "!!192.168.0.0/24",