Commit Graph

916 Commits

Author SHA1 Message Date
Roopesh Chander
c477f721fb macOS: Handle tunnel deletions outside the app 2019-01-22 19:30:21 +05:30
Jason A. Donenfeld
d3db8519b0 macOS: remove mobile network tweeks 2019-01-22 13:11:28 +01:00
Jason A. Donenfeld
b3d9d582bf MacOS: StatusMenu: Properly localize menu title
Partially revert "macOS: StatusMenu: Remove unused menu title"
2019-01-22 11:26:07 +01:00
Roopesh Chander
658c54f59c macOS: Disable save button if the syntax highlighter detects any errors 2019-01-22 12:57:32 +05:30
Roopesh Chander
d056732e27 macOS: Fix crash when importing using NoTunnelsDetailVC's button 2019-01-22 05:00:39 +05:30
Roopesh Chander
592ea5cfca macOS: StatusMenu: Remove unused menu title 2019-01-22 04:41:52 +05:30
Roopesh Chander
8b89c29ace Let there be newlines at the end of all files 2019-01-22 04:40:47 +05:30
Roopesh Chander
4f28737dbf Fix localization
- Use Unicode ellipses
 - Use single quotes everywhere
 - Use smart quotes
 - Minor text change ("You cannot undo this action.")
2019-01-22 04:35:13 +05:30
Roopesh Chander
927ce4c129 macOS: Use Unicode version of '...' for menu text 2019-01-22 04:16:22 +05:30
Roopesh Chander
0f140d2222 macOS: Fix status-related menu items 2019-01-22 04:11:24 +05:30
Roopesh Chander
ca827d2d10 Better os() directives 2019-01-22 04:06:37 +05:30
Jason A. Donenfeld
c0883e37c4 macOS: Tunnel edit: actually clean up error handling 2019-01-21 23:21:47 +01:00
Jason A. Donenfeld
b69dbfda52 XCode: set default signing identity back 2019-01-21 23:17:08 +01:00
Roopesh Chander
808c95567a macOS: Tunnel edit: Clean up error handling when saving 2019-01-22 03:26:01 +05:30
Jason A. Donenfeld
285c21c84c macOS: Observe private key changes for new tunnels too 2019-01-21 22:55:25 +01:00
Jason A. Donenfeld
5b6b34d9c6 macOS: Better highlighter default value and move c implementation 2019-01-21 22:22:20 +01:00
Jason A. Donenfeld
015e94d0a1 macOS: Make highlighter themes static 2019-01-21 22:13:14 +01:00
Roopesh Chander
ef54cae788 Avoid using return in single-line closures 2019-01-22 02:01:32 +05:30
Roopesh Chander
1df572218d macOS: Make color theme use a dict 2019-01-22 02:01:32 +05:30
Roopesh Chander
dd38cbe7ac macOS: Reset attributes for each syntax highlight cycle 2019-01-22 01:19:16 +05:30
Roopesh Chander
053ea9fc54 macOS: Refactor syntax highlighting 2019-01-22 01:18:07 +05:30
Roopesh Chander
a1608819f9 macOS: Simplify NSColor extension 2019-01-21 19:07:42 +05:30
Jason A. Donenfeld
150fd25569 macOS: show icon for inactive state 2019-01-18 21:17:53 +01:00
Jason A. Donenfeld
6b5b8f3c27 highlighter: do not rely on localized case comparisons 2019-01-18 09:32:49 +01:00
Jason A. Donenfeld
919c46af69 Xcode: move directives to toplevel project when possible 2019-01-18 09:32:49 +01:00
Jason A. Donenfeld
aefd7425cf global: Fix up copyright headers 2019-01-18 09:32:49 +01:00
Roopesh Chander
02dbb4f94d TunnelsManager: Remove unused variable 2019-01-18 09:32:49 +01:00
Roopesh Chander
9dc6d68b80 macOS: Tunnel detail: Better alignment for bottom controls 2019-01-18 09:32:49 +01:00
Roopesh Chander
5c4b43bcaf macOS: Rafactor by introducing a TunnelsTracker
The TunnelTracker is now the central place to track what the current
tunnel is, and for keeping track of the tunnel list.
2019-01-18 01:34:24 +05:30
Roopesh Chander
a61a043537 macOS: Fix autolayout errors on Add Empty Tunnel 2019-01-17 14:20:09 +05:30
Roopesh Chander
1e25c4f554 macOS: Update copyright year 2019-01-17 14:08:11 +05:30
Roopesh Chander
b345005645 macOS: Make sure app is active when showing the About dialog 2019-01-17 14:05:23 +05:30
Roopesh Chander
50f6ff311c macOS: Application: Fix comment 2019-01-17 14:03:59 +05:30
Roopesh Chander
19a738b509 macOS: Manage tunnels: Make keyboard shortcuts discoverable 2019-01-17 02:43:24 +05:30
Roopesh Chander
3e850963fc macOS: Manage tunnels: Keyboard shortcuts 2019-01-17 01:44:50 +05:30
Roopesh Chander
4c8c397fac macOS: Tunnel edit: Rename action handling methods 2019-01-17 01:28:57 +05:30
Roopesh Chander
8530ce1545 macOS: Tunnel detail: Rename action handling methods 2019-01-17 00:41:32 +05:30
Roopesh Chander
e116365ea4 macOS: Tunnels list: Rename action handling methods 2019-01-17 00:38:44 +05:30
Roopesh Chander
e7b40cf993 macOS: Support window management keyboard shortcuts 2019-01-16 18:01:59 +05:30
Jason A. Donenfeld
fe1840b028 macOS: Networks should show allowedIPs and disappear when inactive 2019-01-15 22:35:30 +01:00
Roopesh Chander
670673cccc macOS: Use tunnelOverheadBytes for automatic MTU in macOS 2019-01-16 01:51:56 +05:30
Roopesh Chander
b6d159ac96 macOS: Different status bar icon looks for different states
- Looks dimmed when no tunnel is active
 - Looks normal when a tunnel is active
 - Animates when a tunnel is activating
