chore: add persistent-keepalive for wireguard
This commit is contained in:
parent
1333f1fd47
commit
f87144f84b
1 changed files with 16 additions and 12 deletions
|
@ -53,6 +53,7 @@ type WireGuardOption struct {
|
||||||
Workers int `proxy:"workers,omitempty"`
|
Workers int `proxy:"workers,omitempty"`
|
||||||
MTU int `proxy:"mtu,omitempty"`
|
MTU int `proxy:"mtu,omitempty"`
|
||||||
UDP bool `proxy:"udp,omitempty"`
|
UDP bool `proxy:"udp,omitempty"`
|
||||||
|
PersistentKeepalive int `proxy:"persistent-keepalive,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type wgDialer struct {
|
type wgDialer struct {
|
||||||
|
@ -159,6 +160,9 @@ func NewWireGuard(option WireGuardOption) (*WireGuard, error) {
|
||||||
if has6 {
|
if has6 {
|
||||||
ipcConf += "\nallowed_ip=::/0"
|
ipcConf += "\nallowed_ip=::/0"
|
||||||
}
|
}
|
||||||
|
if option.PersistentKeepalive != 0 {
|
||||||
|
ipcConf += fmt.Sprintf("\npersistent_keepalive_interval=%d", option.PersistentKeepalive)
|
||||||
|
}
|
||||||
mtu := option.MTU
|
mtu := option.MTU
|
||||||
if mtu == 0 {
|
if mtu == 0 {
|
||||||
mtu = 1408
|
mtu = 1408
|
||||||
|
|
Loading…
Reference in a new issue