Jason A. Donenfeld
7bf3d7b09d
Update copyright
2019-01-07 19:23:39 -05:00
Jason A. Donenfeld
013d603109
Rework DNS and routes in network extension
...
The DNS resolver prior had useless comments, awful nesting, converted
bytes into strings and back into bytes, and generally made no sense.
That's been rewritten now.
But more fundumentally, this commit made the DNS resolver actually
accomplish its objective, by passing AI_ALL to it. It turns out, though,
that the Go library isn't actually using GAI in the way we need for
parsing IP addresses, so we actually need to do another round, this time
with hints flag as zero, so that we get the DNS64 address.
Additionally, since we're now binding sockets to interfaces, we can
entirely remove the excludedRoutes logic.
2018-12-28 19:38:03 +01:00
Jason A. Donenfeld
0cc55db4cb
NetworkExtension: rescope socket instead of tearing down socket
2018-12-26 01:17:55 +01:00
Jason A. Donenfeld
b68b3785be
Rely on availability of fd only after setting network settings
2018-12-22 18:29:54 +01:00
Jason A. Donenfeld
a60b2a37d0
Retain aggressive socket reestablishment for now
...
This can be reverted once we've done more testing.
2018-12-22 15:45:09 +01:00
Eric Kuck
8fb8d9a9d2
All models now Equatable
2018-12-21 22:57:17 -06:00
Jason A. Donenfeld
27cd93a898
Do not crash if we can't get socket.fileDescriptor
2018-12-22 05:13:04 +01:00
Eric Kuck
3269c54718
Removing a tunnel from iOS's settings is now immediately reflected in app
2018-12-21 21:59:43 -06:00
Jason A. Donenfeld
0b2d91a7f4
Localize remaining strings in network extension
2018-12-22 03:42:01 +01:00
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