Initial commit

This commit is contained in:
Aram 🍐 2021-10-10 17:52:10 -04:00
commit d82b496937
5 changed files with 963 additions and 0 deletions

27
src/main.rs Normal file
View file

@ -0,0 +1,27 @@
#[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(())
}