onetun/src/main.rs
2021-10-10 17:52:10 -04:00

27 lines
716 B
Rust

#[macro_use]
extern crate log;
use std::net::UdpSocket;
use std::sync::Arc;
use anyhow::Context;
use boringtun::crypto::{X25519PublicKey, X25519SecretKey};
use boringtun::device::peer::Peer;
use boringtun::noise::Tunn;
use clap::{App, Arg};
use crate::config::Config;
mod config;
fn main() -> anyhow::Result<()> {
pretty_env_logger::init_custom_env("ONETUN_LOG");
let config = Config::from_args().with_context(|| "Failed to read config")?;
debug!("Parsed arguments: {:?}", config);
// TODO
// 1. Listen on source addr (sA) -> encapsulate packets with peer IP -> send to endpoint IP (sB)
// 2. Connect to endpoint IP (sB) -> decapsulate packets -> send to source addr (sA)
Ok(())
}