Update AmneziaWireguardConfiguration.py

This commit is contained in:
Donald Zou
2025-09-13 14:49:29 +08:00
parent 91a3b52a4a
commit acc1233b11

View File

@@ -52,6 +52,7 @@ class AmneziaWireguardConfiguration(WireguardConfiguration):
"ConnectedPeers": len(list(filter(lambda x: x.status == "running", self.Peers))), "ConnectedPeers": len(list(filter(lambda x: x.status == "running", self.Peers))),
"TotalPeers": len(self.Peers), "TotalPeers": len(self.Peers),
"Protocol": self.Protocol, "Protocol": self.Protocol,
"Table": self.Table,
"Jc": self.Jc, "Jc": self.Jc,
"Jmin": self.Jmin, "Jmin": self.Jmin,
"Jmax": self.Jmax, "Jmax": self.Jmax,
@@ -227,20 +228,10 @@ class AmneziaWireguardConfiguration(WireguardConfiguration):
"remote_endpoint": self.DashboardConfig.GetConfig("Peers", "remote_endpoint")[1], "remote_endpoint": self.DashboardConfig.GetConfig("Peers", "remote_endpoint")[1],
"preshared_key": i["PresharedKey"] if "PresharedKey" in i.keys() else "" "preshared_key": i["PresharedKey"] if "PresharedKey" in i.keys() else ""
} }
# sqlUpdate(
# """
# INSERT INTO '%s'
# VALUES (:id, :private_key, :DNS, :advanced_security, :endpoint_allowed_ip, :name, :total_receive, :total_sent,
# :total_data, :endpoint, :status, :latest_handshake, :allowed_ip, :cumu_receive, :cumu_sent,
# :cumu_data, :mtu, :keepalive, :remote_endpoint, :preshared_key);
# """ % self.Name
# , newPeer)
conn.execute( conn.execute(
self.peersTable.insert().values(tempPeer) self.peersTable.insert().values(tempPeer)
) )
else: else:
# sqlUpdate("UPDATE '%s' SET allowed_ip = ? WHERE id = ?" % self.Name,
# (i.get("AllowedIPs", "N/A"), i['PublicKey'],))
conn.execute( conn.execute(
self.peersTable.update().values({ self.peersTable.update().values({
"allowed_ip": i.get("AllowedIPs", "N/A") "allowed_ip": i.get("AllowedIPs", "N/A")