Skip to content

Commit

Permalink
use get_attr
Browse files Browse the repository at this point in the history
  • Loading branch information
niyawe committed Aug 12, 2021
1 parent a9d5bb0 commit 0fc770b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wgkex/worker/netlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ def find_stale_wireguard_clients(wg_interface: str) -> List:
clients = []
infos = wg.info(wg_interface)
for info in infos:
clients.extend(info.WGDEVICE_A_PEERS.value)
clients.extend(info.get_attr('WGDEVICE_A_PEERS'))
ret = [
client.WGPEER_A_PUBLIC_KEY.get("value", "").decode("utf-8")
client.get_attr('WGPEER_A_PUBLIC_KEY').decode("utf-8")
for client in clients
if client.WGPEER_A_LAST_HANDSHAKE_TIME.get("tv_sec", int())
if client.get_attr('WGPEER_A_LAST_HANDSHAKE_TIME').get("tv_sec", int())
< three_hrs_in_secs
]
return ret

0 comments on commit 0fc770b

Please sign in to comment.