From a81bf938fe2b9409d1fa0175cc5f20635bb16127 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Wed, 24 Nov 2021 20:40:18 +0100 Subject: [feat] enable udp only if really announced --- pkg/vpn/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'pkg/vpn/main.go') diff --git a/pkg/vpn/main.go b/pkg/vpn/main.go index 619a10f..176c86f 100644 --- a/pkg/vpn/main.go +++ b/pkg/vpn/main.go @@ -43,6 +43,7 @@ type Bitmask struct { certPemPath string openvpnArgs []string udp bool + offersUdp bool failed bool canUpgrade bool motd []motd.Message @@ -67,7 +68,7 @@ func Init() (*Bitmask, error) { bonafide.Gateway{}, bonafide.Gateway{}, statusCh, nil, bf, launch, "", nil, "", []string{}, - false, false, false, + false, false, false, false, []motd.Message{}, ""} // FIXME multiprovider: need to pass provider name early on // XXX we want to block on these, but they can timeout if we're blocked. @@ -150,6 +151,10 @@ func (b *Bitmask) UseUDP(udp bool) error { return nil } +func (b *Bitmask) OffersUDP() bool { + return b.bonafide.IsUDPAvailable() +} + func (b *Bitmask) GetMotd() string { bytes, err := json.Marshal(b.motd) if err != nil { -- cgit v1.2.3