flowchart TD
A["Start checkuplink.sh"] --> B{"mesh_vpn enabled?"}
B -- "0" --> Z["Exit"]
B -- "!= 0" --> L["Lockfile setzen /var/lock/checkuplink.lock"]
L --> C{"Lock erhalten?"}
C -- "nein" --> C1["Log: Lock file exists, Exit"]
C -- "ja" --> D{"mesh_vpn.enabled == 1?"}
D -- "nein" --> D1["Warn-Log: Invalid value, weiter"]
D -- "ja" --> E["Privatekey vorhanden?"]
D1 --> E
E -- "nein" --> E1["wg genkey → uci set wireguard.mesh_vpn.privatekey"]
E -- "ja" --> F["Iface aus site.conf holen"]
E1 --> F
F --> G{"Bereits verbunden? (is_connected)"}
G -- "ja" --> Z
G -- "nein" --> H["Log: Reconnecting..."]
H --> I["NTP-Server aus uci system.ntp.server holen"]
I --> J["NTP-Server mit resolve_host auflösen"]
J --> K{"NTP sync ok? (ntpd -q)"}
K -- "nein" --> K1["Log Fehler, Exit 3"]
K -- "ja" --> M["mesh-vpn & wg-Interface löschen"]
M --> N["PUBLICKEY = wg pubkey(privatekey)"]
N --> O["SEGMENT = gluon.core.domain"]
O --> P["HTTPS Probe via ::1 → PROTO http/https"]
P --> Q["WGKEX_BROKER_BASE_PATH aus site.conf"]
Q --> R{"Loadbalancing enabled?"}
R -- "ja" --> R1["use_api_v2: Broker anfragen, Peer-Daten aus Antwort"]
R -- "nein" --> R2["use_api_v1: Broker anfragen, Peer aus uci wählen"]
R1 --> S["PEER_* Variablen gesetzt"]
R2 --> S
S --> T["Log: Connecting to PEER_HOST(ENDPOINT)"]
T --> U["WireGuard-Interface anlegen (ip link add)"]
U --> V["wg set private-key, Interface up"]
V --> W["LINKLOCAL = interface_linklocal()"]
W --> X["IPv6 Linklocal auf IF setzen"]
X --> Y["wg peer setzen (PUBKEY, allowed-ips, endpoint)"]
Y --> AA["10s warten"]
AA --> AB["ip6tables INPUT-Regel für UDP 8472 auf IF setzen"]
AB --> AC["VXLAN-Interface mesh-vpn anlegen"]
AC --> AD["mesh-vpn up, batctl throughput_override"]
AD --> AE{"Erneut is_connected()?"}
AE -- "nein" --> AF["Log: Failed to connect..., Exit 4"]
AE -- "ja" --> AG["Log: Successfully connected"]
AG --> Z
Last active
January 19, 2026 13:24
-
-
Save T0biii/11dfcd9dacf288b937e0a1c85fb8a12d to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment