Add v2ray mux support for all connections

This commit is contained in:
世界 2022-10-03 04:34:14 +08:00
parent 1445bdba37
commit 8aec64b855
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -26,6 +26,7 @@ import (
"github.com/sagernet/sing-box/option" "github.com/sagernet/sing-box/option"
"github.com/sagernet/sing-dns" "github.com/sagernet/sing-dns"
"github.com/sagernet/sing-tun" "github.com/sagernet/sing-tun"
"github.com/sagernet/sing-vmess"
"github.com/sagernet/sing/common" "github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/buf" "github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/bufio" "github.com/sagernet/sing/common/bufio"
@ -543,6 +544,9 @@ func (r *Router) RouteConnection(ctx context.Context, conn net.Conn, metadata ad
case mux.Destination.Fqdn: case mux.Destination.Fqdn:
r.logger.InfoContext(ctx, "inbound multiplex connection") r.logger.InfoContext(ctx, "inbound multiplex connection")
return mux.NewConnection(ctx, r, r, r.logger, conn, metadata) return mux.NewConnection(ctx, r, r, r.logger, conn, metadata)
case vmess.MuxDestination.Fqdn:
r.logger.InfoContext(ctx, "inbound legacy multiplex connection")
return vmess.HandleMuxConnection(ctx, conn, adapter.NewUpstreamHandler(metadata, r.RouteConnection, r.RoutePacketConnection, r))
case uot.UOTMagicAddress: case uot.UOTMagicAddress:
r.logger.InfoContext(ctx, "inbound UoT connection") r.logger.InfoContext(ctx, "inbound UoT connection")
metadata.Destination = M.Socksaddr{} metadata.Destination = M.Socksaddr{}