diff --git a/app/router/lua.go b/app/router/lua.go index 259f3a96b..8e723b954 100644 --- a/app/router/lua.go +++ b/app/router/lua.go @@ -3,6 +3,7 @@ package router import ( "context" "runtime" + "strings" "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/net" @@ -141,7 +142,7 @@ func (r *Router) CallLuaHook(L *lua.LState, ctx context.Context, routeCtx routin if err := L.CallByParam(lua.P{Fn: fn, NRet: 3, Protect: true}, value, lua.LString(routeCtx.GetInboundTag()), lua.LNumber(routeCtx.GetSourcePort()), lua.LNumber(routeCtx.GetTargetPort()), lua.LNumber(routeCtx.GetLocalPort()), - lua.LString(routeCtx.GetTargetDomain()), lua.LNumber(routeCtx.GetNetwork()), + lua.LString(strings.ToLower(routeCtx.GetTargetDomain())), lua.LNumber(routeCtx.GetNetwork()), lua.LString(routeCtx.GetProtocol()), lua.LString(routeCtx.GetUser()), lua.LNumber(routeCtx.GetVlessRoute()), lua.LBool(routeCtx.GetSkipDNSResolve())); err != nil { return "", "", err diff --git a/app/router/lua_test.go b/app/router/lua_test.go index 52ccb0e04..518acdb83 100644 --- a/app/router/lua_test.go +++ b/app/router/lua_test.go @@ -75,7 +75,7 @@ function HandleRoute(ctx, inboundTag, sourcePort, targetPort, localPort, targetDomain, network, protocol, user, vlessRoute, skipDNSResolve, ...) assert(select("#", ...) == 0) assert(inboundTag == "in" and sourcePort == 1234 and targetPort == 443 and localPort == 5678) - assert(targetDomain == "MiXeD.Example." and network == router.NetworkTCP) + assert(targetDomain == "mixed.example." and network == router.NetworkTCP) assert(protocol == "tls" and user == "user@example.com" and vlessRoute == 4321 and skipDNSResolve) assert(ctx.GetNetwork == nil and ctx.Context == nil) savedContext = ctx diff --git a/app/router/script_test.go b/app/router/script_test.go index 553812cd7..ebc0f5ecc 100644 --- a/app/router/script_test.go +++ b/app/router/script_test.go @@ -126,7 +126,7 @@ func TestRouterScriptModules(t *testing.T) { calls := 0 d := &luaRouteDNSClient{lookup: func(domain string, option featureDNS.IPOption) ([]net.IP, uint32, error) { calls++ - if domain != "MiXeD.Example." || !option.IPv4Enable || option.IPv6Enable || !option.FakeEnable { + if domain != "mixed.example." || !option.IPv4Enable || option.IPv6Enable || !option.FakeEnable { t.Fatalf("dns.Query arguments = %q, %+v", domain, option) } return ips, 17, nil