Commit Graph

412 Commits

Author SHA1 Message Date
Jason A. Donenfeld 8bbc49015c TunnelsManager: do not change back to inactive if we are resolving the endpoint 2018-11-03 06:09:57 +01:00
Roopesh Chander 929470c693 Tunnels list: Remove separator lines in the table view 2018-11-03 10:26:15 +05:30
Roopesh Chander 12900e6af3 Tunnels list: Show an 'Add' button when there are no tunnels 2018-11-03 10:26:09 +05:30
Roopesh Chander 4bb45397f1 Tunnels list: Show a busy indicator before the tunnels are loaded 2018-11-03 10:25:47 +05:30
Roopesh Chander c6df88c893 Tunnels list: The Add and Settings buttons should be no-ops until the tunnels are loaded 2018-11-03 10:25:47 +05:30
Roopesh Chander e332d6cf0e Tunnel edit: Use layoutMarginsGuide instead of constants 2018-11-03 10:25:47 +05:30
Jason A. Donenfeld c025ff8024 TunnelsManager: fix use of arrayslice in addMultiple 2018-11-03 04:37:56 +01:00
Jason A. Donenfeld aa5634ee27 TunnelsManager: get rid of name set
Instead, tunnels itself should be a sorted-set. For now it's a list,
which is probably fine though.
2018-11-03 03:53:08 +01:00
Jason A. Donenfeld 2fdbe1c492 TunnelsManager: get rid of index management
No need for premature optimization. There aren't that many tunnels most
of the time, and calling sort on a partially sorted array is fast.
2018-11-03 03:43:09 +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 83eeb289c2 Import: rework addMultiple logic 2018-11-03 03:43:09 +01:00
Roopesh Chander 7077dac4e9 Tunnel detail: In the key-value cell, make the value label scrollable horizontally 2018-11-02 23:48:27 +05:30
Roopesh Chander 36292d570a Tunnel edit: Ensure all key-value fields have a placeholder text 2018-11-02 18:20:32 +05:30
Roopesh Chander 8fee05969e DNSResolver: Bugfix: Always call completion handler 2018-11-02 18:10:51 +05:30
Roopesh Chander c04773276a Info.plist: Update document icons and description 2018-11-02 17:40:46 +05:30
Roopesh Chander dd04633b1d Info.plist: Document type UTI should be consistent with exported UTI 2018-11-02 17:40:46 +05:30
Roopesh Chander 0e61d55d3e Info.plist: Register zip file for open-in 2018-11-02 17:40:46 +05:30
Roopesh Chander 2c999c09de Info.plist: Add .conf extension to document type 2018-11-02 17:40:46 +05:30
Roopesh Chander 2abcba8031 Add document icon 2018-11-02 17:39:43 +05:30
Roopesh Chander 1a169d5cc6 Add app icons 2018-11-02 16:11:24 +05:30
Roopesh Chander db8c6cbc21 Handle cell reuse in showing delete buttons in red 2018-11-02 13:24:10 +05:30
Roopesh Chander c643cd1478 Table edit: Show/hide 'Exclude Private IPs' instead of enable/disable 2018-11-02 13:12:10 +05:30
Roopesh Chander 864394cf81 Tunnel view model: If there's just one peer, populate the scratchpad on init
So that exclude private IPs can be computed correctly.
2018-11-02 13:09:45 +05:30
Roopesh Chander c61491391e Tunnel view model: Initialize peerData.numberOfPeers 2018-11-02 12:05:58 +05:30
Jason A. Donenfeld 799c2d96cd DNSResolver: getaddrinfo returns a sockaddr and inet_ntop takes strlen
The way this was written before was totally wrong.
2018-11-02 05:34:17 +01:00
Jason A. Donenfeld 2267079367 NetworkExtension: check isTunnelClosed before packet existence 2018-11-01 22:01:52 +01:00
Jason A. Donenfeld 73f4a90dee Global: OK over Ok 2018-11-01 21:22:12 +01:00
Roopesh Chander 2bb42ac3ec Deletion buttons are shown in red 2018-11-01 23:53:09 +05:30
Roopesh Chander bf2031776b Tunnel edit: Highlight erroring field keys in red 2018-11-01 23:45:48 +05:30
Roopesh Chander 9f98e172b6 Tunnels list: Swipe left to delete 2018-11-01 23:45:48 +05:30
Jason A. Donenfeld 42948b2816 Global: fix up strings 2018-11-01 19:01:43 +01:00
Roopesh Chander a0b24f53b5 QR code: Fix what happens when an error is shown 2018-11-01 22:08:01 +05:30
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 ae992c3deb Export: fix up export format 2018-11-01 17:31:50 +01:00
Roopesh Chander 479f04a579 Tunnel errors: Consolidate tunnel activation errors into ErrorPresenter 2018-11-01 16:58:33 +05:30
Roopesh Chander e222c8391e TunnelsManager: Better errors 2018-11-01 16:57:40 +05:30
Roopesh Chander c056000b55 ConfigFile: WgQuickConfigFileWriter: Fix '[Peer]' section header 2018-11-01 16:13:30 +05:30
Roopesh Chander 2d6426f798 Importing: Account for errors in showing the 'No configurations found' error 2018-11-01 15:59:17 +05:30
Roopesh Chander 1889614157 Tunnel detail: Fix deletion of tunnel 2018-11-01 15:54:37 +05:30
Roopesh Chander d62c1fd84a VPN: TunnelsManager: Fix deletion code 2018-11-01 15:53:10 +05:30
Roopesh Chander c999c2a0ec VPN: Restart tunnel after modifying a currently active configuration 2018-11-01 15:36:59 +05:30
Roopesh Chander ecad18749a QR code: Degrade gracefully when running on the simulator or on a device without a camera 2018-11-01 11:45:44 +05:30
Roopesh Chander f7331997b2 Revert "QR code: QR code scanning is not available in the simulator"
This reverts commit 9729386406.
2018-11-01 11:45:44 +05:30
Roopesh Chander 771aab9f0f Importing: Show error when the zip file contains no .conf files 2018-11-01 11:45:44 +05:30
Roopesh Chander c681b02f7d VPN: We have to start observing the tunnelContainer before we attempt to activate it 2018-11-01 11:45:44 +05:30
Roopesh Chander fd30ce0e0d Importing: Error out on duplicate name 2018-11-01 11:45:44 +05:30
Roopesh Chander de7bf4cf16 QR Code: Error out on duplicate name 2018-11-01 11:45:44 +05:30
Roopesh Chander 247396ce48 Tunnel edit: Error out on duplicate name when creating / modifying a tunnel 2018-11-01 11:45:44 +05:30
Roopesh Chander 02ff2f783c VPN: An ErrorPresenter class to consolidate showing of error alerts 2018-11-01 11:45:44 +05:30
Roopesh Chander d20a1ce7a4 VPN: Introduce an error enum for adding/modifying/removing tunnels 2018-11-01 11:45:44 +05:30
Roopesh Chander 6a586b6f98 VPN: TunnelsManager: s/TunnelsManagerError/TunnelActivationError/g; 2018-11-01 01:47:53 +05:30
Roopesh Chander 699ace099c VPN: TunnelsManager should keep track of tunnel names to prevent duplicate names 2018-11-01 01:47:53 +05:30
Jason A. Donenfeld 56d827d04a UI: not all subclasses of CopyableLabelTableViewCell have a detailTextLabel, so generalize 2018-10-31 16:38:05 +01:00
Jason A. Donenfeld 04993104b1 TunnelManager: bound recursion in startActivation 2018-10-31 15:58:03 +01:00
Roopesh Chander 5528be92ff VPN: Retry startTunnel based on error conditions 2018-10-31 16:42:29 +05:30
Roopesh Chander dae0e10e20 Tunnel list: Fix importing zip with multiple configurations 2018-10-31 14:30:25 +05:30
Roopesh Chander efe019b643 VPN: Support adding multiple configurations in one shot 2018-10-31 14:29:54 +05:30
Jason A. Donenfeld d75a89c09a wireguard-go-bridge: extract version for consumption by network extension 2018-10-31 04:08:13 +01:00
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
Jason A. Donenfeld 34b9023f67 UI: More elegant copy-to-clipboard behavior 2018-10-31 02:17:47 +01:00
Roopesh Chander 9729386406 QR code: QR code scanning is not available in the simulator 2018-10-30 19:22:24 +05:30
Roopesh Chander 203eb46b28 Style: Remove 'Based on' attributions 2018-10-30 19:07:07 +05:30
Roopesh Chander b12d7bfd95 QR code: Show label overlay with info on how to generate the QR code 2018-10-30 19:04:15 +05:30
Roopesh Chander 1039f1f35a Tunnel creation: Placeholders for Listen port, Pre-shared key, Persistent Keepalive 2018-10-30 18:50:56 +05:30
Roopesh Chander 13e3f4ae0a VPN: Refactor use of DNS resolution while activating the tunnel 2018-10-30 18:36:28 +05:30
Roopesh Chander cc63b0e64f NE: Print error when unable to start the tunnel 2018-10-30 18:36:28 +05:30
Roopesh Chander 167f5ce55f Tunnel view model: IP address can be specified without '/cidr' 2018-10-30 13:46:10 +05:30
Roopesh Chander b372d50757 Model: IP address can be specified without '/cidr' 2018-10-30 13:45:16 +05:30
Roopesh Chander 46080aae63 Fix error message: s/atleast/at least/g; 2018-10-30 13:32:14 +05:30
Jason A. Donenfeld f6d2feec22 Global: fix up captialization in headers 2018-10-30 03:57:35 +01:00
Jason A. Donenfeld 513cd7aa04 Style: simplify remaining headers 2018-10-30 03:55:43 +01:00
Jason A. Donenfeld 896ed2b33d XCode: fall back to default settings 2018-10-30 03:54:00 +01:00
Jason A. Donenfeld f3fa487702 ZIP: fix linter warnings 2018-10-30 00:50:01 +01:00
Roopesh Chander 495b017449 VPN: Better error messages 2018-10-30 00:24:50 +05:30
Roopesh Chander 0ef0eeb116 VPN: Specify an error when there are no peers with an endpoint 2018-10-29 23:38:40 +05:30
Roopesh Chander 22dd3dcc40 Export: Exporting config files 2018-10-29 23:06:55 +05:30
Roopesh Chander d63ee03d66 mv Parsing/ ConfigFile/ 2018-10-29 19:05:01 +05:30
Roopesh Chander 742da89df3 Settings: Add a settings panel 2018-10-29 17:34:09 +05:30
Roopesh Chander 7498e9556b Model: Cap networkPrefixLengths to valid values 2018-10-29 16:49:49 +05:30
Roopesh Chander 93be31e4e6 Tunnel edit: Support for exclude private IPs 2018-10-29 16:44:47 +05:30
Roopesh Chander eb61152fe0 Tunnel view model: Support for exclude private IPs 2018-10-29 16:43:53 +05:30
Roopesh Chander 7f69cb6118 Tunnel edit: Fix keyboard type for reused cells 2018-10-29 16:43:12 +05:30
Roopesh Chander ec3b43bcdf Tunnel detail: Assume there's just one section per peer 2018-10-29 13:02:11 +05:30
Roopesh Chander e83a724d83 Tunnel edit: Assume there's just one section per peer 2018-10-29 12:47:00 +05:30
Roopesh Chander 641bcdea04 Tunnel edit: Set correct keyboard types 2018-10-29 06:19:50 +05:30
Roopesh Chander 3e1748bdd9 VPN: If we don't have to make a DNS request, we shouldn't enter that status 2018-10-29 06:19:50 +05:30
Roopesh Chander 5b85d58b27 VPN: Cache DNS resolutions while the app is in memory 2018-10-29 06:19:50 +05:30
Roopesh Chander 8d3b616fa8 VPN: Reload the tunnel before starting it up
To avoid errors like this: https://stackoverflow.com/q/47550706
2018-10-29 06:19:50 +05:30
Roopesh Chander 3ffd4a8280 Tunnel list, detail: Deletion of tunnels 2018-10-29 06:19:43 +05:30
Roopesh Chander 4e36ed43c0 VPN: Fix deletion of tunnels 2018-10-29 04:54:57 +05:30
Roopesh Chander 1e7fa2390d Fix: Make sure all prepareForReuse() implementations call super 2018-10-29 02:27:14 +05:30
Roopesh Chander 6b6a4d3f17 Tunnel edit: Set correct title when editing 2018-10-29 02:24:32 +05:30
Roopesh Chander b9d6d194bc Tunnel detail: Change title after editing completes 2018-10-29 02:21:19 +05:30
Roopesh Chander 6b969b7bdf Tunnel detail: Copying the public key 2018-10-29 02:19:11 +05:30
Roopesh Chander 90eac14b9a Tunnel editing: Fix cell class names 2018-10-29 02:15:43 +05:30
Roopesh Chander b9c3e062ea Import: Use the refactored function for Open-in 2018-10-29 02:09:50 +05:30
Roopesh Chander 894925466d Import: Minor refactoring 2018-10-29 02:08:40 +05:30
Roopesh Chander 571572943b Import: Show errors when importing fails 2018-10-29 02:03:39 +05:30
Roopesh Chander 2b72e76679 Import config: Directly add config, don't open up the editor 2018-10-29 01:58:21 +05:30
Roopesh Chander b060b9ff06 Zip: Import configs from zip files 2018-10-29 01:52:43 +05:30
Roopesh Chander 2d41591cfd Zip: Add zip file reader 2018-10-29 01:51:49 +05:30
Roopesh Chander 3a58dd9481 Zip: Include minizip in our Xcode project 2018-10-29 01:03:53 +05:30
Roopesh Chander 131d362211 Zip: Add code from the minizip project
Source: https://zlib.net/zlib-1.2.11.tar.gz
2018-10-29 01:03:44 +05:30
Roopesh Chander 974b2568d2 QR code: Save the scanned tunnel 2018-10-28 23:32:15 +05:30
Jeroen Leenarts fabfd17d44 QR code: Ask for title when scanning a QR code 2018-10-28 23:20:18 +05:30
Roopesh Chander b172ba3a2a QR code: Minor refactoring 2018-10-28 23:19:56 +05:30
Jeroen Leenarts 1ae0b9a64b QR code: Support some form of rotation. 2018-10-28 23:19:52 +05:30
Jeroen Leenarts 14a802417b QR code: Make sure correct layering is used to make sure hint remains visible. 2018-10-28 23:19:45 +05:30
Roopesh Chander 153c11c42c QR code: Integrate Eric's QR code scanner 2018-10-28 22:22:32 +05:30
Roopesh Chander 7795b6954c Info.plist: Indicate that the app shall use the camera 2018-10-28 22:01:02 +05:30
Roopesh Chander 54dc70f910 Tunnels list: Need to pass in a name to the parser 2018-10-28 21:59:52 +05:30
Roopesh Chander d7691158a4 Revert "Parser: Interface name can be added after parsing"
This reverts commit d3a9e79149.
2018-10-28 21:57:18 +05:30
Eric Kuck e86923528b QR code: Ability to add tunnels with a QR code scan 2018-10-28 18:26:41 +05:30
Roopesh Chander be1383aed8 Model: Ensure name is not empty
We don't need it because we don't have to open the new-config UI
after scanning a QR code.

