mirror of
https://github.com/egor-white/zaprett.git
synced 2025-12-10 05:19:42 +05:00
Merge branch 'rust' into feat/build-anrdoid
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -7,3 +7,6 @@
|
|||||||
[submodule "rust/crates/libnfqws/zapret"]
|
[submodule "rust/crates/libnfqws/zapret"]
|
||||||
path = rust/crates/libnfqws/zapret
|
path = rust/crates/libnfqws/zapret
|
||||||
url = https://github.com/bol-van/zapret.git
|
url = https://github.com/bol-van/zapret.git
|
||||||
|
[submodule "rust/crates/iptables"]
|
||||||
|
path = rust/crates/iptables
|
||||||
|
url = https://github.com/yaa110/rust-iptables
|
||||||
|
|||||||
1
rust/Cargo.lock
generated
1
rust/Cargo.lock
generated
@@ -905,7 +905,6 @@ dependencies = [
|
|||||||
"libnfqws",
|
"libnfqws",
|
||||||
"log",
|
"log",
|
||||||
"nix",
|
"nix",
|
||||||
"once_cell",
|
|
||||||
"pretty_env_logger",
|
"pretty_env_logger",
|
||||||
"regex",
|
"regex",
|
||||||
"rust-ini",
|
"rust-ini",
|
||||||
|
|||||||
1
rust/crates/iptables
Submodule
1
rust/crates/iptables
Submodule
Submodule rust/crates/iptables added at e0e1f5dcc0
@@ -14,7 +14,6 @@ serde = { workspace = true }
|
|||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
sysctl ={ workspace = true }
|
sysctl ={ workspace = true }
|
||||||
tokio = { workspace = true }
|
tokio = { workspace = true }
|
||||||
once_cell = { workspace = true }
|
|
||||||
libnfqws = { path = "../libnfqws" }
|
libnfqws = { path = "../libnfqws" }
|
||||||
daemonize = { workspace = true }
|
daemonize = { workspace = true }
|
||||||
pretty_env_logger = { workspace = true }
|
pretty_env_logger = { workspace = true }
|
||||||
|
|||||||
@@ -302,14 +302,22 @@ fn get_autostart() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn service_status() -> bool {
|
fn service_status() -> bool {
|
||||||
unimplemented!();
|
let pid_str = match fs::read_to_string(MODULE_PATH.join("tmp/pid.lock")) {
|
||||||
// match all_processes() {
|
Ok(s) => s,
|
||||||
// Ok(iter) => iter
|
Err(_) => return false,
|
||||||
// .filter_map(|rp| rp.ok())
|
};
|
||||||
// .filter_map(|p| p.stat().ok())
|
let pid = match pid_str.trim().parse::<i32>() {
|
||||||
// .any(|st| st.comm == "zaprett"),
|
Ok(p) => p,
|
||||||
// Err(_) => false,
|
Err(_) => return false,
|
||||||
// }
|
};
|
||||||
|
return true
|
||||||
|
/*match all_processes() {
|
||||||
|
Ok(iter) => iter
|
||||||
|
.filter_map(|rp| rp.ok())
|
||||||
|
.filter_map(|p| p.stat().ok())
|
||||||
|
.any(|st| st.pid == pid),
|
||||||
|
Err(_) => false,
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
fn module_version() {
|
fn module_version() {
|
||||||
|
|||||||
19
rust/remove_os_check.patch
Normal file
19
rust/remove_os_check.patch
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
diff --git a/crates/iptables/src/lib.rs b/crates/iptables/src/lib.rs
|
||||||
|
index 4a4d6dc..e7d15fc 100644
|
||||||
|
--- a/src/lib.rs
|
||||||
|
+++ b/src/lib.rs
|
||||||
|
@@ -92,14 +92,6 @@ pub struct IPTables {
|
||||||
|
pub is_numeric: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
-/// Returns `None` because iptables only works on linux
|
||||||
|
-#[cfg(not(target_os = "linux"))]
|
||||||
|
-pub fn new(is_ipv6: bool) -> Result<IPTables, Box<dyn Error>> {
|
||||||
|
- Err(error_from_str("iptables only works on Linux"))
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-/// Creates a new `IPTables` Result with the command of 'iptables' if `is_ipv6` is `false`, otherwise the command is 'ip6tables'.
|
||||||
|
-#[cfg(target_os = "linux")]
|
||||||
|
pub fn new(is_ipv6: bool) -> Result<IPTables, Box<dyn Error>> {
|
||||||
|
let cmd = if is_ipv6 { "ip6tables" } else { "iptables" };
|
||||||
|
|
||||||
Reference in New Issue
Block a user