Commit Graph

530 Commits

Author SHA1 Message Date
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 62573e2ad7 Move logic to extension: .resolvingEndpointDomains is not longer a valid status
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 15:08:57 +05:30
Roopesh Chander a5f9dc4821 Move logic to extension: DNS resolution no longer happens in the app
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 15:04:12 +05:30
Roopesh Chander 7827147bc8 Move logic to extension: Include shared model code when building the extension
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 14:50:05 +05:30
Roopesh Chander a473dfe4f8 Model: Move InterfaceConfiguration.publicKey to Curve25519.swift
The code for public key calculation need not be shared with the extension

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 14:48:25 +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
Roopesh Chander f7b04b0b5d Move logic to extension: Invoke startTunnel() without any options
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 14:15:01 +05:30
Roopesh Chander c88c660b51 Move logic to extension: Move model files to Shared
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 13:56:50 +05:30
Roopesh Chander ec2d67ea00 Tunnel edit: While preparing for reuse, should make onValueBeingEdited nil as well
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 12:25:36 +05:30
Jason A. Donenfeld 9840e94c84 Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-07 17:43:50 +01:00
Roopesh Chander 85a19da487 iPad: Ensure we set sourceRect for all cases where we use sourceView
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-07 17:43:30 +01:00
Roopesh Chander b5447add1e Info.plist: Register for handling public.text files for Open-in
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-07 17:43:30 +01:00
Roopesh Chander 879e9816aa Importing: Also support importing public.text files in the file picker
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-07 17:43:30 +01:00
Roopesh Chander 3269bb476a iPad: Set correct sourceRect for the popover anchored on the central 'Add' button
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-07 18:23:12 +05:30
Roopesh Chander b3515c937e TunnelsManager: Return a manager with no tunnels in the simulator
To be able to run at least parts of the app in the simulator.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-07 18:15:20 +05:30
Roopesh Chander 7e9ee913c1 iPad: Configuring the split-view controller should happen in init(), not loadView()
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-07 15:54:30 +05:30
Jason A. Donenfeld d0ec532bd3 Settings: show build id
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-07 05:45:39 +01:00
Jason A. Donenfeld c5c536318f Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-06 20:18:11 +01:00
Jason A. Donenfeld 6e36c72f96 Importing: simplify
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-06 20:16:40 +01:00
Roopesh Chander f9dcfc1b9d Importing: Assume imported files without .conf or .zip extensions to be a config file
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-07 00:35:37 +05:30
Roopesh Chander 33edfd3587 DNSResolver: No need to resolve if the endpoint is already an IP address
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-06 23:59:48 +05:30
Roopesh Chander aa0b6e0c60 Model: Endpoint.hasHostAsIPAddress()
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-06 23:59:48 +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
Roopesh Chander f6a5dfead4 Global: swiftlint autocorrect --format
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-06 22:42:53 +05:30
Roopesh Chander 0f4b1c5c1c Global: swiftlint autocorrect
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-06 22:42:05 +05:30
Roopesh Chander 3496adca86 Importing: Error out on file with unsupported file extension
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-06 22:32:33 +05:30
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 02c31c89f6 Xcode: enable more warnings
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-06 16:27:25 +01:00
Roopesh Chander 95a4419b20 Tunnel edit: TunnelEditTableViewKeyValueCell need not support a read-only mode now
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-06 19:01:13 +05:30
Roopesh Chander 6c9fc8bcb1 Tunnel edit: A new cell class for the public key field, to make the value scrollable
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-06 17:05:03 +05:30
Roopesh Chander 1a43ad6e39 Tunnel detail: Refactor out the label scrolling into a separate UI class
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-06 16:49:09 +05:30
Roopesh Chander a62f7fb988 Tunnel view model: Peers in a configuation may not share the same public key
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-06 08:17:56 +05:30
Roopesh Chander 636aa98b79 Parser: Peers in a configuation may not share the same public key
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-06 08:17:56 +05:30
Jason A. Donenfeld 24575a5cf9 Version bump
We update the build number, not the version number, so that test flight
doesn't need a new review.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-05 21:44:00 +01:00
Roopesh Chander 34a8d70a45 Parser: Address, DNS and AllowedIPs can have mutliple entries
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-05 23:53:00 +05:30
Roopesh Chander 733c29021e QR Code: Dismiss the QR code screen when the name prompt is cancelled
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-05 23:38:41 +05:30
Roopesh Chander f102051e22 Tunnel view model: No need to save if we already have a validated configuration object
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-05 22:55:09 +05:30
Jason A. Donenfeld e228ac9d99 global: convert to Swift 4.2
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-05 06:31:25 +01:00
Jason A. Donenfeld 8860abc89e TunnelsManager: account for no or many endpoints
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-05 06:23:26 +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 8ec38e1d2b Settings: account for bottom padding on iPhone X
Reported-by: Jeffrey A. Donenfeld <jad@runblue.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-05 02:09:40 +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 897c873296 Settings: anchor logo to bottom
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-04 03:37:18 +01:00
Roopesh Chander 6d191665a4 Add a correct launch-screen storyboard
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-04 02:31:04 +05:30
Jason A. Donenfeld c4e5bde1d9 Revert "Settings: Swap table view sections"
This reverts commit 1108f82489.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 19:53:04 +01:00
Jason A. Donenfeld e43de890e0 Settings: simplify
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 19:48:10 +01:00
Jason A. Donenfeld 955de09c9e Global: run through swiftlint
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 19:35:25 +01:00
Jason A. Donenfeld 6738ebb356 Settings: limit size of logo
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 19:20:21 +01:00
Jason A. Donenfeld b28a62c114 Settings: use updated wireguard banner logo
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 18:37:51 +01:00
Jason A. Donenfeld 1568ae57e3 TunnelsManager: restore sanity
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 18:20:25 +01:00
Roopesh Chander c80901fbed Change version with 0.0.yyyymmdd versioning scheme
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 19:28:29 +05:30
Roopesh Chander 68f91e2a84 VPN: Make sure actions inside tunnelProvider completion handlers are done in the main queue
They should really already be in the main queue, but we do this just in case.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 19:26:28 +05:30
Roopesh Chander 582092abb1 VPN: Start observing the status only if startTunnel() succeeds
This should fix the status change to .disconnected when we're resolving endpoints

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 19:22:30 +05:30
Roopesh Chander 7c4992894b VPN: We should never get a status change to .disconnected if we're resolving endpoints
But we do, which we'll fix subsequently

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 18:58:27 +05:30
Roopesh Chander 538704e7bd Revert "TunnelsManager: initialize observer on correct thread"
Rather, we'll make sure we always call startObservingTunnelStatus from
the main thread.

