Small improve on next IP generation / WireGuard, AWG (#1054)
Small improve on next IP generation
This commit is contained in:
parent
253ae75795
commit
aa92ccd06d
1 changed files with 12 additions and 0 deletions
|
|
@ -95,6 +95,18 @@ WireguardConfigurator::ConnectionData WireguardConfigurator::prepareWireguardCon
|
||||||
stdOut.replace("/32", "");
|
stdOut.replace("/32", "");
|
||||||
QStringList ips = stdOut.split("\n", Qt::SkipEmptyParts);
|
QStringList ips = stdOut.split("\n", Qt::SkipEmptyParts);
|
||||||
|
|
||||||
|
// remove extra IPs from each line for case when user manually edited the wg0.conf
|
||||||
|
// and added there more IPs for route his itnernal networks, like:
|
||||||
|
// ...
|
||||||
|
// AllowedIPs = 10.8.1.6/32, 192.168.1.0/24, 192.168.2.0/24, ...
|
||||||
|
// ...
|
||||||
|
// without this code - next IP would be 1 if last item in 'ips' has format above
|
||||||
|
QStringList vpnIps;
|
||||||
|
for (const auto &ip : ips) {
|
||||||
|
vpnIps.append(ip.split(",", Qt::SkipEmptyParts).first().trimmed());
|
||||||
|
}
|
||||||
|
ips = vpnIps;
|
||||||
|
|
||||||
// Calc next IP address
|
// Calc next IP address
|
||||||
if (ips.isEmpty()) {
|
if (ips.isEmpty()) {
|
||||||
nextIpNumber = "2";
|
nextIpNumber = "2";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue