Pull request merged

Implement an FFI to fetch API IP addresses using mullvad-api

We should test out if using the mullvad-api crate is feasible. An FFI that allows for calling out to https://api.mullvad.net/app/documentation/#/paths/~1v1~1api-addrs/get

We should then see if this works when:

  • Connected over 4g
  • Connected over WiFi
  • Connected to a VPN when IAN is set up
  • Blocked state when IAN is set up
  • Proxies?

Code can be throwaway for now, but if we can make it production ready, we should.

The Swift interface should look similar to the one below:

protocol AddressFetching {
  func fetchApiAddresses() async throws -> [MullvadEndpoint]
}

Said interface would probably have to be implemented by passing a continuation to Rust for when the result is fetched.

/// Swift side for the continuation
struct FFIContinuation {
  let callback: UnsafeMutable<...>
}

@convention(c) func fetch_api_addresses_result(continuation: UnsafePointer<FFIContinuation>)

This task should be owned by an iOS team member, but they should feel free to reach out to any of the Rust developers for help and to pair-program on this task.

As part of this, we should also implement unit tests at least for the Rust parts.

To test that it works, lower updateInterval in AddressCacheTracker to a few seconds to trigger the update of address list. The log should get entries saying Address list: success([45.83.223.196:443]).

see less
File matrix
55 files55 files
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
ios/ios/
MullvadMockData/MullvadREST/MullvadMockData/MullvadREST/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
MullvadREST/ApiHandlers/MullvadREST/ApiHandlers/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
MullvadRESTTests/MullvadRESTTests/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
MullvadRustRuntime/MullvadRustRuntime/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
include/include/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
MullvadVPN/MullvadVPN/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
AddressCacheTracker/AddressCacheTracker/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
MullvadVPN.xcodeproj/MullvadVPN.xcodeproj/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
PacketTunnel/PacketTunnelProvider/PacketTunnel/PacketTunnelProvider/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
mullvad-api/src/mullvad-api/src/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
mullvad-ios/mullvad-ios/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
src/src/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
api_client/api_client/
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
↺ Reverted   ungroup
dist-assets/dist-assets/
r4
r5
r6
r9
r10
r11
r12
ios/ios/
r1
r2
r3
r4
r5
r6
r7
r9
r10
r11
r12
MullvadREST/MullvadREST/
RetryStrategy/RetryStrategy/
r14
r15
r16
Transport/Transport/
r14
r15
r16
r14
r15
r16
MullvadTypes/MullvadTypes/
r1
r2
r3
r4
MullvadVPN/MullvadVPN/
Containers/Root/Containers/Root/
r10
r11
SimulatorTunnelProvider/SimulatorTunnelProvider/
r14
r15
r16
TransportMonitor/TransportMonitor/
r14
r15
r16
r14
r15
r16
TunnelManager/TunnelManager/
r14
r15
r16
View controllers/View controllers/
CreationAccount/CreationAccount/
Completed/Completed/
r10
r11
Welcome/Welcome/
r10
r11
DeviceList/DeviceList/
r10
r11
Login/Login/
r10
r11
OutOfTime/OutOfTime/
r10
r11
RedeemVoucher/RedeemVoucher/
r10
r11
r10
r11
Tunnel/Tunnel/
r10
r11
MullvadVPN.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/MullvadVPN.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/
r1
r2
PacketTunnelCore/PacketTunnelCore/
IPC/IPC/
r14
r15
r16
r14
r15
r16
URLRequestProxy/URLRequestProxy/
r14
r15
r16
r14
r15
r16
r14
r15
r16
~3 +86
+2
+3
+7
~3 +4
+37
+33
adjust what's shown in the file matrix here.
Participants
waiting on
participant
status
role
contributor
last active
drafts
discussions
Diffs
  Reviewing the latest revision (r16) against its ⊥ base revision.

Show diffs to review (file selection:

)

Show other diffs: All changes

Preferences
Top level discussions
Review discussion
1 month ago
New comments
SteffenErnSteffen Ernst

:lgtm:

1 month ago
SteffenErnSteffen Ernst

:lgtm:

1 month ago
buggmagnet

Looks good, but this breaks the UITests build unfortunately.
It looks like it should just be a matter of linking to the correct library in that target, but I haven't looked further

1 month ago
buggmagnet

:lgtm:

1 month ago
SteffenErnSteffen Ernst

:lgtm:

1 month ago
SteffenErnSteffen Ernst

:lgtm:

1 month ago
github-actions[bot]

🚨 End to end tests failed. Please check the failed workflow run.

r1
r2
r3
r4
r5
r6
r7
r8
r9
r10
r11
r12
r13
r14
r15
r16
+2
Revision mapping:
Compact 16 revisions Click and hold to arm, release to activate.
Commits that don't affect files in this pull request were added to revision r16 after it was snapshotted.
-- commits
~3 +86
+3
+7
~3 +4
+33
+37
+2
Use of Reviewable is subject to the terms of useprivacy policy.