Commit Graph

632 Commits

Author SHA1 Message Date
Roopesh Chander e3801308cb Main VC: No need to refresh statuses if the tunnelsManager isn't initialized yet
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 15:52:47 +05:30
Roopesh Chander 05d0429c50 Tunnels list: Deselect rows correctly
Do it like UITableViewController.clearsSelectionOnViewWillAppear would.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:23 +05:30
Roopesh Chander fa9a4921a8 Settings: Exporting configs as zip should open document picker
Because:
- Exporting UI should be consistent with importing UI
- UIActivityVC takes a long time to open

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
Roopesh Chander c827a00307 Error handling: Use ErrorPresenter.showErrorAlert() instead of per-VC showErrorAlert() methods
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
Roopesh Chander dcfa9473e9 Error handling: Use WireGuardAppError and WireGuardResult throughout the app
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
Roopesh Chander 782dd2ea4e Error handling: Introduce a WireGuardResult type to handle errors in callbacks across the app
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
Roopesh Chander c9267ba634 Error handling: Introduce a WireGuardAppError protocol to manage errors
The alert strings shall be located next to where the errors are declared.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
Roopesh Chander 8d26a3c536 Error handling: Cleanup Tunnels Manager errors
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
Roopesh Chander 7631844fbe Error presenter: Always handle the passed error
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
Roopesh Chander 046b540e53 Tunnel detail: Cell status switch should be toggled only after the alert presentation completes
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
Roopesh Chander f6faffa4c1 Refactoring: Consolidate file deletion into a separate function
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
Roopesh Chander 290bd192a0 NE: Logging: Log file should begin with version numbers and tunnel name
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
Roopesh Chander bf86731879 NE: Logging: Make it clear which calls to wg_log use String and which use StaticString
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-04 15:58:53 +05:30
Roopesh Chander 4e386e85e4 Settings: Add timestamp to exported log
And remove the exported log afterwards.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-04 14:12:53 +05:30
Roopesh Chander 046d1413ec Refactor out VPN-handling stuff from tunnels list VC to the main VC
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-03 18:51:51 +05:30
Roopesh Chander e1b258353c VPN: Error out when tunnel activation fails because there's no internet
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-03 18:51:42 +05:30
Roopesh Chander cdd132d7d0 Settings: Export log file
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-02 13:26:53 +05:30
Roopesh Chander 679d63294d NE: Write log to file
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-30 00:36:33 +05:30
Roopesh Chander d01d46fde8 Info.plist: Add app group id for accessing from both the app and the network extension
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-29 14:05:27 +05:30
Roopesh Chander a3bc306b6e Xcode: Add app groups capability
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-29 12:01:45 +05:30
Roopesh Chander 3e1772ccd0 It's 'WiFi', not 'Wifi'
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-28 12:41:35 +05:30
Roopesh Chander b946cbc0f3 NE: All DNS queries must first go through the VPN's DNS servers
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-23 13:04:55 +05:30
Roopesh Chander 8590a8804a Tunnel view model: Invalidate the configuration object when updating allowedIPs using the 'Exclude private IPs' switch
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-19 15:22:27 +05:30
Roopesh Chander a117e3ae3e Config file parser: Be case-insensitive to attribute keys in the config file
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-19 12:37:54 +05:30
Roopesh Chander ef2012330f Config file parser: Fix typo
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-17 22:52:37 +05:30
Roopesh Chander 6bb25782c1 Exporting: Export to zip in a background thread
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-15 13:39:56 +05:30
Roopesh Chander 1dac181803 Exporting: Refactor out zip exporting into a separate class
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-15 13:39:56 +05:30
Roopesh Chander d556729705 Exporting: No need to check for duplicate names - we disallow it at creation time itself
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-15 13:39:56 +05:30
Roopesh Chander b1ae13652c Importing: Import from zip in a background thread
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-15 13:39:56 +05:30
Roopesh Chander 203d6b4596 Importing: Refactor out zip importing into a separate class
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-14 18:52:10 +05:30
Roopesh Chander 2676ee0169 Tunnels manager: After saving after activating on-demand, reload tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-14 13:02:53 +05:30
Roopesh Chander c60c29b93c Tunnels manager: Need to keep VPN-on-demand tunnels's status under observation
Because they can turn on automatically, even while the app is in the foreground.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-12 19:24:13 +05:30
Roopesh Chander bdb2411ebc Tunnel detail: Show VPN-on-demand information
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-12 19:24:13 +05:30
Roopesh Chander 923d039a78 Tunnels manager: Keep track of NETunnelProviderManager's isOnDemandEnabled property
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-12 19:24:13 +05:30
Roopesh Chander abb0312d38 Tunnel edit: Update for VPN-on-demand changes
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-12 19:24:13 +05:30
Roopesh Chander f1b8de7312 Tunnel view model: VPN-on-demand stuff shouldn't be part of the tunnel model
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-12 19:24:13 +05:30
Roopesh Chander cc122d7463 Model, Tunnels manager: Rewrite the model for VPN-on-demand
The VPN-on-demand settings should not be part of the tunnel
configuration. Rather, the onDemandRules stored in the
tunnel provider configuration serve as the one place
where the VPN-on-demand settings are stored.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-12 19:24:13 +05:30
Roopesh Chander 39a067cb96 TunnelsManager: Support for on-demand rules
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-11 01:31:38 +05:30
Roopesh Chander c5e8b05e8b Tunnel edit, Tunnel view model: UI for providing On-Demand activation options
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-11 01:18:36 +05:30
Roopesh Chander 4b7094d652 Model: Add activationType to tunnel configuration
We make sure existing tunnel serializations can be deserialized correctly.

We also bump up the tunnelConfigurationVersion, because the tunnel
configuration contents have changed.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-11 01:17:36 +05:30
Roopesh Chander 0f03ffc920 Model: ActivityType enum to represent VPN-on-demand options
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-10 19:17:24 +05:30
Roopesh Chander 1502bd42d3 Model: TunnelConfiguration: Add explicit conformance to Decodable
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-10 19:01:34 +05:30
Roopesh Chander 290f83d5ef Model: Ensure that a TunnelConfiguration always has a valid array of peers
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-10 17:02:30 +05:30
Roopesh Chander e8d68396ca VPN: When activating while another tunnel is active, deactivate the other tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-10 16:44:28 +05:30
Roopesh Chander 8e7bfb15ed TunnelsManager: startDeactivation() need not take a completion handler
Because the completion handler pattern doesn't fit in this case.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-10 16:44:28 +05:30
Roopesh Chander 95456ec956 VPN: There are no DNS errors to handle in the app now
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-10 16:44:28 +05:30
Roopesh Chander 7485474c4c NE: Minor refactoring to enable calling startTunnel() with a tunnelConfiguration
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-09 22:29:52 +05:30
Roopesh Chander 1d63509b92 VPN: Refresh tunnel statuses when app gets to the foreground
Because the tunnel could've be activated from iOS Settings now

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-09 19:29:34 +05:30
Roopesh Chander f3e32ab737 Remove unused code
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-09 19:20:33 +05:30
Roopesh Chander 59b9a6e5d2 TunnelsManager: Ability to refresh connection statuses
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-09 19:19:32 +05:30