Skip to content

gelocation discovery via tunnel-telemetry library

Pea Nut requested to merge stun-geolocation into main

Issue: #12 (closed)
Discussion in menshen: menshen#39

This is a draft MR. It requires a new menshen endpoint (blocker).

Changes

  • Removed the previous DoGeolocationLookup implementation (asked public ubuntu API)
  • Now uses tunnel-telemetry library to get ip address
    • tunnel-telemetry implementation: try all public STUN servers, use public https APIs as fallback
  • You can try it with: go test -count=1 -v ./... -run TestGeolocatation

TODOs

  • Now we have our public ip address, but we need our country code
    • add api endpoint in menshen: send ip (maybe truncate, just the /24 net) - return asn/country code
  • The tunnel-telemetry library has a function that resolves ip->asn/country code

General issues

  • Getting our IP/CountryCode (using STUN) is part of our bootstrapping process: What if (only) UDP is blocked? There are ~15 STUN servers, each with a timeout of 10 seconds. This takes a long time to give user feedback

Issues with tunnel-telemetry library

  • Needs option to add custom STUN server (+ use the defaults only as fallback)
  • Maybe: do not use non-STUN APIs as fallback to get IP?
  • The library uses log/fmt for logging, bitmask-core uses zerolog - is there a way to overwrite logging?
    • also: don't log ip addresses?
  • Nice to have: use it with bitmask-core's http client. Then we can use DoH

@atanarjuat How do we proceed with the changes of the library? Do you take care or should I create a MR? I'm a big fan of having it on Github cc @sgk @cyberta

Edited by Pea Nut

Merge request reports

Loading