RelayCommand

Enum RelayCommand 

Source
pub enum RelayCommand {
Show 16 variants Begin = 1, Data = 2, End = 3, Connected = 4, SendMe = 5, Extend = 6, Extended = 7, Truncate = 8, Truncated = 9, Drop = 10, Resolve = 11, Resolved = 12, BeginDir = 13, Extend2 = 14, Extended2 = 15, Unknown = 16,
}
Expand description

Relay cell command types.

Commands used within relay cells to manage streams and circuits. These commands have two characteristics:

  • Direction: Forward commands originate from the client; backward commands come from the relay.
  • Scope: Stream commands affect individual streams; circuit commands affect the entire circuit.

§Variants

CommandValueDirectionScopeDescription
Begin1ForwardStreamBegin a new stream
Data2Forward/BackwardStreamTransmit data
End3Forward/BackwardStreamEnd a stream
Connected4BackwardStreamReply to BEGIN
SendMe5Forward/BackwardBothFlow control acknowledgment
Extend6ForwardCircuitExtend circuit (legacy)
Extended7BackwardCircuitReply to EXTEND
Truncate8ForwardCircuitRemove last hop
Truncated9BackwardCircuitReply to TRUNCATE
Drop10Forward/BackwardCircuitIgnorable no-op
Resolve11ForwardStreamDNS resolution request
Resolved12BackwardStreamReply to RESOLVE
BeginDir13ForwardStreamRequest directory info
Extend214ForwardCircuitExtend circuit (ntor)
Extended215BackwardCircuitReply to EXTEND2
Unknown---Unrecognized command

§Example

use stem_rs::client::datatype::RelayCommand;

let (cmd, raw) = RelayCommand::get(1);
assert_eq!(cmd, RelayCommand::Begin);
assert_eq!(format!("{}", cmd), "RELAY_BEGIN");

Variants§

§

Begin = 1

Begin a new stream (forward, stream).

§

Data = 2

Transmit data (forward/backward, stream).

§

End = 3

End a stream (forward/backward, stream).

§

Connected = 4

Reply to BEGIN (backward, stream).

§

SendMe = 5

Flow control - ready for more cells (forward/backward, stream/circuit).

§

Extend = 6

Extend circuit through another relay - legacy (forward, circuit).

§

Extended = 7

Reply to EXTEND (backward, circuit).

§

Truncate = 8

Remove last circuit hop (forward, circuit).

§

Truncated = 9

Reply to TRUNCATE (backward, circuit).

§

Drop = 10

Ignorable no-op (forward/backward, circuit).

§

Resolve = 11

Request DNS resolution (forward, stream).

§

Resolved = 12

Reply to RESOLVE (backward, stream).

§

BeginDir = 13

Request directory information (forward, stream).

§

Extend2 = 14

Extend circuit - ntor handshake (forward, circuit).

§

Extended2 = 15

Reply to EXTEND2 (backward, circuit).

§

Unknown = 16

Unrecognized command.

Implementations§

Source§

impl RelayCommand

Source

pub fn get(val: u8) -> (RelayCommand, u8)

Converts a raw byte value to a RelayCommand and its integer representation.

§Arguments
  • val - The raw command byte from the relay cell
§Returns

A tuple of (RelayCommand, u8) where the second element is the original byte value.

Source

pub fn value(&self) -> u8

Returns the integer value for this relay command.

Returns 255 for Unknown commands.

Trait Implementations§

Source§

impl Clone for RelayCommand

Source§

fn clone(&self) -> RelayCommand

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RelayCommand

Source§

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

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

impl Display for RelayCommand

Source§

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

Formats the relay command as its canonical string name.

Source§

impl Hash for RelayCommand

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for RelayCommand

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 Copy for RelayCommand

Source§

impl Eq for RelayCommand

Source§

impl StructuralPartialEq for RelayCommand

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.