(linetest) fix off by one error
(deps) fix issue w/ compiling smolboi
remove erroneous lock files from workspace members
smolboi
is a prototype of a chat server written in Rust using async
I/O, driven by the smol
async runtime. It also contains a sample
client, linetest
, which is useful for testing & debugging.
cargo build
in the root of this workspace to build all
crates within the workspace simultaneously.cargo run --bin server
to start the server on localhost.cargo run --bin linetest
to start the client.The codec for the chat protocol can be found in smolboi/src/protocol.rs
in
the protocol::packet
module. In general the protocol works as follows:
The first two bytes on the wire(network byte-order) represent the length of
the packet to be decoded. This tells a receiver how many bytes to read.
The receiver should allocate a buffer of that size and pass the resultant
buffer to Packet::decode(...)
.
NOTE: as a consequence a packet can be no greater than u16::MAX bytes long, e.g: 64KiB total.
It is important to note that this is not a general purpose serialization
format, it is a purpose-built binary mapping of the packets enumerated by
the protocol::packet::Packet
type.
In general packet fields are arranged on the wire in the order they are listed in the enumeration, types will be encoded as follows:
bool
is encoded as a u8
which is either 0
or 1
.
String
is encoded as a length (u16
) and then a series of bytes
representing a UTF-8 encoded string.
u16::MAX
is an
error and must be rejected by a conforming sender.Integer types will be represented on the wire as bytes in network endian order.
Arrays will be encoded similarly to strings: however the u16 length prefix will represent the number of elements in the array. All arrays will be heterogeneous: and contain only the objects described above.
The linetest
crate contains basic line editing functionality, as well as a
scrollable line-oriented buffer. This client is cross-platform, w/ the low-level
terminal handling provided by the crossterm
crate. Current functionality
includes: