aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar steering72532026-05-02 20:54:06 +0000
committerGravatar steering72532026-05-02 20:54:06 +0000
commit5cb1023294ec046d5db689c3b3111896ce695e1e (patch)
tree238347cc66700ec034a2ca7fed319296a79533de
parentadd user to crond (diff)
allo wg config for dynamic peers
-rwxr-xr-xautopeer_shell.py5
-rw-r--r--lib_autopeer.py8
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}
<wg pubkey> is your WireGuard public key
<wg address> is your WireGuard IP or hostname
<wg port> is your WireGuard port
- <ipv6 link local> is your WireGuard IPv6LL'''
+ <ipv6 link local> 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 = '<REPLACE ME>'
- 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