Meow
2026-04-14 00:42:29 +08:00
committed by GitHub
parent e9f7d61c2e
commit 82624bcaf0
73 changed files with 5432 additions and 4455 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/app/router"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/geodata"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/serial"
"github.com/xtls/xray-core/core"
@@ -34,8 +35,7 @@ func TestResolveIP(t *testing.T) {
serial.ToTypedMessage(&dns.Config{
StaticHosts: []*dns.Config_HostMapping{
{
Type: dns.DomainMatchingType_Full,
Domain: "google.com",
Domain: &geodata.DomainRule{Value: &geodata.DomainRule_Custom{Custom: &geodata.Domain{Type: geodata.Domain_Full, Value: "google.com"}}},
Ip: [][]byte{dest.Address.IP()},
},
},
@@ -44,10 +44,10 @@ func TestResolveIP(t *testing.T) {
DomainStrategy: router.Config_IpIfNonMatch,
Rule: []*router.RoutingRule{
{
Geoip: []*router.GeoIP{
Ip: []*geodata.IPRule{
{
Cidr: []*router.CIDR{
{
Value: &geodata.IPRule_Custom{
Custom: &geodata.CIDR{
Ip: []byte{127, 0, 0, 0},
Prefix: 8,
},

View File

@@ -10,6 +10,7 @@ import (
"github.com/xtls/xray-core/app/reverse"
"github.com/xtls/xray-core/app/router"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/geodata"
clog "github.com/xtls/xray-core/common/log"
"github.com/xtls/xray-core/common/net"
"github.com/xtls/xray-core/common/protocol"
@@ -52,8 +53,8 @@ func TestReverseProxy(t *testing.T) {
serial.ToTypedMessage(&router.Config{
Rule: []*router.RoutingRule{
{
Domain: []*router.Domain{
{Type: router.Domain_Full, Value: "test.example.com"},
Domain: []*geodata.DomainRule{
{Value: &geodata.DomainRule_Custom{Custom: &geodata.Domain{Type: geodata.Domain_Full, Value: "test.example.com"}}},
},
TargetTag: &router.RoutingRule_Tag{
Tag: "portal",
@@ -118,8 +119,8 @@ func TestReverseProxy(t *testing.T) {
serial.ToTypedMessage(&router.Config{
Rule: []*router.RoutingRule{
{
Domain: []*router.Domain{
{Type: router.Domain_Full, Value: "test.example.com"},
Domain: []*geodata.DomainRule{
{Value: &geodata.DomainRule_Custom{Custom: &geodata.Domain{Type: geodata.Domain_Full, Value: "test.example.com"}}},
},
TargetTag: &router.RoutingRule_Tag{
Tag: "reverse",
@@ -158,7 +159,7 @@ func TestReverseProxy(t *testing.T) {
Receiver: &protocol.ServerEndpoint{
Address: net.NewIPOrDomain(net.LocalHostIP),
Port: uint32(reversePort),
User: &protocol.User{
User: &protocol.User{
Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(),
SecuritySettings: &protocol.SecurityConfig{
@@ -227,8 +228,8 @@ func TestReverseProxyLongRunning(t *testing.T) {
serial.ToTypedMessage(&router.Config{
Rule: []*router.RoutingRule{
{
Domain: []*router.Domain{
{Type: router.Domain_Full, Value: "test.example.com"},
Domain: []*geodata.DomainRule{
{Value: &geodata.DomainRule_Custom{Custom: &geodata.Domain{Type: geodata.Domain_Full, Value: "test.example.com"}}},
},
TargetTag: &router.RoutingRule_Tag{
Tag: "portal",
@@ -307,8 +308,8 @@ func TestReverseProxyLongRunning(t *testing.T) {
serial.ToTypedMessage(&router.Config{
Rule: []*router.RoutingRule{
{
Domain: []*router.Domain{
{Type: router.Domain_Full, Value: "test.example.com"},
Domain: []*geodata.DomainRule{
{Value: &geodata.DomainRule_Custom{Custom: &geodata.Domain{Type: geodata.Domain_Full, Value: "test.example.com"}}},
},
TargetTag: &router.RoutingRule_Tag{
Tag: "reverse",
@@ -347,7 +348,7 @@ func TestReverseProxyLongRunning(t *testing.T) {
Receiver: &protocol.ServerEndpoint{
Address: net.NewIPOrDomain(net.LocalHostIP),
Port: uint32(reversePort),
User: &protocol.User{
User: &protocol.User{
Account: serial.ToTypedMessage(&vmess.Account{
Id: userID.String(),
SecuritySettings: &protocol.SecurityConfig{