mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-12-16 08:26:17 +00:00
Compare commits
1 Commits
v4.3.2-dev
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78be6bf63d |
@@ -18,18 +18,10 @@ def GetRemoteEndpoint() -> str:
|
||||
@return:
|
||||
"""
|
||||
import socket
|
||||
try:
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
||||
s.connect(("1.1.1.1", 80)) # Connecting to a public IP
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
|
||||
s.connect(("1.1.1.1", 80)) # Connecting to a public IP
|
||||
wgd_remote_endpoint = s.getsockname()[0]
|
||||
return str(wgd_remote_endpoint)
|
||||
except (socket.error, OSError):
|
||||
pass
|
||||
try:
|
||||
return socket.gethostbyname(socket.gethostname())
|
||||
except (socket.error, OSError):
|
||||
pass
|
||||
return "127.0.0.1"
|
||||
|
||||
|
||||
def StringToBoolean(value: str):
|
||||
|
||||
@@ -404,7 +404,6 @@ class WireguardConfiguration:
|
||||
try:
|
||||
if "[Peer]" not in content:
|
||||
current_app.logger.info(f"{self.Name} config has no [Peer] section")
|
||||
self.Peers = []
|
||||
return
|
||||
|
||||
peerStarts = content.index("[Peer]")
|
||||
@@ -666,8 +665,9 @@ class WireguardConfiguration:
|
||||
|
||||
if not self.__wgSave():
|
||||
return False, "Failed to save configuration through WireGuard"
|
||||
self.getRestrictedPeers()
|
||||
|
||||
self.getPeers()
|
||||
|
||||
if numOfRestrictedPeers == len(listOfPublicKeys):
|
||||
return True, f"Restricted {numOfRestrictedPeers} peer(s)"
|
||||
return False, f"Restricted {numOfRestrictedPeers} peer(s) successfully. Failed to restrict {numOfFailedToRestrictPeers} peer(s)"
|
||||
@@ -783,7 +783,9 @@ class WireguardConfiguration:
|
||||
)
|
||||
).mappings().fetchone()
|
||||
if cur_i is not None:
|
||||
# print(cur_i is None)
|
||||
total_sent = cur_i['total_sent']
|
||||
# print(cur_i is None)
|
||||
total_receive = cur_i['total_receive']
|
||||
cur_total_sent = float(data_usage[i][2]) / (1024 ** 3)
|
||||
cur_total_receive = float(data_usage[i][1]) / (1024 ** 3)
|
||||
@@ -1224,6 +1226,7 @@ class WireguardConfiguration:
|
||||
def __validateOverridePeerSettings(self, key: str, value: str | int) -> tuple[bool, None] | tuple[bool, str]:
|
||||
status = True
|
||||
msg = None
|
||||
print(value)
|
||||
if key == "DNS" and value:
|
||||
status, msg = ValidateDNSAddress(value)
|
||||
elif key == "EndpointAllowedIPs" and value:
|
||||
|
||||
@@ -3,7 +3,7 @@ ifcfg==0.24
|
||||
psutil==7.1.3
|
||||
pyotp==2.9.0
|
||||
Flask==3.1.2
|
||||
flask-cors==6.0.1
|
||||
flask-cors==6.0.2
|
||||
icmplib==3.0.4
|
||||
gunicorn==23.0.0
|
||||
requests==2.32.5
|
||||
|
||||
Reference in New Issue
Block a user