-
Notifications
You must be signed in to change notification settings - Fork 68
P2P: Update arti and fix issues with our Tor impl #640
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,7 +59,7 @@ pub struct TorContext { | |
| // -------- Only in Arti mode | ||
| /// Arti bootstrapped [`TorClient`]. | ||
| #[cfg(feature = "arti")] | ||
| pub bootstrapped_client: Option<TorClient<PreferredRuntime>>, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is no longer clone, so its now |
||
| pub bootstrapped_client: Option<Arc<TorClient<PreferredRuntime>>>, | ||
| /// Arti bootstrapped client config | ||
| #[cfg(feature = "arti")] | ||
| pub arti_client_config: Option<TorClientConfig>, | ||
|
|
@@ -123,7 +123,9 @@ pub async fn initialize_tor_if_enabled(launch_ctx: &LaunchContext) -> TorContext | |
|
|
||
| /// Initialize Arti Tor client. | ||
| #[cfg(feature = "arti")] | ||
| async fn initialize_arti_client(config: &Config) -> (TorClient<PreferredRuntime>, TorClientConfig) { | ||
| async fn initialize_arti_client( | ||
| config: &Config, | ||
| ) -> (Arc<TorClient<PreferredRuntime>>, TorClientConfig) { | ||
| // Configuration | ||
| let mut tor_config = TorClientConfig::builder(); | ||
|
|
||
|
|
@@ -149,7 +151,7 @@ async fn initialize_arti_client(config: &Config) -> (TorClient<PreferredRuntime> | |
| if config.tor.arti.isolated_circuit { | ||
| let mut stream_prefs = StreamPrefs::new(); | ||
| stream_prefs.isolate_every_stream(); | ||
| tor_client.set_stream_prefs(stream_prefs); | ||
| tor_client = tor_client.with_prefs(stream_prefs); | ||
| } | ||
|
|
||
| (tor_client, tor_config) | ||
|
|
@@ -207,7 +209,7 @@ pub fn transport_clearnet_arti_config(ctx: &TorContext) -> TransportConfig<Clear | |
|
|
||
| TransportConfig::<ClearNet, Arti> { | ||
| client_config: ArtiClientConfig { | ||
| client: bootstrapped_client.clone(), | ||
| client: Arc::clone(bootstrapped_client), | ||
| }, | ||
| server_config: None, | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,19 +68,23 @@ impl OnionAddr { | |
| return Err(OnionAddrParsingError::InvalidTld(String::from(tld))); | ||
| } | ||
|
|
||
| // The domain part must only contain base32 characters. | ||
| // The domain part must only contain base32 characters. monerod also | ||
| // accepts uppercase characters. | ||
| if !domain | ||
| .as_bytes() | ||
| .iter() | ||
| .copied() | ||
| .all(|c| c.is_ascii_lowercase() || (b'2'..=b'7').contains(&c)) | ||
| .all(|c| c.is_ascii_alphabetic() || (b'2'..=b'7').contains(&c)) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the thing causing issues with Tor, it prevents you from connecting to nodes that send upper case addresses. |
||
| { | ||
| return Err(OnionAddrParsingError::NonBase32Char); | ||
| } | ||
|
|
||
| Ok(addr.as_bytes()[..56] | ||
| let mut domain: [u8; 56] = addr.as_bytes()[..56] | ||
| .try_into() | ||
| .unwrap_or_else(|e| panic!("We just validated address: {addr} : {e}"))) | ||
| .unwrap_or_else(|e| panic!("We just validated address: {addr} : {e}")); | ||
| domain.make_ascii_lowercase(); | ||
|
|
||
| Ok(domain) | ||
| } | ||
|
|
||
| /// Generate an onion address string. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seed node was updated upstream