mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-26 10:31:29 +00:00
set outbound tag of the selector for dns route
This commit is contained in:
parent
b80ec55ba0
commit
c79c4cff10
|
@ -153,6 +153,9 @@ func (s *Selector) NewPacketConnection(ctx context.Context, conn N.PacketConn, m
|
||||||
}
|
}
|
||||||
|
|
||||||
func RealTag(detour adapter.Outbound) string {
|
func RealTag(detour adapter.Outbound) string {
|
||||||
|
if s, ok := detour.(*Selector); ok {
|
||||||
|
return RealTag(s.selected)
|
||||||
|
}
|
||||||
if group, isGroup := detour.(adapter.OutboundGroup); isGroup {
|
if group, isGroup := detour.(adapter.OutboundGroup); isGroup {
|
||||||
return group.Now()
|
return group.Now()
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,16 +20,17 @@ import (
|
||||||
"github.com/sagernet/sing-box/common/process"
|
"github.com/sagernet/sing-box/common/process"
|
||||||
"github.com/sagernet/sing-box/common/sniff"
|
"github.com/sagernet/sing-box/common/sniff"
|
||||||
"github.com/sagernet/sing-box/common/taskmonitor"
|
"github.com/sagernet/sing-box/common/taskmonitor"
|
||||||
|
"github.com/sagernet/sing-box/constant"
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
"github.com/sagernet/sing-box/experimental/libbox/platform"
|
"github.com/sagernet/sing-box/experimental/libbox/platform"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
"github.com/sagernet/sing-box/outbound"
|
"github.com/sagernet/sing-box/outbound"
|
||||||
"github.com/sagernet/sing-box/transport/fakeip"
|
"github.com/sagernet/sing-box/transport/fakeip"
|
||||||
"github.com/sagernet/sing-dns"
|
dns "github.com/sagernet/sing-dns"
|
||||||
"github.com/sagernet/sing-mux"
|
mux "github.com/sagernet/sing-mux"
|
||||||
"github.com/sagernet/sing-tun"
|
tun "github.com/sagernet/sing-tun"
|
||||||
"github.com/sagernet/sing-vmess"
|
vmess "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"
|
||||||
|
@ -1113,6 +1114,10 @@ func (r *Router) match(ctx context.Context, metadata *adapter.InboundContext, de
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx = outbound.ContextWithTag(ctx, matchOutbound.Tag())
|
ctx = outbound.ContextWithTag(ctx, matchOutbound.Tag())
|
||||||
|
if matchOutbound.Type() == constant.TypeSelector {
|
||||||
|
tag := outbound.RealTag(matchOutbound)
|
||||||
|
metadata.Outbound = tag
|
||||||
|
}
|
||||||
return ctx, matchRule, matchOutbound, nil
|
return ctx, matchRule, matchOutbound, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue