[][src]Struct boringtun::noise::Tunn

pub struct Tunn { /* fields omitted */ }

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]

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]

Set the log function and logging level for the tunnel

pub fn set_static_private(
    &self,
    static_private: Arc<X25519SecretKey>
) -> Result<(), WireGuardError>
[src]

Update the private key and clear existing sessions

pub fn tunnel_to_network<'a>(
    &self,
    src: &[u8],
    dst: &'a mut [u8]
) -> TunnResult<'a>
[src]

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]

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]

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

impl Send for Tunn

impl Sync for Tunn

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.