Jason A. Donenfeld
accf60b82f
Do not require NetworkExtension to know its own name
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-21 22:05:47 +01:00
Jason A. Donenfeld
ec031b1f19
Get rid of superflous isActivateOnDemandEnabled key
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-21 18:50:32 +01:00
Eric Kuck
8553723e04
Updated NETunnelProvider save format
...
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 16:42:16 +01:00
Jason A. Donenfeld
38445114e0
NE: simplify logic
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-21 15:56:03 +01:00
Roopesh Chander
a21c569e9f
NE: Simplify DNS resolution
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-21 19:24:22 +05:30
Roopesh Chander
f818cdd963
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.
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-21 17:32:44 +05:30
Roopesh Chander
28ce4d5164
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
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-21 15:52:47 +05:30
Eric Kuck
a89ad95901
Enabled more swiftlint rules
...
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-20 11:22:37 -06:00
Roopesh Chander
5c501ac9a6
NE: Log whether tunnel was activated from the app or not
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-19 18:35:53 +05:30
Roopesh Chander
35450bf407
Remove non-helpful comments
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-19 18:35:53 +05:30
Roopesh Chander
fa51e3f1d1
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.
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-19 15:38:00 +05:30
Roopesh Chander
04a8c2ff5a
NE: No need for two startTunnel() methods
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-19 13:10:42 +05:30
Eric Kuck
ed9b4c85ed
Got TunnelsManager back under the max file length by splitting out NEVPNStatus+CustomStringConvertible
...
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-16 23:51:25 -06:00
Eric Kuck
7a24f18eb7
Most similar views now shared between ViewControllers
...
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-14 17:15:22 -06:00
Jason A. Donenfeld
e0bc5e12b3
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.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-14 22:53:42 +01:00
Roopesh Chander
48552d2663
NE: Communicate last error to app through a shared file
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-14 02:24:53 +05:30
Jason A. Donenfeld
77a26e4cd2
Localize swiftlint
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-13 20:06:37 +01:00
Eric Kuck
05d750539b
Reorganized ViewControllers (split out UIViews and UITableViewCells into their own classes)
...
All swiftlint warnings except one fixed up
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-13 12:58:50 -06:00
Jason A. Donenfeld
7323a00612
Avoid escaping heap allocation
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-13 19:43:12 +01:00
Jason A. Donenfeld
a6912ca7a2
Tidy up str to gostr conversion
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-13 19:36:51 +01:00
Jason A. Donenfeld
642b627d27
Rewrite Logger
...
This reverts all of Roop's changes to the C code, and then rewrites the
logger logic to be cleaner.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-13 18:06:37 +01:00
Roopesh Chander
efd4b28a0d
Logging: Write versions from both app and extension
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-13 18:09:38 +05:30
Roopesh Chander
ae7fb7323f
Logging: Use ringlogger for logging from the extension
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-13 17:37:14 +05:30
Roopesh Chander
5ae9eec555
Avoid using 'VPN' in code where possible
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-13 12:20:10 +05:30
Jason A. Donenfeld
5971c197bd
Remove useless whitespace
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-13 05:26:04 +01:00
Eric Kuck
8a916beb38
More formatting nits and cyclomatic complexity fixes
...
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-12 21:09:52 -06:00
Eric Kuck
e4ac48bc75
More linter warnings fixed, enabled more swiftlint rules, project cleanup
...
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-12 15:33:14 -06:00
Eric Kuck
d06cff2a36
Tons more swiftlint warnings fixed. Still a few remaining.
...
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-12 12:28:27 -06:00
Eric Kuck
de14b76b4d
Added swiftlint and fixed all errors (and a bunch, but not all, warnings)
...
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-12 11:40:57 -06:00
Jason A. Donenfeld
034a1a12f7
Supply missing pieces of path change
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-12 01:11:43 +01:00
Eric Kuck
9bc7e58487
Fixed a potential race condition, better naming on PacketTunnelSettingsGenerator methods
...
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-11 16:59:15 -06:00
Eric Kuck
27265fc222
Added an (unfinished) NWPathMonitor implementation for reconnecting on network changes
...
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-11 16:12:04 -06:00
Jason A. Donenfeld
1eddb2c86d
PacketTunnelProvider: Show log timestamp
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-07 23:56:26 +01:00
Jason A. Donenfeld
b7e5638681
Plist: Handle crypto export
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-07 18:52:14 +01:00
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
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
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
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
3136fe0e2c
NE: When there's an error starting the tunnel, show it to the user using displayMessage()
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-09 17:07:42 +05:30
Roopesh Chander
5ee4d392b5
Move logic to extension: Bring up the tunnel from the stored providerConfiguration
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 18:59:16 +05:30
Roopesh Chander
c17e4a27a2
DNSResolver: Simplify
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 17:52:11 +05:30
Roopesh Chander
8409b7e929
DNSResolver: Let's not cache DNS resolution results anymore
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 17:52:11 +05:30
Roopesh Chander
651ffa0c51
DNSResolver: DNS resolution can now happen synchronously
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 17:52:11 +05:30
Roopesh Chander
af58bfcb00
Move logic to extension: Refactor PacketTunnelOptionsGenerator into a PacketTunnelSettingsGenerator
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 15:44:13 +05:30
Roopesh Chander
2f7e437202
Move logic to extension: Move DNSResolver to extension
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 15:09:45 +05:30
Roopesh Chander
fb6a7f6007
Move logic to extension: Move PacketTunnelOptionsGenerator to the extension
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 14:16:30 +05:30
Jason A. Donenfeld
e992030569
PacketTunnelProvider: modernize header
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-06 19:04:53 +01:00
Jason A. Donenfeld
0a55a284d5
wireguard-go-bridge: take fd instead of fnptr
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-06 16:27:25 +01:00
Jason A. Donenfeld
a08a9ba4c4
PacketTunnelProvider: clamp v6 addresses to /120
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-05 03:11:11 +01:00
Jason A. Donenfeld
4bd1ea63c6
XCode: use old network extension ID
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-04 05:42:25 +01:00
Jason A. Donenfeld
6c40479863
XCode: unify version strings
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-04 03:51:50 +01:00
Jason A. Donenfeld
9439e00047
Global: no periods at the end of error messages
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 03:43:09 +01:00
Jason A. Donenfeld
b21de2e398
NetworkExtension: check isTunnelClosed before packet existence
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-01 22:01:52 +01:00
Jason A. Donenfeld
c2d76b9c45
Global: fix up strings
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-01 19:01:43 +01:00
Roopesh Chander
7608cebbc6
NE: Show an alert when someone tries to start the VPN from iOS Settings
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 22:08:01 +05:30
Jason A. Donenfeld
9f5612f93f
wireguard-go-bridge: extract version for consumption by network extension
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-31 04:08:13 +01:00
Jason A. Donenfeld
2a9c7e4745
wireguard-go-bridge: simplify logging and remove tags
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-31 03:22:22 +01:00
Jason A. Donenfeld
d2f3a29f45
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.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-31 03:03:00 +01:00
Roopesh Chander
ce20a17e51
NE: Print error when unable to start the tunnel
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-30 18:36:28 +05:30
Jason A. Donenfeld
5b6ef1ca38
Global: fix up captialization in headers
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-30 03:57:35 +01:00
Jason A. Donenfeld
fc6bee0b8c
XCode: fall back to default settings
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-30 03:54:00 +01:00
Roopesh Chander
793bf63989
VPN: Bring up the tunnel
...
The app figures out all settings and passes them in the
'options' parameter of startTunnel().
The network extension just takes them as is and just plugs the supplied
values into the right places.
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 19:07:16 +05:30
Roopesh Chander
3044637196
NE: Add bridging header
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 19:07:16 +05:30
Roopesh Chander
11a6b988ce
NE: Remove entitlements we don't need for now
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 19:07:16 +05:30
Roopesh Chander
dd672d3dac
Prepare for rewrite: Move WireGuardNetworkExtension into the new project folder
...
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 15:13:01 +05:30