Skip to content

cuprated: parse SOCKS5 proxy URL#596

Open
redsh4de wants to merge 3 commits intoCuprate:mainfrom
redsh4de:feat/parseable-proxyurl
Open

cuprated: parse SOCKS5 proxy URL#596
redsh4de wants to merge 3 commits intoCuprate:mainfrom
redsh4de:feat/parseable-proxyurl

Conversation

@redsh4de
Copy link
Copy Markdown
Contributor

@redsh4de redsh4de commented Apr 7, 2026

What

Closes #579

Why

no unparsed string :)

Where

cuprated, p2p

How

Add a TryFrom<String> impl that parses "", "Tor", falls through to attempting to parse anything else as a SOCKS5 proxy url, checking if each part is correct
Also From<ProxySettings> for String for test compatibility

@github-actions github-actions bot added A-p2p Area: Related to P2P. A-binaries Area: Related to binaries. labels Apr 7, 2026
Comment thread binaries/cuprated/src/p2p.rs Outdated
Comment thread binaries/cuprated/src/config/p2p.rs Outdated
Comment thread binaries/cuprated/src/p2p.rs
@redsh4de redsh4de requested a review from SyntheticBird45 April 8, 2026 05:16
Copy link
Copy Markdown
Member

@SyntheticBird45 SyntheticBird45 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting on @Boog900 for one of the requested change. Will approve once it is resolved.

Edit: resolved

match s.as_str() {
"" => Ok(Self::Disabled),
"Tor" => Ok(Self::Tor),
// TODO: use `if let` guard when on >=1.95
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

https://blog.rust-lang.org/2026/04/16/Rust-1.95.0/

 if-let guards in matches

Rust 1.88 stabilized let chains. Rust 1.95 brings that capability into match expressions, allowing for conditionals based on pattern matching.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wen workspace: Rust 1.93..=1.95 PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-binaries Area: Related to binaries. A-p2p Area: Related to P2P.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parse the proxy url in the config

2 participants