Commit Graph

324 Commits

Author SHA1 Message Date
Samuel Holland
e8d8d5dc29 Keypair: Minimize the scope of warning suppression
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-05-02 10:31:25 -05:00
Samuel Holland
3e8d457501 KeyEncoding: Address lints/warnings and match line length
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-05-02 10:31:25 -05:00
Samuel Holland
aa92c4a9d5 global: Add or update copyright headers in Java code
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-05-02 10:31:25 -05:00
Harsh Shandilya
24572aa861 global: Some more lint cleanup
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-02 17:14:35 +02:00
Jason A. Donenfeld
cb6681b15a drawable: add adaptive icon
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-02 07:19:05 +02:00
Jason A. Donenfeld
ba1b6c7095 ZipExporterPreference: account for directory already existing
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-30 19:55:06 +02:00
Samuel Holland
843003f436 global: Clean up Java
Address Java and Android lints.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-04-30 11:50:21 -05:00
Samuel Holland
8e4fb91a28 global: Clean up XML
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-04-30 11:39:23 -05:00
Samuel Holland
7eedf08d4b global: Automatic code formatting
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-04-30 11:39:12 -05:00
Jason A. Donenfeld
05b4e395a9 Tunnel importer: stricter file filters
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-30 17:37:34 +02:00
Jason A. Donenfeld
3c84db7788 Preferences: use v14 material style
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-30 15:35:21 +02:00
Jason A. Donenfeld
a47ddf57d1 ZipExporterPreference: requireNonNull is redundant
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-30 15:12:49 +02:00
Harsh Shandilya
f9d68185e2 wg: Collapse fab when pressing back before exiting
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-30 17:33:24 +05:30
Harsh Shandilya
f1fa46829d SettingsActivity: Migrate permissions check to AppCompat
Pretty straightforward, I was clearly overthinking this.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-30 17:30:25 +05:30
Harsh Shandilya
a6e530049c ZipExporterPreference: Correctly get preference activity
In AppCompat based preferences, this#getContext returns an
object of android.view.ContextThemeWrapper class from where
we can safely extract a reference to our parent activity.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-30 17:30:25 +05:30
Harsh Shandilya
77c0d4dfa6 TunnelListFragment: Use Collections methods in place of Arrays
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-30 17:30:25 +05:30
Harsh Shandilya
7e415a62c7 wg: Break out crossport dependency
Replace all crossport uses with upstream design
support library components.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-30 17:30:25 +05:30
Harsh Shandilya
fe4cc22ca0 SettingsActivity: Gracefully exit when options menu home is pressed
This is an activity, so it does not join the fragment backstack, but
instead piles on top

SettingsActivity
| -> MainActivity
| -> EditorFragment
| -> DetailFragment
| -> ListFragment

Without overriding the back button in the toolbar, it simply
kills the entire state on MainActivity and causes it to reload.
By calling finish() on the activity when home is pressed from the
item menu we can silently make it die without affecting any underlying
states held by MainActivity and instead return to the exact fragment
we launched settings from.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-30 17:30:24 +05:30
Harsh Shandilya
4fc1e61a83 SettingsActivity: Define preferenceTheme for AppCompat
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-30 17:30:24 +05:30
Harsh Shandilya
e7e571a301 wg: Migrate menu visibility to AppCompat
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-30 17:30:24 +05:30
Harsh Shandilya
425d194e4f wg: Add and use dummy AppTheme
Preparation for when the app will start carrying
colors reflecting the WireGuard brand.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-30 17:30:24 +05:30
Harsh Shandilya
4ec0b3a908 Prefer AppCompat classes
AppCompat is the preferred way to go for any app targetting
a wider range of SDKs.

