mirror of
https://codeberg.org/YGGverse/psocks.git
synced 2026-04-01 00:45:27 +00:00
rename some methods
This commit is contained in:
parent
f5345e963d
commit
0b08744f8f
2 changed files with 11 additions and 11 deletions
10
src/rules.rs
10
src/rules.rs
|
|
@ -58,7 +58,7 @@ impl Rules {
|
|||
})
|
||||
}
|
||||
/// Get total rules from the current session
|
||||
pub async fn rules(&self) -> u64 {
|
||||
pub async fn total(&self) -> u64 {
|
||||
self.0.read().await.len() as u64
|
||||
}
|
||||
/// Allow given `rule`
|
||||
|
|
@ -72,15 +72,15 @@ impl Rules {
|
|||
Ok(self.0.write().await.remove(&Item::from_line(rule)))
|
||||
}
|
||||
/// Return active rules (from server memory)
|
||||
pub async fn list(&self) -> Vec<String> {
|
||||
let mut list: Vec<String> = self
|
||||
pub async fn active(&self) -> Vec<String> {
|
||||
let mut rules: Vec<String> = self
|
||||
.0
|
||||
.read()
|
||||
.await
|
||||
.iter()
|
||||
.map(|item| item.to_string())
|
||||
.collect();
|
||||
list.sort(); // HashSet does not keep the order
|
||||
list
|
||||
rules.sort(); // HashSet does not keep the order
|
||||
rules
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue