fix nightly build (#304)

* fix nightly build

* update toml dep in server for consistency

* cargo update

* fix clippy errors
reorganize-docker-tests
Saber Haj Rabiee 2024-04-18 08:09:23 -07:00 committed by GitHub
parent 4fb77f8eda
commit 15602388f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 379 additions and 393 deletions

664
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,17 @@
[workspace]
members = ["server", "client", "hostsfile", "shared", "publicip", "netlink-request"]
resolver = "2"
members = [
"server",
"client",
"hostsfile",
"shared",
"publicip",
"netlink-request",
]
[profile.release]
codegen-units = 1
opt-level = "s"
lto = "fat"
opt-level = "s"
panic = "abort"

View File

@ -29,7 +29,12 @@ clap = { version = "4.3", features = ["derive", "wrap_help"] }
clap_complete = "4.3"
colored = "2"
dialoguer = { version = "0.10", default-features = false }
hyper = { version = "0.14", default-features = false, features = ["http1", "server", "runtime", "stream"] }
hyper = { version = "0.14", default-features = false, features = [
"http1",
"server",
"runtime",
"stream",
] }
indoc = "2.0.1"
ipnet = { version = "2.4", features = ["serde"] }
libc = "0.2"
@ -47,7 +52,7 @@ shared = { path = "../shared" }
subtle = "2"
thiserror = "1"
tokio = { version = "1.28.0", features = ["macros", "rt-multi-thread", "time"] }
toml = "0.7.4"
toml = "0.8.10"
url = "2"
wireguard-control = { path = "../wireguard-control" }
@ -64,18 +69,42 @@ tempfile = "3"
[package.metadata.deb]
assets = [
["target/release/innernet-server", "usr/bin/", "755"],
["innernet-server@.service", "usr/lib/systemd/system/", "644"],
["../doc/innernet-server.8.gz", "usr/share/man/man8/", "644"],
["../doc/innernet-server.completions.zsh", "usr/share/zsh/site-functions/_innernet-server", "644"],
["../doc/innernet-server.completions.bash", "etc/bash_completion.d/innernet-server", "644"],
["../doc/innernet-server.completions.fish", "usr/share/fish/vendor_completions.d/innernet-server.fish", "644"],
[
"target/release/innernet-server",
"usr/bin/",
"755",
],
[
"innernet-server@.service",
"usr/lib/systemd/system/",
"644",
],
[
"../doc/innernet-server.8.gz",
"usr/share/man/man8/",
"644",
],
[
"../doc/innernet-server.completions.zsh",
"usr/share/zsh/site-functions/_innernet-server",
"644",
],
[
"../doc/innernet-server.completions.bash",
"etc/bash_completion.d/innernet-server",
"644",
],
[
"../doc/innernet-server.completions.fish",
"usr/share/fish/vendor_completions.d/innernet-server.fish",
"644",
],
]
depends = "libc6, libgcc1, libsqlite3-0, zlib1g, systemd"
recommends = "wireguard"
maintainer = "tonari <hey@tonari.no>"
name = "innernet-server"
priority = "optional"
recommends = "wireguard"
section = "net"
[package.metadata.rpm]
@ -86,10 +115,10 @@ buildflags = ["--release"]
[package.metadata.rpm.files]
"../../doc/innernet-server.8.gz" = { path = "/usr/share/man/man8/innernet-server.8.gz" }
"../innernet-server@.service" = { path = "/usr/lib/systemd/system/innernet-server@.service" }
"../../doc/innernet-server.completions.bash" = { path = "/etc/bash_completion.d/innernet-server" }
"../../doc/innernet-server.completions.fish" = { path = "/usr/share/fish/vendor_completions.d/innernet-server.fish" }
"../../doc/innernet-server.completions.zsh" = { path = "/usr/share/zsh/site-functions/_innernet-server" }
"../innernet-server@.service" = { path = "/usr/lib/systemd/system/innernet-server@.service" }
[package.metadata.rpm.targets]
innernet-server = { path = "/usr/bin/innernet-server" }

View File

@ -25,15 +25,15 @@ once_cell = "1.17.1"
publicip = { path = "../publicip" }
regex = "1"
serde = { version = "1", features = ["derive"] }
toml = "0.7.4"
toml = "0.8.10"
url = "2"
wireguard-control = { path = "../wireguard-control" }
[target.'cfg(target_os = "linux")'.dependencies]
netlink-sys = "0.8.5"
netlink-packet-core = "0.7"
netlink-packet-route = "0.17"
netlink-request = { path = "../netlink-request" }
netlink-sys = "0.8.5"
[target.'cfg(target_os = "macos")'.dependencies]
nix = "0.26"

View File

@ -26,9 +26,11 @@ fn if_nametoindex(interface: &InterfaceName) -> Result<u32, io::Error> {
pub fn set_up(interface: &InterfaceName, mtu: u32) -> Result<(), io::Error> {
let index = if_nametoindex(interface)?;
let mut header = LinkHeader::default();
header.index = index;
header.flags = IFF_UP;
let header = LinkHeader {
index,
flags: IFF_UP,
..Default::default()
};
let mut message = LinkMessage::default();
message.header = header;
message.nlas = vec![link::nlas::Nla::Mtu(mtu)];
@ -55,11 +57,13 @@ pub fn set_addr(interface: &InterfaceName, addr: IpNet) -> Result<(), io::Error>
vec![address::Nla::Address(network.addr().octets().to_vec())],
),
};
let mut header = AddressHeader::default();
header.index = index;
header.family = family;
header.prefix_len = addr.prefix_len();
header.scope = RT_SCOPE_UNIVERSE;
let header = AddressHeader {
index,
family,
prefix_len: addr.prefix_len(),
scope: RT_SCOPE_UNIVERSE,
..Default::default()
};
let mut message = AddressMessage::default();
message.header = header;
@ -78,13 +82,15 @@ pub fn add_route(interface: &InterfaceName, cidr: IpNet) -> Result<bool, io::Err
IpNet::V4(network) => (AF_INET as u8, network.network().octets().to_vec()),
IpNet::V6(network) => (AF_INET6 as u8, network.network().octets().to_vec()),
};
let mut header = RouteHeader::default();
header.table = RT_TABLE_MAIN;
header.protocol = RTPROT_BOOT;
header.scope = RT_SCOPE_LINK;
header.kind = RTN_UNICAST;
header.destination_prefix_length = cidr.prefix_len();
header.address_family = address_family;
let header = RouteHeader {
table: RT_TABLE_MAIN,
protocol: RTPROT_BOOT,
scope: RT_SCOPE_LINK,
kind: RTN_UNICAST,
destination_prefix_length: cidr.prefix_len(),
address_family,
..Default::default()
};
let mut message = RouteMessage::default();
message.header = header;
message.nlas = vec![route::Nla::Destination(dst), route::Nla::Oif(if_index)];

View File

@ -15,13 +15,13 @@ hex = "0.4.3"
libc = "0.2"
log = "0.4"
rand_core = { version = "0.6", features = ["getrandom"] }
x25519-dalek = { version = "=2.0.0-rc.3", features = ["static_secrets"] }
x25519-dalek = { version = "2.0.1", features = ["static_secrets"] }
[target.'cfg(target_os = "linux")'.dependencies]
netlink-request = { path = "../netlink-request" }
netlink-sys = "0.8"
netlink-packet-core = "0.7"
netlink-packet-generic = "0.3.3"
netlink-packet-route = "0.17"
netlink-packet-utils = "0.5.2"
netlink-packet-wireguard = "0.2.3"
netlink-request = { path = "../netlink-request" }
netlink-sys = "0.8"