Skip to main content

Event

Type Alias Event 

Source
pub type Event = Event<Box<dyn Writer>>;
Expand description

Concrete Event type using boxed sync Writer.

Aliased Type§

pub enum Event {
Show 32 variants Frame { interface_id: InterfaceId, data: Vec<u8>, }, InterfaceUp(InterfaceId, Option<Box<dyn Writer>>, 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>>, },
}

Variants§

§

Frame

A decoded frame arrived from an interface.

Fields

§interface_id: InterfaceId
§data: Vec<u8>
§

InterfaceUp(InterfaceId, Option<Box<dyn Writer>>, 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.

Fields

§raw: Vec<u8>
§dest_type: u8
§attached_interface: Option<InterfaceId>
§

RegisterDestination

Register a local destination.

Fields

§dest_hash: [u8; 16]
§dest_type: u8
§

DeregisterDestination

Deregister a local destination.

Fields

§dest_hash: [u8; 16]
§

DeregisterLinkDestination

Deregister a link destination (stop accepting incoming links).

Fields

§dest_hash: [u8; 16]
§

Query(QueryRequest, Sender<QueryResponse>)

Query driver state. Response is sent via the provided channel.

§

RegisterLinkDestination

Register a link destination (accepts incoming LINKREQUEST).

Fields

§dest_hash: [u8; 16]
§sig_prv_bytes: [u8; 32]
§sig_pub_bytes: [u8; 32]
§resource_strategy: u8
§

RegisterRequestHandler

Register a request handler for a path on established links.

Fields

§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>

Create an outbound link. Response sends (link_id) back.

Fields

§dest_hash: [u8; 16]
§dest_sig_pub_bytes: [u8; 32]
§response_tx: Sender<[u8; 16]>
§

SendRequest

Send a request on an established link.

Fields

§link_id: [u8; 16]
§path: String
§data: Vec<u8>

Identify on a link (send identity to remote peer).

Fields

§link_id: [u8; 16]
§identity_prv_key: [u8; 64]

Tear down a link.

Fields

§link_id: [u8; 16]
§

SendResource

Send a resource on a link.

Fields

§link_id: [u8; 16]
§data: Vec<u8>
§metadata: Option<Vec<u8>>
§

SetResourceStrategy

Set the resource acceptance strategy for a link.

Fields

§link_id: [u8; 16]
§strategy: u8
§

AcceptResource

Accept or reject a pending resource (for AcceptApp strategy).

Fields

§link_id: [u8; 16]
§resource_hash: Vec<u8>
§accept: bool
§

SendChannelMessage

Send a channel message on a link.

Fields

§link_id: [u8; 16]
§msgtype: u16
§payload: Vec<u8>

Send generic data on a link with a given context.

Fields

§link_id: [u8; 16]
§data: Vec<u8>
§context: u8
§

RequestPath

Request a path to a destination from the network.

Fields

§dest_hash: [u8; 16]
§

RegisterProofStrategy

Register a proof strategy for a destination.

Fields

§dest_hash: [u8; 16]
§strategy: ProofStrategy
§signing_key: Option<[u8; 64]>

Full identity private key (64 bytes) for signing proofs.

§

ProposeDirectConnect

Propose a direct connection to a peer via hole punching.

Fields

§link_id: [u8; 16]
§

SetDirectConnectPolicy

Set the direct-connect policy.

Fields

§

HolePunchProbeResult

(Internal) Probe result arrived from a worker thread.

Fields

§link_id: [u8; 16]
§session_id: [u8; 16]
§observed_addr: SocketAddr
§socket: UdpSocket
§probe_server: SocketAddr

The probe server that responded successfully.

§

HolePunchProbeFailed

(Internal) Probe failed.

Fields

§link_id: [u8; 16]
§session_id: [u8; 16]
§

InterfaceConfigChanged(InterfaceId)

An interface’s configuration changed (placeholder for future use).

§

LoadHook

Load a WASM hook at runtime.

Fields

§name: String
§wasm_bytes: Vec<u8>
§attach_point: String
§priority: i32
§response_tx: Sender<Result<(), String>>
§

UnloadHook

Unload a WASM hook at runtime.

Fields

§name: String
§attach_point: String
§response_tx: Sender<Result<(), String>>
§

ReloadHook

Reload a WASM hook at runtime (detach + recompile + reattach with same priority).

Fields

§name: String
§attach_point: String
§wasm_bytes: Vec<u8>
§response_tx: Sender<Result<(), String>>
§

ListHooks

List all loaded hooks.

Fields

§response_tx: Sender<Vec<HookInfo>>