Commit Graph

583 Commits

Author SHA1 Message Date
Roopesh Chander fe69fe57e4 TunnelsManager: Handle waiting on a stale tunnel
If we have a stale tunnel on which we don't get status updates we rely
on a timer to update the status (see commit 34a7e5b).  Previously, if
the user tries to activate another tunnel, that resulted in both tunnels
waiting indefinitely. This commit fixes that.
2018-12-19 12:48:10 +05:30
Roopesh Chander efc593f7da Remove buttons and text from LaunchScreen.storyboard
With state restoration, we're not guaranteed that the
list view will get shown immediately after the launch screen.
So, generalize the launch screen as much as possible.
2018-12-18 23:00:27 +05:30
Roopesh Chander 332e684ad0 s/Observervation/Observation/g; 2018-12-18 23:00:27 +05:30
Roopesh Chander bc253b1aa8 Tunnel detail: Update restorationIdentifier when tunnel name changes 2018-12-18 19:27:31 +05:30
Roopesh Chander b1bba11785 TunnelsManager: Add periods to end the system error messages
Because they can be part of a multi-sentence message when displayed
in the alert.
2018-12-18 15:47:20 +05:30
Roopesh Chander 92903e5b63 Error handling: Add info on the underlying system error to error alerts 2018-12-17 19:04:17 +05:30
Jason A. Donenfeld 321358271d Version bump
This is our first release to the real app store.
2018-12-17 14:08:17 +01:00
Eric Kuck d1825d6b6c Got TunnelsManager back under the max file length by splitting out NEVPNStatus+CustomStringConvertible 2018-12-16 23:51:25 -06:00
Eric Kuck 92781a6eb9 Potential fix for insertRowAtIndexPath crash 2018-12-16 21:11:33 -06:00
Jason A. Donenfeld 395486b950 Improve mock tunnels generation 2018-12-16 01:51:14 +01:00
Roopesh Chander 6d348ab0e6 Provide mock tunnels for the Simulator
To help in generation of screenshots for the App Store
2018-12-16 01:15:10 +05:30
Jason A. Donenfeld 6f335f898a Nuke duplicate file 2018-12-15 06:21:49 +01:00
Jason A. Donenfeld 8547dabce1 Version bump 2018-12-15 05:08:31 +01:00
Eric Kuck 0ea2e0d11b Fixed editable KeyValueCells being copyable
Fixed DNS servers not saving
2018-12-14 21:48:48 -06:00
Jason A. Donenfeld 424c6d1173 Fix confusing indentation 2018-12-15 04:42:46 +01:00
Eric Kuck 66fcdfd13c KeyValueCells now share code 2018-12-14 20:02:37 -06:00
Eric Kuck 4ae0c4bb17 Reorganized project structure 2018-12-14 17:27:11 -06:00
Eric Kuck b06a43e2a2 Most similar views now shared between ViewControllers 2018-12-14 17:15:22 -06:00
Jason A. Donenfeld 9a7571051f Prettier log time format 2018-12-15 00:08:54 +01:00
Jason A. Donenfeld 33d88529c6 Simplify logging tags
This was roop's initial idea, and it turns out to be the better one, now
that we can pass cstrings more easily.
2018-12-14 22:53:42 +01:00
Roopesh Chander 34a7e5b558 Fix tunnel remaining in 'Activating' state
It uses to remain in 'Activating' state when we don't get a status
update notification, for example, when turning on the tunnel repeatedly
without Internet connectivity.
2018-12-14 17:33:56 +05:30
Roopesh Chander ce112a3f44 Fix status switch weird state after an error occurs 2018-12-14 16:50:36 +05:30
Jason A. Donenfeld 19f16c3291 Deduplicate functions 2018-12-14 00:01:50 +01:00
Jason A. Donenfeld 628ba73aa3 Simplify filemanager extension 2018-12-13 23:25:18 +01:00
Jason A. Donenfeld b4348a33d2 Can't -> cannot 2018-12-13 23:17:05 +01:00
Roopesh Chander e6c1e46b1d NE: Communicate last error to app through a shared file 2018-12-14 02:24:53 +05:30
Roopesh Chander 206de837d1 TunnelsManager: startActivation() need not take a tunnelConfiguration 2018-12-14 00:40:18 +05:30
Jason A. Donenfeld b40bbd1cdc Localize swiftlint 2018-12-13 20:06:37 +01:00
Eric Kuck a8cbe0d683 Reorganized ViewControllers (split out UIViews and UITableViewCells into their own classes)
All swiftlint warnings except one fixed up
2018-12-13 12:58:50 -06:00
Jason A. Donenfeld a5aaec673a Avoid escaping heap allocation 2018-12-13 19:43:12 +01:00
Jason A. Donenfeld 45dd86beee Tidy up str to gostr conversion 2018-12-13 19:36:51 +01:00
Roopesh Chander 65e273c74b TunnelsManager: Remove mentions of 'internal error' 2018-12-13 23:53:17 +05:30
Roopesh Chander fb2b423d06 TunnelsManager: Ask to check Internet connectivity in error alert 2018-12-13 23:49:42 +05:30
Roopesh Chander 03680bf3c9 Remove unused code: InternetReachability 2018-12-13 23:45:21 +05:30
Roopesh Chander 57b95e1e01 TunnelsManager: Remove unused variable 2018-12-13 23:44:13 +05:30
Roopesh Chander 738b2dba52 TunnelsManager: Remove assert 2018-12-13 23:43:15 +05:30
Jason A. Donenfeld d7f91f2888 Simplify C strings 2018-12-13 19:08:38 +01:00
Roopesh Chander 20a23a86da TunnelsManager: Fix race between multiple startActivation() calls
After startActivate() is called on a waiting tunnel, user might turn
on a different tunnel before the waiting tunnel's status gets updated.
This fix prevents that from happening.
2018-12-13 23:34:00 +05:30
Roopesh Chander 872bda6d34 TunnelsManager: Reintroduce waiting for another tunnel to deactivate 2018-12-13 23:21:49 +05:30
Jason A. Donenfeld a9325289d2 Rewrite Logger
This reverts all of Roop's changes to the C code, and then rewrites the
logger logic to be cleaner.
2018-12-13 18:06:37 +01:00
Eric Kuck 825aa95956 More reliable logo sizing 2018-12-13 09:30:13 -06:00
Roopesh Chander b0df5a53da TunnelsManager: Report activation errors through the activationDelegate
Don't report activation errors through completion handlers
2018-12-13 18:56:07 +05:30
Roopesh Chander 8d0d8cc11f Logging: Write versions from both app and extension 2018-12-13 18:09:38 +05:30
Roopesh Chander 2415f20603 Logging: file_log doesn't need the message type 2018-12-13 18:06:57 +05:30
Roopesh Chander b704f7a0db Logging: Tag the entries in the merged log
So we know which entry is from the app and which is from the network
extension.
2018-12-13 18:00:32 +05:30
Roopesh Chander 6ee3bd1ad2 Logging: Use ringlogger for logging from the app 2018-12-13 17:37:20 +05:30
Roopesh Chander 8eb6fa67ef Logging: ringlogger.c: Trim trailing newlines 2018-12-13 17:37:14 +05:30
Roopesh Chander 3520ad13e7 Logging: Use ringlogger for logging from the extension 2018-12-13 17:37:14 +05:30
Roopesh Chander 0a482470bb Avoid using 'VPN' in code where possible 2018-12-13 12:20:10 +05:30
Roopesh Chander 3f2e332c27 mv WireGuard/WireGuard/VPN/ WireGuard/WireGuard/Tunnel/ 2018-12-13 12:14:21 +05:30
Jason A. Donenfeld 6a12af4066 Commit untested ringlogger code 2018-12-13 06:14:24 +01:00
Jason A. Donenfeld f8cbf0ae6d Remove useless whitespace 2018-12-13 05:26:04 +01:00
Jason A. Donenfeld 51213aa4bd Settings: better padding calculation 2018-12-13 05:22:13 +01:00
Eric Kuck a06b50bd1f Fixed hacky logo display for settings 2018-12-12 21:16:28 -06:00
Eric Kuck 42aeb8636c More formatting nits and cyclomatic complexity fixes 2018-12-12 21:09:52 -06:00
Eric Kuck 965f66e5e2 More linter warnings fixed, enabled more swiftlint rules, project cleanup 2018-12-12 15:33:14 -06:00
Eric Kuck ea29a0c7d1 Tons more swiftlint warnings fixed. Still a few remaining. 2018-12-12 12:28:27 -06:00
Eric Kuck fa558a4019 Added swiftlint and fixed all errors (and a bunch, but not all, warnings) 2018-12-12 11:40:57 -06:00
Roopesh Chander a57bb02482 Zip importing: importFromFile should take a completionHandler
Deletion of the being-imported file should be done in the
completionHandler.
2018-12-12 19:24:18 +05:30
Roopesh Chander 60faeea341 ErrorPresenter: Support onPresented for showErrorAlert(title:,message:) 2018-12-12 19:17:06 +05:30
Roopesh Chander 964dd8f723 Zip importing: Handle spaces in filenames correctly
Previously, if a filename of a .conf file inside the zip file
contained spaces, it was not imported.
2018-12-12 16:57:17 +05:30
Jason A. Donenfeld 440073ad9a Supply missing pieces of path change 2018-12-12 01:11:43 +01:00
Eric Kuck 14091de6b6 Fixed a potential race condition, better naming on PacketTunnelSettingsGenerator methods 2018-12-11 16:59:15 -06:00
Eric Kuck 7d387da741 Added an (unfinished) NWPathMonitor implementation for reconnecting on network changes 2018-12-11 16:12:04 -06:00
Roopesh Chander 4e70455800 State restoration: Don't create duplicate mainVC and tunnelsListVC
This creates a duplicate tunnels manager, leading to problems tracking
tunnel statuses.

