960598f504
guacamole-common-js 不会向 guacd 发送 select/connect;改为 Nexus 用 rdp_hosts 凭据完成握手后再桥接 WebSocket,消除 protocol violation。 Co-authored-by: Cursor <cursoragent@cursor.com>
33 lines
910 B
Python
33 lines
910 B
Python
"""Guacamole protocol encode/decode and internal opcode detection."""
|
|
|
|
from server.infrastructure.guacamole.protocol import (
|
|
encode_instruction,
|
|
is_internal_instruction,
|
|
parse_instruction,
|
|
tunnel_open_instruction,
|
|
)
|
|
|
|
|
|
def test_encode_instruction():
|
|
assert encode_instruction("select", "rdp") == "6.select,3.rdp;"
|
|
|
|
|
|
def test_parse_instruction_roundtrip():
|
|
raw = encode_instruction("connect", "host", "3389").rstrip(";")
|
|
opcode, args = parse_instruction(raw)
|
|
assert opcode == "connect"
|
|
assert args == ["host", "3389"]
|
|
|
|
|
|
def test_tunnel_open_instruction():
|
|
msg = tunnel_open_instruction("abc-uuid")
|
|
assert is_internal_instruction(msg)
|
|
opcode, args = parse_instruction(msg.rstrip(";"))
|
|
assert opcode == ""
|
|
assert args == ["abc-uuid"]
|
|
|
|
|
|
def test_is_internal_ping():
|
|
ping = encode_instruction("", "ping", "12345")
|
|
assert is_internal_instruction(ping)
|