mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-04 10:17:30 +03:00
Improve timeouts
This commit is contained in:
@@ -72,10 +72,15 @@ func (i *Inbound) Start(stage adapter.StartStage) error {
|
||||
if stage != adapter.StartStateStart {
|
||||
return nil
|
||||
}
|
||||
return i.listener.Start()
|
||||
err := i.listener.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return i.udpNat.Start()
|
||||
}
|
||||
|
||||
func (i *Inbound) Close() error {
|
||||
i.udpNat.Close()
|
||||
return i.listener.Close()
|
||||
}
|
||||
|
||||
|
||||
@@ -85,10 +85,15 @@ func (t *TProxy) Start(stage adapter.StartStage) error {
|
||||
return E.Cause(err, "configure tproxy UDP listener")
|
||||
}
|
||||
}
|
||||
err = t.udpNat.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *TProxy) Close() error {
|
||||
t.udpNat.Close()
|
||||
return t.listener.Close()
|
||||
}
|
||||
|
||||
|
||||
@@ -56,12 +56,18 @@ func NewEndpoint(ctx context.Context, router adapter.Router, logger log.ContextL
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var udpTimeout time.Duration
|
||||
if options.UDPTimeout != 0 {
|
||||
udpTimeout = time.Duration(options.UDPTimeout)
|
||||
} else {
|
||||
udpTimeout = C.UDPTimeout
|
||||
}
|
||||
wgEndpoint, err := wireguard.NewEndpoint(wireguard.EndpointOptions{
|
||||
Context: ctx,
|
||||
Logger: logger,
|
||||
System: options.System,
|
||||
Handler: ep,
|
||||
UDPTimeout: time.Duration(options.UDPTimeout),
|
||||
UDPTimeout: udpTimeout,
|
||||
Dialer: outboundDialer,
|
||||
CreateDialer: func(interfaceName string) N.Dialer {
|
||||
return common.Must1(dialer.NewDefault(service.FromContext[adapter.NetworkManager](ctx), option.DialerOptions{
|
||||
|
||||
Reference in New Issue
Block a user