diff --git a/Cargo.lock b/Cargo.lock index bc646f1..2f9183c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -509,7 +509,6 @@ dependencies = [ "once_cell", "pin-project-lite", "rand", - "rayon", "regex", "scopeguard", "serde", diff --git a/common/Cargo.toml b/common/Cargo.toml index 53af3dc..188f846 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -23,7 +23,6 @@ once_cell = "1" pin-project-lite = "0.2" # quinn = "0.10.1" rand = "0.8" -rayon = "1" regex = "1" scopeguard = "1" serde = { workspace = true, features = ["derive", "rc"] } diff --git a/common/src/filter.rs b/common/src/filter.rs index 9d6ab9a..2abefd6 100644 --- a/common/src/filter.rs +++ b/common/src/filter.rs @@ -5,7 +5,6 @@ use std::{ sync::Arc, }; -use rayon::prelude::*; use regex::Regex; use serde::{Deserialize, Serialize}; use thiserror::Error; @@ -230,7 +229,7 @@ impl MatcherKind { addr_matcher.is_match_domain_name(addr) } MatcherKind::Many(matchers) => matchers - .par_iter() + .iter() .any(|matcher| matcher.is_match_domain_name(addr, port)), } } @@ -246,9 +245,7 @@ impl MatcherKind { } addr_matcher.is_match_ip(addr.ip()) } - MatcherKind::Many(matchers) => { - matchers.par_iter().any(|matcher| matcher.is_match_ip(addr)) - } + MatcherKind::Many(matchers) => matchers.iter().any(|matcher| matcher.is_match_ip(addr)), } } } @@ -293,7 +290,7 @@ impl AddrListMatcher { pub fn is_match_domain_name(&self, addr: &str) -> bool { match self { Self::Some(matchers) => matchers - .par_iter() + .iter() .any(|matcher| matcher.is_match_domain_name(addr)), Self::Any => true, } @@ -301,7 +298,7 @@ impl AddrListMatcher { pub fn is_match_ip(&self, addr: IpAddr) -> bool { match self { - Self::Some(matchers) => matchers.par_iter().any(|matcher| matcher.is_match_ip(addr)), + Self::Some(matchers) => matchers.iter().any(|matcher| matcher.is_match_ip(addr)), Self::Any => true, } } @@ -403,7 +400,7 @@ enum PortListMatcher { impl PortListMatcher { pub fn is_match(&self, port: u16) -> bool { match self { - Self::Some(matcher) => matcher.par_iter().any(|range| range.is_match(port)), + Self::Some(matcher) => matcher.iter().any(|range| range.is_match(port)), Self::Any => true, } } diff --git a/common/src/proxy_table.rs b/common/src/proxy_table.rs index dc53f78..44c8d56 100644 --- a/common/src/proxy_table.rs +++ b/common/src/proxy_table.rs @@ -6,7 +6,6 @@ use std::{ }; use rand::Rng; -use rayon::prelude::*; use serde::{Deserialize, Serialize}; use thiserror::Error; use tokio_util::sync::CancellationToken; @@ -40,7 +39,6 @@ where { assert!(!nodes.is_empty()); let mut pairs = (0..nodes.len() - 1) - .into_par_iter() .map(|i| { let node = &nodes[i]; let next_node = &nodes[i + 1]; @@ -78,7 +76,7 @@ where where T: Tracer
+ Send + Sync + 'static, { - let cum_weight = chains.par_iter().map(|c| c.weight).sum(); + let cum_weight = chains.iter().map(|c| c.weight).sum(); if cum_weight == 0 { return Err(ProxyTableError::ZeroAccumulatedWeight); } @@ -119,7 +117,7 @@ where None => { let scores: Arc<[_]> = self.scores().into(); info!(?scores, "Calculated scores"); - let sum = scores.par_iter().map(|(_, s)| *s).sum::