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
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
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
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
7eedf08d4b
global: Automatic code formatting
...
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-04-30 11:39:12 -05: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
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
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
53d29b312f
More javafication
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-04-18 05:28:31 +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
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
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
609194fae2
Serviceless rewrite, part 1
...
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-06 04:09:29 -06:00
Jason A. Donenfeld
eb5fdf200a
Config: use consistant verb
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-29 03:30:23 +01:00
Jason A. Donenfeld
e421b997cd
Config: make parsing stricter
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-26 23:45:41 +01:00
Samuel Holland
a828e83399
Centralize/unify validation of configurations
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 22:13:46 -05:00
Samuel Holland
3d6109e6d9
Peer: Add a field for the optional pre-shared key
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 02:00:53 -05:00
Samuel Holland
b2357e58e3
Config/Interface/Peer: Make Parcelable
...
This allows saving the editor state across restarts.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 23:47:44 -05:00
Samuel Holland
95384851cd
Config/Interface/Peer: Fix some missed change notifications
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 23:43:58 -05:00
Samuel Holland
0e46f95668
Config/Interface: Allow copyFrom() to work on null
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 18:02:37 -05:00
Samuel Holland
fb919a7226
Use data binding to provide EditText input filters
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-22 21:48:42 -05:00
Samuel Holland
9026317b0e
Peer: Associate with a Config
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-19 18:50:35 -05:00
Samuel Holland
c2189a78b9
ConfigEditFragment: Add extremely basic validation
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 03:32:01 -05:00
Samuel Holland
cb48a7be3a
Interface: Rework private key handling
...
This works much better with a data-bound UI -- no confusing erasing of
the text box, and no crashes, either!
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 03:30:06 -05:00
Samuel Holland
8f0dcd0a32
Config: add an isPrimary property
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:26:45 -05:00
Samuel Holland
76eb65d7d5
Config: Make it Comparable
...
This will be used for future sorting.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 01:06:05 -05:00
Samuel Holland
f1d97a585a
Config: Rename function to make databinding happy
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 00:57:27 -05:00
Samuel Holland
5e55d196be
Major renaming and refactoring in activity and service
...
Apparently "configuration" is the proper term, not "profile".
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-13 07:24:03 -05:00
Samuel Holland
c72d30a1af
Profile: Add function to copy config from another profile
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-13 07:23:16 -05:00
Samuel Holland
529e320e3f
Interface: Correctly handle setting a null or empty key
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 02:51:54 -05:00
Samuel Holland
f0f9192aed
KeyEncoding: Clean up and reorganize to match style
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09 02:51:08 -05:00
Jason A. Donenfeld
f6b864d4e7
Constant time base64
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08 18:22:41 +02:00
Samuel Holland
99973a4b08
Profile: Add helper to check name validity
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08 05:54:35 -05:00
Samuel Holland
c59b3e1230
Profile: Make name modifiable
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08 05:54:12 -05:00
Samuel Holland
874db0b95e
Interface: Convert to using Keypair class
...
This allows retrieving the public key and generating keypairs, both of
which will be exposed in the UI.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-01 01:12:59 -05:00
Samuel Holland
ca708ba382
Profile: Implement deep copying
...
This is a simple, naive implementation that {,de}serializes the
profile's state, but it does not depend on the internal representation
of Profile or its contained classes.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 21:14:42 -05:00
Samuel Holland
c3b42b85cc
Copyable: New utility interface for deep-copyable classes
...
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 21:11:33 -05:00
Samuel Holland
a1e334efa6
Profile: Track connection state
...
Observability is only enabled for isConnected because it is the only
mutable property.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 21:13:01 -05:00
Samuel Holland
85f1d4f1d3
Profile: Add a blank line before each peer section
...
This is purely a cosmetic change in the generated config files.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29 17:40:36 -05:00
Samuel Holland
748d780a47
Profile: Parse config file to a string per attribute
...
This parser should be able to handle any valid WireGuard or wg-quick
configuration file. It separates the file into a single interface object
and a peer object for each peer. All "[Interface]" sections in the file
are combined into the one object.
For now, later lines in a block with the same key overwrite earlier
lines. This is only relevant for attributes that are lists, such as
Address and AllowedIPs, where additional lines may be expected to append
to the list.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29 17:30:33 -05:00
Samuel Holland
0494dd1404
Profile: Add minimal implementation
...
This represents a wg-quick profile as two strings: the file name and
the file contents.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29 06:08:54 -05:00