Commit Graph

165 Commits

Author SHA1 Message Date
Jason A. Donenfeld e1198b6e08 macOS: Better highlighter default value and move c implementation
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-01-21 22:22:20 +01:00
Roopesh Chander 15517c4c3d macOS: Refactor syntax highlighting
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-22 01:18:07 +05:30
Jason A. Donenfeld d06887d435 Xcode: move directives to toplevel project when possible
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-01-18 09:32:49 +01:00
Roopesh Chander dc8f27c5c3 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.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-18 01:34:24 +05:30
Roopesh Chander e29cf19fdd 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

Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-16 01:26:10 +05:30
Roopesh Chander 13e8c6b178 macOS: Support for on-demand activation
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:36 +05:30
Roopesh Chander c2a6241b5c macOS: Refactor config file parsing
- To report more fine grained errors
- To make the parse errors conform to WireGuardAppError

Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:34 +05:30
Eric Kuck 59bfa7f1df Added syntax highlighting conf textview
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2019-01-14 14:52:34 +05:30
Roopesh Chander c2633987c3 macOS: Tunnel edit view
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:33 +05:30
Roopesh Chander f7b2f73015 macOS: Rename *Cell to *Row
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:33 +05:30
Roopesh Chander cb778fe7e0 macOS: Consolidate presenting of the import panel
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:33 +05:30
Roopesh Chander f3c2904241 macOS: Manage tunnels: Handle the case when there are no tunnels
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:33 +05:30
Roopesh Chander f6ea25573b macOS: Xcode: Add ablity to save files
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:32 +05:30
Roopesh Chander ada7db3dca macOS: Manage tunnels: Tunnel detail view
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:31 +05:30
Roopesh Chander 7934d6b0c7 macOS: Manage tunnels window: Tunnels list
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:30 +05:30
Roopesh Chander 545f8c88f4 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.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:30 +05:30
Roopesh Chander 6a27626fc0 iOS: Refactor importFromFile
So that it can be used in macOS as well

Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:29 +05:30
Roopesh Chander b5751b6321 macOS: Create status bar with tunnel names
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:29 +05:30
Roopesh Chander 5c7a149167 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

Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:29 +05:30
Roopesh Chander d7d4355f5e Make app groups work on both iOS and macOS
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:28 +05:30
Roopesh Chander 55d6961a2f macOS: Add Network Extensions capability to app
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:28 +05:30
Roopesh Chander c8cd663a05 iOS: Fix WireGuardNetworkExtensioniOS target
- Rename WireGuardNetworkExtension.entitlements to WireGuardNetworkExtension_iOS.entitlements

Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:28 +05:30
Roopesh Chander a754c4d7ab iOS: Fix WireGuardiOS target
- Move Info.plist and entitlements to WireGuard/UI/iOS/

Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:28 +05:30
Roopesh Chander 95415cd917 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

Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:28 +05:30
Roopesh Chander b32b897181 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

Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:27 +05:30
Roopesh Chander d5c1acb57e macOS: WireGuardNetworkExtensionmacOS depends on WireGuardGoBridgemacOS
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:27 +05:30
Roopesh Chander 573f9640de macOS: Add WireGuardNetworkExtensionmacOS target
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:27 +05:30
Roopesh Chander f6772dc353 macOS: Add WireGuardmacOS target
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:27 +05:30
Roopesh Chander 0cbe66df99 Xcode: Add WireGuardGoBridgemacOS target
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:27 +05:30
Roopesh Chander 3cd33ebe8f Move iOS images and storyboard into UI/iOS/ folder
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:27 +05:30
Roopesh Chander c7a40d3cb0 Xcode: Rename iOS targets to include an 'iOS' suffix
But keep the PRODUCT_NAME as 'WireGuard', not 'WireGuardiOS'.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:26 +05:30
Roopesh Chander d02b0fd10e xcconfig: Make app id platform-specific
Signed-off-by: Roopesh Chander <roop@roopc.net>
2019-01-14 14:52:26 +05:30
Roopesh Chander c563a24348 minizip: Remove zip encryption code
We can now remove -DNOCRYPT cflag while compiling

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-25 12:48:04 +05:30
Roopesh Chander fd29cf3402 TunnelStatus: Absorb NEVPNStatus+CustomStringConvertible
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-22 15:46:28 +05:30
Eric Kuck 0bec5b04b0 All models now Equatable
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 22:57:17 -06:00
Jason A. Donenfeld aede9f6e45 Move model helpers to model directory
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-12-22 01:36:42 +01:00
Eric Kuck 1fecd8eb6c providerConfiguration is now a WgQuickConfig
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 16:32:08 -06:00
Eric Kuck f6af9d9ffb All migration stuff moved to one gross file
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 12:51:14 -06:00
Eric Kuck 8553723e04 Updated NETunnelProvider save format
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-21 16:42:16 +01:00
Roopesh Chander 0552d75aa1 Localize all the things
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-21 18:34:09 +05:30
Eric Kuck 5618c465a2 Added a String->[String] helper
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-20 10:46:26 -06:00
Roopesh Chander 2582ddd6f6 Error handling: Add info on the underlying system error to error alerts
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-17 19:04:17 +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
Roopesh Chander 2a22c0f2d6 Provide mock tunnels for the Simulator
To help in generation of screenshots for the App Store

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-16 01:15:10 +05:30
Eric Kuck ccd8cfe478 KeyValueCells now share code
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-14 20:02:37 -06:00
Eric Kuck cb051f695d Reorganized project structure
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
2018-12-14 17:27:11 -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
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
Roopesh Chander 740ffd68b6 Remove unused code: InternetReachability
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-13 23:45:21 +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 6528a581de mv WireGuard/WireGuard/VPN/ WireGuard/WireGuard/Tunnel/
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-13 12:14:21 +05:30
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 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
Roopesh Chander 782dd2ea4e Error handling: Introduce a WireGuardResult type to handle errors in callbacks across the app
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
Roopesh Chander c9267ba634 Error handling: Introduce a WireGuardAppError protocol to manage errors
The alert strings shall be located next to where the errors are declared.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-07 12:36:19 +05:30
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 e1b258353c VPN: Error out when tunnel activation fails because there's no internet
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-12-03 18:51:42 +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 a3bc306b6e Xcode: Add app groups capability
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-29 12:01:45 +05:30
Roopesh Chander 1dac181803 Exporting: Refactor out zip exporting into a separate class
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-15 13:39:56 +05:30
Roopesh Chander 203d6b4596 Importing: Refactor out zip importing into a separate class
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-14 18:52:10 +05:30
Roopesh Chander cc122d7463 Model, Tunnels manager: Rewrite the model for VPN-on-demand
The VPN-on-demand settings should not be part of the tunnel
configuration. Rather, the onDemandRules stored in the
tunnel provider configuration serve as the one place
where the VPN-on-demand settings are stored.

Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-12 19:24:13 +05:30
Roopesh Chander 0f03ffc920 Model: ActivityType enum to represent VPN-on-demand options
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-10 19:17:24 +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 a1070d2b29 Remove unused file PacketTunnelOptionKey.swift
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 18:59:16 +05:30
Roopesh Chander e66cf5264a Move logic to extension: NETunnelProviderProtocol extension code should be shared
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-08 17:52:01 +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 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 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 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
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 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
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 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
Roopesh Chander 1e5bd7e458 Add document icon
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-11-02 17:39:43 +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
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 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
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 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 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 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 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 3044637196 NE: Add bridging header
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 3f4d12c404 VPN: DNSResolver: A class that does DNS resolution using getaddrinfo
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 19:07:16 +05:30
Roopesh Chander ff7adb8bc8 Import: Support for importing a config file from file providers
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 15:13:02 +05:30
Roopesh Chander e0c7006dbc Config file: Parsing a wg-quick config file
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 15:13:01 +05:30
Roopesh Chander c689be7eff Crypto: Swift wrapper for the Curve25519 C code
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 15:13:01 +05:30
Roopesh Chander acfa77f3df Crypto: Add Curve25519 C code to project
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 15:13:01 +05:30
Roopesh Chander c14d816b87 Tunnel detail: Start off with the tunnel detail view
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 15:13:01 +05:30
Roopesh Chander e1b8b67890 Model for DNS server
Signed-off-by: Roopesh Chander <roop@roopc.net>
2018-10-27 15:13:01 +05:30