20 lines
518 B
Python
20 lines
518 B
Python
from pywireguard.factory import Interface, Peer
|
|
|
|
|
|
class WGManager:
|
|
interface: str
|
|
|
|
def __init__(self, interface: str):
|
|
self.interface = interface
|
|
|
|
def get_peers(self):
|
|
wginterface = Interface(self.interface)
|
|
return wginterface.peers
|
|
|
|
def add_peer(self, peer: Peer):
|
|
wginterface = Interface(self.interface)
|
|
wginterface.upsert_peer(peer)
|
|
|
|
def remove_peer(self, peer: Peer):
|
|
wginterface = Interface(self.interface)
|
|
wginterface.remove_peer(peer)
|