Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ttcc back to its original location #6208

Closed
Changes from 1 commit
Commits
Show all changes
283 commits
Select commit Hold shift + click to select a range
b7da313
Add more bridge info to OpenVPN settings
raksooo Apr 8, 2024
9e7b4bf
Add Custom bridge to Select location view
raksooo Apr 9, 2024
41a01db
Refactor custom proxy form out of Api access method component
raksooo Apr 8, 2024
0470304
Add view for editing custom bridge
raksooo Apr 9, 2024
70cc5dd
Change special location item icon
raksooo Apr 9, 2024
2b414ef
Update translations
raksooo Apr 9, 2024
8f5bd86
Add changelog item about custom bridge
raksooo Apr 9, 2024
0f12447
Make custom bridge hover button persistent
raksooo Apr 11, 2024
3632270
Convert comment to JSDoc comments
MarkusPettersson98 Apr 11, 2024
9aaebec
Merge branch 'add-custom-bridge-to-gui-des-431'
raksooo Apr 11, 2024
59b15ef
Change WireGuard key rotation interval to 30 days for desktop + Android
faern Apr 11, 2024
51f272d
Merge branch 'set-wireguard-key-rotation-interval-to-30-days-des-806'
faern Apr 12, 2024
4a89dda
Add time left properly displayed test
niklasberglund Apr 2, 2024
c4f3d51
Merge branch 'test-that-app-properly-displays-time-left-in-account-vi…
buggmagnet Apr 12, 2024
14c8897
Revert "Use faster GH runners for slow jobs"
albin-mullvad Apr 12, 2024
e8407a8
Bump key rotation interval to 30 days on iOS
pinkisemils Apr 11, 2024
0f38aed
Merge branch 'set-wireguard-key-rotation-interval-to-30-days-ios-607'
pinkisemils Apr 12, 2024
fe15f60
Add missing translations for some strings
raksooo Apr 12, 2024
be0a46a
Merge branch 'add-missing-translation-labels-in-api-access-methods-de…
raksooo Apr 12, 2024
32ad869
Make sure we clear all settings between e2e tests
hulthe Apr 9, 2024
9be8fb4
Add ClearCustomApiAccessMethods rpc call
hulthe Apr 9, 2024
eb3c056
Add ClearCustomLists RPC call
hulthe Apr 10, 2024
f36bd2e
Merge branch 'e2e-tests-cleanup'
MarkusPettersson98 Apr 12, 2024
08f1883
Refactor custom access method integration tests
MarkusPettersson98 Apr 9, 2024
94c3ce9
Fix SOCKS5 server should accept all traffic
MarkusPettersson98 Apr 9, 2024
39cac29
Get rid of type casting for test function argument
MarkusPettersson98 Apr 9, 2024
43663fe
Do not panic in DNS tests
MarkusPettersson98 Apr 10, 2024
60562b5
Upgrade `pcap` to `1.3`
MarkusPettersson98 Apr 12, 2024
9531b30
Reset daemon environment when needed
MarkusPettersson98 Apr 9, 2024
6b7c1fc
Merge branch 'fix-flaky-test_custom_access_methods-des-778'
MarkusPettersson98 Apr 12, 2024
7cfc902
Add WireGuard tests for iOS app
niklasberglund Mar 5, 2024
3a4acfb
Add iOS app connection test
niklasberglund Mar 14, 2024
02e2f2e
Merge branch 'test-app-connection-ios-430'
pinkisemils Apr 12, 2024
b1722ac
Add alphabetical sorting for custom list locations
mojganii Apr 11, 2024
bdcce0b
Merge branch 'alphabetical-sorting-for-custom-list-locations-ios-604'
buggmagnet Apr 12, 2024
f26f315
Update privacy manifest
mojganii Apr 12, 2024
0eab341
Merge branch 'backport-changes-to-the-manifest-from-the-release-branc…
buggmagnet Apr 15, 2024
ef57b79
Suppress Joda-Time CVE-2024-23080
albin-mullvad Apr 12, 2024
fda323c
Merge branch 'suppress-CVE-2024-23080'
albin-mullvad Apr 15, 2024
80ccb2b
Update F-Droid description
albin-mullvad Apr 12, 2024
8f8bd1d
Merge branch 'align-f-droid-description-with-play-description-droid-889'
albin-mullvad Apr 15, 2024
c3d575e
Prevent duplicate list names in custom lists
Apr 10, 2024
6973de9
Merge branch 'custom-list-crashes-when-naming-a-list-with-the-name-of…
buggmagnet Apr 15, 2024
fb551fd
Add Zlib to allowed licences
raksooo Apr 15, 2024
74b67a1
Merge branch 'add-zlib-to-allowed-licenses'
raksooo Apr 15, 2024
a4cbf31
Update changelog with 2024.2-beta1 section
raksooo Apr 15, 2024
71b9e7f
Update desktop app version to 2024.2-beta1
raksooo Apr 15, 2024
c396d70
Fix Add/Save button in ProxyForm
raksooo Apr 15, 2024
65d7fa7
Merge branch 'fix-test_custom_access_methods_gui-des-821'
raksooo Apr 15, 2024
8cbff64
Add missing `windows_sys` feature
MarkusPettersson98 Apr 12, 2024
0a8d974
Merge branch 'fix-windows-compile-errors'
MarkusPettersson98 Apr 16, 2024
6b29d78
Add default settings when app is uninstalled
Apr 15, 2024
077781b
Merge branch 'add-default-settings-when-app-is-uninstalled-ios-609'
buggmagnet Apr 16, 2024
b111e72
Intercept back button when leaving an unsaved custom list
Apr 7, 2024
0149f00
Move tracking unsaved changes into coordinator
mojganii Apr 12, 2024
6fdc653
Merge branch 'intercept-back-button-when-leaving-an-unsaved-custom-li…
buggmagnet Apr 16, 2024
25ea585
Limit the name of a custom list to 30 characters
Apr 16, 2024
0e716a9
Merge branch 'limit-the-name-of-a-custom-list-to-30-characters-ios-621'
buggmagnet Apr 16, 2024
77d21ad
Fix custom DNS address being restored incorrectly
dlon Apr 15, 2024
3efb7a7
Add unit tests for macOS DNS monitor
dlon Apr 15, 2024
a7d589f
Update changelog
dlon Apr 16, 2024
486fd32
Merge branch 'macos-fix-custom-dns-reset'
dlon Apr 16, 2024
9b9a6a1
Fix overflow & max lines for custom list name
Rawa Apr 16, 2024
c1d3d10
Merge branch 'fix-list-items-to-to-apply-max-lines-1-and-elipisis-ove…
Rawa Apr 16, 2024
a8f5a90
Trim custom list name and limit to 30 characters
Rawa Apr 16, 2024
b9a5907
Merge branch 'custom-list-name-is-not-being-trimmed-droid-902'
Rawa Apr 16, 2024
99ae0b4
Add Event::duplicate
dlon Nov 20, 2023
af96a71
Add DAITA Windows client and updated tuncfg
dlon Sep 5, 2023
f099a10
Add daita toggle
raksooo Dec 5, 2023
ee841c0
Add daita filtering of relay list
raksooo Dec 5, 2023
52a2bed
Add daita label to filters in location selector
raksooo Dec 5, 2023
424a519
Only filter locations for first wg hop
raksooo Dec 14, 2023
5cfc8e5
Update translations
raksooo Jan 4, 2024
d1cdd30
Update info dialog text
raksooo Jan 4, 2024
b3d948b
Hide the DAITA setting on non-windows
raksooo Jan 17, 2024
bc9bf8d
Fix DAITA help texts
raksooo Apr 11, 2024
65a00ac
Add DAITA display to main view
raksooo Apr 11, 2024
cdb220b
Switch to lower case a in against
raksooo Apr 11, 2024
bab8932
Update translations
raksooo Apr 11, 2024
3f2a9b3
Add DAITA to relay selection
dlon Apr 12, 2024
87d5f41
Add DAITA relay selection tests
dlon Apr 12, 2024
7fa8ba2
Bump binaries submodule
dlon Apr 12, 2024
1929cda
Update maybenot machines
dlon Apr 15, 2024
1832ccc
Check out wg-nt in CI
dlon Apr 15, 2024
58dadaa
Merge branch 'add-wg-nt-daita'
dlon Apr 16, 2024
bea0150
Remove duplicate workspace member
dlon Apr 16, 2024
85ba264
Show loading states in purchasing flow an extra amount of time
Pururun Apr 8, 2024
446baab
Merge branch 'show-loading-payment-dialog-for-a-minimum-amount-of-tim…
Pururun Apr 16, 2024
293be10
Change log rotation to a quota based system
Apr 8, 2024
eaa0d44
Merge branch 'keep-more-logs-ios-522'
buggmagnet Apr 17, 2024
720b66c
Remove DAITA beta label
raksooo Apr 17, 2024
a94ee24
Merge branch 'remove-beta-label-des-744'
raksooo Apr 17, 2024
d427080
Prevent select location scroll position reset on pop
raksooo Apr 16, 2024
3f06c50
Merge branch 'fix-select-location-pop-scroll-position'
raksooo Apr 17, 2024
5ea76a5
Run nightly formatter for tests
dlon Apr 10, 2024
d1e9281
Prevent ARP lookups during LAN tests
dlon Apr 8, 2024
84d15c4
Remove dummy interfaces
dlon Apr 9, 2024
35dd2a4
Merge branch 'fix-flaky-lan-lockdown-test'
dlon Apr 17, 2024
7f1efa0
Fix formatting issues with swiftformat
buggmagnet Apr 17, 2024
5f8b2e3
Merge branch 'fix-formatting-issues-ios-624'
buggmagnet Apr 17, 2024
7a366ae
Align server IP override title with desktop app
albin-mullvad Apr 17, 2024
97e6d26
Update translations
albin-mullvad Apr 17, 2024
9f80320
Merge branch 'align-server-ip-override-title-with-desktop'
albin-mullvad Apr 17, 2024
4838c05
Add a header to log files
pinkisemils Sep 22, 2023
5b1ad96
Fix tests for log header
acb-mv Apr 9, 2024
4654acb
Add bundle version to log header
acb-mv Apr 9, 2024
6cd9341
Move log file header writing to LogFileOutputStream
acb-mv Apr 11, 2024
983f48f
Disable failing test
acb-mv Apr 11, 2024
bafb84a
Adjust indentation
acb-mv Apr 11, 2024
9af50ac
Make changes suggested in PR
acb-mv Apr 11, 2024
0cab19c
Wait for the logfile to settle before attempting to read it in tests
acb-mv Apr 15, 2024
b8e3bfe
Make logging tests synchronous on file writes / add test
acb-mv Apr 15, 2024
49d950f
Fix rebase from main
buggmagnet Apr 17, 2024
4b732a8
Merge branch 'log-app-version-on-start-of-each-log-file-improve-trunc…
buggmagnet Apr 17, 2024
323e101
Do not filter locations for custom lists
Pururun Apr 16, 2024
2e4bae9
Fix ui tests
Pururun Apr 16, 2024
9a33575
Fix unit tests
Pururun Apr 16, 2024
0a2f49c
Merge branch 'edit-list-view-gets-affected-by-filters-droid-903'
Pururun Apr 17, 2024
559d15a
Make sure to query app verion every 24 hours
hulthe Apr 12, 2024
f5326b7
Do not query latest version unless stale
hulthe Apr 15, 2024
d3fb939
Refactor away Daemon::app_version_info
hulthe Apr 15, 2024
dd475d1
Merge remote-tracking branch 'origin/version-checks-are-too-infrequen…
dlon Apr 17, 2024
ec585b7
Remove logs older than 7 days, instead all of them
pinkisemils Apr 17, 2024
746b930
Merge branch 'ios-fix-log-rotation'
pinkisemils Apr 17, 2024
3f22b8d
Fix for failing nightly iOS end to end tests
niklasberglund Apr 12, 2024
247b25e
Remove unused fn `would_return`
Serock3 Apr 17, 2024
c531b57
Filter queries with no matching relays
Serock3 Apr 17, 2024
1e0a583
Replace refs to config with just custom list
Serock3 Apr 17, 2024
ce59eb2
Add test
Serock3 Apr 17, 2024
f1d97bc
Merge branch 'fix-nightly-ios-test-issues'
buggmagnet Apr 17, 2024
52b70e8
Merge branch 'relay-selector-bug'
MarkusPettersson98 Apr 17, 2024
d7da373
Add test for login to account with too many devices
niklasberglund Mar 27, 2024
d140367
Merge branch 'test-app-login-when-theres-too-many-devices-ios-432'
buggmagnet Apr 18, 2024
6719c48
Limit the size of custom list names to 30 graphemes
pinkisemils Apr 16, 2024
b9ddc24
Merge branch 'limit-custom-list-name-to-30-chars'
pinkisemils Apr 18, 2024
48226ee
Bump binaries submodule
dlon Apr 18, 2024
c80d2d3
Remove pointless submodule update
dlon Apr 18, 2024
39afae6
Merge branch 'fix-wg-header' into main
dlon Apr 18, 2024
c0b5ad7
Fix missing cities and relays in custom list
Pururun Apr 18, 2024
0819505
Merge branch 'relay-and-city-items-not-showing-in-custom-list-droid-909'
Pururun Apr 18, 2024
25fb695
Remove support for iPad layout
buggmagnet Apr 18, 2024
774b760
Merge branch 'remove-custom-ipad-ui-ios-632'
buggmagnet Apr 18, 2024
f7050a9
Bump pfctl to 0.4.6
dlon Apr 17, 2024
a38d103
Flush PF states using pfctl-rs
dlon Apr 17, 2024
511a6e5
Update changelog
dlon Apr 17, 2024
d54dcc6
Merge branch 'macos-flush-states-for-transitions'
dlon Apr 19, 2024
5815716
Bump hickory-dns version to 0.24.1
dlon Apr 18, 2024
28563f3
Fix duplicate entries when adding through bottom sheet
Rawa Apr 19, 2024
1d58cd6
Merge branch 'user-can-have-duplicate-entries-in-custom-list-droid-912'
Rawa Apr 19, 2024
ca1d45e
Add delete custom list entry bottom sheet
Rawa Apr 19, 2024
f9e4201
Merge branch 'add-ability-to-delete-entry-from-custom-list-in-select-…
Rawa Apr 19, 2024
f9ad3d2
Add testid to custom bridge delete confirmation button
raksooo Apr 16, 2024
bc7b8e9
Add aria-label to edit custom bridge button
raksooo Apr 16, 2024
b2e98f2
Fix not resetting to bridge type normal when selecting automatic
raksooo Apr 16, 2024
a457903
Add GUI test for custom bridge
raksooo Apr 16, 2024
67e772a
Add ensure_logged_in test helper function
raksooo Apr 16, 2024
1637cdf
Add gui test to test framework
raksooo Apr 16, 2024
9931f2c
Update translations
raksooo Apr 16, 2024
eced118
Merge branch 'add-custom-bridge-test-des-820'
raksooo Apr 19, 2024
a15d373
Use only blue as a top bar color in the welcome screen
Pururun Apr 22, 2024
47a32b6
Merge branch 'top-bar-color-on-welcome-screen-droid-837'
Pururun Apr 22, 2024
a0f3abe
Fix broken lints in rustdocs
Serock3 Apr 19, 2024
88145b7
Merge branch 'fix-broken-doclinks'
MarkusPettersson98 Apr 22, 2024
95f88f7
Limit execution of `test_installation_idempotency`
MarkusPettersson98 Apr 22, 2024
7cc55c8
Merge branch 'limit-test-execution-des-898'
MarkusPettersson98 Apr 22, 2024
0a194d9
Rename .cargo/config to .cargo/config.toml
faern Apr 19, 2024
0a5b185
Merge branch 'rename-cargo-config'
faern Apr 23, 2024
170458d
Upgrade rustls to avoid RUSTSEC-2024-0336
faern Apr 23, 2024
430d39b
Merge branch 'upgrade-rustls-to-fix-rustsec-2024-0336-des-903'
faern Apr 23, 2024
7f0fd24
Bump setup-protoc action to v3
dlon Apr 23, 2024
d63e491
Add TODO comment about removing symlink monitor
dlon Apr 23, 2024
f3763e9
Merge branch 'win-add-symlink-comment'
dlon Apr 23, 2024
0329c9e
Remove some pointless checks
dlon Apr 17, 2024
b0f5b60
Remove pointless round trip for version check
dlon Apr 17, 2024
ab6b6bb
Remove unused DaemonEventSender method
dlon Apr 17, 2024
87317c2
Merge branch 'minor-version-check-cleanup'
dlon Apr 23, 2024
0ba9f4c
Make talpid-time timers mockable in tests
dlon Apr 19, 2024
45cbe81
Add tests for version checker
dlon Apr 17, 2024
9e1f55d
Document 'test' feature in talpid-time
dlon Apr 19, 2024
9ceb3be
Merge branch 'version-check-test'
dlon Apr 23, 2024
f0cca90
Update android editorconfig to the latest from ktfmt repository
Pururun Apr 22, 2024
8a37044
Merge branch 'update-editorconfig-file'
Pururun Apr 23, 2024
6dbfc10
Revert "Remove support for iPad layout"
buggmagnet Apr 23, 2024
65e92f2
Merge branch 'bring-back-ipad-before-removing-it-again'
pinkisemils Apr 24, 2024
d565a02
Remove unused goruntime-boottime-over-monotonic.diff
faern Apr 11, 2024
7b4c315
Upgrade golang.org/x/net, golang.org/x/crypto and golang.org/x/sys
faern Apr 24, 2024
4243569
Merge branch 'improve-wireguard-go-build'
faern Apr 24, 2024
9d2a317
Update electron-builder
raksooo Apr 23, 2024
c16ef1f
Update dependencies with npm audit fix
raksooo Apr 23, 2024
0bd70fb
Add guard to prevent running preinstall and postinstall a second time
raksooo Apr 24, 2024
c94fc08
Fix notarization issues after upgrading electron-builder to 24.13.3
raksooo Apr 24, 2024
4136d7d
Merge branch 'update-dependencies-with-known-vulnerabilities-des-902'
raksooo Apr 25, 2024
59ab06f
Fix iPad location selection entries not being unmarked as selected
Apr 24, 2024
34a7653
Merge branch 'fix-ipad-location-selection-entries-not-being-unmarked-…
buggmagnet Apr 25, 2024
dbc1391
Add a test to delete, edit and create a custom list
buggmagnet Apr 17, 2024
618b157
Merge branch 'write-ui-tests-for-custom-lists-ios-625'
buggmagnet Apr 25, 2024
360ab16
Update relay-locations.pot
raksooo Apr 16, 2024
9a3acad
Download translations
raksooo Apr 25, 2024
2865a03
Merge branch 'update-translations-for-2024.2-des-709'
raksooo Apr 25, 2024
ab4b01b
Run cargo update + use new base64
hulthe Apr 24, 2024
4836fcf
Fix chrono deprecation warnings
hulthe Apr 24, 2024
548f391
Update windows-sys
hulthe Apr 25, 2024
33063c8
Fix use of deprecated socket2 function
hulthe Apr 25, 2024
84a249b
Merge branch 'deps'
MarkusPettersson98 Apr 25, 2024
5002832
Update changelog for android/2024.2-beta1
albin-mullvad Apr 17, 2024
e61a348
Update android app version to 2024.2-beta1
albin-mullvad Apr 23, 2024
463fb4b
Update changelog with changes for 2024.2
raksooo Apr 25, 2024
52e40a2
Update desktop app version to 2024.2
raksooo Apr 25, 2024
cf980c8
Add FFI to talpid-tunnel-config-client
pinkisemils Feb 6, 2024
e10fece
Remove debug statements
buggmagnet Mar 20, 2024
87710df
Regroup switch cases together
buggmagnet Mar 20, 2024
86e12c8
Enable reading Quantum Resistance settings from SettingsReader
buggmagnet Mar 20, 2024
6593cc9
Add utility methods for mutating `State`'s data, replacing switch stmts
acb-mv Mar 19, 2024
64baed2
Remove premature changes not related to this refactoring
acb-mv Mar 19, 2024
2b1f0dc
Remove commented dead code
acb-mv Mar 19, 2024
15698a2
Make State Equatable, move change checks to didSet &c
acb-mv Mar 20, 2024
eb8a951
Add a new actor state for key negotiation
buggmagnet Mar 20, 2024
b528169
Read settings to determine whether to exchange a PQ key
buggmagnet Mar 21, 2024
f92a81e
Try to reconnect when PQ key exchange fails
buggmagnet Mar 26, 2024
5b7a204
Remove dead code
buggmagnet Mar 26, 2024
7b2e5e6
Enable exchanging PQ keys from an unconnected state
buggmagnet Mar 26, 2024
97946da
Add safety checks at the FFI boundary
buggmagnet Mar 26, 2024
55f646b
Remove unneeded dependencies
buggmagnet Mar 27, 2024
ceecd50
Tidy code around key negotiation and cancellation token flow
acb-mv Mar 27, 2024
95979bc
Add "tidy" as an imperative verb
acb-mv Mar 27, 2024
f8e2696
Update git-commit-message-style to match main
acb-mv Mar 27, 2024
34bcefe
Fix a typo
buggmagnet Mar 28, 2024
84c28b8
Remove unneeded framework reference
buggmagnet Mar 28, 2024
c742674
Rewrite the PQ cancellation token in a safer way
buggmagnet Mar 28, 2024
e3b54dd
Fix rebase issues
buggmagnet Apr 8, 2024
6ba2959
Add a method to receive the preshared key in the actor
buggmagnet Apr 10, 2024
b85d480
Add preSharedKey to configurationBuilder
acb-mv Apr 10, 2024
31d3e18
Attempt at starting a tunnel with the PQ shared key
acb-mv Apr 10, 2024
7864765
Hack the new private key as a global to prove PQ PSK works
buggmagnet Apr 11, 2024
c805115
Prototype a new actor to handle PQ PSK
buggmagnet Apr 12, 2024
07aaa66
Add the ephemeral private key to the negotiation data flow (Swift-sid…
acb-mv Apr 12, 2024
2af50f2
Pass the ephemeral key to postQuantumConnect
acb-mv Apr 12, 2024
71156e1
Modify (partially) Rust code to handle the ephemeral key as passed th…
acb-mv Apr 15, 2024
3f18654
Derive the ephemeral public key from the private key in the FFI
buggmagnet Apr 15, 2024
e508663
Correct spelling of PostQuantumKeyNegotiator
acb-mv Apr 23, 2024
5c10737
Add functionality to the actor
acb-mv Apr 24, 2024
1062fab
Move PQ negotiation to Actor which is now not an Actor
acb-mv Apr 24, 2024
1626e48
Refactor PQ key receiving protocol
acb-mv Apr 24, 2024
3829fef
Fix whitespace
acb-mv Apr 24, 2024
a4c39a6
Combine all negotiation-lifecycle data in one optional struct
acb-mv Apr 24, 2024
5815d3a
Remove obsolete code from PacketTunnelProvider
acb-mv Apr 24, 2024
15d4f91
Do not schedule more than one read or writes at a time
buggmagnet Apr 26, 2024
fb891f0
Use the new proto file
buggmagnet Apr 29, 2024
eb47373
Readd missing line after rebase
buggmagnet Apr 29, 2024
4955b22
Remove the iOS custom TTCC crate in favour of the original one
buggmagnet Apr 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor custom access method integration tests
Break out the Shadowsocks and SOCKS5 custom access method tests into
seperate tests. The intent is to increase logging granularity.
  • Loading branch information
MarkusPettersson98 committed Apr 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 08f1883f88f71d1959762452ceb2e07ead7bce4a
94 changes: 50 additions & 44 deletions test/test-manager/src/tests/access_methods.rs
Original file line number Diff line number Diff line change
@@ -1,50 +1,30 @@
//! Integration tests for API access methods.
use super::{Error, TestContext};
//!
//! The tested access methods are:
//! * Shadowsocks
//! * SOCKS5 in remote mode
//!
//! These tests rely on working proxies to exist *somewhere* for all tested protocols.
//! If the proxies themselves are bad/not running, this test will fail due to issues
//! that are out of the test manager's control.
use anyhow::{anyhow, ensure, Context};

use mullvad_management_interface::MullvadProxyClient;
use talpid_types::net::proxy::CustomProxy;
use test_macro::test_function;
use test_rpc::ServiceClient;

/// Assert that custom access methods may be used to access the Mullvad API.
///
/// The tested access methods are:
/// * Shadowsocks
/// * Socks5 in remote mode
///
/// # Note
///
/// This tests assume that there exists working proxies *somewhere* for all
/// tested protocols. If the proxies themselves are bad/not running, this test
/// will fail due to issues that are out of the test manager's control.
use super::TestContext;

/// Assert that API traffic can be proxied via a custom Shadowsocks proxy.
#[test_function]
pub async fn test_custom_access_methods(
async fn test_access_method_shadowsocks(
_: TestContext,
_rpc: ServiceClient,
mullvad_client: MullvadProxyClient,
) -> Result<(), Error> {
log::info!("Testing Shadowsocks access method");
test_shadowsocks(mullvad_client.clone()).await?;
log::info!("Testing SOCKS5 (Remote) access method");
test_socks_remote(mullvad_client.clone()).await?;
Ok(())
}

macro_rules! assert_access_method_works {
($mullvad_client:expr, $access_method:expr) => {
let successful = $mullvad_client
.test_custom_api_access_method($access_method.clone().into())
.await
.expect("Failed to test custom API access method");

assert!(
successful,
"Failed while testing access method - {:?}",
$access_method
);
};
}

async fn test_shadowsocks(mut mullvad_client: MullvadProxyClient) -> Result<(), Error> {
mut mullvad_client: MullvadProxyClient,
) -> anyhow::Result<()> {
use mullvad_relay_selector::{RelaySelector, SelectorConfig};
log::info!("Testing Shadowsocks access method");
// Set up all the parameters needed to create a custom Shadowsocks access method.
//
// Since Mullvad's bridge servers host Shadowsocks relays, we can simply
@@ -53,22 +33,48 @@ async fn test_shadowsocks(mut mullvad_client: MullvadProxyClient) -> Result<(),
let relay_selector = RelaySelector::from_list(SelectorConfig::default(), relay_list);
let access_method = relay_selector
.get_bridge_forced()
.expect("`test_shadowsocks` needs at least one shadowsocks relay to execute. Found none in relay list.");
assert_access_method_works!(mullvad_client, access_method);
.context("`test_shadowsocks` needs at least one shadowsocks relay to execute. Found none in relay list.")?;
log::info!("Selected shadowsocks bridge: {access_method:?}");
assert_access_method_works(mullvad_client, access_method.clone())
.await
.with_context(|| anyhow!("Access method {access_method:?} did not work!"))?;
Ok(())
}

async fn test_socks_remote(mut mullvad_client: MullvadProxyClient) -> Result<(), Error> {
/// Assert that API traffic can be proxied via a custom SOCKS5 proxy.
#[test_function]
async fn test_access_method_socks5_remote(
_: TestContext,
_rpc: ServiceClient,
mullvad_client: MullvadProxyClient,
) -> anyhow::Result<()> {
use crate::vm::network::{NON_TUN_GATEWAY, SOCKS5_PORT};
use std::net::SocketAddr;
use talpid_types::net::proxy::{CustomProxy, Socks5Remote};
use talpid_types::net::proxy::Socks5Remote;
log::info!("Testing SOCKS5 (Remote) access method");
// Set up all the parameters needed to create a custom SOCKS5 access method.
//
// The remote SOCKS5 proxy is assumed to be running on the test manager. On
// which port it listens to is defined as a constant in the `test-manager`
// crate.
let endpoint = SocketAddr::from((NON_TUN_GATEWAY, SOCKS5_PORT));
let access_method = CustomProxy::from(Socks5Remote::new(endpoint));
assert_access_method_works!(mullvad_client, access_method);
let access_method = Socks5Remote::new(endpoint);
log::info!("Testing SOCKS5-proxy: {access_method:?}");
assert_access_method_works(mullvad_client, access_method.clone())
.await
.with_context(|| anyhow!("Access method {access_method:?} did not work!"))?;
Ok(())
}

async fn assert_access_method_works(
mut mullvad_client: MullvadProxyClient,
access_method: impl Into<CustomProxy> + std::fmt::Debug,
) -> anyhow::Result<()> {
let successful = mullvad_client
.test_custom_api_access_method(access_method.into())
.await
.context("Failed to test custom API access method")?;

ensure!(successful, "Failed while testing access method");
Ok(())
}