summaryrefslogtreecommitdiffhomepage
path: root/mullvad-daemon/src/lib.rs
AgeCommit message (Collapse)AuthorFilesLines
2023-10-09Code cleanupMarkus Pettersson1-6/+2
- 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-09Add `GetCurrentApiAccessMethod` to show the current API access methodMarkus Pettersson1-6/+20
- Add a new RPC message: `GetCurrentApiAccessMethod`. This message may be used to retrieve the access method which is currently in use by the daemon for connecting to the Mullvad API. - Add `mullvad api-access status` for showing the API access method in use
2023-10-09Code cleanupMarkus Pettersson1-15/+24
- 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-09Rename `ApiAccessMethod` to `AccessMethodSetting`Markus Pettersson1-5/+5
`ApiAccessMethod` was just an app-centric wrapper around `AccessMethod`.
2023-10-09`AccessMethod`s are now filtered by the daemon rather than ↵Markus Pettersson1-1/+3
`ConnectionModesIterator` Move the duty of filtering active `AccessMethod`s from `ConnectionModesIterator` to the daemon. This provides more flexibility in the iterator as it does not need to know about `AccessMethod` at all.
2023-10-09Code cleanupMarkus Pettersson1-0/+1
- 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-09Refactor protobuf `ApiAccessMethod` definitionsMarkus Pettersson1-34/+15
- Replace rpcs `ReplaceApiAccessMethod` and `ToggleApiAccessMethod` in favor of a commmon `UpdateApiAccessMethod` (which resembles `ReplaceApiAccessMethod` in a lot of ways). - `UpdateApiAccessMethod` works with unique identifiers instead of array indices to pinpoint which API access method to update. - Toggling an API access method to be enabled/disabled now happens via `UpdateApiAccessMethod` - Add the useful `UUID` protobuf type definition, which conveys more information that a raw string. - Refactor `SetApiAccessMethod` to use API access method ID - Update `ApiAcessMethod` messages to use `UUID` type for uuid values - Use unique id for removing custom `ApiAccessMethods`
2023-10-09CleanupMarkus Pettersson1-18/+28
- 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-09Add `mullvad proxy test`Markus Pettersson1-0/+10
For quickly assessing whether an api access method can reach the API or not.
2023-10-09Add `mullvad proxy use`Markus Pettersson1-4/+24
Allow for settings a specific Access Method to use
2023-10-09Add `mullvad api-access enable/disable`Markus Pettersson1-1/+19
Add `mullvad api-access enable/disable`, which allows for toggling API access methods On/Off. Make `ApiConnectionModeProvider` consider status of access method. `ApiConnectionModeProvider` will only be able to return access methods which are enabled, as it will disregard those which are disabled. Add logic to guarantee the invariant that at least one API access method is available for selection by the `ApiConnectionModeProvider`
2023-10-09Code cleanupMarkus Pettersson1-3/+3
- 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 `mullvad proxy api edit` commandMarkus Pettersson1-1/+18
Allow a user to edit an existing custom api proxy method
2023-10-09Add `mullvad proxy api remove` commandMarkus Pettersson1-0/+15
Allow the user to manually remove a custom api proxy.
2023-10-09Add `mullvad proxy add` commandMarkus Pettersson1-0/+24
Add daemon logic for storing custom access methods & allow a user to add a custom socks5 or shadowsocks proxy. Add all the necessary information for establishing Socks5 connections (both using a local Socks-proxy as well as the normal, remote-proxy, use case) and Shadowsocks connections. Add `api_access_settings` to `mullvad-daemon` Naturally, the Protobuf types has to be mirrored on the Rust/daemon side and lots of boilerplate code had to be written to convert between the two.
2023-09-27Refactor custom list implementationDavid Lönnhager1-69/+28
2023-08-31Remove wireguard-nt switchDavid Lönnhager1-40/+0
2023-08-30Fix clippy lintsEmīls1-41/+33
2023-08-07Get rid of "extern crate serde" and import derive macros explicitlyLinus Färnstrand1-3/+0
2023-07-14Remove `x_threshold_wg_default` codeMarkus Pettersson1-28/+8
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-06-29Cleanup review comments, CI issues and android supportJonathan1-15/+34
Add necessary android support to allow it to not crash due to interface changes. Format the code, remove redundant async functions, fix android issues related to not having to use a Vec to store the custom lists and a string as an id. Fix unit tests.
2023-06-29Add basic features for custom list and file persistenceJonathan1-1/+66
Create the basic features outside of rename for custom lists and route these to the daemon. Persist custom lists in settings. Has basic custom list features done, adds errors. Adds reconnect in the case where a selected custom list is modified.
2023-06-12Resume background requests after loginDavid Lönnhager1-4/+12
2023-05-03And gRPC interface wrapper and refactor CLI to use clap derive instead of ↵David Lönnhager1-2/+4
the builder
2023-04-26Fix remaining clippy warningsDavid Lönnhager1-2/+2
2023-04-21Remove mullvad-exclusion group on macOSDavid Lönnhager1-6/+1
2023-04-21Apply clippy --fix fixesLinus Färnstrand1-2/+2
This commit does not contain everything that `cargo clippy --fix` changed on Windows. But the least controversial and simplest subset. The remaining fixes I felt could use some manual cleanup also.
2023-04-17Log important settingsDavid Lönnhager1-2/+5
2023-03-29Remove getters and setters from SettingsPersisterDavid Lönnhager1-40/+81
2023-03-27Fix many typosAlexander Seiler1-1/+1
Signed-off-by: Alexander Seiler <seileralex@gmail.com>
2023-02-21Make quantum-resistant tunnel optional in mullvad layerDavid Lönnhager1-6/+7
2023-02-08Make async fns without awaits into regular fnsLinus Färnstrand1-7/+6
2022-11-29Output '[EXPIRED_ACCOUNT]' for WireGuard when the account is out of timeDavid Lönnhager1-1/+2
2022-11-07Refactor tunnel_state_machine::spawnEmīls Piņķis1-3/+4
2022-11-07Split up talpid-coreEmīls Piņķis1-0/+4
2022-10-10Adapt all crates to use mullvad-versionLinus Färnstrand1-1/+1
2022-09-30Stop IPv6 requestsEmīls Piņķis1-2/+3
Stop sending IPv6 geolocation requests if IPv6 is disabled.
2022-09-22Remove shutdown daemon commandEmīls Piņķis1-5/+10
2022-09-22Remove shutdown GRPCEmīls Piņķis1-0/+2
2022-09-21Always block on shutdownEmīls Piņķis1-2/+1
2022-09-20Add shutdown detection for Windows serviceDavid Lönnhager1-10/+18
2022-09-13Move expiry event to separate enumDavid Lönnhager1-14/+13
2022-09-13Explain continual reconnect on 'AuthFailed'David Lönnhager1-0/+2
2022-09-13Implement correctly cancellable voucher submissions in the account managerDavid Lönnhager1-15/+14
2022-09-13Enter or leave error state when account runs out of time or has timeDavid Lönnhager1-0/+17
added
2022-09-13Allow for within-daemon-only device eventsDavid Lönnhager1-2/+3
2022-09-02Swallow spurious 'failed to bypass socket' errorDavid Lönnhager1-1/+6
2022-08-15Allow for migrating windows users to WGJonathan1-8/+33
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-18Fix potential leak window on shutdownDavid Lönnhager1-7/+7
2022-06-21Fix the large majority of clippy warningsJonathan1-17/+30
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.