Tunnel inbound: Compatible with listening UNIX domain socket (#5693)

https://github.com/XTLS/Xray-core/pull/5693#issuecomment-4229947428

---------

Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
This commit is contained in:
Seyyed Mostafa
2026-04-11 22:09:32 +03:30
committed by GitHub
parent 93225a1132
commit 32937846c5

View File

@@ -2,6 +2,7 @@ package dokodemo
import ( import (
"context" "context"
"slices"
"strconv" "strconv"
"strings" "strings"
@@ -56,6 +57,9 @@ func (d *DokodemoDoor) Init(config *Config, pm policy.Manager, sockopt *session.
// Network implements proxy.Inbound. // Network implements proxy.Inbound.
func (d *DokodemoDoor) Network() []net.Network { func (d *DokodemoDoor) Network() []net.Network {
if slices.Contains(d.config.Networks, net.Network_TCP) {
return append(d.config.Networks, net.Network_UNIX)
}
return d.config.Networks return d.config.Networks
} }
@@ -68,6 +72,10 @@ func (d *DokodemoDoor) policy() policy.Session {
// Process implements proxy.Inbound. // Process implements proxy.Inbound.
func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn stat.Connection, dispatcher routing.Dispatcher) error { func (d *DokodemoDoor) Process(ctx context.Context, network net.Network, conn stat.Connection, dispatcher routing.Dispatcher) error {
errors.LogDebug(ctx, "processing connection from: ", conn.RemoteAddr()) errors.LogDebug(ctx, "processing connection from: ", conn.RemoteAddr())
// forward to TCP if from UNIX
if network == net.Network_UNIX {
network = net.Network_TCP
}
dest := net.Destination{ dest := net.Destination{
Network: network, Network: network,
Address: d.address, Address: d.address,