summaryrefslogtreecommitdiffhomepage
path: root/mullvad-relay-selector/src/lib.rs
AgeCommit message (Collapse)AuthorFilesLines
2025-07-10Run `cargo fmt`Sebastian Holmin1-2/+2
2025-03-25Avoid using an unavailable ip version to connect to a relayJonatan Rhodin1-2/+1
Co-authored-by: Sebastian Holmin <sebastian.holmin@mullvad.net>
2025-03-05Remove automatic tunnel typeDavid Lönnhager1-1/+2
Co-authored-by: Markus Pettersson <markus.pettersson@mullvad.net>
2025-02-24Make `filter_matching_relay_list` publicSebastian Holmin1-3/+3
2024-10-18Run nightly formatterMarkus Pettersson1-5/+3
2024-10-18Introduce `Singlehop` and `Multihop` as distinct typesMarkus Pettersson1-3/+5
2024-04-22Fix broken lints in rustdocsSebastian Holmin1-5/+4
I ran `cargo doc` and fixed as many broken links as I could find.
2024-04-16Add DAITA to relay selectionDavid Lönnhager1-2/+3
2024-03-27Refactor `mullvad-relay-selector`Markus Pettersson1-2402/+11
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-14/+13
`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-12/+24
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-20Remove `parking_lot`Markus Pettersson1-79/+138
2024-02-19Fix redundant importsDavid Lönnhager1-5/+2
2024-01-03Allow app to use custom socks5 and shadwosocks proxiesJonathan1-26/+27
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-12Select WireGuard as automatic tunnel protocol three times instead of twoDavid Lönnhager1-24/+14
2023-12-12Always alternate between random ports and port 53 when using WireGuardDavid Lönnhager1-6/+5
2023-12-12Cycle over all udp2tcp portsDavid Lönnhager1-15/+5
There are currently only two ports, so this only simplifies the logic but makes no practical difference
2023-12-12Remove mention of special automatic tunnel protocol logic on Windows,David Lönnhager1-32/+1
and other vestiges
2023-12-12Simplify selection of default tunnel constraintsDavid Lönnhager1-22/+36
2023-12-12Remove unused 'default tunnel type' from relay selectorDavid Lönnhager1-136/+74
2023-12-11Supress warnings when building androidJonatan Rhodin1-0/+5
2023-12-11Never select OpenVPN on AndroidDavid Lönnhager1-0/+6
2023-11-13Simplify relay list parsing and flatteningDavid Lönnhager1-155/+140
2023-11-13Log warnings when overrides are set for unknown hostnamesDavid Lönnhager1-1/+10
2023-11-13Patch in-ips in relay selectorDavid Lönnhager1-24/+68
2023-10-31Replace UpdateRelaySettings with SetRelaySettingsDavid Lönnhager1-18/+13
2023-08-30Fix clippy lintsEmīls1-4/+1
2023-08-21Implement formatter for constraintsDavid Lönnhager1-5/+9
2023-08-04Replace all use of `lazy_static` with `once_cell`Markus Pettersson1-123/+124
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-07-07Unpublicize get_obfuscator()Emīls1-9/+11
Since RelaySelector::get_obfuscator() is only ever called from tests, it only makes sense to only compile it when testing.
2023-06-29Add settings migration code, refactor and cleanupJonathan1-2/+2
Bump the settings version. Add code for migrating settings to new version since it is now not backwards compatible. Refactor LocationConstraint and related types to be more lean. Cleanup issues and fix formatting. Refactor LocationConstraint and add migration code
2023-06-29Cleanup review comments, CI issues and android supportJonathan1-27/+80
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-96/+151
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-03-23Remove port 443 from available WireGuard over TCP portsLinus Färnstrand1-1/+1
2023-03-03Make test_load_balancing much less likely to failDavid Lönnhager1-1/+1
2022-12-22Add "load balancing" test to relay selectorDavid Lönnhager1-0/+62
2022-12-22Test openvpn constraints in relay selectorDavid Lönnhager1-1/+126
2022-12-22Test automatic bridge modeDavid Lönnhager1-14/+84
2022-12-22Add unit test for providers constraintDavid Lönnhager1-3/+26
2022-11-07Split up talpid-coreEmīls Piņķis1-1/+5
2022-10-13Add unit test for 'include_in_country'David Lönnhager1-2/+117
2022-10-13Filter out 'include_in_country' correctly for bridge relaysDavid Lönnhager1-46/+42
2022-10-13Ignore 'include_in_country' if no other relays matchDavid Lönnhager1-27/+14
2022-08-29Fix Clippy errorsDavid Lönnhager1-2/+1
2022-08-15Increase penalty for distant bridgesDavid Lönnhager1-27/+18
2022-08-15Prune distant bridges before selecting a bridgeDavid Lönnhager1-12/+46
2022-08-15Allow for migrating windows users to WGJonathan1-60/+145
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-19Upgrade x25519-dalek and rand to latest versionsLinus Färnstrand1-2/+2
2022-07-14Connect to udp2tcp (tcp2udp) endpoints over v6David Lönnhager1-2/+2
2022-07-07Update unit tests to use shared endpoint dataDavid Lönnhager1-142/+34