This reverts commit d16a6a167c.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 18:45:26 +05:30
Roopesh Chander 66389c60b5 Settings: Show the captioned WireGuard logo at the end
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 18:41:54 +05:30
Roopesh Chander 09fbe93bf0 Settings: Swap table view sections
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 17:53:50 +05:30
Roopesh Chander e8802b14b4 Remove empty image
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 17:39:43 +05:30
Jeroen Leenarts 477916f0c4 Add Wireguard logo with caption to project
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 17:39:22 +05:30
Roopesh Chander b9d0b9f096 Tunnels list: Fix status switch look after flipping it off after an error
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 17:28:16 +05:30
Roopesh Chander 2f5e83cf99 ErrorPresenter: showErrorAlert takes an onPresentated handler
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 17:27:07 +05:30
Roopesh Chander a512216d85 Tunnels list: Should deselect the row when handling the selection
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 16:05:02 +05:30
Roopesh Chander 9312821778 Tunnel list: Don't show the detail view after creating a config from scratch
So it's consistent with the other two "Add a configuration" menu items

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 15:51:29 +05:30
Roopesh Chander 366ca7802a Ensure that all tunnel names are trimmed of whitespaces
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 15:45:29 +05:30
Roopesh Chander ac79c5b1f7 Zip archive: Handle files within folders inside the zip
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 15:37:31 +05:30
Jason A. Donenfeld ec943587fa TunnelsManager: initialize observer on correct thread
Because of the callback recursion, this function needs to always be called from the right thread

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 07:03:23 +01:00
Jason A. Donenfeld 6405b76941 TunnelsManager: do not track currentTunnel
It's error prone and does not give us anything.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 06:22:57 +01:00
Jason A. Donenfeld 9e9898f17d TunnelsManager: do not change back to inactive if we are resolving the endpoint
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 06:09:57 +01:00
Roopesh Chander ae2ae87bbe Tunnels list: Remove separator lines in the table view
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 10:26:15 +05:30
Roopesh Chander 735d542658 Tunnels list: Show an 'Add' button when there are no tunnels
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 10:26:09 +05:30
Roopesh Chander 0c60489819 Tunnels list: Show a busy indicator before the tunnels are loaded
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 10:25:47 +05:30
Roopesh Chander 9df0064eac Tunnels list: The Add and Settings buttons should be no-ops until the tunnels are loaded
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 10:25:47 +05:30
Roopesh Chander f6a29d9f50 Tunnel edit: Use layoutMarginsGuide instead of constants
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-03 10:25:47 +05:30
Jason A. Donenfeld 5845db4568 TunnelsManager: fix use of arrayslice in addMultiple
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 04:37:56 +01:00
Jason A. Donenfeld f57c40c38b 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.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 03:53:08 +01:00
Jason A. Donenfeld 007d6d9c58 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.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 03:43:09 +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 95101dce5c Import: rework addMultiple logic
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-03 03:43:09 +01:00
Roopesh Chander dff928fafa Tunnel detail: In the key-value cell, make the value label scrollable horizontally
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 23:48:27 +05:30
Roopesh Chander 4c485cdbb2 Tunnel edit: Ensure all key-value fields have a placeholder text
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 18:20:32 +05:30
Roopesh Chander f92fb1b9f4 DNSResolver: Bugfix: Always call completion handler
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 18:10:51 +05:30
Roopesh Chander 29004c0ab6 Info.plist: Update document icons and description
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 17:40:46 +05:30
Roopesh Chander 159ecca829 Info.plist: Document type UTI should be consistent with exported UTI
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 17:40:46 +05:30
Roopesh Chander cd16db83cc Info.plist: Register zip file for open-in
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 17:40:46 +05:30
Roopesh Chander 09a0d1ef20 Info.plist: Add .conf extension to document type
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 17:40:46 +05:30
Roopesh Chander 1e5bd7e458 Add document icon
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 17:39:43 +05:30
Roopesh Chander f7be9a29a9 Add app icons
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 16:11:24 +05:30
Roopesh Chander 90af773fef Handle cell reuse in showing delete buttons in red
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 13:24:10 +05:30
Roopesh Chander e7a1f142fb Table edit: Show/hide 'Exclude Private IPs' instead of enable/disable
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 13:12:10 +05:30
Roopesh Chander 66e802584b Tunnel view model: If there's just one peer, populate the scratchpad on init
So that exclude private IPs can be computed correctly.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 13:09:45 +05:30
Roopesh Chander b3cc30a207 Tunnel view model: Initialize peerData.numberOfPeers
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 12:05:58 +05:30
Jason A. Donenfeld 7fc0e3ee94 DNSResolver: getaddrinfo returns a sockaddr and inet_ntop takes strlen
The way this was written before was totally wrong.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-02 05:34:17 +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 cf569fd0d2 Global: OK over Ok
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-01 21:22:12 +01:00
Roopesh Chander abd02975c5 Deletion buttons are shown in red
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 23:53:09 +05:30
Roopesh Chander 46e9eddecc Tunnel edit: Highlight erroring field keys in red
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 23:45:48 +05:30
Roopesh Chander 55cf6e6181 Tunnels list: Swipe left to delete
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 23:45:48 +05:30
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 196daccdde QR code: Fix what happens when an error is shown
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 22:08:01 +05:30
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 c5e35fee1e Export: fix up export format
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-11-01 17:31:50 +01:00
Roopesh Chander 3611f8cf5a Tunnel errors: Consolidate tunnel activation errors into ErrorPresenter
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 16:58:33 +05:30
Roopesh Chander 39a457e402 TunnelsManager: Better errors
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 16:57:40 +05:30
Roopesh Chander 53a93e9b92 ConfigFile: WgQuickConfigFileWriter: Fix '[Peer]' section header
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 16:13:30 +05:30
Roopesh Chander 1377153bc6 Importing: Account for errors in showing the 'No configurations found' error
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 15:59:17 +05:30
Roopesh Chander 5138cdf9ea Tunnel detail: Fix deletion of tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 15:54:37 +05:30
Roopesh Chander 040ce32015 VPN: TunnelsManager: Fix deletion code
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 15:53:10 +05:30
Roopesh Chander 2870175ab2 VPN: Restart tunnel after modifying a currently active configuration
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 15:36:59 +05:30
Roopesh Chander b96e5ae563 QR code: Degrade gracefully when running on the simulator or on a device without a camera
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 11:45:44 +05:30
Roopesh Chander 95ad752d65 Revert "QR code: QR code scanning is not available in the simulator"
This reverts commit 9729386406.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 11:45:44 +05:30
Roopesh Chander 193b8c2596 Importing: Show error when the zip file contains no .conf files
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 11:45:44 +05:30
Roopesh Chander cf7966e876 VPN: We have to start observing the tunnelContainer before we attempt to activate it
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 11:45:44 +05:30
Roopesh Chander 066449b207 Importing: Error out on duplicate name
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 11:45:44 +05:30
Roopesh Chander bede8a17ad QR Code: Error out on duplicate name
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 11:45:44 +05:30
Roopesh Chander 050f8aa679 Tunnel edit: Error out on duplicate name when creating / modifying a tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 11:45:44 +05:30
Roopesh Chander bd1820e9f5 VPN: An ErrorPresenter class to consolidate showing of error alerts
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 11:45:44 +05:30
Roopesh Chander 92d3de1b0d VPN: Introduce an error enum for adding/modifying/removing tunnels
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 11:45:44 +05:30
Roopesh Chander dd33d74caf VPN: TunnelsManager: s/TunnelsManagerError/TunnelActivationError/g;
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 01:47:53 +05:30
Roopesh Chander 0aab067a53 VPN: TunnelsManager should keep track of tunnel names to prevent duplicate names
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-01 01:47:53 +05:30
Jason A. Donenfeld fff1a70ab9 UI: not all subclasses of CopyableLabelTableViewCell have a detailTextLabel, so generalize
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-31 16:38:05 +01:00
Jason A. Donenfeld ecb6035d36 TunnelManager: bound recursion in startActivation
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-31 15:58:03 +01:00
Roopesh Chander b2ab6b91a1 VPN: Retry startTunnel based on error conditions
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-31 16:42:29 +05:30
Roopesh Chander 059a989fc9 Tunnel list: Fix importing zip with multiple configurations
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-31 14:30:25 +05:30
Roopesh Chander 439f8f5a15 VPN: Support adding multiple configurations in one shot
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-31 14:29:54 +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
Jason A. Donenfeld 2e78aecd68 UI: More elegant copy-to-clipboard behavior
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-31 02:17:47 +01:00
Roopesh Chander e13bf133db QR code: QR code scanning is not available in the simulator
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-30 19:22:24 +05:30
Roopesh Chander 900b468622 Style: Remove 'Based on' attributions
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-30 19:07:07 +05:30
Roopesh Chander 904a080690 QR code: Show label overlay with info on how to generate the QR code
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-30 19:04:15 +05:30
Roopesh Chander cd7dd56980 Tunnel creation: Placeholders for Listen port, Pre-shared key, Persistent Keepalive
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-30 18:50:56 +05:30
Roopesh Chander fd241fac40 VPN: Refactor use of DNS resolution while activating the tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-30 18:36:28 +05:30
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
Roopesh Chander 60943d88e0 Tunnel view model: IP address can be specified without '/cidr'
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-30 13:46:10 +05:30
Roopesh Chander 7e4597e0d7 Model: IP address can be specified without '/cidr'
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-30 13:45:16 +05:30
Roopesh Chander 535f0e1e4a Fix error message: s/atleast/at least/g;
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-30 13:32:14 +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 dd1e800348 Style: simplify remaining headers
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-30 03:55:43 +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
Jason A. Donenfeld 8bf6ae8729 ZIP: fix linter warnings
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-30 00:50:01 +01:00
Roopesh Chander 38e4e274aa VPN: Better error messages
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-30 00:24:50 +05:30
Roopesh Chander 4cacf550a3 VPN: Specify an error when there are no peers with an endpoint
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 23:38:40 +05:30
Roopesh Chander 6fe0eb0bcf Export: Exporting config files
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 23:06:55 +05:30
Roopesh Chander fc78187d54 mv Parsing/ ConfigFile/
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 19:05:01 +05:30
Roopesh Chander ffc9b11efb Settings: Add a settings panel
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 17:34:09 +05:30
Roopesh Chander 3791b2e1b9 Model: Cap networkPrefixLengths to valid values
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 16:49:49 +05:30
Roopesh Chander 1f8585443d Tunnel edit: Support for exclude private IPs
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 16:44:47 +05:30
Roopesh Chander 12a87784dd Tunnel view model: Support for exclude private IPs
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 16:43:53 +05:30
Roopesh Chander c3c905884a Tunnel edit: Fix keyboard type for reused cells
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 16:43:12 +05:30
Roopesh Chander 92c0f2a17e Tunnel detail: Assume there's just one section per peer
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 13:02:11 +05:30
Roopesh Chander 81bbfcf46a Tunnel edit: Assume there's just one section per peer
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 12:47:00 +05:30
Roopesh Chander e4125f6d22 Tunnel edit: Set correct keyboard types
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 06:19:50 +05:30
Roopesh Chander b7aaae7513 VPN: If we don't have to make a DNS request, we shouldn't enter that status
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 06:19:50 +05:30
Roopesh Chander 21ac338f64 VPN: Cache DNS resolutions while the app is in memory
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 06:19:50 +05:30
Roopesh Chander e80e8b06c5 VPN: Reload the tunnel before starting it up
To avoid errors like this: https://stackoverflow.com/q/47550706

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 06:19:50 +05:30
Roopesh Chander 0baca8bf58 Tunnel list, detail: Deletion of tunnels
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 06:19:43 +05:30
Roopesh Chander c955c5a913 VPN: Fix deletion of tunnels
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 04:54:57 +05:30
Roopesh Chander 7f77d87e27 Fix: Make sure all prepareForReuse() implementations call super
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 02:27:14 +05:30
Roopesh Chander 0396a3550c Tunnel edit: Set correct title when editing
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 02:24:32 +05:30
Roopesh Chander d48a4382b7 Tunnel detail: Change title after editing completes
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 02:21:19 +05:30
Roopesh Chander 335618a8db Tunnel detail: Copying the public key
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 02:19:11 +05:30
Roopesh Chander 65d54d2e9f Tunnel editing: Fix cell class names
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 02:15:43 +05:30
Roopesh Chander 95a451f4e1 Import: Use the refactored function for Open-in
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 02:09:50 +05:30
Roopesh Chander dda43a0780 Import: Minor refactoring
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 02:08:40 +05:30
Roopesh Chander b5ef62ddee Import: Show errors when importing fails
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 02:03:39 +05:30
Roopesh Chander 3f97199f68 Import config: Directly add config, don't open up the editor
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 01:58:21 +05:30
Roopesh Chander 3356cfd688 Zip: Import configs from zip files
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 01:52:43 +05:30
Roopesh Chander de3dde84fd Zip: Add zip file reader
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 01:51:49 +05:30
Roopesh Chander 38b816ba4c Zip: Include minizip in our Xcode project
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 01:03:53 +05:30
Roopesh Chander 718311b32c Zip: Add code from the minizip project
Source: https://zlib.net/zlib-1.2.11.tar.gz

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-29 01:03:44 +05:30
Roopesh Chander e9d90a2f0d QR code: Save the scanned tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 23:32:15 +05:30
Jeroen Leenarts f57953767b QR code: Ask for title when scanning a QR code
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-28 23:20:18 +05:30
Roopesh Chander 981a745bcc QR code: Minor refactoring
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 23:19:56 +05:30
Jeroen Leenarts 1335724c58 QR code: Support some form of rotation.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-28 23:19:52 +05:30
Jeroen Leenarts 09a2284104 QR code: Make sure correct layering is used to make sure hint remains visible.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-28 23:19:45 +05:30
Roopesh Chander 08c855fce6 QR code: Integrate Eric's QR code scanner
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 22:22:32 +05:30
Roopesh Chander cd7baac0fc Info.plist: Indicate that the app shall use the camera
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 22:01:02 +05:30
Roopesh Chander fa410c668a Tunnels list: Need to pass in a name to the parser
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 21:59:52 +05:30
Roopesh Chander 4855eafb39 Revert "Parser: Interface name can be added after parsing"
This reverts commit d3a9e79149.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 21:57:18 +05:30
Eric Kuck 3082863fd1 QR code: Ability to add tunnels with a QR code scan
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-10-28 18:26:41 +05:30
Roopesh Chander 3d4409fc93 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.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 18:13:47 +05:30
Roopesh Chander a680fdf2bd VPN: A tunnel may be already active on app startup
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 18:09:38 +05:30
Roopesh Chander 269a6c3719 VPN: Remove ability to deactivate the tunnel while resolving DNS
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 17:47:01 +05:30
Roopesh Chander 493166bd70 VPN: DNSResolver: Resolve multiple endpoints in parallel
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 17:44:25 +05:30
Roopesh Chander dfbdcf3c28 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.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 14:56:15 +05:30
Roopesh Chander 1870a3d364 VPN: Save the tunnel name when modifying a tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 14:55:24 +05:30
Roopesh Chander 31e5d33114 Tunnel detail: For now, don't allow cancelling when resolving domains is in progress
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 14:54:41 +05:30
Roopesh Chander 78ab196a28 VPN: Cleaner derivation of subnet mask from CIDR network prefix length
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-28 11:51:18 +05:30
Roopesh Chander 011e1eeab8 Tunnel detail: The tableView should have selection disabled
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 19:14:08 +05:30
Roopesh Chander a3e912a21f VPN: Better error and status handling
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 19:07:16 +05:30
Roopesh Chander dba3226a34 Xcode: Disable bitcode
Enabling bitcode generates a linker error when linking with libwg-go.a

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 19:07:16 +05:30
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 a08e08fe2e 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.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 19:07:16 +05:30
Roopesh Chander 8d2bc4524a VPN: Fix DNS resolution API
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 2c591f33c6 NE: Include the network extension in the project
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 19:07:16 +05:30
Roopesh Chander e5840a1959 VPN: Perform DNS resolution before starting the tunnel
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 19:07:16 +05:30