Commit Graph

586 Commits

Author SHA1 Message Date
Jason A. Donenfeld
a2ccbf003c TunnelManager: new intents
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-04 07:06:28 +02:00
Jason A. Donenfeld
10ca2c8681 Preferences: don't use round icon
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-03 16:15:30 +02:00
Harsh Shandilya
fd63e496e5 Preferences: Move version pref to top and add icon
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-06-02 19:35:11 +02:00
Jason A. Donenfeld
567503abc7 Backends: print versions somewhere in log
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-02 19:26:33 +02:00
Harsh Shandilya
4671f59c67 android: Cleanup classes
- Use final modifer wherever possible
- Use try-with-resources for input/output streams

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-06-02 19:14:56 +02:00
Harsh Shandilya
4986d92f3d crypto: KeyEncoding: Fix style
- Replace python style variable names with camel case
- Don't declare multiple variables in the same line

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-06-02 19:12:30 +02:00
Jason A. Donenfeld
0b1c7cc35f Topic: John does things differently
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-02 18:44:35 +02:00
Jason A. Donenfeld
9e278c88e6 ExporterPreferences: disable control immediately
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-02 18:38:56 +02:00
Jason A. Donenfeld
c3246060f5 Preferences: add log exporter
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-02 18:35:09 +02:00
Jason A. Donenfeld
b7e025e381 libwg-go: fix style
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-01 18:27:30 +02:00
Jason A. Donenfeld
858ec4c0ab Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-01 18:01:25 +02:00
Jason A. Donenfeld
65292aaa79 Topic: make reentrant
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-01 17:34:59 +02:00
Jason A. Donenfeld
3d57eb633e BaseActivity: flush themed icon cache on theme change
The most terrible hack you have ever seen.

The drawable cache isn't properly flushed when changing the theme -- a
frameworks bug, evidently -- so we work around it by digging deep into
the mud.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-01 16:48:08 +02:00
Jason A. Donenfeld
1e45898d70 Settings: add version
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-01 16:06:56 +02:00
Jason A. Donenfeld
61431fb579 colors: final touches
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-01 15:18:23 +02:00
Harsh Shandilya
00d48e867b ui: Use better list colors in night mode
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-06-01 18:42:20 +05:30
Harsh Shandilya
d5df0c10ab TunnelListFragment: Dejank action mode title
When unselecting items, the toolbar briefly says
'0 items selected' before it reverts back to the
non-action mode toolbar which feels janky at best.

To mitigate this, just set a blank title to the action
mode toolbar when item count is 0, to facilitate the
smoothness of the transition to non-action mode toolbar.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-06-01 18:42:20 +05:30
Harsh Shandilya
af814951f3 fab: Make label responsive to night mode
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-06-01 18:42:20 +05:30
Harsh Shandilya
a54a03aa2f FloatingActionButton: Cleanup declaration of TranslucentLayerDrawable class
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-06-01 18:42:20 +05:30
Harsh Shandilya
4edfdd8f3b FloatingActionButton: Make attribute grabbing not be terrible
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-06-01 18:42:19 +05:30
Jason A. Donenfeld
32d669a661 theme: add dark theme with toggle
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-01 14:57:25 +02:00
Jason A. Donenfeld
918076a670 global: fix theme situation and clean up cruft while adding more cruft
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-06-01 14:57:25 +02:00
Harsh Shandilya
752e61d1c7 fab: default to app theme colors
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-06-01 03:19:26 +02:00
Harsh Shandilya
125f725a03 fab: use AppCompatTextView for label
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-06-01 03:17:29 +02:00
Harsh Shandilya
3c84b48f08 fab: cleanup
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-06-01 03:16:32 +02:00
Jason A. Donenfeld
8c32c32c2b wg-quick: don't break push notifications
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-31 16:40:50 +02:00
Jason A. Donenfeld
e664a05d4b KeyEncoding: more constant time
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-30 23:31:20 +02:00
Jason A. Donenfeld
ba4672b422 Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-29 19:08:55 +02:00
Jason A. Donenfeld
09833a1ba5 FloatingActionButton: import cleaned up getbase code
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-29 19:03:47 +02:00
Jason A. Donenfeld
ded0191aae SharedLibraryLoader: introduce to work around Samsung PackageManager bugs
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-29 05:09:37 +02:00
Jason A. Donenfeld
9245e9536a Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-27 19:00:38 +02:00
Jason A. Donenfeld
292df12175 Support always-on-vpn
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-27 18:57:52 +02:00
Jason A. Donenfeld
f988306c17 libwg-go: Saner way to deal with sockets
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-27 18:17:55 +02:00
Jason A. Donenfeld
64ce6cd5a2 EditorFragment: show toast on creation too
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-27 04:08:23 +02:00
Jason A. Donenfeld
5476fc2228 Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-26 13:56:35 +02:00
Jason A. Donenfeld
7120ef9ffd libwg-go: try no stickiness and no roaming
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-26 03:03:15 +02:00
Jason A. Donenfeld
75f4478fb5 Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-24 19:26:48 +02:00
Jason A. Donenfeld
23c4174fcd libwg-go: reenable sticky sockets, just slightly less sticky
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-24 18:39:29 +02:00
Jason A. Donenfeld
5754df6b71 Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-23 17:12:18 +02:00
Jason A. Donenfeld
62dbeca732 libwg-go: use gopath
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-23 17:01:40 +02:00
Jason A. Donenfeld
a533be82e8 libwg-go: No sticky sockets with VPNService.java
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-22 23:28:54 +02:00
Jason A. Donenfeld
52d90724bc Fix hang and version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-21 14:17:34 +02:00
Jason A. Donenfeld
4863bd647a Add stacktrace via SIGUSR2
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-21 14:13:55 +02:00
Jason A. Donenfeld
cb62dc8fa2 Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-21 04:23:31 +02:00
Jason A. Donenfeld
e3442cde56 libwg-go: better up/down sync
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-16 22:24:20 +02:00
Jason A. Donenfeld
694577b9b4 ExceptionLoggers: never have a null message
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-16 17:36:25 +02:00
Harsh Shandilya
9c3091456d android: Directly use views for snackbars
There should be no need to deference an extra variable.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-16 17:31:31 +02:00
Jason A. Donenfeld
515be5e453 libwg-go: more fixes
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-15 21:57:17 +02:00
Jason A. Donenfeld
b89b9e89c2 build: version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-15 13:44:59 +02:00
Jason A. Donenfeld
9d20c378ba libwg-go: bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-15 13:44:22 +02:00
Jason A. Donenfeld
f661c67c89 tools: move wg-quick to main wireguard repo
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-14 18:25:42 +02:00
Jason A. Donenfeld
e1ac4247ff libwg-go: make changes for recent go code
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-14 17:10:59 +02:00
Jason A. Donenfeld
34422e57a9 build: another bump for mistake
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-10 17:14:48 +02:00
Jason A. Donenfeld
088ff2dbda build: version bump and fix disaster
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-10 16:18:34 +02:00
Jason A. Donenfeld
2853515e8f build: version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-09 18:49:03 +02:00
Jason A. Donenfeld
95dbb14cb5 theme: revert to old color scheme
Noble effort, but ultimately ugly.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-09 18:38:13 +02:00
Harsh Shandilya
0b9bcf0f9e global: Cleanup line lengths and misc lint warnings
I know we decided to ditch the idea of shutting up "Exception
thrown with empty param" warnings but this pesters me too
much and we can instead just treat this as a weird future proofing
thing if and when we end up needing the exception messages.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-09 18:16:14 +02:00
Harsh Shandilya
e2ab2210cd MainActivity: Nip out as early as possible when moving to same fragment
Save the useless logging and fragment manager object creation.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-09 18:16:09 +02:00
Jason A. Donenfeld
332c35747e libwg-go: new timer system upstream
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-09 17:38:27 +02:00
Jason A. Donenfeld
ebe3297c83 libwg-go: ensure local Go instance is patched
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-09 17:33:36 +02:00
Samuel Holland
7f6c861fd6 mipmap: Fix formatting of launcher icon XML
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-05-05 10:11:35 -05:00
Harsh Shandilya
58b9a88bcb styles: Fixup CAB background color
Long pressing any list item entry would cause the action bar to
use the dark color from the parent theme -- fix that.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-05 10:11:20 -05:00
Harsh Shandilya
e4eac7a3cf drawables: Introduce material iconography
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-05 10:11:14 -05:00
Harsh Shandilya
55ec3046d1 styles: Propagate WireGuard blue in UI
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-05 10:08:49 -05:00
Harsh Shandilya
6bd4f7495d styles: Propagate WireGuard red in UI
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-05 10:08:24 -05:00
Harsh Shandilya
fd571c53ce TunnelEditor: Add toast messages to success events
Letting the user know that the operation went successfully
via visual cues is a nice UX touch.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-05 10:08:14 -05:00
Jason A. Donenfeld
5ed36d7346 wireguard-go: bump submodule
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-05 06:09:45 +02:00
Harsh Shandilya
37413f2fb4 TunnelEditor: Remove unused parameter
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-03 23:49:14 -05:00
Harsh Shandilya
59aa3035a8 ui: Use a proper CardView based layout
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-03 23:45:03 -05:00
Jason A. Donenfeld
46b374cf25 tools: include libmnl paths after system paths for ndk 17
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-03 19:15:09 -05:00
Jason A. Donenfeld
b276833b33 config: loosen parser to match reality
Mid-line comments, mixed case.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-03 19:15:09 -05:00
Jason A. Donenfeld
f77eac6796 global: fix up copyrights
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-03 19:15:09 -05:00
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
a46b2eb9e5 libwg-go: avoid phony target and update go
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-02 06:02:15 +02:00
Harsh Shandilya
96ebf4cd51 libwg-go: Ignore go{path,root}
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-05-02 03:40:02 +02:00
Jason A. Donenfeld
92fc1dbac8 libwg-go: do not deadlock on Close
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-05-01 17:48:59 +02:00
Jason A. Donenfeld
997138cd22 Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-30 23:11:32 +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
Samuel Holland
e2636320b7 app: Sort dependencies
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-04-30 11:38:15 -05:00
Jason A. Donenfeld
6ce739f01f libwg-go: use system Go when possible
We're still maybe curlzipping and using a binary distribution of Go, but
at least this is only the case on machines that don't have go.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-30 18:19:37 +02: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
65ca5979d2 proguard: enable
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-30 16:57:57 +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
431b75be15 wg-build: Upgrade databinding library to 3.1.2
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2018-04-30 17:30:24 +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
Harsh Shandilya
af57824c14 wireguard: Extract dependency versions to ext struct
Maintain common versions in a single place

Also upgraded the support library to 27.1.1 and
databinding library to 3.1.1.

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
592c5cbbd6 Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-28 04:56:12 +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
254cc4cc87 Latest go changes
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
86ffb24748 Use variable map instead of shell switch
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-25 14:43:46 +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
e6838f9cb0 Use binary distro of Golang
This is a bummer, but Gradle already specifies tons of specific versions
of various binary components, so this is not materially different than
the rest of how this whole thing works.

It also allows us to specify the Go version that will actually build a
working binary of wireguard-go, since all of the Go bugs mean not every
version works equally. We do *not* want to use whatever version a distro
happens to be shipping.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-24 15:34:13 +02:00
Jason A. Donenfeld
83b30bed7b Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-23 17:04:17 +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
a1c6f4b3b7 Version bump
Due to https://github.com/golang/go/issues/24950

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-19 18:55:25 +02:00
Jason A. Donenfeld
32fcb3fccf Work around go fd closing limitation and version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-19 17:11:02 +02:00
Jason A. Donenfeld
e7c6e487ea Version bump for go race condition
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-18 21:33:18 +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
ed42e30069 Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-18 09:56:06 +02:00
Jason A. Donenfeld
dc1b808f8e Update dependencies
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-18 09:51:55 +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
69f1a35a3f Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 06:02:03 +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
Jason A. Donenfeld
e40c579b0e global: update various upstreams
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-17 02:25:35 +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
19aec7c5c6 GoBackend: support NO_PI mode
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-02-28 19:59:50 +01:00
Jason A. Donenfeld
f2113f80db Update submodules
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-02-20 17:01:54 +01: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
b923f7bc57 wg: bump commit
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
Samuel Holland
b22e2b259b manifest: Add permission to read external storage
This fixes support for file managers that don't proxy the file access
from the file selection dialog through a content provider, and just
return a raw file:// URL. In this case, resolver.openInputStream() tries
to open the file directly, and fails with "Permission denied".

Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-02-03 12:47:14 -06:00
Jason A. Donenfeld
a66348c315 Version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-18 23:17:29 +01:00
Samuel Holland
c683d23125 FileConfigStore: Warn for deletion failure in exception path
There's nothing we can do about it at this point; we're already rolling
back changes.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-18 04:12:54 -06:00
Samuel Holland
23535c0577 WgQuickBackend: Always pass the full path to wg-quick
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-18 04:10:58 -06:00
Samuel Holland
8dde6c3c0f fragments: Be extra paranoid about the binding getting destroyed
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-18 04:10:58 -06:00
Samuel Holland
54f201174d TunnelManager: Use constants directly where appropriate
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-17 14:35:39 -06:00
Samuel Holland
fb3138bdda Peer: Add missing @Override
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-17 14:35:39 -06:00
Samuel Holland
f63aeea6b8 WgQuickBackend: Clean up unused fields and imports
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-17 14:35:39 -06:00
Samuel Holland
09c207b8a3 ToolsInstaller: Remove double-checked locking
It can't work and may be crashing the runtime.

