Spaces:
Paused
Paused
Automated deployment update from ML build
Browse files- services/mc_tunnel.py +5 -5
services/mc_tunnel.py
CHANGED
|
@@ -66,7 +66,7 @@ def extract_tunnel_from_request(payload):
|
|
| 66 |
if D>len(B):return _B,C
|
| 67 |
return xor_bytes(B[A:D]),C
|
| 68 |
def client_login(remote_sock,host,port,remote_target_port=2222,timeout=1e1):
|
| 69 |
-
A=remote_sock;A.settimeout(timeout);
|
| 70 |
while _A:
|
| 71 |
C,E=B.read_packet()
|
| 72 |
if C==PKT_LOGIN_SUCCESS:break
|
|
@@ -83,13 +83,13 @@ def server_consume_login(client_sock,timeout=1e1):
|
|
| 83 |
if D:import sys;print(f"[mc_tunnel] skipped PROXY header: {D}",file=sys.stderr,flush=_A)
|
| 84 |
A,E=C.read_packet()
|
| 85 |
if A!=PKT_HANDSHAKE:raise ValueError(f"expected handshake, got {A:#x}")
|
|
|
|
|
|
|
| 86 |
F=2222
|
| 87 |
try:
|
| 88 |
-
|
| 89 |
-
if'
|
| 90 |
except Exception:pass
|
| 91 |
-
A,I=C.read_packet()
|
| 92 |
-
if A!=PKT_LOGIN_START:raise ValueError(f"expected login start, got {A:#x}")
|
| 93 |
B.sendall(build_login_success());B.settimeout(_B);return C,F
|
| 94 |
def _pump_plain_to_mc(src,mc_sock,wrap_fn):
|
| 95 |
try:
|
|
|
|
| 66 |
if D>len(B):return _B,C
|
| 67 |
return xor_bytes(B[A:D]),C
|
| 68 |
def client_login(remote_sock,host,port,remote_target_port=2222,timeout=1e1):
|
| 69 |
+
A=remote_sock;A.settimeout(timeout);A.sendall(build_handshake(host,port));D=f"Steve_{remote_target_port}";A.sendall(build_login_start(D));B=PacketReader(A)
|
| 70 |
while _A:
|
| 71 |
C,E=B.read_packet()
|
| 72 |
if C==PKT_LOGIN_SUCCESS:break
|
|
|
|
| 83 |
if D:import sys;print(f"[mc_tunnel] skipped PROXY header: {D}",file=sys.stderr,flush=_A)
|
| 84 |
A,E=C.read_packet()
|
| 85 |
if A!=PKT_HANDSHAKE:raise ValueError(f"expected handshake, got {A:#x}")
|
| 86 |
+
A,E=C.read_packet()
|
| 87 |
+
if A!=PKT_LOGIN_START:raise ValueError(f"expected login start, got {A:#x}")
|
| 88 |
F=2222
|
| 89 |
try:
|
| 90 |
+
G,I=read_string_from_payload(E,0)
|
| 91 |
+
if'_'in G:H=G.split('_');F=int(H[-1])
|
| 92 |
except Exception:pass
|
|
|
|
|
|
|
| 93 |
B.sendall(build_login_success());B.settimeout(_B);return C,F
|
| 94 |
def _pump_plain_to_mc(src,mc_sock,wrap_fn):
|
| 95 |
try:
|