deepslate 0.3.1

A high-performance Minecraft server proxy written in Rust.
Documentation
# Deepslate

A Minecraft server proxy library written in Rust.

Deepslate sits between players and backend servers, handling authentication, packet forwarding, and server switching. Use this crate to build a custom proxy binary with compile-time plugins and full type safety.

## Quick Start

Add `deepslate` to your `Cargo.toml`:

```toml
[dependencies]
deepslate = "0.3"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
```

Build a proxy binary with a plugin:

```rust
use deepslate::{Proxy, ServerId};
use deepslate::event::*;
use deepslate::event::events::*;

const LOBBY: ServerId = ServerId::new("lobby", "127.0.0.1:25566");

struct MyPlugin;

impl Plugin for MyPlugin {
    fn register(&self, events: &mut EventManager) {
        events.observe::<LoginEvent>(Phase::Post, |event| {
            println!("{} logged in", event.player.profile.name);
        });
    }
}

#[tokio::main]
async fn main() {
    let proxy = Proxy::builder()
        .forwarding_secret("your-secret")
        .server(&LOBBY)
        .try_servers([&LOBBY])
        .plugin(MyPlugin)
        .build()
        .expect("failed to build proxy");

    proxy.run().await.expect("proxy error");
}
```

## Features

Plugins are compiled into the binary rather than loaded at runtime, giving you zero dispatch overhead and compile-time guarantees.

- Minecraft Java Edition 1.21.x
- Online mode with Mojang authentication
- Velocity modern forwarding
- Compile-time plugin system with an events API
- Environment variable and code-driven configuration

## Feature Flags

| Flag | Default | Description |
|---|---|---|
| `grpc` | Yes | gRPC control plane for managing backend servers at runtime |
| `grpc-reflection` | Yes | gRPC server reflection (requires `grpc`) |

To disable gRPC:

```toml
[dependencies]
deepslate = { version = "0.3", default-features = false }
```

## Documentation

For configuration, the plugin API, events, and more, see the [wiki](https://man.sr.ht/~deepslate/deepslate/).

## Licence

Deepslate is licensed under either of

- Apache License, Version 2.0, ([LICENSE-APACHE]../../LICENSE-APACHE or <https://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT]../../LICENSE-MIT or <https://opensource.org/licenses/MIT>)

at your option.

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.