pub struct BootstrapInfo {
pub version: u32,
pub motd: Vec<u8>,
}
Expand description
Sent by both client and server, only server will respond. When server receives this packet it may respond with the version of the library plus MoTD (message of the day). The max length of MoTD is 256 bytes so the max packet lenght of server BootstrapInfo is 261=(1+4+256) bytes.
Client must send a BootstrapInfo of exactly 78 bytes, the only 1 field is required: packet type
which is filled automatically. So version may be filled with any value, so does MoTD, but
it has to be exactly 73=(78-1-4) bytes long. The server should check that the size of the
packet is exactly 78 bytes long (or MoTD=73 bytes filled with any values). Frankly speaking,
there should be neither version
nor motd
fields in the request version, the serialized form
should be 1 byte with packet type + (78-1) bytes of trash, but this implementation is simplified.
Serialized form:
Length | Contents |
---|---|
1 | 0xF0 |
4 | Version in BigEndian |
variable | MoTD, must not longer than 256 bytes |
Fields§
§version: u32
The version of DHT server
motd: Vec<u8>
Message of the day
Trait Implementations§
Source§impl Clone for BootstrapInfo
impl Clone for BootstrapInfo
Source§fn clone(&self) -> BootstrapInfo
fn clone(&self) -> BootstrapInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for BootstrapInfo
impl Debug for BootstrapInfo
Source§impl FromBytes for BootstrapInfo
impl FromBytes for BootstrapInfo
Source§fn from_bytes(i: &[u8]) -> IResult<&[u8], BootstrapInfo, (&[u8], ErrorKind)>
fn from_bytes(i: &[u8]) -> IResult<&[u8], BootstrapInfo, (&[u8], ErrorKind)>
nom
from raw bytes