Use a lock object to avoid exposing the synchronization in the class's
interface.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-17 14:35:39 -06:00
Samuel Holland
d56eda2fd6 RootShell: Use a lock object instead of sync methods
This avoids exposing the synchronization implementation details
in the class's interface.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-17 14:35:14 -06:00
Jason A. Donenfeld
75aeec035c Build bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-10 23:52:02 +01:00
Jason A. Donenfeld
c1cc2774be Manifest: show back arrow on sub activities
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-10 23:52:02 +01:00
Jason A. Donenfeld
7e06768f75 ToolsInstaller: symlink tools always
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-10 23:47:13 +01:00
Jason A. Donenfeld
7a618c1463 FileConfigStore: cleanup on rename problem
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-10 23:26:12 +01:00
Samuel Holland
f8ee7dcce9 QuickTileService: Fix crash opening activity
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-10 11:13:16 -06:00
Samuel Holland
30901a6152 TunnelController: Use helper function to unwrap the Throwable
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-10 00:03:45 -06:00
Samuel Holland
7b9c1a536c model: Use ConfigStore.rename() to avoid recreating tunnels
Rename all of the functions to be in line with setConfig/setState

Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-10 00:03:03 -06:00
Samuel Holland
951afaa9b2 ConfigStore: Add a rename method and implement it
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-10 00:01:52 -06:00
Samuel Holland
5ce7eba2bf FileConfigStore: Simplify error handling
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-09 23:57:15 -06:00
Jason A. Donenfeld
dfa4a2eb9d WgQuickBackend: properly report exception so alert shows
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-10 03:16:42 +01:00
Jason A. Donenfeld
df3062c7ad Tunnel: ifname has max len 15
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-10 02:49:06 +01:00
Jason A. Donenfeld
b3e928c1bf tools: error if setconf fails
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-10 02:48:05 +01:00
Jason A. Donenfeld
01faa9b358 tools: ifname has max len 15
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-10 02:38:29 +01:00
Jason A. Donenfeld
a42892bc28 TunnelEditorFragment: do not pass null localConfig
Otherwise we might dereference it, per this play store gathered trace:

Xiaomi Redmi 3S (land), 2048MB RAM, Android 7.1
java.lang.NullPointerException:
at com.wireguard.android.model.Tunnel.setConfig (Tunnel.java:118)
at com.wireguard.android.fragment.TunnelEditorFragment.onOptionsItemSelected (TunnelEditorFragment.java:160)
at android.app.Fragment.performOptionsItemSelected (Fragment.java:2478)
at android.app.FragmentManagerImpl.dispatchOptionsItemSelected (FragmentManager.java:2182)
at android.app.FragmentController.dispatchOptionsItemSelected (FragmentController.java:336)
at android.app.Activity.onMenuItemSelected (Activity.java:3211)
at com.android.internal.policy.PhoneWindow.onMenuItemSelected (PhoneWindow.java:1219)
at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected (MenuBuilder.java:761)
at com.android.internal.view.menu.MenuItemImpl.invoke (MenuItemImpl.java:152)
at com.android.internal.view.menu.MenuBuilder.performItemAction (MenuBuilder.java:904)
at com.android.internal.view.menu.MenuBuilder.performItemAction (MenuBuilder.java:894)
at android.widget.ActionMenuView.invokeItem (ActionMenuView.java:616)
at com.android.internal.view.menu.ActionMenuItemView.onClick (ActionMenuItemView.java:152)
at android.view.View.performClick (View.java:5637)
at android.view.View$PerformClick.run (View.java:22433)
at android.os.Handler.handleCallback (Handler.java:751)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:153)
at android.app.ActivityThread.main (ActivityThread.java:6244)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:891)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:781)

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-10 00:54:59 +01:00
Jason A. Donenfeld
138ba5c416 QuickTileService: sometimes tile is null
According to play store reports, such as:

