mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-10-27 13:36:57 +00:00
refactor: New tun udpnat
This commit is contained in:
@@ -42,6 +42,9 @@ type Inbound struct {
|
||||
logger log.ContextLogger
|
||||
tunOptions tun.Options
|
||||
udpTimeout time.Duration
|
||||
udpMapping tun.NATMapping
|
||||
udpFiltering tun.NATFiltering
|
||||
udpNATMax uint32
|
||||
dnsHijackAddress []netip.Addr
|
||||
stack string
|
||||
tunIf tun.Tun
|
||||
@@ -230,6 +233,9 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
|
||||
EXP_MultiPendingPackets: multiPendingPackets,
|
||||
},
|
||||
udpTimeout: udpTimeout,
|
||||
udpMapping: tun.NATMapping(options.UDPMapping),
|
||||
udpFiltering: tun.NATFiltering(options.UDPFiltering),
|
||||
udpNATMax: options.UDPNATMax,
|
||||
stack: options.Stack,
|
||||
platformInterface: platformInterface,
|
||||
platformOptions: common.PtrValueOrDefault(options.Platform),
|
||||
@@ -448,6 +454,9 @@ func (t *Inbound) Start(stage adapter.StartStage) error {
|
||||
TunOptions: t.tunOptions,
|
||||
UDPTimeout: t.udpTimeout,
|
||||
ICMPTimeout: C.ICMPTimeout,
|
||||
UDPMapping: t.udpMapping,
|
||||
UDPFiltering: t.udpFiltering,
|
||||
UDPNATMax: t.udpNATMax,
|
||||
Handler: t,
|
||||
Logger: t.logger,
|
||||
ForwarderBindInterface: C.IsDarwin,
|
||||
|
||||
Reference in New Issue
Block a user