Add methods to remove WireGuard default gateways
This commit is contained in:
parent
e2aaffc06f
commit
0db3f52931
|
@ -176,6 +176,18 @@ extension WireGuard {
|
|||
$0 == Self.defaultGateway6
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
guard let addr = IPAddressRange(from: allowedIP) else {
|
||||
|
|
Loading…
Reference in New Issue