Skip to main content

Module proxy

Module proxy 

Source
Expand description

Proxy configuration for routing Minecraft pings through SOCKS5 or HTTP CONNECT proxies.

Enabled with features = ["proxy"] in Cargo.toml.

§Supported proxy types

ConstructorProtocolUDP (Bedrock)Auth
ProxyConfig::socks5SOCKS5Nooptional
ProxyConfig::socks5_with_udpSOCKS5 + UDP ASSOCIATEYesoptional
ProxyConfig::httpHTTP CONNECTNooptional (Basic)

§Quick start

use rust_mc_status::{McClient, ProxyConfig};

// Anonymous SOCKS5
let client = McClient::builder()
    .proxy(ProxyConfig::socks5("127.0.0.1:1080"))
    .build();

// Authenticated HTTP CONNECT
let client = McClient::builder()
    .proxy(ProxyConfig::http("squid.corp.example.com:3128")
        .with_auth("alice", "s3cr3t"))
    .build();

§Bedrock and UDP

Bedrock Edition uses UDP (RakNet). Most SOCKS5 proxies and all HTTP CONNECT proxies do not support UDP. Attempting a Bedrock ping through such a proxy returns McError::Proxy(ProxyError::UdpUnsupported) immediately without making a network connection.

Use ProxyConfig::socks5_with_udp only when your proxy server actually advertises UDP ASSOCIATE support (e.g. dante with udp_relay yes, or a tun2socks setup).

Re-exports§

pub use socks5::ProxyConfig;
pub use socks5::ProxyAuth;
pub use socks5::ProxyAddr;
pub use socks5::ProxyKind;
pub use socks5::UdpSupport;

Modules§

socks5
Proxy configuration types for McClient.