Skip to main content

DataPlane

Struct DataPlane 

Source
pub struct DataPlane {
    pub wireguard: Endpoint,
    pub or_out: Router,
    pub ur_out: Router,
    pub src_filter_in: Arc<Table<NodePublicKey>>,
    pub or_in: Router,
    pub packet_filter: Arc<dyn Filter + Send + Sync>,
    pub events: Scheduler<Subsystem>,
    pub wg_next: Option<Handle<Subsystem>>,
}
Expand description

Transforms packets to make tailscale happen.

Fields§

§wireguard: Endpoint

Wireguard encryption/decryption.

§or_out: Router

Outbound overlay router.

§ur_out: Router

Outbound underlay router.

§src_filter_in: Arc<Table<NodePublicKey>>

Inbound source filter.

§or_in: Router

Inbound overlay router.

§packet_filter: Arc<dyn Filter + Send + Sync>

The packet filter.

§events: Scheduler<Subsystem>

Events queued for future processing.

§wg_next: Option<Handle<Subsystem>>

Next event for the wireguard subsystem.

Implementations§

Source§

impl DataPlane

Source

pub fn new(my_key: NodeKeyPair) -> Self

Creates a new data plane for a wireguard node key.

Source

pub fn process_outbound(&mut self, packets: Vec<PacketMut>) -> OutboundResult

Processes packets originating from the local device.

Source

pub fn process_inbound( &mut self, packets: impl IntoIterator<Item = PacketMut>, ) -> InboundResult

Processes packets received from elsewhere.

Source

pub fn next_event(&self) -> Option<Instant>

Return the next time at which DataPlane::process_events must be called.

DataPlane::process_outbound, DataPlane::process_inbound and DataPlane::process_events may all update the next event time. Callers should prefer calling next_event as needed to get a correct result, rather than store the returned value.

Source

pub fn process_events(&mut self) -> EventResult

Process all queued events that are due for processing.

Must be called at least as often as dictated by DataPlane::next_event for the data plane to function correctly. It is harmless to call it more frequently.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more