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

skrillax-stream

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

2 unstable releases

0.2.0 Oct 27, 2024
0.1.0 Jun 22, 2024

#1589 in Asynchronous

Download history 12/week @ 2024-09-10 8/week @ 2024-09-17 18/week @ 2024-09-24 17/week @ 2024-10-01 2/week @ 2024-10-08 112/week @ 2024-10-22 54/week @ 2024-10-29

166 downloads per month
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
~180K SLoC