mirror of
https://github.com/timvisee/lazymc.git
synced 2025-08-11 02:02:01 -07:00
Refactor, cleanup status logic, extract join occupy logic into modules
This commit is contained in:
30
src/join/forward.rs
Normal file
30
src/join/forward.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use bytes::BytesMut;
|
||||
use tokio::net::TcpStream;
|
||||
|
||||
use crate::config::*;
|
||||
use crate::service;
|
||||
|
||||
use super::MethodResult;
|
||||
|
||||
/// Forward the client.
|
||||
pub async fn occupy(
|
||||
config: Arc<Config>,
|
||||
inbound: TcpStream,
|
||||
inbound_history: &mut BytesMut,
|
||||
) -> Result<MethodResult, ()> {
|
||||
trace!(target: "lazymc", "Using forward method to occupy joining client");
|
||||
|
||||
debug!(target: "lazymc", "Forwarding client to {:?}!", config.join.forward.address);
|
||||
|
||||
service::server::route_proxy_address_queue(
|
||||
inbound,
|
||||
config.join.forward.address,
|
||||
inbound_history.clone(),
|
||||
);
|
||||
|
||||
// TODO: do not consume, continue on proxy connect failure
|
||||
|
||||
Ok(MethodResult::Consumed)
|
||||
}
|
Reference in New Issue
Block a user