2019-01-16 01:26:10 +05:30
Roopesh Chander
02814ba546 macOS: Add About dialog 2019-01-14 14:52:37 +05:30
Roopesh Chander
e1d329707a macOS: Add app icon 2019-01-14 14:52:37 +05:30
Roopesh Chander
93b9b0442b macOS: Edit view: Auto hide editor scrollbars 2019-01-14 14:52:37 +05:30
Roopesh Chander
ea053c2701 macOS: To set default size, change frame instead of min size 2019-01-14 14:52:37 +05:30
Roopesh Chander
bec0cb1e75 macOS: Fix editor scrolling 2019-01-14 14:52:37 +05:30
Eric Kuck
1c3cf52c7d Default view controller sizes 2019-01-14 14:52:36 +05:30
Jason A. Donenfeld
40cabd6e66 ConfTextView: enable undo and disable junk
Double space stil makes a period, unfortunately.
2019-01-14 14:52:36 +05:30
Eric Kuck
ab48f7bed8 Cut/copy/paste now work 2019-01-14 14:52:36 +05:30
Jason A. Donenfeld
171989ec56 Resync highlighter 2019-01-14 14:52:36 +05:30
Eric Kuck
2617eab35e Syntax highlighter color updates 2019-01-14 14:52:36 +05:30
Roopesh Chander
1e848c5ef8 macOS: Support for on-demand activation 2019-01-14 14:52:36 +05:30
Roopesh Chander
59f8cc792b macOS: Quit menu item 2019-01-14 14:52:36 +05:30
Roopesh Chander
d681e70ce5 macOS: Get the app back in focus after macOS' VPN prompt 2019-01-14 14:52:35 +05:30
Roopesh Chander
f68648f874 macOS: Fix 'Network' entry in menu 2019-01-14 14:52:35 +05:30
Roopesh Chander
341f15678f macOS: Ensure a tunnel is selected when '-' is clicked 2019-01-14 14:52:35 +05:30
Roopesh Chander
874057fb9e macOS: Handle errors from TunnelsManager.create() 2019-01-14 14:52:35 +05:30
Roopesh Chander
2724a99733 iOS: Export log: Should present error from the main thread 2019-01-14 14:52:35 +05:30
Roopesh Chander
5cd3859b47 macOS: Localize export sheets 2019-01-14 14:52:35 +05:30
Roopesh Chander
3969cc6ee3 macOS: Import sheet button should say 'Import' 2019-01-14 14:52:35 +05:30
Roopesh Chander
0b8d18b842 macOS: Tunnel detail: Ensure long keys fit 2019-01-14 14:52:35 +05:30
Roopesh Chander
718c316933 macOS: Manage tunnels: Add empty tunnel pulldown menu implementation 2019-01-14 14:52:35 +05:30
Roopesh Chander
14decf0146 macOS: Update detail view after editing 2019-01-14 14:52:35 +05:30
Roopesh Chander
e428708631 macOS: Edit view: Update public key as you edit 2019-01-14 14:52:35 +05:30
Roopesh Chander
5802c74245 Highlighter: Report each key type separately 2019-01-14 14:52:34 +05:30
Roopesh Chander
728b3ef61f Parsing: Always error on unrecognized keys 2019-01-14 14:52:34 +05:30
Roopesh Chander
bc9f050d7f Parsing: Error on duplicate entries 2019-01-14 14:52:34 +05:30
Roopesh Chander
3830499ac1 macOS: Edit view: Validate and save 2019-01-14 14:52:34 +05:30
Roopesh Chander
309d06217f macOS: Refactor config file parsing
- To report more fine grained errors
 - To make the parse errors conform to WireGuardAppError
