Skip to content

Commit

Permalink
add switch bool
Browse files Browse the repository at this point in the history
  • Loading branch information
T0biii committed Apr 3, 2024
1 parent cfe5b8c commit 8aab326
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wgkex/broker/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,14 @@ def wg_api_v2_gateway_best() -> Tuple[Response | Dict, int]:
logger.error(f"Couldn't get worker endpoint data for {best_worker}/{domain}")
return {"error": {"message": "could not get gateway data"}}, 500

#Add Code to check if we should Switch (check if Gateways are Loadbalaced in a specefiy trashhold)
shouldSwitch = True
endpoint = {
"Address": w_data.get("ExternalAddress"),
"Port": str(w_data.get("Port")),
"AllowedIPs": [w_data.get("LinkAddress")],
"PublicKey": w_data.get("PublicKey"),
"Switch:" shouldSwitch
}

return {"Endpoint": endpoint}, 200
Expand Down

0 comments on commit 8aab326

Please sign in to comment.