Repository navigation
Tunnel inbound: Fix panic when listening on UDS for Xray's internal services (e.g. API) - #6062
Conversation
|
|
|
the traffic is intended to be processed by the internal gRPC API {
"inbounds": [
{
"protocol": "dokodemo-door",
"listen": "/my/path/api.sock,0666",
"tag": "api"
}
],
"api": {
"tag": "api",
"services": [
"LoggerService",
"RoutingService",
"HandlerService"
]
},
"routing": {
"rules": [
{
"inboundTag": ["api"],
"outboundTag": "api"
}
]
}
}I tested it and еverything works perfectly on my end with this configuration and the fix |
|
While exploring the XRAY-core internals, I noticed that the API listener currently uses the standard net.Listen from golang. Although net.Listen itself supports Unix sockets, I found it more appropriate to use XRAY's internal listener wrapper instead. |
处理 @@ 的代码也在里面对吧 |
|
看到了,有包含 @@ |
Yes. Btw, unlike net.Listen, this wrapper has supports @@ |
fixed a panic that occurs when using UNIX socket as the listen address in dokodemo-door inbound configuration:
when using UNIX socket, the net.SplitHostPort() function returns an empty string for the port variable. at line 99, the code attempts to convert this empty string to an integer using strconv.Atoi(port), which causes the panic.
my example configuration:
{ "protocol": "dokodemo-door", "listen": "/my/path/api.sock,0666", "tag": "api" }