Crate dust_devil_core

Crate dust_devil_core 

Source
Expand description

Shared sources used in the dust-devil socks5 server and monitoring clients for implementing the Sandstorm monitoring protocol.

§The Sandstorm monitoring protocol

The dust-devil server uses a custom monitoring protocol called Sandstorm. Sandstorm is a TCP protocol that is partly a request-response protocol, and partly a server-side stream of events. A better description of the protocol is provided in the sandstorm_protocol.txt file.

The client can request actions to the server, such as adding or removing users, getting metrics, shutting down, etc. The server will then perform these actions and send responses back to the client indicating their results.

This “stream of events” can be enabled by the client, and while enabled the server will send asynchronous events to the client. These events can be used, for example, as logging (in fact, if logging is enabled in the dust-devil server, logs are just a text representation of the events).

§This crate

This crate contains common files used for serializing and deserializing requests and responses for the Sandstorm protocol from raw bytes. All serializers and deserializers are prepared to receive any type implementing AsyncRead or AsyncWrite from tokio::io and are async.

All the serializing revolves around the ByteRead and ByteWrite traits. These are defined in the serialize module and define async read and write functions.

Modules§

buffer_size
Provides the parse_pretty_buffer_size function, used to parse human-readable byte counts.
logging
Defines the Event and EventData structs used for serializing events, as well as implementing the fmt::Display trait for EventData, which is used for turning events into server logs.
sandstorm
A full implementation of the Sandstorm protocol.
serialize
Defines the ByteRead and ByteWrite traits and implements them for many basic types.
socks5
Basic types for implementing the socks5 protocol as well as implementations of ByteRead and ByteWrite for them.
u8_repr_enum
Provides the U8ReprEnum trait, which is made to be implemented by enums that can be converted into or parsed from an u8 value, for easy serialization and deserialization.
users
Constants and types for dealing with Sandstorm users, as well as implementations of ByteRead and ByteWrite for these types.