-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nat): add binary to probe for NAT status #1678
Conversation
This binary will help a machine figure out its NAT status. For this to work a public machine runs the binary, while a peer asks the public machine for a dial-back.
let registry = tracing_subscriber::registry().with(tracing_subscriber::fmt::layer()); | ||
// Use `RUST_LOG` if set, else use the verbosity flag (where `-vvvv` is trace level). | ||
let _ = if std::env::var_os("RUST_LOG").is_some() { | ||
registry.with(EnvFilter::from_env("RUST_LOG")).try_init() | ||
} else { | ||
let filter = tracing_subscriber::filter::Targets::new().with_target( | ||
env!("CARGO_BIN_NAME").replace('-', "_"), | ||
opt.verbose.log_level_filter().as_trace(), | ||
); | ||
registry.with(filter).try_init() | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe in a follow up PR can we make use of sn_logging
here? I think it will be useful to have the logs inside a single place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, kind of agree, though I think it's quite compact code here that isn't too complex. I didn't think it would be useful to log to files etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
This binary will help a machine figure out its NAT status. For this to
work a public machine runs the binary, while a peer asks the public
machine for a dial-back.