Replace all activities and fragments with their AppCompat
variants and fixup method calls to use support variants.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-30 17:30:24 +05:30
Jason A. Donenfeld
596904977a TunnelDetailFragment: rewrite and simplify
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-30 05:29:54 +02:00
Jason A. Donenfeld
73b0c4ea81 TunnelEditorFragment: rewrite and simplify
This should remove some null pointer dereferences and overall make the
thing more robust.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-30 05:29:54 +02:00
Jason A. Donenfeld
622f41f11f Allow exporting to zip file
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-29 07:53:56 +02:00
Jason A. Donenfeld
f4e462fabd Allow importing from zip file
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-28 21:55:42 +02:00
Harsh Shandilya
217ab5e17f config: Minor cleanup
- Stop implicitly assuming locales in String.format
- Cleanup method visibilities
- Improve uses of Integer methods
- Remove unused getToken method

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-28 06:07:48 +02:00
Harsh Shandilya
ba862b166b Quick cleanup across the board
- Clean up imports
- Adjust method visibility
- Drop in NonNull annotations where needed
- Prevent potential NPEs from nulled getActivity calls
- Remove unused methods

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-28 06:07:48 +02:00
Jason A. Donenfeld
63071f57b7 Use validation instead of two-way binding
This is insane, but it appears to be working. We essentially store
things in a separate class for editing, and then commit it back at a
given time.

This business with onViewStateRestored in both TunnelEditorFragment and
in TunnelDetailFragment is buggy and likely wrong.

In general TunnelEditorFragment should probably be rewritten. The
relationship with the changed name is not clear.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-28 04:51:43 +02:00
Jason A. Donenfeld
693228985d Do not do DNS lookups for IPs
This involves reflection, which is a bummer, but it's better than doing
unnecessary DNS lookups.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-27 18:34:52 +02:00
Jason A. Donenfeld
9ee976823d Throw IllegalArgumentExceptions when arguments are bad
This will make the two way data binding crash more, but it will improve
the robustness of the config file parser, which deals with exceptions
gracefully, and when we move to one way data binding, it will help with
that too.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-27 05:43:07 +02:00
Jason A. Donenfeld
31101f2418 WgQuickBackend: always create configuration file
It might be removed on an update.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-26 19:42:55 +02:00
Jason A. Donenfeld
8d2510ae9e Manifest: disable always-on VPN
We don't actually comprehend how this works yet, so disable it. But
we'll need to add support for this at some point.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-26 02:25:55 +02:00
Jason A. Donenfeld
532edf774a GoBackend: bring down tunnels when revoked or disconnected
This synchronizes the OS's connection state with ours, such as when the
user disconnects using the system UI.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-25 18:27:18 +02:00
Jason A. Donenfeld
2c9e11f4f2 Curve25519: fix up spacing
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-25 14:36:51 +02:00
Jason A. Donenfeld
88cf839c90 Update application state based on wg-quick
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-23 17:04:17 +02:00
Jason A. Donenfeld
80f22e6c3d Determine MTU automatically
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-18 16:44:05 +02:00
Jason A. Donenfeld
53d29b312f More javafication
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-18 05:28:31 +02:00
Jason A. Donenfeld
140fb395dc GoBackend: default MTU is 1280
This sucks, but it works with mobile networks. Later we can do something
sophisticated like we do with wg-quick.c, but not now.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 05:59:23 +02:00
Jason A. Donenfeld
b5360871e8 Remove sloppy java with enterprise java horrors
Since the amount of mind numbing boiler plate has been increased, this
must be the proper way to do things.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 05:27:05 +02:00
Aurélien Chabot
4c9143c835 GoBackend: Handle vpn service expiration
After a timeout the android system is destroying the vpn service when it
is not used. By using a completable future we can wait for the service
to be relaunch on demand.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 02:15:24 +02:00
Aurélien Chabot
74eae55c87 Config: Handle multiple address or dns in config file
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 02:15:24 +02:00
Aurélien Chabot
44698bb000 GoBackend: Add support for multiple address and dns as a comma separated list
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 02:15:24 +02:00
Aurélien Chabot
175f7e16dd GoBackend: parse allowed ips
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 02:15:24 +02:00
Aurélien Chabot
c6d311923a GoBackend: Parse the dns address
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 02:15:24 +02:00
Aurélien Chabot
6878aba911 GoBackend: IPv6 handling
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 02:15:24 +02:00
Aurélien Chabot
d97312b96a GoBackend: Resolve endpoint before passing it to the go lib
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 02:15:24 +02:00
Aurélien Chabot
9dfab4d60f GoBackend: Use the android VpnService to encapsulate the go backend
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 02:15:24 +02:00
Jason A. Donenfeld
0ea6f73332 GoBackend: integrate into app
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-02-17 21:14:09 +01:00
Jason A. Donenfeld
d1c863b16e KeyEncoding: add constant time hex implementation
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-02-13 19:47:31 +01:00