meta: remove unused code and format
parent
3fcacc2ad8
commit
c512985214
|
@ -54,8 +54,8 @@ package = "innernet"
|
|||
buildflags = ["--release"]
|
||||
|
||||
[package.metadata.rpm.files]
|
||||
"../innernet@.service" = { path = "/usr/lib/systemd/system/innernet@.service" }
|
||||
"../../doc/innernet-server.8.gz" = { path = "/usr/share/man/man8/innernet.8.gz" }
|
||||
"../innernet@.service" = { path = "/usr/lib/systemd/system/innernet@.service" }
|
||||
|
||||
[package.metadata.rpm.targets]
|
||||
innernet = { path = "/usr/bin/innernet" }
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "publicip"
|
||||
version = "0.1.0"
|
||||
authors = ["Jake McGinty <me@jake.su>"]
|
||||
edition = "2018"
|
||||
name = "publicip"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -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"] }
|
||||
|
@ -64,8 +64,8 @@ package = "innernet-server"
|
|||
buildflags = ["--release"]
|
||||
|
||||
[package.metadata.rpm.files]
|
||||
"../innernet-server@.service" = { path = "/usr/lib/systemd/system/innernet-server@.service" }
|
||||
"../../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" }
|
||||
|
||||
[package.metadata.rpm.targets]
|
||||
innernet-server = { path = "/usr/bin/innernet-server" }
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue