Browse Source

* Potential fix for stats when preshared key is set.

pull/5/head
Per-Arne 5 years ago
parent
commit
e3737e26c4
  1. 5
      wg_dashboard_backend/script/wireguard.py

5
wg_dashboard_backend/script/wireguard.py

@ -161,8 +161,8 @@ def get_stats(server: schemas.WGServer):
tx=None tx=None
)) ))
elif len(lines) == 5: elif len(lines) == 5:
public_key = lines[0]
public_key, client_endpoint, allowed_ips, handshake, rx_tx = lines client_endpoint, allowed_ips, handshake, rx_tx = lines[-4:] # [1] is sometimes psk
rx = re.match(r"^(.*) received", rx_tx).group(1) rx = re.match(r"^(.*) received", rx_tx).group(1)
tx = re.match(r"^.*, (.*)sent", rx_tx).group(1) tx = re.match(r"^.*, (.*)sent", rx_tx).group(1)
@ -174,6 +174,7 @@ def get_stats(server: schemas.WGServer):
rx=rx, rx=rx,
tx=tx tx=tx
)) ))
else: else:
ValueError("We have not handled peers with line number of %s" % str(len(lines))) ValueError("We have not handled peers with line number of %s" % str(len(lines)))

Loading…
Cancel
Save