Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resurface the list of allowedIPs to make it configurable #5804

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions ios/PacketTunnel/WireGuardAdapter/WgAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ private extension TunnelAdapterConfiguration {
if let peer {
var peerConfig = PeerConfiguration(publicKey: peer.publicKey)
peerConfig.endpoint = peer.endpoint.wgEndpoint
peerConfig.allowedIPs = [
IPAddressRange(from: "0.0.0.0/0")!,
IPAddressRange(from: "::/0")!,
]
peerConfig.allowedIPs = allowedIPs
peers.append(peerConfig)
}

Expand Down
4 changes: 3 additions & 1 deletion ios/PacketTunnelCore/Actor/ConfigurationBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ struct ConfigurationBuilder {
var interfaceAddresses: [IPAddressRange]
var dns: SelectedDNSServers?
var endpoint: MullvadEndpoint?
var allowedIPs: [IPAddressRange]

func makeConfiguration() throws -> TunnelAdapterConfiguration {
return TunnelAdapterConfiguration(
privateKey: privateKey,
interfaceAddresses: interfaceAddresses,
dns: dnsServers,
peer: try peer
peer: try peer,
allowedIPs: allowedIPs
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ extension PacketTunnelActor {
do {
let configurationBuilder = ConfigurationBuilder(
privateKey: PrivateKey(),
interfaceAddresses: []
interfaceAddresses: [],
allowedIPs: []
)
var config = try configurationBuilder.makeConfiguration()
config.dns = [IPv4Address.loopback]
Expand Down
6 changes: 5 additions & 1 deletion ios/PacketTunnelCore/Actor/PacketTunnelActor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ extension PacketTunnelActor {
privateKey: activeKey,
interfaceAddresses: settings.interfaceAddresses,
dns: settings.dnsServers,
endpoint: connectionState.connectedEndpoint
endpoint: connectionState.connectedEndpoint,
allowedIPs: [
IPAddressRange(from: "0.0.0.0/0")!,
IPAddressRange(from: "::/0")!,
]
)

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public struct TunnelAdapterConfiguration {
public var interfaceAddresses: [IPAddressRange]
public var dns: [IPAddress]
public var peer: TunnelPeer?
public var allowedIPs: [IPAddressRange]
}

/// Struct describing a single peer.
Expand Down
Loading