import segno

HOME = """[Interface]
PrivateKey = dGmBa6PGFcfEifYPHpd3kFDxHu7XMdtc00rf5GZuSCM=
Address = 10.0.0.1/32
DNS = 10.0.0.53

[Peer]
PublicKey = hNYkaV3vw7gHRzv14U5JiaihZ9uLj+ZjpOO/uTSuKlE=
AllowedIPs = 0.0.0.0/0
Endpoint = 192.168.1.8:51820
"""

# du phong: ban "Outside" se doi endpoint sau khi co DDNS
OUTSIDE_TMPL = HOME.replace("192.168.1.8:51820", "{ddns}:51820")

import os, segno

OUT = os.path.dirname(os.path.abspath(__file__))

segno.make(HOME, error='l').save(os.path.join(OUT, "wg_gsm_home.png"), scale=10, border=2)

OUTSIDE = HOME.replace("192.168.1.8:51820", "gsm.minproducerdn.com:51820")
segno.make(OUTSIDE, error='l').save(os.path.join(OUT, "wg_gsm_outside.png"), scale=10, border=2)

open(os.path.join(OUT, "wg_outside_template.txt"), "w").write(OUTSIDE)
print("OK -> wg_gsm_home.png + wg_gsm_outside.png")
