master
大蒟蒻 4 years ago
parent fa767c765e
commit db0fef1cde

@ -1,4 +1,4 @@
url: "http://1.117.146.57:43662"
url: "https://1.117.146.57:43662"
local_wg: "wg0"
remote_wg: "wg0"
peers:

@ -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)

Loading…
Cancel
Save