aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app/src/main/java/com/wireguard/config/Peer.java (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Remodel the ModelSamuel Holland2018-12-081-294/+222
| | | | | | | | | | | | | | - The configuration and crypto model is now entirely independent of Android classes other than Nullable and TextUtils. - Model classes are immutable and use builders that enforce the appropriate optional/required attributes. - The Android config proxies (for Parcelable and databinding) are moved to the Android side of the codebase, and are designed to be safe for two-way databinding. This allows proper observability in TunnelDetailFragment. - Various robustness fixes and documentation updates to helper classes. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Auto-format the source directoriesSamuel Holland2018-11-111-44/+43
| | | | | | Blame Jason for writing Java in vim. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Peer: prefer v4 endpoints to v6Jason A. Donenfeld2018-10-011-33/+8
| | | | | | This works around DNS64 XLAT changeovers. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: update copyright headersJason A. Donenfeld2018-09-061-2/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Supress false-positive DefaultLocale warningsHarsh Shandilya2018-08-261-0/+3
| | | | | | We decided in 402472237e8f that it's a bad idea for our use-case Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* Extract error messages to string resourcesHarsh Shandilya2018-08-261-3/+7
| | | | | | Useful for validation errors and localisation later on Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* config: fix wrong Peer endpoint string formatZhao Gang2018-08-161-1/+4
| | | | | | | | | | | | | | | | | | | | When a tunnel is running, saving the tunnel's config with an IPv6 address endpoint like [::1]:42 would result in the wrong format ::1:42. This patch fixes it. For endpoints with an IPv6 address(e.g. [::1]:42). Since the default endpoint InetSocketAddress is created unresolved, getEndpointString() returns "[::1]:42" (InetSocketAddress.getHostString() returns the literal hostname). After the endpoint is resolved, getEndpointString() returns "::1:42" (InetSocketAddress.getHostString() returns the IPv6 address without the square brackets). This inconsistent return values caused the above mentioned bug. With this patch, function getEndpointString would return the right format string whether the endpoint is resolved or not. Signed-off-by: Zhao Gang <gang.zhao.42@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* config: show more informative error message on wrong keyJason A. Donenfeld2018-07-271-0/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* config: Remove Locale based string formatHarsh Shandilya2018-07-241-6/+3
| | | | | | | | | | | | The configurations are supposed to be in a very specific format which is not user-facing and hence doesn't have to be adjusted for locale avoiding both the redundancy as well as potential breakages in the configuration file format from different locales. Fixes: 71c67aa24ae2 ("config: Minor cleanup") Reported-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
* config: dns servers can be nullJason A. Donenfeld2018-07-131-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* config: make loadData privateJason A. Donenfeld2018-07-131-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: Add nullity annotationsEric Kuck2018-07-131-23/+28
| | | | Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
* Version bump0.0.20180711Jason A. Donenfeld2018-07-121-1/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* TunnelEditorFragment: add DNSes to allowedIPs when excluding rfc1918Jason A. Donenfeld2018-07-121-16/+46
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: move to Apache 2.0Jason A. Donenfeld2018-07-061-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* PeerEditor: add exclude private IPs functionalityJason A. Donenfeld2018-07-061-0/+33
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* config: Refactor IPCidr and use of InetAddressSamuel Holland2018-06-191-4/+4
| | | | | | | | | Use a canonically-named utility class to tack on methods to the existing InetAddress class. Rename IPCidr to InetNetwork so it better matches InetAddress and is more pronouceable :) While here, simplify the constructor and toString() functions, and properly implement hashCode(). Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: fix up copyrightsJason A. Donenfeld2018-05-031-0/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: Add or update copyright headers in Java codeSamuel Holland2018-05-021-0/+5
| | | | Signed-off-by: Samuel Holland <samuel@sholland.org>
* global: Clean up JavaSamuel Holland2018-04-301-43/+51
| | | | | | Address Java and Android lints. Signed-off-by: Samuel Holland <samuel@sholland.org>
* global: Automatic code formattingSamuel Holland2018-04-301-152/+149
| | | | Signed-off-by: Samuel Holland <samuel@sholland.org>
* TunnelEditorFragment: rewrite and simplifyJason A. Donenfeld2018-04-301-45/+37
| | | | | | | This should remove some null pointer dereferences and overall make the thing more robust. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* config: Minor cleanupHarsh Shandilya2018-04-281-4/+11
| | | | | | | | | - 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>
* Use validation instead of two-way bindingJason A. Donenfeld2018-04-281-32/+103
| | | | | | | | | | | | | | 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>
* Do not do DNS lookups for IPsJason A. Donenfeld2018-04-271-2/+0
| | | | | | | 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>
* Throw IllegalArgumentExceptions when arguments are badJason A. Donenfeld2018-04-271-15/+12
| | | | | | | | | 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>
* More javaficationJason A. Donenfeld2018-04-181-45/+113
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Remove sloppy java with enterprise java horrorsJason A. Donenfeld2018-04-171-13/+30
| | | | | | | 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>
* Peer: Add missing @OverrideSamuel Holland2018-01-171-0/+1
| | | | Signed-off-by: Samuel Holland <samuel@sholland.org>
* Serviceless rewrite, part 1Samuel Holland2018-01-061-37/+12
| | | | Signed-off-by: Samuel Holland <samuel@sholland.org>
* Config: make parsing stricterJason A. Donenfeld2017-11-261-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Peer: Add a field for the optional pre-shared keySamuel Holland2017-08-241-0/+20
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Config/Interface/Peer: Make ParcelableSamuel Holland2017-08-231-1/+36
| | | | | | This allows saving the editor state across restarts. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Config/Interface/Peer: Fix some missed change notificationsSamuel Holland2017-08-231-8/+9
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Peer: Associate with a ConfigSamuel Holland2017-08-191-1/+15
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Major renaming and refactoring in activity and serviceSamuel Holland2017-08-131-2/+27
| | | | | | Apparently "configuration" is the proper term, not "profile". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Profile: Parse config file to a string per attributeSamuel Holland2017-07-291-0/+83
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>