2019-01-14 14:52:34 +05:30
Eric Kuck
e0aaf0661f Syntax highlighter color updates 2019-01-14 14:52:34 +05:30
Jason A. Donenfeld
1c7ae7a334 Highlighter: use original file from contrib/examples/highlighter
This makes it easier to track updates and make diffs. Also, disable
things we don't support in the NetworkExtension app.
2019-01-14 14:52:34 +05:30
Eric Kuck
3795a06e92 Added syntax highlighting conf textview 2019-01-14 14:52:34 +05:30
Roopesh Chander
b5cfa60c8a macOS: Tunnel edit view 2019-01-14 14:52:33 +05:30
Roopesh Chander
b35ebd8a67 macOS: Rename *Cell to *Row 2019-01-14 14:52:33 +05:30
Roopesh Chander
ab077422d8 macOS: On adding the first tunnel, select it 2019-01-14 14:52:33 +05:30
Roopesh Chander
6b587b4a11 macOS: Consolidate presenting of the import panel 2019-01-14 14:52:33 +05:30
Roopesh Chander
4b4fa6519a macOS: Manage tunnels: Handle the case when there are no tunnels 2019-01-14 14:52:33 +05:30
Roopesh Chander
eddfee90f1 macOS: Present tunnel activation errors from the window when possible 2019-01-14 14:52:33 +05:30
Roopesh Chander
c14e156926 macOS: Present errors as a sheet when applicable 2019-01-14 14:52:32 +05:30
Roopesh Chander
ca5e90a70e macOS: Manage tunnels: Remove tunnel 2019-01-14 14:52:32 +05:30
Roopesh Chander
78c11a1f14 macOS: Manage tunnels: Update tunnels list on changes 2019-01-14 14:52:32 +05:30
Roopesh Chander
37d84f9f3b macOS: Manage tunnels: Export log pulldown menu implementation 2019-01-14 14:52:32 +05:30
Roopesh Chander
fde0d67dda macOS: Manage tunnels: Export tunnels pulldown menu implementation 2019-01-14 14:52:32 +05:30
Roopesh Chander
ae991167f2 macOS: Xcode: Add ablity to save files 2019-01-14 14:52:32 +05:30
Roopesh Chander
fda8a5d83b macOS: Manage tunnels: Select first tunnel on showing the window 2019-01-14 14:52:32 +05:30
Roopesh Chander
14fa8530d7 macOS: Manage tunnels: Set window title 2019-01-14 14:52:32 +05:30
Roopesh Chander
59e5247e0f macOS: Manage tunnels: Import pulldown menu implementation 2019-01-14 14:52:32 +05:30
Roopesh Chander
005a2c37c2 macOS: Manage tunnels: Localize pulldown menu items 2019-01-14 14:52:32 +05:30
Roopesh Chander
79feef3d1d macOS: Show open panel as sheet on manage window 2019-01-14 14:52:32 +05:30
Roopesh Chander
8a08b9cc2c macOS: Manage tunnels: Adjust spacings 2019-01-14 14:52:32 +05:30
Roopesh Chander
f26f4b5e7d macOS: Manage tunnels: Add a box around the detail view 2019-01-14 14:52:31 +05:30
Roopesh Chander
5ed147aa3e macOS: Manage tunnels: Show status checkbox and edit button 2019-01-14 14:52:31 +05:30
Roopesh Chander
9535a0c585 macOS: s/macMenuStatus/macStatus/g; 2019-01-14 14:52:31 +05:30
Roopesh Chander
50ed363ef2 macOS: Manage tunnels: Tunnel detail view 2019-01-14 14:52:31 +05:30
Roopesh Chander
5bd9b6f9d4 macOS: Manage tunnels: Add a filler button 2019-01-14 14:52:31 +05:30
Roopesh Chander
301dc81770 macOS: Manage tunnels: Fix list view look 2019-01-14 14:52:31 +05:30
Roopesh Chander
3bfcfe61a6 macOS: Manage tunnels: Add buttons to the bottom of the list view 2019-01-14 14:52:30 +05:30
Roopesh Chander
8d39a2725c macOS: Manage tunnels window: Tunnels list 2019-01-14 14:52:30 +05:30
Roopesh Chander
8008498ffc macOS: Capitalize All Rights Reserved 2019-01-14 14:52:30 +05:30
Roopesh Chander
b024887052 macOS: Show status as disabled menu items 2019-01-14 14:52:30 +05:30
Roopesh Chander
e61da844bd macOS: Ability to activate / deactivate a tunnel 2019-01-14 14:52:30 +05:30
Roopesh Chander
c1a5fb7ddd macOS: Ability to import tunnels from file
For now, the open panel shows as a separate window.
Later, we'll open it as a sheet on the 'Manage tunnels' window.
2019-01-14 14:52:30 +05:30
Roopesh Chander
c8b3d5a8ed iOS: Refactor importFromFile
So that it can be used in macOS as well
2019-01-14 14:52:29 +05:30
Roopesh Chander
3d97b59a4f macOS: Add tunnel management menu items 2019-01-14 14:52:29 +05:30
Roopesh Chander
93d7bfa12c macOS: Specify app is an 'agent'
This hides the app from the Dock, while still enabling the app
to come to the foreground if required.
2019-01-14 14:52:29 +05:30
Roopesh Chander
f5e5fa4d5e macOS: Create status bar with tunnel names 2019-01-14 14:52:29 +05:30
Roopesh Chander
0355d55937 macOS: Add status bar icon 2019-01-14 14:52:29 +05:30
Roopesh Chander
ee4eae0ade macOS: Remove MainMenu.xib
When there's no xib, we should explicitly set the app delegate, so we
override NSApplication and set the app delegate in NSApplication.shared
2019-01-14 14:52:29 +05:30
Roopesh Chander
1e543f7f8c macOS: NE: Add entitlements for making network connections 2019-01-14 14:52:28 +05:30
Roopesh Chander
c41be2a29d Make app groups work on both iOS and macOS 2019-01-14 14:52:28 +05:30
Roopesh Chander
c8a8d4ba1e macOS: Add Network Extensions capability to app 2019-01-14 14:52:28 +05:30
Roopesh Chander
2632ead1bf iOS: Fix WireGuardNetworkExtensioniOS target
- Rename WireGuardNetworkExtension.entitlements to WireGuardNetworkExtension_iOS.entitlements
2019-01-14 14:52:28 +05:30
Roopesh Chander
10ff41cc64 iOS: Fix WireGuardiOS target
- Move Info.plist and entitlements to WireGuard/UI/iOS/
2019-01-14 14:52:28 +05:30
Roopesh Chander
3ea00e1f41 macOS: Fix WireGuardmacOS target
- Include non-UI code from iOS while building
- Add run scripts
- Move files to WireGuard/UI/macOS
- Set Swift-Obj-C bridging header
2019-01-14 14:52:28 +05:30
Roopesh Chander
966883ea05 macOS: Fix WireGuardNetworkExtensionmacOS target
- Build using common network extension code
- Add run scripts
- Set Info.plist to common network extension's Info.plist
- Move entitlements to common network extension folder
- Remove Xcode-generated macOS network extension code
- Set Swift-Obj-C bridging header
2019-01-14 14:52:27 +05:30
Roopesh Chander
548d6bda72 macOS: WireGuardNetworkExtensionmacOS depends on WireGuardGoBridgemacOS 2019-01-14 14:52:27 +05:30
Roopesh Chander
fae6bc6bdf macOS: Add WireGuardNetworkExtensionmacOS target 2019-01-14 14:52:27 +05:30
Roopesh Chander
46b26a146c macOS: Add WireGuardmacOS target 2019-01-14 14:52:27 +05:30
Roopesh Chander
1fa38101c5 Xcode: Add WireGuardGoBridgemacOS target 2019-01-14 14:52:27 +05:30
Roopesh Chander
ad502331f0 Move iOS images and storyboard into UI/iOS/ folder 2019-01-14 14:52:27 +05:30
Roopesh Chander
6ec9e94a39 Xcode: Rename iOS targets to include an 'iOS' suffix
But keep the PRODUCT_NAME as 'WireGuard', not 'WireGuardiOS'.
2019-01-14 14:52:26 +05:30
Roopesh Chander
8715b66caa xcconfig: Make app id platform-specific 2019-01-14 14:52:26 +05:30
Roopesh Chander
1d5b04c822 On-Demand: Add support for macOS-specific values 2019-01-14 14:52:26 +05:30
Roopesh Chander
230713a6fc import Foundation instead of UIKit wherever possible 2019-01-14 14:52:26 +05:30
Jason A. Donenfeld
809c64b219 Version bump 2019-01-08 02:13:44 +01:00
Jason A. Donenfeld
a266171157 PacketTunnelSettingsGenerator: use 127.0.0.1 as dummy address
It turns out that using 0.0.0.0 somehow conflicts with DNS lookups when
CLAT is in use.
2019-01-08 01:51:12 +01:00
Jason A. Donenfeld
83cc642b34 Avoid dynamic MTU calculations for now 2019-01-07 19:23:39 -05:00
Jason A. Donenfeld
7bf3d7b09d Update copyright 2019-01-07 19:23:39 -05:00
Jason A. Donenfeld
25676c461f Version bump 2018-12-28 19:43:11 +01: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
1de0f5746c Version bump
A Christmas Special, for TestFlight, and possibly for release if things
go well there.
2018-12-26 01:41:22 +01:00
Jason A. Donenfeld
0cc55db4cb NetworkExtension: rescope socket instead of tearing down socket 2018-12-26 01:17:55 +01:00
Roopesh Chander
a380f17974 minizip: Remove zip encryption code
We can now remove -DNOCRYPT cflag while compiling
2018-12-25 12:48:04 +05:30
Roopesh Chander
00c07377ed Tunnel edit: Fix crash
This fixes a crash that happens when you:

 1. Scroll to the end of the Edit screen
 2. Delete a peer
 3. Toggle the Activate On Demand switch
