Skip to content

chore(test): make proxy test robust wrt IPv4/v6 #195

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

Merged
merged 1 commit into from
May 23, 2025
Merged
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions tests/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,10 @@ async fn test_socks_v5_with_locally_resolved_domain_works() {

// command req/res
let n = to_client.read(&mut buf).await.expect("read 3");
let message = [0x05, 0x01, 0x00, 0x01];
assert_eq!(&buf[..4], message);
assert_eq!(n, 4 + 4 + 2);
let message = [0x05, 0x01, 0x00];
assert_eq!(&buf[..3], message);
assert!(buf[3] == 0x01 || buf[3] == 0x04); // IPv4 or IPv6
assert_eq!(n, 4 + 4 * (buf[3] as usize) + 2);

let message = vec![0x05, 0x00, 0x00, 0x01, 0, 0, 0, 0, 0, 0];
to_client.write_all(&message).await.expect("write 3");
Expand Down
Loading