Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions components/microlink/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ menu "MicroLink V2 Configuration"
communicate with). For large tailnets, set this to the actual
peer count needed, not the total tailnet size.

config ML_DERP_REGION
int "Preferred DERP region ID"
default 9
help
Tailscale DERP region ID to advertise as this node's home region
(sent as Hostinfo.NetInfo.PreferredDERP) and to prefer for STUN
probing/relay fallback before any live latency measurement has
happened. Defaults to 9 (Dallas, Texas) - fine for North America,
but every deployment relying on DERP-relayed traffic (e.g. a peer
behind CGNAT with no direct path) from elsewhere in the world pays
needless latency relaying through Dallas instead of a nearby
region. Real Tailscale clients pick this by STUN-probing several
regions at startup and using whichever has the lowest measured
latency; this project doesn't do that yet, so pick the closest
region to this device's usual network by hand instead. Region IDs
are visible in this device's own boot log (`ml_coord: DERP region
N (code): ...`, printed once the initial MapResponse is parsed) -
e.g. 4 = Frankfurt, 14 = Amsterdam, 18 = Paris.

config ML_PRIORITY_PEER_IP
string "Priority peer VPN IP"
default ""
Expand Down
10 changes: 8 additions & 2 deletions components/microlink/include/microlink_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ extern "C" {
#define ML_MAX_PACKET_SIZE 1500
#define ML_DERP_MAX_FRAME (ML_MAX_PACKET_SIZE + 64)

/* DERP */
#define ML_DERP_REGION 9 /* Dallas (dfw) */
/* DERP - preferred region is Kconfig-driven (default 9/Dallas) rather than
* hardcoded, so a deployment relying on DERP-relayed traffic (e.g. a peer
* behind CGNAT with no direct path) elsewhere in the world doesn't pay
* needless latency relaying through Dallas - see ML_DERP_REGION's Kconfig
* help text. ML_DERP_HOST/_PORT stay hardcoded: they're only a bootstrap
* fallback used before the first DERPMap arrives (ml_derp.c's ml_derp_connect
* uses the real per-region host from the parsed DERPMap once available). */
#define ML_DERP_REGION CONFIG_ML_DERP_REGION
#define ML_DERP_HOST "derp9e.tailscale.com"
#define ML_DERP_PORT 443

Expand Down