client, server: configurable MTU via --mtu

ex: innernet --mtu 1400 up foobarnet

Closes #102
pull/121/head
Jake McGinty 2021-06-14 19:06:35 +09:00
parent 2fa7524def
commit d431953353
2 changed files with 5 additions and 1 deletions

View File

@ -384,6 +384,10 @@ pub struct NetworkOpt {
/// Specify a WireGuard backend to use. /// Specify a WireGuard backend to use.
/// If not set, innernet will auto-select based on availability. /// If not set, innernet will auto-select based on availability.
pub backend: Backend, pub backend: Backend,
#[structopt(long, default_value = "1420")]
/// Specify the desired MTU for your interface.
pub mtu: u32,
} }
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]

View File

@ -85,7 +85,7 @@ pub fn up(
.set_private_key(wgctrl::Key::from_base64(&private_key).unwrap()) .set_private_key(wgctrl::Key::from_base64(&private_key).unwrap())
.apply(interface, network.backend)?; .apply(interface, network.backend)?;
set_addr(interface, address)?; set_addr(interface, address)?;
set_up(interface, 1420)?; set_up(interface, network.mtu)?;
if !network.no_routing { if !network.no_routing {
add_route(interface, address)?; add_route(interface, address)?;
} }