[−][src]Struct boringtun::noise::Tunn
Tunnel represents a point-to-point WireGuard connection
Methods
impl Tunn
[src]
pub fn tick_handshake_started(&self)
[src]
pub fn timer_tick(&self, timer_name: TimerName)
[src]
pub fn timer_tick_session_established(&self, is_initiator: bool)
[src]
pub fn update_timers<'a>(&self, dst: &'a mut [u8]) -> TunnResult<'a>
[src]
pub fn time_since_last_handshake(&self) -> Option<Duration>
[src]
pub fn persistent_keepalive(&self) -> Option<u16>
[src]
impl Tunn
[src]
pub fn new(
static_private: Arc<X25519SecretKey>,
peer_static_public: Arc<X25519PublicKey>,
preshared_key: Option<[u8; 32]>,
persistent_keepalive: Option<u16>,
index: u32
) -> Result<Box<Tunn>, &'static str>
[src]
static_private: Arc<X25519SecretKey>,
peer_static_public: Arc<X25519PublicKey>,
preshared_key: Option<[u8; 32]>,
persistent_keepalive: Option<u16>,
index: u32
) -> Result<Box<Tunn>, &'static str>
Create a new tunnel using own private key and the peer public key
pub fn set_logger(
&mut self,
logger: Box<dyn Fn(&str) + Send>,
verbosity: Verbosity
)
[src]
&mut self,
logger: Box<dyn Fn(&str) + Send>,
verbosity: Verbosity
)
Set the log function and logging level for the tunnel
pub fn set_static_private(
&self,
static_private: Arc<X25519SecretKey>
) -> Result<(), WireGuardError>
[src]
&self,
static_private: Arc<X25519SecretKey>
) -> Result<(), WireGuardError>
Update the private key and clear existing sessions
pub fn tunnel_to_network<'a>(
&self,
src: &[u8],
dst: &'a mut [u8]
) -> TunnResult<'a>
[src]
&self,
src: &[u8],
dst: &'a mut [u8]
) -> TunnResult<'a>
Receives an IP packet from the tunnel interface and encapsulates it. Returns wireguard_result.
Panics
Panics if dst buffer is too small. Size of dst should be at least src.len() + 32, and no less than 148 bytes.
pub fn network_to_tunnel<'a>(
&self,
src: &[u8],
dst: &'a mut [u8]
) -> TunnResult<'a>
[src]
&self,
src: &[u8],
dst: &'a mut [u8]
) -> TunnResult<'a>
Receives a UDP packet from the network and parses it. Returns wireguard_result. If the result is of type TunnResult::WriteToNetwork, must repeat the call with empty src, until TunnResult::Done is returned.
pub fn format_handshake_initiation<'a>(
&self,
dst: &'a mut [u8],
force_resend: bool
) -> TunnResult<'a>
[src]
&self,
dst: &'a mut [u8],
force_resend: bool
) -> TunnResult<'a>
pub fn dst_address(packet: &[u8]) -> Option<IpAddr>
[src]
pub fn log(&self, lvl: Verbosity, entry: &str)
[src]
pub fn stats(&self) -> (Option<u64>, usize, usize)
[src]
Return stats from the tunnel:
- Time since last handshake in seconds
- Data bytes sent
- Data bytes received
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,