Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: Calling IP() on a DomainAddress #116

Open
maskedeken opened this issue Dec 30, 2020 · 10 comments
Open

panic: Calling IP() on a DomainAddress #116

maskedeken opened this issue Dec 30, 2020 · 10 comments
Labels
bug Something isn't working

Comments

@maskedeken
Copy link
Contributor

在往buf.Buffer的UDP属性赋值的时候,创建
&net.UDPAddr{
IP: addr.IP(),
Port: int(port.Value()),
}

但这里的addr是从addrParser.ReadAddressPort()而来,这里的addr有可能是域名,如果直接调用addr.IP(),会直接panic

func (domainAddress) IP() net.IP {
panic("Calling IP() on a DomainAddress.")
}

@maskedeken maskedeken changed the title Calling IP() on a DomainAddress panic: Calling IP() on a DomainAddress Dec 30, 2020
@RPRX
Copy link
Member

RPRX commented Dec 30, 2020

两天前的提交已经修复 13ad3fd

(不过最新的 commit 有问题,等下会 force

@maskedeken
Copy link
Contributor Author

怎么解决循环引用的问题?

@maskedeken maskedeken reopened this Dec 30, 2020
@RPRX
Copy link
Member

RPRX commented Dec 30, 2020

怎么解决循环引用的问题?

6bcac6c

@RPRX RPRX closed this as completed Dec 30, 2020
@RPRX
Copy link
Member

RPRX commented Dec 30, 2020

如果发现存在其它问题,也请直接反馈

比如目前发现任意门 TPROXY 那里不能缓存 conns,只能发一个包就 close,否则行为会异常,等下打算看看把 dial 改为 listen 的表现

@z719893361
Copy link

z719893361 commented Aug 30, 2022

问题修复了吗,我用最新版碰到了相同的问题
我想大概是使用TPROXY转发UDP流量导致,使用tun2socks转发不会出现这类问题。

@mmmray
Copy link
Contributor

mmmray commented Apr 24, 2024

I encountered this issue just now on xray 1.8.10

unfortunately i have nothing useful to reproduce it with. the server config has been running fine for a very long time before then, so i suspect it is somehow triggered by traffic and not the config itself. but i also don't know which protocol.

stacktrace
panic: Calling IP() on a DomainAddress.

goroutine 10315396 [running]:
github.com/xtls/xray-core/common/net.domainAddress.IP(...)
   github.com/xtls/xray-core/common/net/address.go:164
github.com/xtls/xray-core/features/routing/session.(*Context).GetTargetIPs(0xc00cfb1290)
   github.com/xtls/xray-core/features/routing/session/context.go:54 +0x5f
github.com/xtls/xray-core/app/router.(*MultiGeoIPMatcher).Apply(0xc0003bc4e0, {0x1549850?, 0xc00cfb1290?})
   github.com/xtls/xray-core/app/router/condition.go:142 +0x3e
github.com/xtls/xray-core/app/router.(*ConditionChan).Apply(0x8?, {0x1549850, 0xc00cfb1290})
   github.com/xtls/xray-core/app/router/condition.go:31 +0x5c
github.com/xtls/xray-core/app/router.(*Rule).Apply(...)
   github.com/xtls/xray-core/app/router/config.go:28
github.com/xtls/xray-core/app/router.(*Router).pickRouteInternal(0xc0003a1260, {0x1549850, 0xc00cfb1290})
   github.com/xtls/xray-core/app/router/router.go:195 +0x176
github.com/xtls/xray-core/app/router.(*Router).PickRoute(0x15402b8?, {0x1549850?, 0xc00cfb1290?})
   github.com/xtls/xray-core/app/router/router.go:83 +0x25
github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).routedDispatch(0xc00039d8c0, {0x15402b8, 0xc009bfa570}, 0xc00bdaa360, {{0x1540440, 0xc00b6dc204}, 0x1bb, 0x2})
   github.com/xtls/xray-core/app/dispatcher/default.go:403 +0x2e2
github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).Dispatch.func1()
   github.com/xtls/xray-core/app/dispatcher/default.go:266 +0x3f9
created by github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).Dispatch in goroutine 10315389
   github.com/xtls/xray-core/app/dispatcher/default.go:239 +0x40b
config (users, wireguard credentials and http paths redacted)
{
  "inbounds": [
    {
      "listen": "0.0.0.0",
      "port": 42007,
      "protocol": "socks",
      "settings": {
        "auth": "password",
        "accounts": [
        ],
        "udp": true,
        "userLevel": 8
      },
      "sniffing": {
        "destOverride": [
          "http",
          "tls"
        ],
        "enabled": true
      },
      "tag": "socks"
    },
    {
      "port": 42003,
      "listen": "0.0.0.0",
      "protocol": "vmess",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "clients": [
        ]
      },
      "streamSettings": {
        "network": "ws",
        "wsSettings": {
          "path": "/xxx"
        }
      }
    },
    {
      "port": 42005,
      "listen": "0.0.0.0",
      "protocol": "vmess",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "clients": [
        ]
      },
      "streamSettings": {
        "network": "grpc",
        "grpcSettings": {
          "serviceName": "xxx"
        }
      }
    },
    {
      "port": 42006,
      "listen": "0.0.0.0",
      "protocol": "vmess",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "clients": [
        ]
      },
      "streamSettings": {
        "network": "httpupgrade",
        "httpUpgradeSettings": {
          "path": "/xxx"
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "wireguard",
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "block"
    }
  ],
  "routing": {
    "domainStrategy": "AsIs",
    "rules": [
      {
        "type": "field",
        "outboundTag": "block",
        "protocol": [
          "bittorrent"
        ]
      },
      {
        "type": "field",
        "outboundTag": "block",
        "ip": [
          "0.0.0.0/8",
          "10.0.0.0/8",
          "100.64.0.0/10",
          "127.0.0.0/8",
          "169.254.0.0/16",
          "172.16.0.0/12",
          "192.0.0.0/24",
          "192.0.2.0/24",
          "192.88.99.0/24",
          "192.168.0.0/16",
          "198.18.0.0/15",
          "198.51.100.0/24",
          "203.0.113.0/24",
          "224.0.0.0/4",
          "233.252.0.0/24",
          "240.0.0.0/4",
          "255.255.255.255/32"
        ]
      }
    ]
  },
  "log": {
    "access": "none",
    "error": "",
    "loglevel": "error"
  }
}

@yuhan6665 yuhan6665 reopened this Apr 24, 2024
@yuhan6665 yuhan6665 added the bug Something isn't working label Apr 24, 2024
@mmmray
Copy link
Contributor

mmmray commented May 26, 2024

It occurs with 1.8.13 as well. Stacktrace is the same.

Is it reasonable to think the broken address comes from a specific inbound? I can try to remove inbounds from production (or rather, move them to a secondary xray container) until the problem stops occurring, but would like to know if it's worth the effort.

currently the issue only happens 2-3 times per day, so it's kind of fine with autorestart.

@somebodywashere
Copy link

Also had this a few times on one server. Can you by any chance have any outbound with ForceIP?

I didn't checked the code but I didn't see this error anymore when I removed plain ForceIP from outbound (ForceIPv4v6 & ForceIPv6v4 is ok for me)

@mmmray
Copy link
Contributor

mmmray commented May 26, 2024

i posted my full config above, no I don't use any variant of ForceIP.

@somebodywashere
Copy link

somebodywashere commented May 26, 2024

i posted my full config above, no I don't use any variant of ForceIP.

Oh, sorry, didn't pay enough attention. Now I see. That's strange than.

If I encounter that once more I'll get back with additional info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants