connection fix
This commit is contained in:
parent
7526862a75
commit
7a12dfb51d
46
Cargo.lock
generated
46
Cargo.lock
generated
@ -80,9 +80,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.14.5"
|
version = "0.15.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ignore-result"
|
name = "ignore-result"
|
||||||
@ -92,9 +92,9 @@ checksum = "665ff4dce8edd10d490641ccb78949832f1ddbff02c584fb1f85ab888fe0e50c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.2.6"
|
version = "2.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
@ -117,9 +117,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.155"
|
version = "0.2.162"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libyml"
|
name = "libyml"
|
||||||
@ -188,18 +188,18 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.86"
|
version = "1.0.89"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
|
checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.36"
|
version = "1.0.37"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
@ -216,7 +216,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "rust_mc_proto"
|
name = "rust_mc_proto"
|
||||||
version = "0.1.16"
|
version = "0.1.16"
|
||||||
source = "git+https://github.com/MeexReay/rust_mc_proto#26a78af446bd7ceba54fa2fa34d2f6570e827904"
|
source = "git+https://github.com/MeexReay/rust_mc_proto#abe738aad5aed4f3dffc121f508ce081a50784bb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytebuffer",
|
"bytebuffer",
|
||||||
"flate2",
|
"flate2",
|
||||||
@ -231,18 +231,18 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.204"
|
version = "1.0.215"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
|
checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.204"
|
version = "1.0.215"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
|
checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -277,9 +277,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.71"
|
version = "2.0.87"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462"
|
checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -330,9 +330,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.12"
|
version = "1.0.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
@ -348,18 +348,18 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi-util"
|
name = "winapi-util"
|
||||||
version = "0.1.8"
|
version = "0.1.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b"
|
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.52.0"
|
version = "0.59.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-targets",
|
"windows-targets",
|
||||||
]
|
]
|
||||||
|
@ -7,13 +7,13 @@ messaging: # messaging server (optional)
|
|||||||
|
|
||||||
servers:
|
servers:
|
||||||
play: # server internal name
|
play: # server internal name
|
||||||
host: 127.0.0.1:12345 # server host
|
host: sloganmc.ru:25565 # server host
|
||||||
domains:
|
domains:
|
||||||
- _ # means that this server is default to connect players
|
- _ # means that this server is default to connect players
|
||||||
- play.localhost
|
- play.localhost
|
||||||
- mc.localhost
|
- mc.localhost
|
||||||
forwarding: # player forwarding
|
forwarding: # player forwarding
|
||||||
enabled: true
|
enabled: false
|
||||||
type: velocity
|
type: velocity
|
||||||
secret: "123456"
|
secret: "123456"
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use std::{net::{SocketAddr, TcpStream}, sync::{Arc, Mutex}, thread};
|
use std::{net::{SocketAddr, TcpStream}, sync::{Arc, Mutex}, thread};
|
||||||
|
|
||||||
use ignore_result::Ignore;
|
use ignore_result::Ignore;
|
||||||
|
use log::debug;
|
||||||
use rust_mc_proto::{DataBufferReader, DataBufferWriter, MCConnTcp, Packet, ProtocolError};
|
use rust_mc_proto::{DataBufferReader, DataBufferWriter, MCConnTcp, Packet, ProtocolError};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
@ -118,6 +119,7 @@ impl Player {
|
|||||||
}
|
}
|
||||||
0x02 => {
|
0x02 => {
|
||||||
player.write_client_packet(&packet)?;
|
player.write_client_packet(&packet)?;
|
||||||
|
// player.write_server_packet(&player.read_client_packet()?)?;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
0x03 => {
|
0x03 => {
|
||||||
@ -142,9 +144,10 @@ impl Player {
|
|||||||
verify_token
|
verify_token
|
||||||
});
|
});
|
||||||
|
|
||||||
player.write_server_packet(&player.read_client_packet()?)?;
|
debug!("player connected");
|
||||||
|
|
||||||
player.client_recv_loop();
|
player.client_recv_loop();
|
||||||
|
player.server_recv_loop();
|
||||||
|
|
||||||
Ok(player)
|
Ok(player)
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,8 @@ pub enum ProxyError {
|
|||||||
HandshakePacket,
|
HandshakePacket,
|
||||||
LoginPacket,
|
LoginPacket,
|
||||||
PeerAddr,
|
PeerAddr,
|
||||||
ProtocolError(ProtocolError)
|
ProtocolError(ProtocolError),
|
||||||
|
ConnectionClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
impl std::fmt::Display for ProxyError {
|
impl std::fmt::Display for ProxyError {
|
||||||
@ -29,7 +30,13 @@ pub trait AsProxyResult<T> {
|
|||||||
|
|
||||||
impl AsProxyError for ProtocolError {
|
impl AsProxyError for ProtocolError {
|
||||||
fn as_proxy(self) -> ProxyError {
|
fn as_proxy(self) -> ProxyError {
|
||||||
ProxyError::ProtocolError(self)
|
match self {
|
||||||
|
Self::ConnectionClosedError => {
|
||||||
|
ProxyError::ConnectionClosed
|
||||||
|
}, i => {
|
||||||
|
ProxyError::ProtocolError(i)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use log::{error, info};
|
use log::{debug, error, info};
|
||||||
use rust_mc_proto::{
|
use rust_mc_proto::{
|
||||||
read_packet, write_packet, DataBufferReader, DataBufferWriter, MCConnTcp, Packet
|
read_packet, write_packet, DataBufferReader, DataBufferWriter, MCConnTcp, Packet
|
||||||
};
|
};
|
||||||
@ -117,6 +117,7 @@ impl MeexProx {
|
|||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("connection error: {:?}", e);
|
error!("connection error: {:?}", e);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user