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/backend/README.md | 10 ++++++++++ pkg/backend/status.go | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 pkg/backend/README.md (limited to 'pkg/backend') diff --git a/pkg/backend/README.md b/pkg/backend/README.md new file mode 100644 index 0000000..1adefe8 --- /dev/null +++ b/pkg/backend/README.md @@ -0,0 +1,10 @@ +# how to add new fields to backend api + +1. add to the struct in `status.go` +2. populate it in `toJson()` method. +3. modify the `bitmask` interface in `pkg/bitmask/bitmask.go` (note: this is + a relict from the past, we can probably get rid of since there'll be + a single implementation in the foreseeable future). +4. modify the `bitmask` struct in `pkg/vpn/main.go` +5. modify the bitmask instantiation in `pkg/vpn/main.go:Init` +6. implement functionality... diff --git a/pkg/backend/status.go b/pkg/backend/status.go index f21fddd..2ed5cfd 100644 --- a/pkg/backend/status.go +++ b/pkg/backend/status.go @@ -52,6 +52,7 @@ type connectionCtx struct { BestLocation string `json:"bestLocation"` Transport string `json:"transport"` UseUDP bool `json:"udp"` + OffersUDP bool `json:"offersUdp"` ManualLocation bool `json:"manualLocation"` IsReady bool `json:"isReady"` CanUpgrade bool `json:"canUpgrade"` @@ -73,6 +74,7 @@ func (c *connectionCtx) toJson() ([]byte, error) { c.BestLocation = c.bm.GetBestLocation(transport) c.Transport = transport c.UseUDP = c.cfg.UDP // TODO initialize bitmask too + c.OffersUDP = c.bm.OffersUDP() c.ManualLocation = c.bm.IsManualLocation() c.CanUpgrade = c.bm.CanUpgrade() c.Motd = c.bm.GetMotd() -- cgit v1.2.3