From dc64e387b2aa12f63e40e879801cb8a8dbf531e5 Mon Sep 17 00:00:00 2001 From: QQ Date: Sat, 14 Nov 2026 14:42:52 +0800 Subject: [PATCH] Import fixtures/protocol/v1/control/connect.json --- fixtures/protocol/v1/control/connect.json | 179 ++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 fixtures/protocol/v1/control/connect.json diff --git a/fixtures/protocol/v1/control/connect.json b/fixtures/protocol/v1/control/connect.json new file mode 100644 index 0000000..c9dd96f --- /dev/null +++ b/fixtures/protocol/v1/control/connect.json @@ -0,0 +1,179 @@ +{ + "name": "control-connect", + "cases": [ + { + "name": "accept-connect-request", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "0198abc0-0001-7abc-8123-123456789abc", + "type": "connect.request", + "timestamp": 1786000000000, + "payload": { + "hostDeviceId": "0198abc0-1001-7abc-8123-123456789abc", + "preferredTransports": ["lan", "p2p", "turn", "relay"] + } + }, + "expect": { "accepted": true } + }, + { + "name": "reject-connect-request-with-empty-host-id", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "0198abc0-0002-7abc-8123-123456789abc", + "type": "connect.request", + "timestamp": 1786000000000, + "payload": { + "hostDeviceId": "", + "preferredTransports": ["relay"] + } + }, + "expect": { "accepted": false } + }, + { + "name": "reject-connect-request-with-empty-transports", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "0198abc0-0003-7abc-8123-123456789abc", + "type": "connect.request", + "timestamp": 1786000000000, + "payload": { + "hostDeviceId": "0198abc0-1001-7abc-8123-123456789abc", + "preferredTransports": [] + } + }, + "expect": { "accepted": false } + }, + { + "name": "reject-connect-request-with-unknown-transport", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "0198abc0-0004-7abc-8123-123456789abc", + "type": "connect.request", + "timestamp": 1786000000000, + "payload": { + "hostDeviceId": "0198abc0-1001-7abc-8123-123456789abc", + "preferredTransports": ["udp"] + } + }, + "expect": { "accepted": false } + }, + { + "name": "accept-connect-incoming", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "0198abc0-0005-7abc-8123-123456789abc", + "type": "connect.incoming", + "timestamp": 1786000000000, + "payload": { + "connectionId": "0198abc0-2001-7abc-8123-123456789abc", + "clientDeviceId": "0198abc0-3001-7abc-8123-123456789abc", + "clientIdentityKey": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "authorization": "account", + "preferredTransports": ["p2p", "turn", "relay"] + } + }, + "expect": { "accepted": true } + }, + { + "name": "reject-connect-incoming-with-invalid-authorization", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "0198abc0-0006-7abc-8123-123456789abc", + "type": "connect.incoming", + "timestamp": 1786000000000, + "payload": { + "connectionId": "0198abc0-2001-7abc-8123-123456789abc", + "clientDeviceId": "0198abc0-3001-7abc-8123-123456789abc", + "clientIdentityKey": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "authorization": "device", + "preferredTransports": ["relay"] + } + }, + "expect": { "accepted": false } + }, + { + "name": "reject-connect-incoming-with-empty-identity-key", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "0198abc0-0007-7abc-8123-123456789abc", + "type": "connect.incoming", + "timestamp": 1786000000000, + "payload": { + "connectionId": "0198abc0-2001-7abc-8123-123456789abc", + "clientDeviceId": "0198abc0-3001-7abc-8123-123456789abc", + "clientIdentityKey": "", + "authorization": "account", + "preferredTransports": ["relay"] + } + }, + "expect": { "accepted": false } + }, + { + "name": "accept-connect-accepted", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "0198abc0-0008-7abc-8123-123456789abc", + "type": "connect.accepted", + "timestamp": 1786000000000, + "payload": { + "connectionId": "0198abc0-2001-7abc-8123-123456789abc" + } + }, + "expect": { "accepted": true } + }, + { + "name": "accept-connect-rejected-with-error", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "0198abc0-0009-7abc-8123-123456789abc", + "type": "connect.rejected", + "timestamp": 1786000000000, + "payload": { + "connectionId": "0198abc0-2001-7abc-8123-123456789abc", + "code": "HOST_OFFLINE", + "message": "The Host is offline." + } + }, + "expect": { "accepted": true } + }, + { + "name": "reject-connect-result-without-connection-id", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "0198abc0-0010-7abc-8123-123456789abc", + "type": "connect.accepted", + "timestamp": 1786000000000, + "payload": {} + }, + "expect": { "accepted": false } + }, + { + "name": "reject-connect-incoming-with-noncanonical-identity-key", + "operation": "parseControlFrame", + "input": { + "v": 1, + "id": "0198abc0-0011-7abc-8123-123456789abc", + "type": "connect.incoming", + "timestamp": 1786000000000, + "payload": { + "connectionId": "0198abc0-2001-7abc-8123-123456789abc", + "clientDeviceId": "0198abc0-3001-7abc-8123-123456789abc", + "clientIdentityKey": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB", + "authorization": "account", + "preferredTransports": ["relay"] + } + }, + "expect": { "accepted": false } + } + ] +}