summaryrefslogtreecommitdiffhomepage
path: root/mullvad-api/src
AgeCommit message (Collapse)AuthorFilesLines
2023-10-19Fold all access token requests into a single requestDavid Lönnhager5-145/+253
2023-10-16Add android conditional compilation for google payJonathan2-4/+35
Add conditional compilation for google pay API access for only android. Also allow new error type to be parsed. Additionally fix review comments, formatting and warnings.
2023-10-16Add piping for google play payment API requestsJonathan1-1/+58
This commit adds all of the basic piping in order to let Android use the JNI interface in order to make requests to our API pertaining to google play payment initialization and status.
2023-10-09UX improvements for `mullvad api-access`Markus Pettersson1-6/+18
- Re-phrase help texts for a lot of `mullvad api-access` commands - Add to help texts for some `mullvad api-access` commands - Compact the output of `mullvad api-access test` - `mullvad api-access status` is changed to `mullvad api-access get` to align with other `mullvad` commands. - `mullvad api-access get` does not print the enabled/disabled status of the shown access method - Rotate access method if the currently active one is updated or removed - Fix reset access method after `mullvad api-access test` After running `mullvad api-access test`, the previously used access method should be used, which was not the case previously. - Fix `mullvad api-access use` API connectivity check - `mullvad api-access use` now runs a test-routine to check that the new access method will function before comitting to it. If this check fails, the previously used access method will be used instead - guarantee that `set_api_access_method` has finished upon returning. Make `mullvad_api::rest::next_api_endpoint` `async` and send a message upon completion. This is propagated to the caller of `next_api_endpoint` which can `await` the result
2023-10-09Add authentication with username+password for SOCKS5 access methodMarkus Pettersson1-9/+38
Add the option to authenticate against remote SOCKS5 proxies with a username+password combination. It was an oversight that this was not added from the start.
2023-10-09Code cleanupMarkus Pettersson1-73/+59
- Get rid of extraneous calls to `clone` - Address nit: combine similar match arms into a single match arm - Fix `clippy` lint "unused `async` for function with no await statements" - Fix protobuf field numbers should start from 1 - This was not the case for `Socks5Local` & `Shadowsocks` - Refactor code for opening proxy connections - Cut down on duplicated code for setting up a proxied connection in `mullvad-api`. The difference between different connection modes is how they wrap the underlying `TCP` stream. - Remove `enable_access_method` & `disable_access_method` from RPC-client
2023-10-09Code cleanupMarkus Pettersson2-9/+9
- Rename `mullvad_types::api_access.rs` -> `mullvad_types::access_method.rs` - Rename `ApiAccessMethodId` to simply `Id` Prefer to prefix with module name `access_method` to disambiguate use of `Id` instead, like `access_method::Id` - Remove dead code - Remove `AccessMethodSettingsUpdate` - Remove the `retry_attempt` struct field from `ApiConnectionModeProvider`, as it is no longer used for anything. - Fix typos - `GetApiAddressess` is now correctly spelled `GetApiAddresses` (a single trailing "s") - Deprecate the name `ApiAccessMethod` in favor of `AccessMethodSetting` - To decrease the confusion between `AccessMethod` & `ApiAccessMethod`. `AccessMethodSetting` adds some app-specific settings details on top of an `AccessMethod`, which is not too far fetched with the new naming convention. - Refactor proto file - Rename protobuf message `AccessMethodSettingAdd` to `NewAccessMethodSetting` - `AccessMethod` is now its own message - `AccessMethods` is removed - Add `ApiAccessMethodAdd` protobuf message - The `ApiAccessMethodAdd` returns a `UUID` for the . One important change is that new `AccessMethodSetting`s are created in the daemon, rather than in the CLI/other clients. This means that the daemon now has full control over generating new `AccessMethodSetting`s from `AccessMethod`s. - Clean up conversion code to/from `AccessMethod` protobuf types - Simplify `UpdateApiAccessMethod` RPC - Remove the extranous `ApiAccessMethodUpdate` data type - get rid of `ApiAccessMethodUpdate` protobuf message. Use `UUID` of `ApiAccessMethod` to identify which struct to edit. - get rid of `ApiAccessMethodUpdate` struct
2023-10-09Code cleanupMarkus Pettersson2-9/+9
- Refactor `RemoveApiAccessMethod` to be based on UUID - Remove debug-prints in `mullvad api-access list` et al - Get rid of `GetApiAccessMethods` RPC - Use the more generic RPC `GetSettings` to get hold of all API access methods instead - Rename `mullvad_types::access_method` to `mullvad_types::api_access` - Remove (unjustified) `#[inline(always)]` attributes
2023-10-09CleanupMarkus Pettersson2-16/+47
- General code cleanup - Fix some typos - Add some doc comments - Address several `TODO` comments - Fix `clippy` warnings - Removed unused dependency `mullvad-api` from `mullvad-cli` - Removed unused dependency `rand` from `mullvad-daemon` - Rename `mullvad proxy` to `mullvad api-access` - Rename `mullvad_types::api_access_method` -> `mullvad_types::access_method` - Remove unused `mullvad api-access edit` arguments - Fix `Display` for `ProxyConfig` printing arguments in the wrong order - Re-phrase `mullvad api-access test` - If the API call failed, point out which tested access method that did not work. - Fix missing `socket_bypass_tx` value for Android - Refactor `ApiAccessMethod` proto definition - Simplify protobuf definitions of `SOCKS5` api access methods - Remove the `Socks5` enum in favor of implementing `Socks5Local` and `Socks5Remote` directly. - Move `enabled` and `name` out of the individual messages and put them next to the `oneof access_method` in `ApiAccessMethod` proto definition - Use derived `PartialEq` and `Hash` from `AccessMethod` - Instead of hand-rolling `Hash` and implementing an ad-hoc version of half of `PartialEq`, these can now be derived and used as one would imaging due to the refactoring wherer `name` and `enabled` was moved out of `AccessMethod` into `ApiAccessMethod`.
2023-10-09Allowing traffic to and from a SOCKS5-proxy running on localhost.Markus Pettersson2-10/+21
The daemon has to add a rule to allow traffix to/from the remote server which the locally running SOCKS5-proxy communicates with.
2023-10-09Code cleanupMarkus Pettersson2-14/+22
- Add a new datastructures for distinguishing between built-in & custom api access methods - Implement `TryFrom` instead of `From` for fallible conversions - Do not panic if a protobuf-message is ill-formatted - Do not allow removal of built-in api access methods - Refactor notification logic in `access_methods.rs` - Rename `mullvad proxy api` to simply `mullvad proxy` - Since there are no other kinds of proxies at the moment, the subcommand `proxy api` does not make much sense. - Remove left-over comments
2023-10-09Add `Socks5` as a Proxy settingMarkus Pettersson2-59/+141
- Rename `InnerConnectionMode` variant `Proxied` to `Shadowsocks` - Move proxy/socket connection logic to `InnerConnectMode` impl block - Move `handle_x_connection` functions to `InnerConnectionMode` impl block - These functions does not need to be visible in the entire module, really. - Refactor some code into standalone functions - Mostly for visibilities' sake, but it also helps `rustc` with inferring the return type of each match arm inside of `stream_fut`.
2023-09-20Remove deadcode from mullvad-apiEmīls1-16/+0
2023-09-05Remove forwarded port from devices in Rust codeLinus Färnstrand1-4/+1
2023-08-04Replace all use of `lazy_static` with `once_cell`Markus Pettersson1-1/+1
To align more with the upcoming standardizations within the Rust ecosystem which started with the release of `1.70.0` and the inevitable deprecation of `lazy_static`.
2023-08-04Remove some use of `once_cell` with new std alternativesMarkus Pettersson1-4/+4
`OnceCell` and `OnceLock` was stabilized in Rust `1.70.0`, which allow us to refactor some use of the `once_cell` crate to use the implementations in the standard library.
2023-07-14Remove `x_threshold_wg_default` codeMarkus Pettersson1-10/+0
Since we migrated to using Wireguard as the definitive default VPN, we can stop reading the `x_threshold_wg_default` field from the API and remove all daemon code related to using it
2023-05-24Fix warnings pointed out by ClippyLinus Färnstrand1-1/+1
2023-04-20Update shadowsocks to 1.15.3Emīls1-1/+1
2023-03-29Remove getters and setters from SettingsPersisterDavid Lönnhager4-75/+2
2023-03-27Fix many typosAlexander Seiler1-1/+1
Signed-off-by: Alexander Seiler <seileralex@gmail.com>
2023-02-08Make async fns without awaits into regular fnsLinus Färnstrand1-1/+1
2023-01-30Run `cargo clippy --fix` with the new Rust 1.67 preferred formatLinus Färnstrand6-18/+17
2022-12-21Fix rust formattingAlbin1-2/+1
2022-12-21Apply more clippy fixesEmīls1-3/+1
2022-11-28Conditionally compile some API override fieldsDavid Lönnhager3-17/+46
2022-11-28Warn about MULLVAD_API_DISABLE_TLS being set if the API address and host are notDavid Lönnhager1-3/+10
2022-11-28Use specified port for the APIDavid Lönnhager1-4/+9
2022-11-28Make API address overridable from MullvadDaemonDavid Lönnhager1-9/+44
2022-11-28Add option to disable TLS for API RPCs, and resolve address from hostname if ↵David Lönnhager1-14/+28
needed
2022-11-28Don't use bridges if the API endpoint is overriddenDavid Lönnhager2-1/+12
2022-11-28Add support for non-TLS API connectionsDavid Lönnhager3-39/+83
2022-11-28Use once_cell instead of lazy_static in mullvad-apiDavid Lönnhager2-16/+14
2022-11-21Update API ipAndrej Mihajlov1-1/+1
2022-08-29Fix Clippy errorsDavid Lönnhager2-5/+4
2022-08-15Allow for migrating windows users to WGJonathan1-0/+10
Use a potential value between 0 and 1 provided by the API version check to decide if the Windows client should use WireGuard or OpenVpn. This decision is then persisted in the settings in the form of a random value between 0 and 1 where if the value is higher than the value provided by the API the client will use OpenVpn. If there is no value provided by the API then the client will use WireGuard as the migration has concluded.
2022-07-07Implement functions for extracting relays in mullvad-api as methodsDavid Lönnhager1-108/+113
2022-07-07Move shared endpoint data to the top of the relay listDavid Lönnhager1-77/+67
2022-06-21Fix the large majority of clippy warningsJonathan6-27/+26
This commit fixes most of the remaining clippy warnings in the codebase. These warnings were the more semantically difficult ones to fix. There are some warnings that remain from the rebase that will be fixed in the upcoming PR.
2022-06-20Add abstraction for atomic file I/ODavid Lönnhager4-30/+81
2022-06-14Manually fix the simpler non-semantic clippy warnsJonathan3-16/+9
This commit tries to manually fix the clippy warnings that are fairly straightforward and do not have rippling effects on the codebase nor have a very high chance of causing bugs.
2022-06-13Perform a clippy --fixjonathan5-24/+18
This is a giant commit which performs only a clippy --fix. Auditing can happen in two ways, either by reading every line or by running a `cargo clippy --fix` on the previous commit and make sure that the result is the same.
2022-05-25Save 'created' and 'hijack_dns' fields in device structsDavid Lönnhager1-0/+7
2022-05-11Don't stop device check if an API request is abortedDavid Lönnhager1-0/+7
2022-05-11Check status in API response body to determine whether a device has been revokedDavid Lönnhager2-1/+3
2022-05-09Use stable device API endpointsDavid Lönnhager2-2/+2
2022-05-02Remove account number field from non-creation account API responseDavid Lönnhager1-8/+12
2022-04-29Pause API requests when the daemon hasn't received any commands for 3 daysDavid Lönnhager1-3/+84
2022-04-29Only log API availability changes if the state actually changesDavid Lönnhager1-9/+14
2022-04-26Set hijack_dns explicitlyDavid Lönnhager1-1/+5