pub enum Event<W: Send> {
Show 32 variants
Frame {
interface_id: InterfaceId,
data: Vec<u8>,
},
InterfaceUp(InterfaceId, Option<W>, Option<InterfaceInfo>),
InterfaceDown(InterfaceId),
Tick,
Shutdown,
SendOutbound {
raw: Vec<u8>,
dest_type: u8,
attached_interface: Option<InterfaceId>,
},
RegisterDestination {
dest_hash: [u8; 16],
dest_type: u8,
},
DeregisterDestination {
dest_hash: [u8; 16],
},
DeregisterLinkDestination {
dest_hash: [u8; 16],
},
Query(QueryRequest, Sender<QueryResponse>),
RegisterLinkDestination {
dest_hash: [u8; 16],
sig_prv_bytes: [u8; 32],
sig_pub_bytes: [u8; 32],
resource_strategy: u8,
},
RegisterRequestHandler {
path: String,
allowed_list: Option<Vec<[u8; 16]>>,
handler: Box<dyn Fn([u8; 16], &str, &[u8], Option<&([u8; 16], [u8; 64])>) -> Option<Vec<u8>> + Send>,
},
CreateLink {
dest_hash: [u8; 16],
dest_sig_pub_bytes: [u8; 32],
response_tx: Sender<[u8; 16]>,
},
SendRequest {
link_id: [u8; 16],
path: String,
data: Vec<u8>,
},
IdentifyOnLink {
link_id: [u8; 16],
identity_prv_key: [u8; 64],
},
TeardownLink {
link_id: [u8; 16],
},
SendResource {
link_id: [u8; 16],
data: Vec<u8>,
metadata: Option<Vec<u8>>,
},
SetResourceStrategy {
link_id: [u8; 16],
strategy: u8,
},
AcceptResource {
link_id: [u8; 16],
resource_hash: Vec<u8>,
accept: bool,
},
SendChannelMessage {
link_id: [u8; 16],
msgtype: u16,
payload: Vec<u8>,
},
SendOnLink {
link_id: [u8; 16],
data: Vec<u8>,
context: u8,
},
RequestPath {
dest_hash: [u8; 16],
},
RegisterProofStrategy {
dest_hash: [u8; 16],
strategy: ProofStrategy,
signing_key: Option<[u8; 64]>,
},
ProposeDirectConnect {
link_id: [u8; 16],
},
SetDirectConnectPolicy {
policy: HolePunchPolicy,
},
HolePunchProbeResult {
link_id: [u8; 16],
session_id: [u8; 16],
observed_addr: SocketAddr,
socket: UdpSocket,
probe_server: SocketAddr,
},
HolePunchProbeFailed {
link_id: [u8; 16],
session_id: [u8; 16],
},
InterfaceConfigChanged(InterfaceId),
LoadHook {
name: String,
wasm_bytes: Vec<u8>,
attach_point: String,
priority: i32,
response_tx: Sender<Result<(), String>>,
},
UnloadHook {
name: String,
attach_point: String,
response_tx: Sender<Result<(), String>>,
},
ReloadHook {
name: String,
attach_point: String,
wasm_bytes: Vec<u8>,
response_tx: Sender<Result<(), String>>,
},
ListHooks {
response_tx: Sender<Vec<HookInfo>>,
},
}Expand description
Events sent to the driver thread.
W is the writer type (e.g. Box<dyn Writer> for sync,
or a channel sender for async).
Variants§
Frame
A decoded frame arrived from an interface.
InterfaceUp(InterfaceId, Option<W>, Option<InterfaceInfo>)
An interface came online after (re)connecting. Carries a new writer if the connection was re-established. Carries InterfaceInfo if this is a new dynamic interface (e.g. TCP server client).
InterfaceDown(InterfaceId)
An interface went offline (socket closed, error).
Tick
Periodic maintenance tick (1s interval).
Shutdown
Shut down the driver loop.
SendOutbound
Send an outbound packet.
RegisterDestination
Register a local destination.
DeregisterDestination
Deregister a local destination.
DeregisterLinkDestination
Deregister a link destination (stop accepting incoming links).
Query(QueryRequest, Sender<QueryResponse>)
Query driver state. Response is sent via the provided channel.
RegisterLinkDestination
Register a link destination (accepts incoming LINKREQUEST).
RegisterRequestHandler
Register a request handler for a path on established links.
Fields
CreateLink
Create an outbound link. Response sends (link_id) back.
SendRequest
Send a request on an established link.
IdentifyOnLink
Identify on a link (send identity to remote peer).
TeardownLink
Tear down a link.
SendResource
Send a resource on a link.
SetResourceStrategy
Set the resource acceptance strategy for a link.
AcceptResource
Accept or reject a pending resource (for AcceptApp strategy).
SendChannelMessage
Send a channel message on a link.
SendOnLink
Send generic data on a link with a given context.
RequestPath
Request a path to a destination from the network.
RegisterProofStrategy
Register a proof strategy for a destination.
Fields
strategy: ProofStrategyProposeDirectConnect
Propose a direct connection to a peer via hole punching.
SetDirectConnectPolicy
Set the direct-connect policy.
Fields
policy: HolePunchPolicyHolePunchProbeResult
(Internal) Probe result arrived from a worker thread.
Fields
observed_addr: SocketAddrprobe_server: SocketAddrThe probe server that responded successfully.
HolePunchProbeFailed
(Internal) Probe failed.
InterfaceConfigChanged(InterfaceId)
An interface’s configuration changed (placeholder for future use).
LoadHook
Load a WASM hook at runtime.
Fields
UnloadHook
Unload a WASM hook at runtime.
ReloadHook
Reload a WASM hook at runtime (detach + recompile + reattach with same priority).
Fields
ListHooks
List all loaded hooks.
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for Event<W>where
W: Freeze,
impl<W> !RefUnwindSafe for Event<W>
impl<W> Send for Event<W>
impl<W> !Sync for Event<W>
impl<W> Unpin for Event<W>where
W: Unpin,
impl<W> UnsafeUnpin for Event<W>where
W: UnsafeUnpin,
impl<W> !UnwindSafe for Event<W>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> InterfaceConfigData for Twhere
T: Send + 'static,
impl<T> InterfaceConfigData for Twhere
T: Send + 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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