Skip to content

Commit

Permalink
big WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ewpratten committed May 20, 2024
1 parent 66552ae commit 19c8499
Show file tree
Hide file tree
Showing 28 changed files with 632 additions and 1,045 deletions.
62 changes: 15 additions & 47 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,44 @@ exclude = ["/.github/", "/.vscode/"]
[workspace]
members = [
"libs/easy-tun",
"libs/fast-nat",
# "libs/fast-nat",
"libs/interproto",
"libs/rfc6052",
"libs/rtnl",
"libs/protomask-metrics",
]

[features]
default = []
profiler = [
"puffin",
"puffin_http",
"easy-tun/profile-puffin",
"fast-nat/profile-puffin",
"interproto/profile-puffin",
]

[[bin]]
name = "protomask"
path = "src/protomask.rs"

[[bin]]
name = "protomask-clat"
path = "src/protomask-clat.rs"

[[bin]]
name = "protomask-6over4"
path = "src/protomask-6over4.rs"
path = "src/main.rs"

[dependencies]
# Internal dependencies
easy-tun = { version = "^2.0.0", path = "libs/easy-tun" }
fast-nat = { version = "^1.0.0", path = "libs/fast-nat" }
interproto = { version = "^1.0.0", path = "libs/interproto", features = [
"metrics",
] }
interproto = { version = "^1.0.0", path = "libs/interproto" }
rfc6052 = { version = "^1.0.0", path = "libs/rfc6052" }
rtnl = { version = "^1.0.0", path = "libs/rtnl", features = ["tokio"] }
protomask-metrics = { version = "^0.1.0", path = "libs/protomask-metrics" }

# External Dependencies
tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] }
owo-colors = { version = "3.5.0", features = ["supports-colors"] }
clap = { version = "4.3.11", features = ["derive"] }
ipnet = { version = "2.8.0", features = ["serde"] }
puffin_http = { version = "0.13.0", optional = true }
puffin = { version = "0.16.0", optional = true }
# puffin_http = { version = "0.13.0", optional = true }
# puffin = { version = "0.16.0", optional = true }
serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
log = "0.4.19"
fern = "0.6.2"
nix = "0.26.2"
# nix = "0.26.2"
thiserror = "1.0.44"
cfg-if = "1.0.0"
profiling = "1.0.9"
# cfg-if = "1.0.0"
# profiling = "1.0.9"
caps = "0.5.5"
bimap = "0.6.3"

[profile.release]
opt-level = 3
Expand All @@ -84,21 +67,11 @@ assets = [
"/usr/local/bin/protomask",
"755",
],
[
"target/release/protomask-clat",
"/usr/local/bin/protomask-clat",
"755",
],
[
"config/protomask.json",
"/etc/protomask/protomask.json",
"644",
],
[
"config/protomask-clat.json",
"/etc/protomask/protomask-clat.json",
"644",
],
[
"README.md",
"/usr/share/doc/protomask/README.md",
Expand All @@ -108,16 +81,11 @@ assets = [
conf-files = []
depends = []
maintainer-scripts = "./debian/"
systemd-units = [
{ unit-name = "protomask-service", enable = false },
{ unit-name = "protomask-clat-service", enable = false },
]
systemd-units = [{ unit-name = "protomask-service", enable = false }]

[package.metadata.generate-rpm]
assets = [
{ source = "target/release/protomask", dest = "/usr/local/bin/protomask", mode = "755"},
{ source = "target/release/protomask-clat", dest = "/usr/local/bin/protomask-clat", mode = "755"},
{ source = "config/protomask.json", dest = "/etc/protomask/protomask.json", mode = "644"},
{ source = "config/protomask-clat.json", dest = "/etc/protomask/protomask-clat.json", mode = "644"},
{ source = "README.md", dest = "/usr/share/doc/protomask/README.md", mode = "644"},
]
{ source = "target/release/protomask", dest = "/usr/local/bin/protomask", mode = "755" },
{ source = "config/protomask.json", dest = "/etc/protomask/protomask.json", mode = "644" },
{ source = "README.md", dest = "/usr/share/doc/protomask/README.md", mode = "644" },
]
9 changes: 0 additions & 9 deletions debian/protomask-clat-service

This file was deleted.

5 changes: 3 additions & 2 deletions libs/easy-tun/src/tun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ impl Tun {

// Check for errors
if err < 0 {
log::error!("ioctl failed: {}", err);
return Err(std::io::Error::last_os_error());
let last_error = std::io::Error::last_os_error();
log::error!("ioctl failed: {:?}", last_error);
return Err(last_error);
}
}

Expand Down
2 changes: 0 additions & 2 deletions libs/interproto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ categories = []

[features]
default = []
metrics = ["protomask-metrics"]
profile-puffin = ["profiling/profile-with-puffin"]

[dependencies]
protomask-metrics = { version = "^0.1.0", path = "../protomask-metrics", optional = true }
log = "^0.4"
pnet = "0.34.0"
thiserror = "^1.0.44"
Expand Down
19 changes: 0 additions & 19 deletions libs/protomask-metrics/Cargo.toml

This file was deleted.

1 change: 0 additions & 1 deletion libs/protomask-metrics/README.md

This file was deleted.

44 changes: 0 additions & 44 deletions libs/protomask-metrics/src/http.rs

This file was deleted.

12 changes: 0 additions & 12 deletions libs/protomask-metrics/src/lib.rs

This file was deleted.

9 changes: 0 additions & 9 deletions libs/protomask-metrics/src/macros.rs

This file was deleted.

37 changes: 0 additions & 37 deletions libs/protomask-metrics/src/metrics.rs

This file was deleted.

21 changes: 0 additions & 21 deletions src/args/mod.rs

This file was deleted.

Loading

2 comments on commit 19c8499

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Binary sizes for x86_64-unknown-linux-musl

Channel: stable

4.0M	target/x86_64-unknown-linux-musl/release/protomask

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Binary sizes for aarch64-unknown-linux-musl

Channel: stable

4.2M	target/aarch64-unknown-linux-musl/release/protomask

Please sign in to comment.