Compare commits
1 Commits
main
...
init-route
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2a03b9b6c9 |
@ -181,6 +181,7 @@ class WireGuard:
|
||||
|
||||
# Ensure a wg config exists on startup
|
||||
self.update(force=True)
|
||||
self.init_routes()
|
||||
|
||||
|
||||
def log(self, context_id: str, message) -> None:
|
||||
@ -228,6 +229,14 @@ class WireGuard:
|
||||
def meta_filepath(self, config_id: str) -> Path:
|
||||
return self.filepath(f'{config_id}{metasuffix}')
|
||||
|
||||
def init_routes(self) -> None:
|
||||
config = ConfigParser(interpolation=None)
|
||||
for conffile in self.configs_base.glob('*/*'+serversuffix):
|
||||
config.read(conffile)
|
||||
client_ip_str = config['peer']['allowedips']
|
||||
client_ip = ipaddress(client_ip_str.split('/')[0])
|
||||
create_route(client_ip)
|
||||
|
||||
def generate_server_config(self):
|
||||
config = ConfigParser(interpolation=None)
|
||||
config['Interface'] = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user