基本完善SBProxy-MC

This commit is contained in:
CN-JS-HuiBai
2026-04-21 17:15:37 +08:00
parent 5910b7c019
commit 39f9a7592c
7 changed files with 58 additions and 14 deletions

View File

@@ -75,7 +75,9 @@ func (h *Inbound) handleJavaStatus(conn net.Conn) {
conn.Write(body.Bytes())
} else if packetID == 0x01 { // Ping
var b [8]byte
io.ReadFull(conn, b[:])
if _, err := io.ReadFull(conn, b[:]); err != nil {
return
}
var body bytes.Buffer
WriteVarInt(&body, 0x01)
@@ -90,10 +92,9 @@ func (h *Inbound) handleJavaStatus(conn net.Conn) {
}
}
func (h *Inbound) handleJavaLogin(ctx context.Context, conn net.Conn, username string, metadata adapter.InboundContext, onClose N.CloseHandlerFunc) {
// Note: Packet length is already read in switch or caller
func (h *Inbound) handleJavaLogin(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, onClose N.CloseHandlerFunc) {
// Login Start
packetLen, _, err := ReadVarInt(conn)
_, _, err := ReadVarInt(conn)
if err != nil {
conn.Close()
return