Crate northstar_rcon_client

Source
Expand description

This crate provides a high-level cross-platform implementation of an RCON client for Northstar mod, as it’s implemented in the RCON PR.

The client is entirely asynchronous and requires a Tokio runtime.

To connect to an RCON server and create a client instance, use the connect function.

§Example

use northstar_rcon_client::connect;

#[tokio::main]
async fn main() {
    let client = connect("localhost:37015")
        .await
        .unwrap();

    let (mut read, mut write) = client.authenticate("password123")
        .await
        .unwrap();

    write.enable_console_logs().await.unwrap();
    write.exec_command("status").await.unwrap();

    loop {
        let line = read.receive_console_log().await.unwrap();
        println!("> {}", line);
    }
}

Structs§

ClientRead
The read end of a connected and authenticated RCON client.
ClientWrite
The write end of a connected and authenticated RCON client.
NotAuthenticatedClient
A connected but not yet authenticated RCON client.

Enums§

AuthError
An error describing why an authentication request failed.
Error
Error type for RCON operations.

Functions§

connect
Asynchronously connect to an RCON server.

Type Aliases§

Result
Result alias for Error.