Commit Graph

68 Commits

Author SHA1 Message Date
Jason A. Donenfeld 137d453c0d Do not require NetworkExtension to know its own name 2018-12-21 22:05:47 +01:00
Jason A. Donenfeld df698658d2 Get rid of superflous isActivateOnDemandEnabled key 2018-12-21 18:50:32 +01:00
Eric Kuck f39893685f Updated NETunnelProvider save format 2018-12-21 16:42:16 +01:00
Jason A. Donenfeld cab80f8fc0 NE: simplify logic 2018-12-21 15:56:03 +01:00
Roopesh Chander b02754a7bd NE: Simplify DNS resolution 2018-12-21 19:24:22 +05:30
Roopesh Chander 939e96e5c1 NE: Update listen port only when first interface changes
When handling network path changes, change the listen port
only when the first interface has changed.
2018-12-21 17:32:44 +05:30
Roopesh Chander 115e057d96 NE: Change handling of bad domain names and Activate On Demand
The solution implemented in commit b8c331c causes the tunnel to
remain in 'Activating' state, without the ability to cancel that.

So, in this commit, instead of retrying DNS silently on
Activated-On-Demand tunnels, we fail the startTunnel() silently.

To summarize, if activate-on-demand is on:
  - If started from the WireGuard app, show error using lastErrorFile
    mechanism, suggesting a way to turn off Activate On Demand
  - If not started from WireGuard app, don't call displayMessage()
    (don't show error to user) and silently fail starting the tunnel
2018-12-21 15:52:47 +05:30
Eric Kuck 9c7f27f19f Enabled more swiftlint rules 2018-12-20 11:22:37 -06:00
Roopesh Chander d36b764e20 NE: Log whether tunnel was activated from the app or not 2018-12-19 18:35:53 +05:30
Roopesh Chander 8f46713b0d Remove non-helpful comments 2018-12-19 18:35:53 +05:30
Roopesh Chander b8c331c72d NE: Handle bad domain names and Activate On Demand
This combination causes iOS to keep trying to bring up the tunnel,
leading to a lot of displayMessage() alerts.

In this fix, if we get a DNS resolution error in an Activate On Demand
enabled tunnel, we silently retry 9 times (with a 4-second delay before
each retry) and then show the displayMessage() alert.
2018-12-19 15:38:00 +05:30
Roopesh Chander 82ca9f7c5a NE: No need for two startTunnel() methods 2018-12-19 13:10:42 +05:30
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 b06a43e2a2 Most similar views now shared between ViewControllers 2018-12-14 17:15:22 -06: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 e6c1e46b1d NE: Communicate last error to app through a shared file 2018-12-14 02:24:53 +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
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
Roopesh Chander 8d0d8cc11f Logging: Write versions from both app and extension 2018-12-13 18:09:38 +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
Jason A. Donenfeld f8cbf0ae6d Remove useless whitespace 2018-12-13 05:26:04 +01: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
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
Jason A. Donenfeld 9992322186 PacketTunnelProvider: Show log timestamp 2018-12-07 23:56:26 +01:00
Jason A. Donenfeld 8227e77111 Plist: Handle crypto export 2018-12-07 18:52:14 +01:00
Roopesh Chander 5764fa4930 NE: Logging: Log file should begin with version numbers and tunnel name 2018-12-07 12:36:19 +05:30
Roopesh Chander 07fbb7c4ad NE: Logging: Make it clear which calls to wg_log use String and which use StaticString 2018-12-04 15:58:53 +05:30
Roopesh Chander 67268a0ce5 NE: Write log to file 2018-11-30 00:36:33 +05:30
Roopesh Chander 64175071fa Info.plist: Add app group id for accessing from both the app and the network extension 2018-11-29 14:05:27 +05:30
Roopesh Chander 41aca352a7 Xcode: Add app groups capability 2018-11-29 12:01:45 +05:30
Roopesh Chander ff64ef79f1 NE: All DNS queries must first go through the VPN's DNS servers 2018-11-23 13:04:55 +05:30
Roopesh Chander 6d28240531 NE: Minor refactoring to enable calling startTunnel() with a tunnelConfiguration 2018-11-09 22:29:52 +05:30
Roopesh Chander c9c58f3755 NE: When there's an error starting the tunnel, show it to the user using displayMessage() 2018-11-09 17:07:42 +05:30
Roopesh Chander c0f9c01fb9 Move logic to extension: Bring up the tunnel from the stored providerConfiguration 2018-11-08 18:59:16 +05:30
Roopesh Chander df7197473e DNSResolver: Simplify 2018-11-08 17:52:11 +05:30
Roopesh Chander 40ce2604ea DNSResolver: Let's not cache DNS resolution results anymore 2018-11-08 17:52:11 +05:30
Roopesh Chander 7bde4a6300 DNSResolver: DNS resolution can now happen synchronously 2018-11-08 17:52:11 +05:30
Roopesh Chander 80e563406b Move logic to extension: Refactor PacketTunnelOptionsGenerator into a PacketTunnelSettingsGenerator 2018-11-08 15:44:13 +05:30
Roopesh Chander 13eebb2e64 Move logic to extension: Move DNSResolver to extension 2018-11-08 15:09:45 +05:30
Roopesh Chander de92f2dcd8 Move logic to extension: Move PacketTunnelOptionsGenerator to the extension 2018-11-08 14:16:30 +05:30
Jason A. Donenfeld b57824cde1 PacketTunnelProvider: modernize header 2018-11-06 19:04:53 +01:00