mirror of
https://codeberg.org/YGGverse/psocks.git
synced 2026-03-31 16:35:28 +00:00
reorganize List from enum to struct; separate features to children mods
This commit is contained in:
parent
0b6b0ebd0e
commit
e5268e49f1
2 changed files with 37 additions and 41 deletions
19
src/list/item.rs
Normal file
19
src/list/item.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use log::debug;
|
||||
|
||||
#[derive(PartialEq, Eq, Hash)]
|
||||
pub enum Item {
|
||||
Ending(String),
|
||||
Exact(String),
|
||||
}
|
||||
|
||||
impl Item {
|
||||
pub fn from_line(rule: &str) -> Self {
|
||||
if let Some(item) = rule.strip_prefix(".") {
|
||||
debug!("Add `{rule}` to the whitelist");
|
||||
Self::Ending(item.to_string())
|
||||
} else {
|
||||
debug!("Add `{rule}` exact match to the whitelist");
|
||||
Self::Exact(rule.to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue