add static peer formatting for client config

This commit is contained in:
Fedor Lyanguzov
2024-12-27 23:53:58 +03:00
parent 965fa0cb4e
commit 35071d2b6f
3 changed files with 26 additions and 3 deletions
+2
View File
@@ -0,0 +1,2 @@
from .__main__ import *
+18
View File
@@ -1,3 +1,21 @@
from dataclasses import dataclass
@dataclass
class StaticPeer:
public_key: str
endpoint: str
port: str
def format_static_peer(static_peer, routes, keepalive=30):
return f'''[Peer]
PublicKey = {static_peer.public_key}
AllowedIPs = {routes}
Endpoint = {static_peer.endpoint}:{static_peer.port}
PersistentKeepAlive = {keepalive}'''
def main():
print("run")