To reproduce the bug that this commit fixes, you can do the following:
 1. Remove all tunnels
 2. Run in Xcode
 3. Import zip with ~10 tunnels
 4. Stop app in Xcode
 5. Run in Xcode
 6. Turn on 1st tunnel, after it's on, turn off
    Turn on 2nd tunnel, after it's on, turn off
    ...
    After 6-8 tunnels, the spinner doesn't show up, indicating that the
    status is not being tracked.
2018-12-11 17:52:54 +05:30
Roopesh Chander 4d6a21f14e TunnelsManager: Error out only on no-internet scenario
The other scenario happens even during reloading of a tunnel for activation.
2018-12-11 03:48:28 +05:30
Roopesh Chander 0c913d0dbc Remove the feature of waiting for another tunnel to deactivate 2018-12-11 03:47:23 +05:30
Roopesh Chander 39ac53d853 TunnelsManager: Deactivate only when the status becomes 'connected' 2018-12-11 02:42:21 +05:30
Roopesh Chander 56730ef048 Allow turning off the status switch of a waiting tunnel
It just means the waiting should be cancelled
2018-12-11 02:01:54 +05:30
Roopesh Chander 9906689122 TunnelsManager: Handle status change in TunnelsManager
Rather than in TunnelContainer.
2018-12-11 02:01:49 +05:30
Roopesh Chander 305264d064 Error handling: alertText() can be nil
Indicating that no alert is to be shown for that error.
2018-12-11 00:34:22 +05:30
Roopesh Chander d3ba76def3 TunnelsManager: Don't act on status change on tunnelProviders we don't have
That causes errors we don't want, and duplicate notifications.
2018-12-10 17:03:23 +05:30
Roopesh Chander 94b81fc577 TunnelsManager: Always call the completion handler before returning 2018-12-10 17:01:53 +05:30
Roopesh Chander 0472527617 TunnelsManager: Debugging helpers for tunnel status 2018-12-10 16:31:36 +05:30
Roopesh Chander 66bb9c94d4 TunnelsManager: Handle deactivation of a waiting tunnel 2018-12-10 16:28:41 +05:30
Roopesh Chander 42729a0fe7 Tunnels list: Fix AutoLayout error during deletion of a tunnel 2018-12-10 12:59:31 +05:30
Roopesh Chander c375d01199 Settings: Dynamic Type support 2018-12-10 01:45:34 +05:30
Roopesh Chander 9bdfabee6a Tunnel edit: Dynamic Type support 2018-12-10 01:45:34 +05:30
Roopesh Chander 3e27a9ddb0 Tunnel detail: Dynamic Type support 2018-12-10 01:45:34 +05:30
Roopesh Chander 527c1fcb37 Tunnels list: Dynamic Type support for the add button at the center 2018-12-09 18:13:37 +05:30
Roopesh Chander 3a7dbc6e37 Tunnels list: Dynamic Type support for the table view 2018-12-09 18:13:04 +05:30
Roopesh Chander af018988b4 Model: Declare keyLength constant and use that wherever applicable 2018-12-09 14:07:03 +05:30
Roopesh Chander 34a21098fc TunnelsManager: Observe status for all tunnels in one block 2018-12-08 18:43:24 +05:30
Roopesh Chander d7762f5055 TunnelsManager: Remove unused variables 2018-12-08 15:00:26 +05:30
Roopesh Chander ada1b659a8 Zip: Fix comment 2018-12-08 13:43:00 +05:30
Jason A. Donenfeld 01ec87ddee Version bump 2018-12-07 23:58:53 +01:00
Jason A. Donenfeld 9992322186 PacketTunnelProvider: Show log timestamp 2018-12-07 23:56:26 +01:00
Roopesh Chander 2e5d467bc7 Zip: Increase size of buffer used to read data from the archive 2018-12-08 02:17:55 +05:30
Roopesh Chander aa915fc54c Settings: Export log: Perform file operations in a background thread 2018-12-08 02:17:55 +05:30
Roopesh Chander 3af543a352 On-Demand: TunnelViewModel: Make activate-on-demand methods static 2018-12-08 02:17:23 +05:30
Roopesh Chander 4f98330bc0 On-Demand: Move detail text to TunnelViewModel 2018-12-08 02:17:15 +05:30
Jason A. Donenfeld 8227e77111 Plist: Handle crypto export 2018-12-07 18:52:14 +01:00
Jason A. Donenfeld f8f922eda9 Make strings consistent 2018-12-07 18:52:14 +01:00
Roopesh Chander 880ea9237e State restoration: Restore tunnel detail view 2018-12-07 19:05:08 +05:30
Roopesh Chander 059fc77c61 Main VC: No need to refresh statuses if the tunnelsManager isn't initialized yet 2018-12-07 15:52:47 +05:30
Roopesh Chander 800cb8559e Tunnels list: Deselect rows correctly
Do it like UITableViewController.clearsSelectionOnViewWillAppear would.
2018-12-07 12:36:23 +05:30
Roopesh Chander c3a3effd82 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
2018-12-07 12:36:19 +05:30
Roopesh Chander 24de510ea6 Error handling: Use ErrorPresenter.showErrorAlert() instead of per-VC showErrorAlert() methods 2018-12-07 12:36:19 +05:30
Roopesh Chander cc39342e6e Error handling: Use WireGuardAppError and WireGuardResult throughout the app 2018-12-07 12:36:19 +05:30
Roopesh Chander 8d58a79272 Error handling: Introduce a WireGuardResult type to handle errors in callbacks across the app 2018-12-07 12:36:19 +05:30