mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 14:02:15 +00:00
load balancer in fix mode
This commit is contained in:
@@ -55,7 +55,7 @@ def set_records_round_robin(
|
||||
proxied: bool,
|
||||
comment: str = None,
|
||||
cloudflare_api_token: str,
|
||||
):
|
||||
) -> bool:
|
||||
headers = {'Authorization': f'Bearer {cloudflare_api_token}'}
|
||||
|
||||
dns_records = get_dns_records_round_robin(zone_id, cloudflare_api_token=cloudflare_api_token)
|
||||
@@ -64,7 +64,7 @@ def set_records_round_robin(
|
||||
current_ips = {r['content'] for r in current_records}
|
||||
if current_ips == host_ip_set:
|
||||
print(f'No need to update records: {name} currently set: {sorted(current_ips)}')
|
||||
return
|
||||
return False
|
||||
|
||||
# changing records
|
||||
|
||||
@@ -92,6 +92,8 @@ def set_records_round_robin(
|
||||
data = res.json()
|
||||
assert data['success'] is True
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def delete_record(zone_id, *, id_: str, cloudflare_api_token: str):
|
||||
headers = {'Authorization': f'Bearer {cloudflare_api_token}'}
|
||||
|
||||
@@ -14,6 +14,7 @@ def pycurl_status(url, domain, host_ip):
|
||||
c.setopt(c.CAINFO, '/etc/ssl/certs/ca-certificates.crt')
|
||||
c.setopt(c.RESOLVE, [f'{domain}:443:{host_ip}'])
|
||||
c.setopt(c.NOBODY, True)
|
||||
c.setopt(c.TIMEOUT, 5)
|
||||
c.perform()
|
||||
status_code = c.getinfo(c.RESPONSE_CODE)
|
||||
c.close()
|
||||
@@ -33,6 +34,7 @@ def pycurl_get(url, domain, host_ip):
|
||||
c.setopt(c.CAINFO, '/etc/ssl/certs/ca-certificates.crt')
|
||||
c.setopt(c.RESOLVE, [f'{domain}:443:{host_ip}'])
|
||||
c.setopt(c.WRITEDATA, buffer)
|
||||
c.setopt(c.TIMEOUT, 5)
|
||||
c.perform()
|
||||
status_code = c.getinfo(c.RESPONSE_CODE)
|
||||
c.close()
|
||||
|
||||
Reference in New Issue
Block a user