mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-24 17:20:28 +08:00
Chore: add udp-timeout constraint
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
||||||
"github.com/xjasonlyu/tun2socks/v2/core"
|
"github.com/xjasonlyu/tun2socks/v2/core"
|
||||||
@@ -113,6 +114,9 @@ func general(k *Key) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if k.UDPTimeout > 0 {
|
if k.UDPTimeout > 0 {
|
||||||
|
if k.UDPTimeout < time.Second {
|
||||||
|
return errors.New("invalid udp timeout value")
|
||||||
|
}
|
||||||
tunnel.SetUDPTimeout(k.UDPTimeout)
|
tunnel.SetUDPTimeout(k.UDPTimeout)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user