Handle UNIX network connections in Process method#5693
Handle UNIX network connections in Process method#5693
Conversation
Forward connections from UNIX to TCP network type.
|
? |
|
Why? |
|
Sorry, I remembered sth incorrectly |
配置示例里这个? |
|
yes |
|
actually it listens on unix on client but sends to that tcp address better to rename it unix-tcp but this works for now |
|
哦哦 address 和 port 是 target,然而这个 network 是 listen 的 network, 另外这个 network 应该放外面然后改成 |
|
这一改现有配置又要大炸特炸了 这个需求很小众我觉得这个PR这么改几行就行了 |
|
in previous versions we also can have unix as network and nothing changed i just changed logic to forward to tcp instead of unix as target |
append unix as dokodemo network
|
now this works no need to configure network as unix {
"listen": "@test.socket",
"port": 10085,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1",
"network": "tcp",
"port": 8000
},
"tag": "test"
}logs:if we change {
"listen": "0.0.0.0",
"port": 10085,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1",
"network": "tcp",
"port": 8000
},
"tag": "test"
}logs: |
|
in other word if we have network |
|
now unix socket works with udp too {
"listen": "@test.socket",
"port": 10085,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1",
"network": "udp",
"port": 8000
},
"tag": "test"
} |
|
Example config for test {
"log": {
"loglevel": "debug"
},
"inbounds": [
{
"listen": "@test-tcp.socket",
"port": 10085,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1",
"network": "tcp",
"port": 8000 // forward to block-in for test
},
"tag": "test-tcp"
},
{
"listen": "@test.socket",
"port": 10085,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1",
"network": "udp",
"port": 8000 // forward to block-in for test
},
"tag": "test"
},
{
"listen": "127.0.0.1",
"port": 8000, // simple tcp,udp server on port 8000
"tag": "block-in",
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp"
}
}
],
"outbounds": [
{
"tag": "free",
"protocol": "freedom"
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
}
],
"routing": {
"rules": [
{
"inboundTag": [
"block-in"
],
"outboundTag": "block",
"type": "field"
}
],
"domainStrategy": "AsIs"
}
}udp test$ nc -U @test.socket
tcp test$ nc -U @test-tcp.socket |
Forward connections from UNIX to TCP network type.
Added support listening on unix socket for dokodemo and forwarding to TCP endpoint
{ "listen": "@test.socket", "port": 10085, "protocol": "dokodemo-door", "settings": { "address": "127.0.0.1", "network": "unix", "port": 8000 }, "tag": "test" }creates a unix listener and forwards incoming request to that unix to tcp addr