From 5cb1023294ec046d5db689c3b3111896ce695e1e Mon Sep 17 00:00:00 2001 From: steering7253 Date: Sat, 2 May 2026 20:54:06 +0000 Subject: allo wg config for dynamic peers --- autopeer_shell.py | 5 ++++- lib_autopeer.py | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/autopeer_shell.py b/autopeer_shell.py index de126e4..9ec8702 100755 --- a/autopeer_shell.py +++ b/autopeer_shell.py @@ -114,7 +114,10 @@ My Tunnel IPv6LL: {me.ipll} is your WireGuard public key is your WireGuard IP or hostname is your WireGuard port - is your WireGuard IPv6LL''' + is your WireGuard IPv6LL + + Note: if you have a dynamic IP, specify the port as 0 (and some valid garbage for the IP). + The Endpoint (IP and port) will then be omitted from my side, so WireGuard will wait to receive packets from you first.''' if not re.match(NAME_REGEX, name): print(f'Error: name must match {NAME_REGEX}', file=sys.stderr) return diff --git a/lib_autopeer.py b/lib_autopeer.py index cf3b66e..4de4f37 100644 --- a/lib_autopeer.py +++ b/lib_autopeer.py @@ -53,7 +53,7 @@ def _wg_config(name, far_side, local_side): else: privkey = '' - return f''' + out = f''' [Interface] Address = {local_side.ipll}/128 Table = off @@ -64,6 +64,10 @@ PrivateKey = {privkey} [Peer] PublicKey = {far_side.pubkey} AllowedIPs = fd00::/8, 172.20.0.0/14, fe80::/64, 10.0.0.0/8, 172.31.0.0/16 -Endpoint = {far_side.endpoint}:{far_side.port} ''' + if str(far_side.port) != '0': + out += f''' +Endpoint = {far_side.endpoint}:{far_side.port} + ''' + return out -- cgit v1.3.1-10-gc9f91