udp hole punch

This commit is contained in:
afeiszli 2022-01-30 16:26:32 -05:00 committed by 0xdcarns
parent 3cc3cd9a0f
commit 023d9dd3ef

View file

@ -291,7 +291,7 @@ func WriteWgConfig(node *models.Node, privateKey string, peers []wgtypes.PeerCon
} }
wireguard := ini.Empty(options) wireguard := ini.Empty(options)
wireguard.Section(section_interface).Key("PrivateKey").SetValue(privateKey) wireguard.Section(section_interface).Key("PrivateKey").SetValue(privateKey)
if node.ListenPort > 0 { if node.ListenPort > 0 && node.UDPHolePunch != "yes" {
wireguard.Section(section_interface).Key("ListenPort").SetValue(strconv.Itoa(int(node.ListenPort))) wireguard.Section(section_interface).Key("ListenPort").SetValue(strconv.Itoa(int(node.ListenPort)))
} }
if node.Address != "" { if node.Address != "" {