mirror of
https://github.com/aramperes/onetun.git
synced 2025-09-09 23:38:30 -04:00
Dockerize, and switch back to main boringtun repo
This commit is contained in:
parent
006a1b0b4e
commit
b4317dad1a
6 changed files with 51 additions and 4 deletions
10
src/main.rs
10
src/main.rs
|
@ -26,8 +26,8 @@ pub const MAX_PACKET: usize = 65536;
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
pretty_env_logger::try_init_timed_custom_env("ONETUN_LOG").unwrap();
|
||||
let config = Config::from_args().with_context(|| "Failed to read config")?;
|
||||
init_logger(&config)?;
|
||||
let port_pool = Arc::new(PortPool::new());
|
||||
|
||||
let wg = WireGuardTunnel::new(&config, port_pool.clone())
|
||||
|
@ -379,3 +379,11 @@ async fn virtual_tcp_interface(
|
|||
abort.store(true, Ordering::Relaxed);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn init_logger(config: &Config) -> anyhow::Result<()> {
|
||||
let mut builder = pretty_env_logger::formatted_builder();
|
||||
builder.parse_filters(&config.log);
|
||||
builder
|
||||
.try_init()
|
||||
.with_context(|| "Failed to initialize logger")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue