Skip to content

Commit

Permalink
meta: remove unused code and format
Browse files Browse the repository at this point in the history
  • Loading branch information
mcginty committed May 19, 2021
1 parent 3fcacc2 commit c512985
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 29 deletions.
2 changes: 1 addition & 1 deletion client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ package = "innernet"
buildflags = ["--release"]

[package.metadata.rpm.files]
"../[email protected]" = { path = "/usr/lib/systemd/system/[email protected]" }
"../../doc/innernet-server.8.gz" = { path = "/usr/share/man/man8/innernet.8.gz" }
"../[email protected]" = { path = "/usr/lib/systemd/system/[email protected]" }

[package.metadata.rpm.targets]
innernet = { path = "/usr/bin/innernet" }
5 changes: 1 addition & 4 deletions client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,7 @@ fn fetch(
}

println!();
log::info!(
"updated interface {}\n",
interface.as_str_lossy().yellow()
);
log::info!("updated interface {}\n", interface.as_str_lossy().yellow());
} else {
log::info!("{}", "peers are already up to date.".green());
}
Expand Down
14 changes: 10 additions & 4 deletions client/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ static LOGGER: Logger = Logger;
struct Logger;
impl log::Log for Logger {
fn enabled(&self, metadata: &log::Metadata) -> bool {
metadata.level() <= log::max_level() && (log::max_level() == LevelFilter::Trace
|| metadata.target().starts_with("shared::")
|| metadata.target() == "innernet")
metadata.level() <= log::max_level()
&& (log::max_level() == LevelFilter::Trace
|| metadata.target().starts_with("shared::")
|| metadata.target() == "innernet")
}

fn log(&self, record: &log::Record) {
Expand All @@ -25,7 +26,12 @@ impl log::Log for Logger {
Level::Trace => "[T]".purple(),
};
if record.level() <= LevelFilter::Debug && record.target() != "innernet" {
println!("{} {} {}", level_str, format!("[{}]", record.target()).dimmed(), record.args());
println!(
"{} {} {}",
level_str,
format!("[{}]", record.target()).dimmed(),
record.args()
);
} else {
println!("{} {}", level_str, record.args());
}
Expand Down
6 changes: 0 additions & 6 deletions docker-tests/run-docker-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ cleanup() {
}
trap cleanup EXIT

if [[ "$OSTYPE" == "darwin"* ]]; then
info "Loading wireguard kernel module in Docker VM."
# ensure the wireguard kernel module is loaded in the macOS docker VM.
cmd docker run --rm --pid=host --privileged justincormack/nsenter1 /sbin/modprobe wireguard
fi

info "Creating network."
NETWORK=$(cmd docker network create -d bridge --subnet=172.18.0.0/16 innernet)

Expand Down
4 changes: 2 additions & 2 deletions publicip/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "publicip"
version = "0.1.0"
authors = ["Jake McGinty <[email protected]>"]
edition = "2018"
name = "publicip"
version = "0.1.0"

[dependencies]
4 changes: 2 additions & 2 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ libc = "0.2"
libsqlite3-sys = "0.22"
log = "0.4"
parking_lot = "0.11"
publicip = { path = "../publicip" }
pretty_env_logger = "0.4"
publicip = { path = "../publicip" }
regex = { version = "1", default-features = false, features = ["std"] }
rusqlite = "0.25"
serde = { version = "1", features = ["derive"] }
Expand Down Expand Up @@ -64,8 +64,8 @@ package = "innernet-server"
buildflags = ["--release"]

[package.metadata.rpm.files]
"../[email protected]" = { path = "/usr/lib/systemd/system/[email protected]" }
"../../doc/innernet-server.8.gz" = { path = "/usr/share/man/man8/innernet-server.8.gz" }
"../[email protected]" = { path = "/usr/lib/systemd/system/[email protected]" }

[package.metadata.rpm.targets]
innernet-server = { path = "/usr/bin/innernet-server" }
10 changes: 2 additions & 8 deletions shared/src/wg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,8 @@ fn cmd(bin: &str, args: &[&str]) -> Result<process::Output, Error> {
let output = Command::new(bin).args(args).output()?;
log::debug!("{} {}", bin, args.join(" "));
log::debug!("status code {:?}", output.status.code());
log::trace!(
"stdout: {}",
String::from_utf8_lossy(&output.stdout)
);
log::trace!(
"stderr: {}",
String::from_utf8_lossy(&output.stderr)
);
log::trace!("stdout: {}", String::from_utf8_lossy(&output.stdout));
log::trace!("stderr: {}", String::from_utf8_lossy(&output.stderr));
if output.status.success() {
Ok(output)
} else {
Expand Down
8 changes: 6 additions & 2 deletions wgctrl-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ impl FromStr for Backend {
impl Backend {
pub fn variants() -> &'static [&'static str] {
#[cfg(target_os = "linux")]
{ &["kernel", "userspace"] }
{
&["kernel", "userspace"]
}

#[cfg(not(target_os = "linux"))]
{ &["userspace"] }
{
&["userspace"]
}
}
}

0 comments on commit c512985

Please sign in to comment.