pub enum Message {
Show 13 variants
Auth {
token: String,
client_id: Uuid,
},
AuthOk {
tunnel_id: Uuid,
},
AuthFail {
reason: String,
},
Register {
name: String,
protocol: ServiceProtocol,
local_port: u16,
remote_port: u16,
},
RegisterOk {
service_id: Uuid,
},
RegisterFail {
reason: String,
},
Connect {
service_id: Uuid,
connection_id: Uuid,
client_addr: String,
},
ConnectAck {
connection_id: Uuid,
},
ConnectFail {
connection_id: Uuid,
reason: String,
},
Heartbeat {
timestamp: u64,
},
HeartbeatAck {
timestamp: u64,
},
Unregister {
service_id: Uuid,
},
Disconnect {
reason: String,
},
}Expand description
Protocol messages
Variants§
Auth
Client authentication request (C->S)
AuthOk
Server authentication success (S->C)
AuthFail
Server authentication failure (S->C)
Register
Client service registration (C->S)
Fields
§
protocol: ServiceProtocolProtocol type
RegisterOk
Server registration success (S->C)
RegisterFail
Server registration failure (S->C)
Connect
Server connection announcement (S->C)
Fields
ConnectAck
Client connection acknowledgment (C->S)
ConnectFail
Client connection failure (C->S)
Heartbeat
Heartbeat (bidirectional)
HeartbeatAck
Heartbeat acknowledgment (bidirectional)
Unregister
Client service unregistration (C->S)
Disconnect
Server disconnect notification (S->C)
Implementations§
Source§impl Message
impl Message
Sourcepub const fn message_type(&self) -> MessageType
pub const fn message_type(&self) -> MessageType
Get the message type
Sourcepub fn decode(bytes: &[u8]) -> Result<(Self, usize)>
pub fn decode(bytes: &[u8]) -> Result<(Self, usize)>
Decode a message from binary format
Returns the decoded message and the number of bytes consumed.
§Errors
Returns an error if:
- The buffer is too short for a complete message
- The message type is unknown
- The payload is malformed or contains invalid data
Trait Implementations§
impl Eq for Message
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.