mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2024-12-30 02:37:01 +00:00
Feature: add udp-rlybuf option
* Default UDP relay buffer size: 16KiB
This commit is contained in:
@@ -129,6 +129,14 @@ func general(k *Key) error {
|
||||
}
|
||||
tunnel.SetUDPTimeout(k.UDPTimeout)
|
||||
}
|
||||
|
||||
if k.UDPRelayBufferSize != "" {
|
||||
size, err := units.RAMInBytes(k.UDPRelayBufferSize)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tunnel.SetUDPRelayBufferSize(int(size))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -13,7 +13,8 @@ type Key struct {
|
||||
TCPModerateReceiveBuffer bool `yaml:"tcp-moderate-receive-buffer"`
|
||||
TCPSendBufferSize string `yaml:"tcp-send-buffer-size"`
|
||||
TCPReceiveBufferSize string `yaml:"tcp-receive-buffer-size"`
|
||||
UDPRelayBufferSize string `yaml:"udp-relay-buffer-size"`
|
||||
UDPTimeout time.Duration `yaml:"udp-timeout"`
|
||||
TUNPreUp string `yaml:"tun-pre-up"`
|
||||
TUNPostUp string `yaml:"tun-post-up"`
|
||||
UDPTimeout time.Duration `yaml:"udp-timeout"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user