This reverts commit db72e95.
2018-10-28 18:13:47 +05:30
Roopesh Chander ac29886f7b VPN: A tunnel may be already active on app startup 2018-10-28 18:09:38 +05:30
Roopesh Chander 4a71c0e98e VPN: Remove ability to deactivate the tunnel while resolving DNS 2018-10-28 17:47:01 +05:30
Roopesh Chander 8df53b7709 VPN: DNSResolver: Resolve multiple endpoints in parallel 2018-10-28 17:44:25 +05:30
Roopesh Chander 2c94dd4694 Tunnels list: Add a switch and an activity indicator to the list view
They track the status of the tunnel. The switch can also be used to
bring the tunnel up and down.
2018-10-28 14:56:15 +05:30
Roopesh Chander f2cbf10f72 VPN: Save the tunnel name when modifying a tunnel 2018-10-28 14:55:24 +05:30
Roopesh Chander 7d61385572 Tunnel detail: For now, don't allow cancelling when resolving domains is in progress 2018-10-28 14:54:41 +05:30
Roopesh Chander 2781026728 VPN: Cleaner derivation of subnet mask from CIDR network prefix length 2018-10-28 11:51:18 +05:30
Roopesh Chander 5add29a5c8 Tunnel detail: The tableView should have selection disabled 2018-10-27 19:14:08 +05:30
Roopesh Chander 4516fa0fdd VPN: Better error and status handling 2018-10-27 19:07:16 +05:30
Roopesh Chander 924b824af4 Xcode: Disable bitcode
Enabling bitcode generates a linker error when linking with libwg-go.a
2018-10-27 19:07:16 +05:30
Roopesh Chander 7433634b66 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.
2018-10-27 19:07:16 +05:30
Roopesh Chander be25d9d491 Xcode: Make Xcode build libwg-go.a automatically
This is based on Jeroen Leenarts' work (commit a3cdb84)
and Jason Donenfeld's work (commit 9d01829).

