mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-06 16:00:28 +01:00
IPv6 configuration IP should be working now
This commit is contained in:
parent
337c9bc01e
commit
5af2fff9ca
@ -66,6 +66,9 @@ class addConfiguration:
|
||||
for i in configs:
|
||||
if i['port'] == port:
|
||||
return {"status": False, "reason": f"{port} used by {i['conf']}."}
|
||||
checkSystem = subprocess.run(f'ss -tulpn | grep :{port} > /dev/null', shell=True)
|
||||
if checkSystem.returncode != 1:
|
||||
return {"status": False, "reason": f"Port {port} used by other process in your system."}
|
||||
return good
|
||||
|
||||
def NameCheck(self, data, configs):
|
||||
|
@ -607,19 +607,32 @@ def f_available_ips(config_name):
|
||||
"""
|
||||
config_interface = read_conf_file_interface(config_name)
|
||||
if "Address" in config_interface:
|
||||
available = []
|
||||
existed = []
|
||||
conf_address = config_interface['Address']
|
||||
address = conf_address.split(',')
|
||||
for i in address:
|
||||
add, sub = i.split("/")
|
||||
existed.append(ipaddress.ip_address(add))
|
||||
existed.append(ipaddress.ip_address(add.replace(" ", "")))
|
||||
peers = g.cur.execute("SELECT allowed_ip FROM " + config_name).fetchall()
|
||||
for i in peers:
|
||||
add = i[0].split(",")
|
||||
for k in add:
|
||||
a, s = k.split("/")
|
||||
existed.append(ipaddress.ip_address(a.strip()))
|
||||
available = list(ipaddress.ip_network(address[0], False).hosts())
|
||||
count = 0
|
||||
for i in address:
|
||||
tmpIP = ipaddress.ip_network(i.replace(" ", ""), False)
|
||||
if tmpIP.version == 6:
|
||||
for i in tmpIP.hosts():
|
||||
if i not in existed:
|
||||
available.append(i)
|
||||
count += 1
|
||||
if count > 100:
|
||||
break
|
||||
else:
|
||||
available = available + list(tmpIP.hosts())
|
||||
|
||||
for i in existed:
|
||||
try:
|
||||
available.remove(i)
|
||||
|
@ -9,7 +9,7 @@
|
||||
{% include "navbar.html" %}
|
||||
<div class="container-fluid">
|
||||
{% include "sidebar.html" %}
|
||||
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-md-4 mb-4">
|
||||
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-md-4 mb-4" style="margin-bottom: 10rem !important;">
|
||||
<div style="display: flex; flex-direction: row; align-items: center;">
|
||||
<h1 class="pb-4 mt-4">Home</h1>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user