summaryrefslogtreecommitdiffhomepage
path: root/mullvad-daemon/src/lib.rs
AgeCommit message (Collapse)AuthorFilesLines
2024-04-18Limit the size of custom list names to 30 graphemesEmīls1-6/+2
2024-04-17Refactor away Daemon::app_version_infoJoakim Hulthe1-26/+13
2024-04-17Make sure to query app verion every 24 hoursJoakim Hulthe1-4/+3
even if the daemon was restarted.
2024-04-16Add DAITA to relay selectionDavid Lönnhager1-1/+3
2024-04-16Add DAITA Windows client and updated tuncfgDavid Lönnhager1-1/+54
2024-04-12Add ClearCustomLists RPC callJoakim Hulthe1-0/+8
2024-04-12Add ClearCustomApiAccessMethods rpc callJoakim Hulthe1-0/+11
2024-03-27Refactor `mullvad-relay-selector`Markus Pettersson1-4/+4
Implement a system built on 'queries' for selecting appropriate relays. A query is a set of constraints which dictates which relay(s) that *can* be chosen by the relay selector. The user's settings can naturally be expressed as a query. The semantics of merging two queries in a way that always prefer user settings is defined by the new `Intersection` trait. Split `mullvad-relay-selector` into several modules: - `query.rs`: Definition of a query on different types of relays. This module is integral to the new API of `mullvad-relay-selector` - `matcher.rs`: Logic for filtering out candidate relays based on a query. - `detailer.rs`: Logic for deriving connection details for the selected relay. - `tests/`: Integration tests for the new relay selector. These tests only use the public APIs of `RelaySelector` and make sure that the output matches the expected output in different scenarios.
2024-02-27Replace err_derive with thiserrorJoakim Hulthe1-56/+55
`err_derive` is unmaintained and will probably stop working with rust edition 2024. `thiserror` is almost a drop-in replacement. This commit simply replaces all occurences of `derive(err_derive::Error)` with `derive(thiserror::Error)` and fixes the attributes, but the Error and Display impls should be identical.
2024-02-20Move `relay_updater` to `mullvad-daemon`Markus Pettersson1-6/+9
Move `mullvad-relay-selector::relay_updater` to the `mullvad-daemon`. The implications of this is that `mullvad-relay-selector` can drop the dependency on both `mullvad-api` and `tokio`, which brings down the total amount of dependencies when running a simple `Cargo check` from 250+ down to a mere 75. :-)
2024-02-19Move responsibility of updating the API IP from REST handle to the daemonDavid Lönnhager1-1/+8
2024-02-16Refactor API access methodsDavid Lönnhager1-19/+27
2024-02-15Fix off-by-one error when choosing access method candidatesMarkus Pettersson1-18/+15
2024-01-31Adapt Electron frontend to new access method settings formatMarkus Pettersson1-8/+0
2024-01-31If the current access method is disabled or removed, select the next availableMarkus Pettersson1-5/+2
If the current access method is disabled, select the next available access method from the daemon settings.
2024-01-22Add `TestCustomApiAccessMethod` RPC callMarkus Pettersson1-40/+53
Add a new RPC call `TestCustomApiAccessMethod` for testing access methods on the fly, without having to save them to the daemon settings first. This only works for custom access methods.
2024-01-22Move logic of toggling disabled access methods on use to the daemonMarkus Pettersson1-1/+1
2024-01-18Update the tunnel state on lockdown mode change.Sebastian Holmin1-3/+2
The printing of lockdown mode by `mullvad status` does not reflect the current setting unless the tunnel state has also been updated.
2024-01-18Print if lockdown mode is enabled when disconnected for `mullvad status`Sebastian Holmin1-8/+18
Add `locked_down` field to disconnected tunnel state.
2024-01-11Synchronize `mullvad-api` and `mullvad-daemon` when the `api-override`Markus Pettersson1-31/+45
feature is enabled Move the logic for using overridden API endpoints for API calls from `mullvad-api::rest` to `mullvad_daemon::api`. This is in line with how the interaction between the two crates work for a normal release build, i.e. when the `api-override` feature is disabled. This commit also removes references to `force_direct_connection` in the Android code. The flag does not exist in the `mullvad-*` rust crates anymore, so it would be erroneous to try to serialize/deserialize the value from the Android client.
2024-01-10Add patch export to the management interfaceDavid Lönnhager1-1/+9
2024-01-08Re-implement test procedure for access methodsMarkus Pettersson1-22/+67
Since the `AccessModeSelector` knows how to resolve endpoints on it's own, we no longer have to re-use the existing `MullvadRestHandle` from the daemon. Instead, we may spawn a completely new `ApiProxy` and except the appropriate endpoint in the firewall without affecting the running `MullvadRestHandle`.
2024-01-08Implement handler for `NewAccessMethodEvent`Markus Pettersson1-1/+25
This commit implements the daemon logic for handling a `NewAccessMethodEvent`. Such an event occur when `AccessModeSelector` announces that a new access method is active, and it will cause the daemon to except some API endpoint in the firewall. It may conditionally broadcast the new access method to all clients.
2024-01-08Allow `AccessModeSelector` to resolve api endpointsMarkus Pettersson1-7/+11
Until now, `AccessModeSelector` has not been able to resolve API endpoints on it's own. This has happened at some later stage, for example in the `mullvad-api` crate. However, for testing the `Direct` access method, it is very useful to be able to resolve the actual endpoint without involving the daemon's "API runtime".
2024-01-08Remove `ApiEndpointUpdateHandler`Markus Pettersson1-9/+1
Previously, the `mullvad-api` would tell the `mullvad-daemon` that it wanted a new API endpoint by calling a certain callback (`ApiEndpointUpdateCallback`), which would asynchronously resolve a new API endpoint and tell the daemon to punch an appropriate hole in the firewall for that particular endpoint before the `mullvad-api` crate would consume it. The logic of the callback can be moved inside `AccessModeSelector`, which simplifies the contract between `mullvad-daemon` and `mullvad-api` somewhat.
2024-01-08Add new internal daemon event `AccessMethodEvent`Markus Pettersson1-0/+26
Add a new `InternalDaemonEvent` for announcing when the current API access method changes.
2024-01-04Add workspace level lintsLinus Färnstrand1-1/+0
2024-01-03Allow app to use custom socks5 and shadwosocks proxiesJonathan1-4/+16
This PR has a couple of different purposes - Allow users to use socks5 local proxies with the CLI without having to be root nor use split-tunneling. This only works for OpenVPN. - Unify the types used by different proxy parts of the codebase, such as the Access Methods as well as some already existing OpenVPN proxy code. This PR changes the firewall on all desktop platforms as well as changes the routing table slightly on MacOS and Windows. On Linux the firewall code is modified to apply the appropriate firewall marks to all packages that go to a remote endpoint corresponding to the remote part of a local socks5 proxy. The firewall marks will allow the routing to be done without having to modify the routing table. On MacOS and Windows the routing table is modified to allow packages to go to that same endpoint to pass outside the VPN tunnel, it will additionally punch a hole in the firewall. The PR also migrates the settings file from version 7 to version 8 in order to properly and neatly unify Proxy related types. Finally it provides some slight extensions to the gRPC interface in order to allow for control over the custom proxy settings.
2023-12-29Fetch account ID from APIDavid Lönnhager1-6/+2
2023-12-21Handle am.i.mullvad.net with internal daemon eventSebastian Holmin1-62/+87
Add `geoip::GeoIpHandler`, which sends an `InternalDaemonEvent::LocationEvent` when the location arrives. It also handles aborting in-flight requests and retries.
2023-12-21Remove `GetCurrentLocation`.Sebastian Holmin1-59/+70
Make the daemon send two tunnel state updates, one with out IP being empty, and another with it being filled when am.i.mullvad.net responds. Update CLI for this change. Other front ends are left out.
2023-12-12Remove unused 'default tunnel type' from relay selectorDavid Lönnhager1-3/+0
2023-12-04Clean up error handlingMarkus Pettersson1-107/+19
2023-12-04Add more comments to `AccessModeSelector`Markus Pettersson1-1/+1
2023-12-04Construct `AccessModeSelectorHandle` by calling `AccessModeSelector::spawn`Markus Pettersson1-29/+2
Construct an `AccessModeSelectorHandle` by calling `AccessModeSelector::spawn`, which is consistent with how actors are spawned in other parts of the `mullvad-daemon`.
2023-12-04Refactor `access_methods.rs`Markus Pettersson1-3/+6
- Naming of structs/enums/variables - Add documentation - Change existing doc comment to better reflect their context / any new naming
2023-12-04Perform testing of access methods asynchronouslyMarkus Pettersson1-34/+112
Perform testing of access methods asynchronously in a separate `tokio` task as to not block the daemon from handling other daemon events during the testing window
2023-12-04Move access method testing logic to `mullvad-daemon`Markus Pettersson1-7/+53
Move access method testing logic to `mullvad-daemon`, which means that the implementation details of how the test works is opaque to whatever frontend which wants to issue a test of some (configured) access method.
2023-11-28Add retry for `GetCurrentLocation`Sebastian Holmin1-36/+29
2023-11-22Complete certain management interface commands when the tunnel state machine ↵David Lönnhager1-7/+41
has actually handled the request
2023-11-22Default to the direct access method if all methods are disabled in the settingsMarkus Pettersson1-2/+17
Make sure that access method settings can never be empty, as `ConnectionModesIterator` should never work with an empty collection
2023-11-17Add support for applying JSON patches to management interfaceDavid Lönnhager1-0/+15
2023-11-13Add observers to SettingsPersisterDavid Lönnhager1-84/+38
2023-11-13Add management interface for relay overrideDavid Lönnhager1-1/+61
2023-11-13Patch in-ips in relay selectorDavid Lönnhager1-0/+1
2023-11-07Add configurable transport protocol to local SOCKS5 access methodMarkus Pettersson1-1/+4
2023-10-31Replace UpdateRelaySettings with SetRelaySettingsDavid Lönnhager1-8/+8
2023-10-16Add android conditional compilation for google payJonathan1-33/+39
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 play purchasing modelsJonatan Rhodin1-8/+4
2023-10-16Add piping for google play payment API requestsJonathan1-1/+51
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.