To reproduce:

In Xcode, add a new target called 'WireGuardGoBridge' with
the Cross-platform > External build system template. Configure
that target with the 'make' build tool and ask it to build on the
wireguard-go-bridge directory.

The Makefile in wireguard-go-bridge is already configured to
handle being called from Xcode as an external build system.

In WireGuardNetworkExtension's build phases, add a dependancy to
WireGuardGoBridge, and ask it to link to libwg-go.a (the make command
shall generate this archive). Add libwg-go.a as a library to be linked
with.

Edit the Xcode pbxproj file and in the file reference entry for
libwg-go.a, set path as "libwg-go.a" and sourceTree as
BUILT_PRODUCTS_DIR.
2018-10-27 19:07:16 +05:30
Roopesh Chander 69a35ec3ff VPN: Fix DNS resolution API 2018-10-27 19:07:16 +05:30
Roopesh Chander 0f92228136 NE: Add bridging header 2018-10-27 19:07:16 +05:30
Roopesh Chander 4eb13921d2 NE: Remove entitlements we don't need for now 2018-10-27 19:07:16 +05:30
Roopesh Chander b41c6b49d5 NE: Include the network extension in the project 2018-10-27 19:07:16 +05:30
Roopesh Chander 02fb23bb45 VPN: Perform DNS resolution before starting the tunnel 2018-10-27 19:07:16 +05:30
Roopesh Chander 5cb2558fea Tunnel detail: Account for status section in peer index calculations 2018-10-27 19:07:16 +05:30
Roopesh Chander 373adc578c VPN: DNSResolver: A class that does DNS resolution using getaddrinfo 2018-10-27 19:07:16 +05:30
Roopesh Chander c1cfed7739 Tunnel detail: UI for activating and deactivating a tunnel 2018-10-27 19:07:16 +05:30
Roopesh Chander 59133f5467 VPN: Activating, deactivating and tracking the status 2018-10-27 19:07:16 +05:30
Roopesh Chander d586f1d619 Tunnel detail: Fix comment 2018-10-27 19:07:16 +05:30
Roopesh Chander 8c2b9432d7 Model: Add a version number to the tunnel 2018-10-27 19:07:01 +05:30
Roopesh Chander ac60a97dee VPN: Adding, modifying and deleting actual NETunnelProviderManager instances 2018-10-27 15:13:02 +05:30
Roopesh Chander f6620fed9a Import: Support for importing a config file from file providers 2018-10-27 15:13:02 +05:30
Roopesh Chander 9d340ab873 iPad: Fix modal presentation style 2018-10-27 15:13:02 +05:30
Roopesh Chander 9aa0c1b1f8 iPad: Make sure the navigation bar is visible in the detail view 2018-10-27 15:13:02 +05:30
Roopesh Chander b2ad15da55 Tunnel editing: Delegate should also report when editing is cancelled 2018-10-27 15:13:02 +05:30
Roopesh Chander 4e2a1aa07a Import: Support for opening a .conf file in the app 2018-10-27 15:13:02 +05:30
Roopesh Chander 44a2eff1e0 Tunnel editing: Separate init for creation and modification 2018-10-27 15:13:02 +05:30
Roopesh Chander d3a9e79149 Parser: Interface name can be added after parsing 2018-10-27 15:13:02 +05:30
Roopesh Chander db72e9522a Model: Allow creating an interface with empty name
But don't allow such a tunnel to be added to the tunnel manager.

(We'll need to create an interface with an empty name when we're reading QR codes.)
2018-10-27 15:13:02 +05:30
Roopesh Chander e8633b243d Info.plist: support for opening wg-quick config (.conf) files 2018-10-27 15:13:02 +05:30
Roopesh Chander 8561b0f84c Info.plist: Export the config file type declaration 2018-10-27 15:13:02 +05:30
Roopesh Chander ab3fab4024 Config file: Parsing a wg-quick config file 2018-10-27 15:13:01 +05:30