summaryrefslogtreecommitdiffhomepage
path: root/app/src/main
AgeCommit message (Collapse)Author
2017-08-09Interface: Correctly handle setting a null or empty keySamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09KeyEncoding: Clean up and reorganize to match styleSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-09Keypair: Convert to java-style array declarationsSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08Constant time base64Jason A. Donenfeld
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08res: Add icons for quick settings tileSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08Profile: Add helper to check name validitySamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08Profile: Make name modifiableSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-08ProfileActivity: Refactor into clean layers of functionalitySamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07ProfileServiceInterface: Update for map-based collectionSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07ProfileService: Use a map to store profile dataSamuel Holland
This has no visible changes at the moment, but will allow most functions to pass around strings instead of Profile objects, obviating the need to implement serialization for them. It also trades some naive linear searches for the binary search in SimpleArrayMap. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07ObservableArrayMapAdapter: Copy ObservableListAdapterSamuel Holland
Since the conversion to a sequential list (to implement ListAdapter) depends on the implementation detail that ObservableArrayMap is backed by an array, we can't use the ObservableMap interface here. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07ProfileActivity: Add two-pane master-detail layoutSamuel Holland
This is designed for tablets, but for testing purposes, it is currently enabled for all devices in landscape orientation. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07PlaceholderFragment: Simple fragment that shows a messageSamuel Holland
This is used for the detail pane when no profile is selected. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07ProfileActivity: Make local variables finalSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07ProfileActivityFragment: Fix service connection trackingSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-07ProfileList: Load fragment programmaticallySamuel Holland
This is necessary to replace it with the profile detail fragment later. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-04ProfileList: Extract service management into a base classSamuel Holland
It will be shared with other fragments. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-04ProfileList: Convert to a fragmentSamuel Holland
This is required for a future two-fragment tablet layout, and simplifies the code a bit since the profile detail (view/edit) will be implemented as fragments anyway. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-04ProfileList: remove generated config from UISamuel Holland
It was only there for developing the parser. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-04RootShell: Make shell command configurableSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-04icon: Remove transparency inside non-round dragonSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-01ProfileList: Remove "Add" menu action, to be replaced by a FABSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-01ProfileService: Rework profile updatingSamuel Holland
This should help discourage editing a Profile without making a copy first, since the caller has to keep track of the old Profile as well. ProfileAdder has been updated to prevent adding duplicate profiles. It checks once in the constructor, so the caller can catch the exception and pass the error back to the UI. It checks again in the worker thread to prevent any race from happening if a profile is added twice quickly. Either the file exists, or it doesn't. Additionally, this change solves the race condition when the old profile is removed before it is updated; previously this would lead to the profile being re-added. Now, ProfileRemover will fail and the profile will stay removed. Finally, updating a profile's name should now work correctly. There were previously multiple bugs with that (the old profile wasn't removed, the new one could duplicate a name, the new one could overwrite some random other one, etc.). Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-01Interface: Convert to using Keypair classSamuel Holland
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-01Keypair: Create class for generating/storing keysSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-01Curve25519: Import class from noise-javaSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-04RootShell: rename SETUP to SETUP_TEMPLATESamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31RootShell: Use the application cache dir as TMPDIRSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31ProfileService: Use wg to enumerate interfacesSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31BootCompletedReceiver: Enforce receiving the correct broadcastSamuel Holland
This satisfies an Android security lint. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29ProfileList: Add a simple menuSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31ProfileList: Toggle connection state on clickSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31ProfileService: Implement the rest of its interfaceSamuel Holland
As per the FIXMEs, the list of profiles should eventually become a map. Since it can only be modified on the main thread anyway, the current code is still safe, and it works, it's just not optimal. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31ProfileService: Use deep copy to clone profilesSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31Profile: Implement deep copyingSamuel Holland
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-31Copyable: New utility interface for deep-copyable classesSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31ProfileList: Add indicator of profile connection stateSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31ProfileService: Check for existing interfaces when loading profilesSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31Profile: Track connection stateSamuel Holland
Observability is only enabled for isConnected because it is the only mutable property. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31ProfileService: Expand and document service interfaceSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31RootShell: Add helper class for running commands as rootSamuel Holland
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-30ProfileService: Add a listener to start it on bootSamuel Holland
This will allow automatically starting profiles on boot. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-30ProfileService: Only load from files ending with .confSamuel Holland
This condition was previously enforced in the AsyncTask, but was lost in the move from ProfileListActivity to ProfileService. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-30ProfileService: Create it and move profile loadingSamuel Holland
The long-running service is needed for keeping track of which profiles are enabled, for showing notifications, and for the tile service to use. Since it has to know which profiles exist anyway, moving the main ObservableList there avoids some code duplication. It ensures the list is only loaded once, so it cannot get out of sync. It also makes the ProfileList activity load faster, because it doesn't have to wait for file I/O; and it provides a canonical place for storing the Profile objects so they are accessible everywhere, instead of having to look them up by name. This does present some challenges with leaking activities, because all listeners must be removed from the profiles list (and its contents) when an activity is stopped. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-30binding: Weakly reference adapter in list change callbackSamuel Holland
This allows the ObservableListAdapter to be garbage collected along with its activity. On the next list change, the OnListChangedCallback will detect that the adapter is gone and clean itself up. This avoids needing to manually remove the list from the adapter, as would otherwise be required to break the reference cycle adapter→list→listener→adapter. This will be relevant once the list of profiles outlives the activity. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29ProfileList: Add minimal activitySamuel Holland
For now, it simply reads the files in the app's data directory with file names ending in ".conf" and displays them in a list. This includes the generic list data binding setup for future use. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29Profile: Add a blank line before each peer sectionSamuel Holland
This is purely a cosmetic change in the generated config files. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29Profile: Parse config file to a string per attributeSamuel Holland
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-29Profile: Add minimal implementationSamuel Holland
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-30icon: Use the uncropped logo for the non-round iconSamuel Holland
The round icon remains the same. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>