Skip to main content

ProtocolMessage

Enum ProtocolMessage 

Source
pub enum ProtocolMessage {
Show 26 variants Hello { protocol_version: u32, session: String, }, Challenge { nonce: Vec<u8>, }, Auth { pubkey: Vec<u8>, signature: Vec<u8>, }, Established { path: SessionPath, }, Register { username: String, machine: String, pubkey: Vec<u8>, }, Join { channel: String, token: Option<String>, }, Leave { channel: String, }, Who { channel: Option<String>, }, Admin(AdminOp), ChannelMsg { channel: String, from: SessionPath, payload: Payload, }, Whisper { from: SessionPath, target: SessionPath, payload: Payload, }, Presence { channel: Option<String>, sessions: Vec<SessionPath>, }, Error(ProtocolError), ListChannels, ChannelList { channels: Vec<ChannelInfo>, }, Joined { channel: String, }, Ack { detail: Option<String>, }, InviteToken { token: String, }, Ping, Pong, ServerInfo { admin: bool, }, ListMachines, MachineList { machines: Vec<MachineInfo>, }, ListUsers, UserList { users: Vec<String>, }, InviteList { invites: Vec<InviteInfo>, },
}
Expand description

The versioned frame exchanged between a bridge and a central server.

Variants are append-only across protocol versions: later milestones may add variants but must not renumber or repurpose existing ones without a version bump (see negotiate_version).

Variants§

§

Hello

Client → server on connect: advertise the protocol version and the session handle.

Fields

§protocol_version: u32

The client’s protocol version.

§session: String

The session handle (--as, defaulting to the repo/dir name).

§

Challenge

Server → client: a random nonce for the client to sign (challenge-response).

Fields

§nonce: Vec<u8>

The random nonce.

§

Auth

Client → server: the machine public key and its signature over the nonce.

Fields

§pubkey: Vec<u8>

The machine’s Ed25519 public key.

§signature: Vec<u8>

The signature over the server’s nonce.

§

Established

Server → client: authentication succeeded; the resolved full participant path.

Fields

§path: SessionPath

The resolved user/machine/session path.

§

Register

Client → server: claim a username and enroll this machine as its first key.

Fields

§username: String

Username to claim.

§machine: String

Machine name for this key.

§pubkey: Vec<u8>

The machine’s Ed25519 public key.

§

Join

Client → server: join a channel, optionally redeeming an invite token.

Fields

§channel: String

Channel name.

§token: Option<String>

Invite token, if required.

§

Leave

Client → server: leave a channel.

Fields

§channel: String

Channel name.

§

Who

Client → server: request presence, optionally scoped to one channel.

Fields

§channel: Option<String>

Channel to scope to, or all subscribed channels if absent.

§

Admin(AdminOp)

Client → server: an admin / moderation operation.

§

ChannelMsg

A message addressed to all sessions subscribed to a channel.

Fields

§channel: String

Channel name.

§from: SessionPath

The sender’s full participant path.

§payload: Payload

The message body.

§

Whisper

A direct message to exactly one session path.

Fields

§from: SessionPath

The sender’s full participant path.

§target: SessionPath

The single recipient’s full participant path.

§payload: Payload

The message body.

§

Presence

Server → client: presence enumerated as full session paths.

Fields

§channel: Option<String>

Channel the presence is scoped to, or server-wide if absent.

§sessions: Vec<SessionPath>

The present sessions.

§

Error(ProtocolError)

A typed error surfaced to the peer that triggered it.

§

ListChannels

Client → server: request the channels visible to the authenticated user (discovery).

§

ChannelList

Server → client: the discovery result, already visibility-gated.

Fields

§channels: Vec<ChannelInfo>

The channels the caller may see.

§

Joined

Server → client: a ProtocolMessage::Join succeeded; the session is now subscribed.

Fields

§channel: String

The channel that was joined.

§

Ack

Server → client: a control / admin operation succeeded, with an optional human detail.

Fields

§detail: Option<String>

A short human-readable detail (e.g. the affected name), if any.

§

InviteToken

Server → client: the token minted by an AdminOp::InviteCreate.

Fields

§token: String

The opaque invite token.

§

Ping

Client → server: liveness keepalive; refreshes presence and draws a ProtocolMessage::Pong (the application-level realization of the §10 heartbeat, uniform across transports).

§

Pong

Server → client: keepalive acknowledgement.

§

ServerInfo

Server → client, immediately after ProtocolMessage::Established: the authenticated user’s server-wide role, so the bridge can gate its admin tools (DESIGN.md §7).

Fields

§admin: bool

Whether the user is a server admin (on the serve-config allowlist).

§

ListMachines

Client → server: list the machines enrolled under the authenticated user.

§

MachineList

Server → client: the caller’s enrolled machines.

Fields

§machines: Vec<MachineInfo>

The machines under the caller’s account.

§

ListUsers

Client → server: list the server’s users (server-admin only).

§

UserList

Server → client: the registered usernames (server-admin only).

Fields

§users: Vec<String>

The registered usernames.

§

InviteList

Server → client: a channel’s outstanding invites (channel-admin audit, PRD-0011).

Fields

§invites: Vec<InviteInfo>

The outstanding invites.

Trait Implementations§

Source§

impl Clone for ProtocolMessage

Source§

fn clone(&self) -> ProtocolMessage

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProtocolMessage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ProtocolMessage

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ProtocolMessage

Source§

impl PartialEq for ProtocolMessage

Source§

fn eq(&self, other: &ProtocolMessage) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ProtocolMessage

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ProtocolMessage

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<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read more
Source§

impl<T> AsyncFriendly for T
where T: Send + Sync + 'static,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Generator<T> for T
where T: Clone,

Source§

fn generate(&mut self) -> T

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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool