Commit Graph

53 Commits

Author SHA1 Message Date
Jason A. Donenfeld d0cc2a8afd Combine double log invocations 2018-12-22 02:21:07 +01:00
Jason A. Donenfeld e1c3d9b57a Move name from interface to tunnel 2018-12-22 00:28:18 +01:00
Jason A. Donenfeld 775e174967 Nuke trailing spaces 2018-12-21 23:34:56 +01:00
Eric Kuck c62c56da13 providerConfiguration is now a WgQuickConfig 2018-12-21 16:32:08 -06:00
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
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
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
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 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
Jason A. Donenfeld b57824cde1 PacketTunnelProvider: modernize header 2018-11-06 19:04:53 +01:00
Jason A. Donenfeld 040f0a25ea wireguard-go-bridge: take fd instead of fnptr 2018-11-06 16:27:25 +01:00
Jason A. Donenfeld 8958a04ba4 PacketTunnelProvider: clamp v6 addresses to /120 2018-11-05 03:11:11 +01:00
Jason A. Donenfeld 6c737545aa Global: no periods at the end of error messages 2018-11-03 03:43:09 +01:00
Jason A. Donenfeld 2267079367 NetworkExtension: check isTunnelClosed before packet existence 2018-11-01 22:01:52 +01:00
Jason A. Donenfeld 42948b2816 Global: fix up strings 2018-11-01 19:01:43 +01:00
Roopesh Chander 79672fa920 NE: Show an alert when someone tries to start the VPN from iOS Settings 2018-11-01 22:08:01 +05:30
Jason A. Donenfeld 003286aee0 wireguard-go-bridge: simplify logging and remove tags 2018-10-31 03:22:22 +01:00
Jason A. Donenfeld 47c9924405 NetworkExtension: close context before turning off go
The go turnOff code waits for all readers to have completed. In order to
make readers complete, we must send the signal to unblock the request.
Thus, we must reorder these.
2018-10-31 03:03:00 +01:00
Roopesh Chander cc63b0e64f NE: Print error when unable to start the tunnel 2018-10-30 18:36:28 +05:30