-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathproxy.rs
More file actions
32 lines (26 loc) · 853 Bytes
/
proxy.rs
File metadata and controls
32 lines (26 loc) · 853 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//! Proxy support for BungeeCord and Velocity.
use base::ProfileProperty;
use protocol::packets::client::Handshake;
use uuid::Uuid;
use crate::connection_worker::Worker;
mod bungeecord;
mod velocity;
/// IP forwarding data received from the proxy.
#[derive(Debug, PartialEq)]
pub struct ProxyData {
/// IP address of the proxy.
pub host: String,
/// IP address of the client.
pub client: String,
/// Client UUID.
pub uuid: Uuid,
/// Client profile properties (skin).
pub profile: Vec<ProfileProperty>,
}
/// Runs proxy forwarding and returns the client's `ProxyData`.
pub fn do_bungee_ip_forwarding(handshake: &Handshake) -> anyhow::Result<ProxyData> {
bungeecord::extract(handshake)
}
pub async fn do_velocity_ip_forwarding(worker: &mut Worker) -> anyhow::Result<ProxyData> {
velocity::run(worker).await
}