#tcp-stream #stream #silkroad #tcp #tokio #read-stream #server-client

skrillax-stream

Combines skrillax-network crates to work nicely on top of a tokio tcp stream

1 unstable release

0.1.0 Jun 22, 2024

#1514 in Asynchronous


Used in skrillax-protocol

MIT license

155KB
2.5K SLoC

skrillax-stream

Crates.io Docs.rs

This is the high-level (tcp) stream implementation for working with Silkroad Online connections. It is built on top of the other crates (skrillax-packet, skrillax-codec, skrillax-serde, skrillax-security) from the skrillax-network family of creates. Additionally, it provides the initialization handshake for both the server and client party, whichever applies.


lib.rs:

Provides convenient abstractions for handling streams of Silkroad Online packets.

While it is possible to simply use the abstractions provided by more lover level crates of the stack, such as simply using [skrillax_packet] and [skrillax_codec], it can become quite cumbersome. In particular, when dealing with lots of different packets it might be easier to create logical groupings of packets: protocols.

Protocols are essentially just a collection of packets and possibly other protocols that allow reading and writing a single type instead of handling all possible cases manually.

It is expected that you'll be using a tokio::net::TcpStream for the connection such that you can create a Silkroad stream from by calling stream::SilkroadTcpExt::into_silkroad_stream. With the resulting stream::SilkroadStreamRead and stream::SilkroadStreamWrite, you can now read packets using stream::SilkroadStreamRead::next_packet and write packets using stream::SilkroadStreamWrite::write_packet.

On top of the provided stream abstraction, this provides a way to handle the security handshake through handshake::ActiveSecuritySetup and handshake::PassiveSecuritySetup for the server point of view and the client respectively.

Dependencies

~6–15MB
~181K SLoC