2018-12-24 13:01:21 +05:30
Eric Kuck
00a7eabed2 SwitchCell nits 2018-12-22 15:32:29 -06:00
Eric Kuck
89fd494291 Fix typo for simulator builds 2018-12-22 14:32:39 -06:00
Roopesh Chander
3ca5712ac1 Remove more comments 2018-12-23 00:31:44 +05:30
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
Roopesh Chander
2e37d511db Don't set username on NETunnelProviderProtocol
The username corresponds to the Account field in iOS system VPN UI,
but if we don't set it, the field is not shown, so setting it isn't
really required.
2018-12-22 16:13:31 +05:30
Roopesh Chander
09a96ec2a8 TunnelErrors: Add alert text for PacketTunnelProviderError 2018-12-22 16:05:43 +05:30
Roopesh Chander
baf99733f5 TunnelStatus: Absorb NEVPNStatus+CustomStringConvertible 2018-12-22 15:46:28 +05:30
Jason A. Donenfeld
08daec71aa Also refresh status 2018-12-22 07:07:53 +01:00
Jason A. Donenfeld
470da3ffcc Reassign tunnelProvider if it changes from outside the app 2018-12-22 06:56:12 +01:00
Eric Kuck
8fb8d9a9d2 All models now Equatable 2018-12-21 22:57:17 -06:00
Jason A. Donenfeld
053c655fc0 Clean up trailing whitespace 2018-12-22 05:30:35 +01: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
Eric Kuck
4277887146 RTL support 2018-12-21 20:37:22 -06:00
Eric Kuck
1124d4d359 Strongly recommended now appears as placeholder for DNS when needed 2018-12-21 19:52:51 -06:00
Jason A. Donenfeld
d0cc2a8afd Combine double log invocations 2018-12-22 02:21:07 +01:00
Jason A. Donenfeld
cfdb4ec233 Attempt to strongly recommend things 2018-12-22 01:55:42 +01:00
Jason A. Donenfeld
30cf9a1d1d Move model helpers to model directory 2018-12-22 01:36:42 +01:00
Eric Kuck
0d841609f6 Fixes mock tunnels 2018-12-21 18:35:01 -06:00
Jason A. Donenfeld
bfb0eb5dae Do not set copyable back to true on reuse 2018-12-22 01:31:59 +01:00
Jason A. Donenfeld
e1c3d9b57a Move name from interface to tunnel 2018-12-22 00:28:18 +01:00
Jason A. Donenfeld
41af6d863e Fix paren typo
"I am very anti-paren." --Eric
2018-12-21 23:45:20 +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
Eric Kuck
d7a27426e9 All migration stuff moved to one gross file 2018-12-21 12:51:14 -06:00
Jason A. Donenfeld
d540c1811c Simplify versioning of stored data 2018-12-21 18:58:06 +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
6b48cb3095 Localize all the things 2018-12-21 18:34:09 +05:30
Roopesh Chander
01ea8f5f30 Tunnel detail: iPad: Handle deletion of tunnel correctly 2018-12-21 18:02:18 +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
7ce5cb9d58 Added missing param in MockTunnels 2018-12-20 13:51:44 -06:00
Eric Kuck
9c7f27f19f Enabled more swiftlint rules 2018-12-20 11:22:37 -06:00
Eric Kuck
cba41de73a Added a String->[String] helper 2018-12-20 10:46:26 -06:00
Roopesh Chander
f141cf83a6 TunnelErrors: Remove unused error 2018-12-20 19:44:57 +05:30
Roopesh Chander
d82aedebbd Tunnel edit: init() need not take a tunnelConfiguration argument 2018-12-19 18:35:53 +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
61c3928459 Tunnel edit: Fix comment 2018-12-19 18:35:53 +05:30
Roopesh Chander
4c1c1f013c TunnelsManager: If only Activate On Demand has changed, don't restart tunnel 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
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