summaryrefslogtreecommitdiffhomepage
path: root/mullvad-api/src/https_client_with_sni.rs
AgeCommit message (Collapse)AuthorFilesLines
2025-01-02Remove global API endpointEmīls1-4/+24
2024-12-02Make SNI hostname implicitDavid Lönnhager1-12/+6
2024-12-02Remove DNS fallback except for conncheckDavid Lönnhager1-24/+10
2024-12-02Make `EncryptedDNSForwarder::from_stream` infallibeMarkus Pettersson1-1/+2
2024-11-22Add non-blocking DNS resolver for Android API requestsDavid Lönnhager1-17/+19
2024-10-23Enable Encrypted DNS proxy access method in the daemonMarkus Pettersson1-1/+3
2024-10-23Wire up Mullvad Encrypted DNS proxy in `mullvad-api`Markus Pettersson1-0/+21
2024-10-16Replace old client with `hyper_util` legacy clientSebastian Holmin1-6/+7
2024-02-27Replace err_derive with thiserrorJoakim Hulthe1-2/+2
`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-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-03Allow app to use custom socks5 and shadwosocks proxiesJonathan1-25/+18
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-11-06Prefix remote `ip` and `port` with `remote_` in Socks5Local contextsMarkus Pettersson1-1/+4
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 Pettersson1-2/+2
- 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 Pettersson1-2/+2
- 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 Pettersson1-8/+39
- 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 Pettersson1-1/+3
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 Pettersson1-5/+8
- 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 Pettersson1-57/+132
- 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-05-24Fix warnings pointed out by ClippyLinus Färnstrand1-1/+1
2023-04-20Update shadowsocks to 1.15.3Emīls1-1/+1
2022-11-28Conditionally compile some API override fieldsDavid Lönnhager1-11/+18
2022-11-28Use specified port for the APIDavid Lönnhager1-4/+9
2022-11-28Add support for non-TLS API connectionsDavid Lönnhager1-6/+15
2022-06-21Fix the large majority of clippy warningsJonathan1-2/+2
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-14Manually fix the simpler non-semantic clippy warnsJonathan1-5/+4
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 --fixjonathan1-2/+2
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-03-23Rename mullvad-rpc to mullvad-apiDavid Lönnhager1-0/+351