Skip to content

v5 implementation with a single Bitmask struct

Pea Nut requested to merge v5-integration-single-bitmask-struct into main

Add v5 implementation. I hope it's the final MR... This one uses a single Bitmask struct which has some improvements. The v3/v5 switch is now lower in the code hierarchy.

The big changes are:

  • v5 can be enforced with envs: API_VERSION=5 and API_URL=http://localhost:8443
  • Only one instance of Bitmask struct, independant if v3/v5 is used - so legacy package was renamed to bitmask
  • in pkt/bitmask/interface.go there are the functions defined which are implemented by bonafide/menshen
  • As some of the functions return Gateways, I created a new struct for gateways: TransitGateway (pkt/vpn/bonafide/backwards.go)
    • this can be removed if the v3 way is gone
    • FirewallStart in launcher_*.go used the TransitGateways (not strings as prepared before)
      • you can ignore the commit "Change function signature of launcher.StartFirewall", as it was changed later to the TransitGateway struct
  • Added the v5 implementation in pkg/vpn/menshen
    • v5 and snowflake does not work
    • v5 and obsv4 works
  • You can ignore commit (Add v5 implementation (bitmask-core) - it adds the Bitmask5 struct which gets removed later in the MR... sorry for the git confusion... I'm happy if this big thing is done...)
  • Added depenencies: bitmask-core, pro-bing (used to find out latency, should be moved into bitmask-core in the future, testify for tests)

Some smaller improvements

  • Add http timeout (geolocation lookup)
  • Removed the InstallHelpers function from the Bitmask interface
  • Fixed/Improved logging (snowflake + obfs4 part, replaced panic by log.Fatal)
  • Cleaned the code (name of files, functions, ...ListLocationFullness and ListLocationLabels were renamed)
  • Document structs and functions in menshen
  • Removed unused offersUDP in struct Bitmask
  • Removed unused field failed in struct Bitmask
  • Changed logic of checkforpugrade

Future work

  • I found this bug, maybe we should prioritise it for this release: #823 (closed)
  • get rid for the Bbitmask interface
  • in the menshen package, there is a function which calculates the latency => move this to bitmask-core (and make it more robust)
  • To verify: Bitmask.ReloadFirewall gets never executed #824 (closed)

Tests

  • There are tests for the v5 implementation. You need to set the menshn url via env API_URL=..

Please also test snowflake and obfs4. For me everything worked except for bitmask provider+obfs4+US location/gateway

Edited by Pea Nut

Merge request reports

Loading