wt88047, 0MB RAM, Android 8.1
java.lang.NullPointerException:
at com.wireguard.android.QuickTileService.updateTile (QuickTileService.java:97)
at com.wireguard.android.QuickTileService.onStartListening (QuickTileService.java:56)
at android.service.quicksettings.TileService$H.handleMessage (TileService.java:407)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:164)
at android.app.ActivityThread.main (ActivityThread.java:6520)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:442)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-10 00:41:28 +01:00
Samuel Holland
c6bdeb1d45 Prepare version 0.3.0
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-09 10:31:08 -06:00
Samuel Holland
17f8c65b2e WgQuickBackend: Finish the implementation
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-09 10:31:08 -06:00
Samuel Holland
933a685585 model: Chain completions to avoid race conditions
Otherwise getConfigAsync().thenCompose(x -> setState()) would be unsafe.

This reverts commit a6595a273afd50524cc66765c6bfbdcc34cb12e4.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-09 10:03:29 -06:00
Samuel Holland
daacc06a0d global: Clean up error logging
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-09 09:37:49 -06:00
Samuel Holland
a1d955ef62 WgQuickBackend: Log when tunnels can't be enumerated
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-09 09:18:03 -06:00
Samuel Holland
ca077dd090 RootShell: Improve shell start error handling
No need to catch and re-throw exceptions before starting the process. If
running `su` itself fails, there's no (functional) root, so report that.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-09 09:17:08 -06:00
Samuel Holland
3d6737e32f RootShell: Be stricter about command delimiters
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-09 09:16:53 -06:00
Jason A. Donenfeld
643b698f30 RootShell: stop if we can't start
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-09 08:39:07 -06:00
Jason A. Donenfeld
23c09eb655 RootShell: hoist out synchronization
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-09 15:19:50 +01:00
Jason A. Donenfeld
14638b10ae tools: try not to overflow
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-09 15:15:15 +01:00
Samuel Holland
426fa7d50b ToolsInstaller: Propagate NoRootException properly
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-09 08:13:32 -06:00
Samuel Holland
52e8eef9ce RootShell: Simplify, synchronize, clean up
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-09 08:13:11 -06:00
Samuel Holland
662bc3894b TunnelListFragment: Remove useless keyword
final doesn't do anything in try-with-resources (it's always final).

Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-09 06:25:53 -06:00
Jason A. Donenfeld
1451c4baf5 ToolsInstaller: terminators are better than seperators
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-09 13:12:49 +01:00
Jason A. Donenfeld
2785def37a RootShell: synchronize accesses to single shell
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-09 13:12:49 +01:00
Samuel Holland
204755d689 RootShell: Simplify constructor
ToolsInstaller now takes care of installing the tools.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-08 23:49:14 -06:00
Samuel Holland
c806e655fa WgQuickBackend: Ensure tools are available before use
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-08 23:39:32 -06:00
Samuel Holland
5201c7f849 ToolsInstaller: Add a method to ensure tool availability
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-08 23:39:32 -06:00
Samuel Holland
ba30d46e08 WgQuickBackend: Inline resolveState()
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-08 23:39:32 -06:00
Samuel Holland
1cfb938dd1 ToolsInstaller: Add methods to check/make symlinks
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-08 23:39:32 -06:00
Samuel Holland
011d683c23 ToolsInstallerPreference: Examine current state on load
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-08 23:39:32 -06:00
Samuel Holland
b87568482d ToolsInstaller: Add method to check installation status
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-08 23:39:32 -06:00
Samuel Holland
2776455d4f TunnelEditorFragment: Fix dismissing creator activity
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-08 23:39:32 -06:00
Samuel Holland
4f02817ef0 global: Fix or suppress most lints/warnings
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-08 23:39:26 -06:00
Samuel Holland
dd69a2e778 project: Remove currently-unused library
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-08 23:39:15 -06:00
Samuel Holland
710ffc7bb3 Fragment/Tile: Make success/error messages translatable
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-08 20:30:03 -06:00
Jason A. Donenfeld
6361628e16 layout: never use suggestions
IP addresses and key material could be potentially sensitive. We also
don't want any interactions with the suggestive text APIs. So, we mark
it as both a visible password and we turn off suggestions. This will fix
the length limit, too, in Android 8.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-09 00:23:33 +01:00
Jason A. Donenfeld
da30a6d449 TunnelListFragment: fix plural grammar
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-09 00:23:22 +01:00
Jason A. Donenfeld
1ae10b8f45 RootShell: fix off by one
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-01-08 20:42:12 +01:00