Add methods to remove WireGuard default gateways
This commit is contained in:
parent
e2aaffc06f
commit
0db3f52931
|
@ -177,6 +177,18 @@ extension WireGuard {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public mutating func removeDefaultGateways(fromPeer peerIndex: Int) {
|
||||||
|
peers[peerIndex].allowedIPs.removeAll {
|
||||||
|
$0 == Self.defaultGateway4 || $0 == Self.defaultGateway6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public mutating func removeAllDefaultGateways() {
|
||||||
|
peers.indices.forEach {
|
||||||
|
removeDefaultGateways(fromPeer: $0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public mutating func addAllowedIP(_ allowedIP: String, toPeer peerIndex: Int) {
|
public mutating func addAllowedIP(_ allowedIP: String, toPeer peerIndex: Int) {
|
||||||
guard let addr = IPAddressRange(from: allowedIP) else {
|
guard let addr = IPAddressRange(from: allowedIP) else {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue