|
|
|
|
@ -11,7 +11,11 @@ last_local_hash = ""
|
|
|
|
|
url = f"{cfg['url']}/hash/{cfg['remote_wg']}"
|
|
|
|
|
urlpat2 = f"{cfg['url']}/peers/{cfg['remote_wg']}"
|
|
|
|
|
while True:
|
|
|
|
|
new_hash = requests.get(url).text
|
|
|
|
|
new_hash = requests.get(
|
|
|
|
|
url,
|
|
|
|
|
cert=("client1.crt", "client1.key"),
|
|
|
|
|
verify="ca.crt",
|
|
|
|
|
).text
|
|
|
|
|
new_local_hash = hashlib.sha256(wg_showconf(
|
|
|
|
|
cfg["local_wg"]).encode()).hexdigest()
|
|
|
|
|
if last_hash != new_hash or last_local_hash != new_local_hash:
|
|
|
|
|
@ -24,10 +28,12 @@ while True:
|
|
|
|
|
res = requests.get(
|
|
|
|
|
url2,
|
|
|
|
|
cert=("client1.crt", "client1.key"),
|
|
|
|
|
verify=False,
|
|
|
|
|
verify="ca.crt",
|
|
|
|
|
).json()
|
|
|
|
|
p["Endpoint"] = res["Endpoint"]
|
|
|
|
|
wg_syncconf(cfg["local_wg"], str(local_cfg))
|
|
|
|
|
new_local_hash = hashlib.sha256(wg_showconf(
|
|
|
|
|
cfg["local_wg"]).encode()).hexdigest()
|
|
|
|
|
last_hash = new_hash
|
|
|
|
|
last_local_hash = new_local_hash
|
|
|
|
|
sleep(5)
|
|
|
|
|
|