summaryrefslogtreecommitdiffhomepage
path: root/mullvad-api/src
AgeCommit message (Collapse)AuthorFilesLines
2024-10-16Replace old client with `hyper_util` legacy clientSebastian Holmin4-48/+54
2024-10-16Add `impl From<Infallible> for Error`Sebastian Holmin1-0/+7
2024-10-16Replace occurrences of old `Body` type in `rest` modSebastian Holmin3-77/+153
Use `Empty<Bytes>` for outgoing, `Incoming` for responses and generic paras for our type wrapping `Request`.
2024-10-16Update `rustls` in `tls_stream.rs`Sebastian Holmin1-11/+12
2024-10-02Fix bug when overriding API with only MULLVAD_API_HOSTLinus Färnstrand1-0/+1
2024-10-01Rename account "token" to account "number"Joakim Hulthe4-33/+31
2024-09-26Add unit tests to `availability` moduleMarkus Pettersson1-0/+36
2024-09-26Implement `Default` for `ApiAvailibility`Markus Pettersson2-11/+19
2024-09-26Fix regression in API timer logicDavid Lönnhager1-2/+10
2024-09-25Consolidate two mutexes into oneMarkus Pettersson3-149/+149
2024-09-17Remove Option from Relay::locationJoakim Hulthe1-1/+1
2024-08-27Use std LazyLock instead of once_cell LazyDavid Lönnhager1-2/+2
2024-08-22Fix IP-override feature indicatorSebastian Holmin1-0/+2
It was trigger by any overrides existing in the settings, not by the current endpoint being overridden. Add flag to `Relay` to specify if its IPv4 and/or IPv6 has been overridden and use that in combination with the endpoint IP version to derive if the current connection is overridden.
2024-08-16Use range types for all port rangesDavid Lönnhager1-2/+16
Breaks backwards compatibility with relays.json (which is acceptable)
2024-08-16Parse shadowsocks ports in relay listDavid Lönnhager1-1/+8
2024-07-30Ignore obfuscation protocol specific constraints when 'auto' is selectedDavid Lönnhager1-2/+1
2024-07-26Fix `doc list item missing indentation`Sebastian Holmin1-1/+1
2024-06-10Use configured hostname for access tokenEmīls4-11/+11
2024-04-22Fix broken lints in rustdocsSebastian Holmin2-3/+3
I ran `cargo doc` and fixed as many broken links as I could find.
2024-04-16Add DAITA Windows client and updated tuncfgDavid Lönnhager1-0/+3
2024-04-03Wrap AbortableStream abort receiver in FuseDavid Lönnhager1-2/+4
The contract of FusedFuture says that a future may not be polled when resolved, not that it is safe to poll it afterwards
2024-03-07Add comments explaining decisionsBug Magnet1-0/+2
2024-03-07Force environment variables when running on iOSBug Magnet1-0/+4
2024-02-27Replace err_derive with thiserrorJoakim Hulthe6-37/+36
`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-21Create device proxy on tokio runtimeDavid Lönnhager1-2/+4
2024-02-19Fix redundant importsDavid Lönnhager1-1/+1
2024-02-19Move responsibility of updating the API IP from REST handle to the daemonDavid Lönnhager3-73/+10
2024-02-19Fix pointless API method rotations when concurrent requests failDavid Lönnhager1-4/+14
2024-02-16Refactor API access methodsDavid Lönnhager4-60/+82
2024-02-16Only force direct mode by default when overriding the API host/addrDavid Lönnhager1-7/+8
2024-02-15Add `force_direct` flag to API overrideMarkus Pettersson1-21/+46
2024-02-15Fix the mullvad API ffi, consume the header after building itBug Magnet1-4/+2
2024-02-15Fix off-by-one error when choosing access method candidatesMarkus Pettersson3-34/+30
2024-02-15Fix `mullvad-api` build on androidMarkus Pettersson1-3/+1
2024-02-14Add MullvadApi to MullvadVPNUITetstsEmīls1-2/+2
2024-02-14Fix talpid-time for iOS, add FFI for mullvad-apiEmīls6-4/+666
2024-01-23Use infallible HeaderValue::from() when converting from usizeAndrej Mihajlov1-6/+2
2024-01-16Do not try to resolve API address if `MULLVAD_API_HOST` is not setMarkus Pettersson1-17/+24
If the `api-override` feature is enabled, we allow overriding the ip address to the Mullvad API by settings the `MULLVAD_API_ADDRESS` env variable or have it be resolved automatically if `MULLVAD_API_HOST` is overriden. This commit fixes a bug where we would try to resolve the API address when `MULLVAD_API_ADDRESS` was not set even if `MULLVAD_API_ADDRESS` was not set either.
2024-01-12Validate SOCKS5 credentialsMarkus Pettersson1-26/+13
Validate SOCKS credentials by checking that both `username` and `password` both have a length between 1 and 255 bytes. Link to RFC detailing SOCKS5 username/password authentication: https://datatracker.ietf.org/doc/html/rfc1929
2024-01-11Synchronize `mullvad-api` and `mullvad-daemon` when the `api-override`Markus Pettersson4-91/+149
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-08Remove `ApiEndpointUpdateHandler`Markus Pettersson4-86/+23
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-05Run `cargo +nightly fmt`Sebastian Holmin2-3/+2
2024-01-04Add workspace level lintsLinus Färnstrand1-2/+0
2024-01-03Allow app to use custom socks5 and shadwosocks proxiesJonathan2-47/+33
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.
2024-01-02Fix clippy lintsDavid Lönnhager1-1/+1
2023-12-29Fetch account ID from APIDavid Lönnhager1-11/+4
2023-12-04Perform testing of access methods asynchronouslyMarkus Pettersson2-16/+12
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-0/+20
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-1/+1
2023-11-07Configure firewall rules to allow proxy clientsMarkus Pettersson3-6/+38
The default setting will (always) be to only allow processes with root-privilege to send/receive traffic from an allowed endpoint. This change is only supposed to be used with the local SOCKS5 api access method.