Skip to main content

ADP Operator

C2C 连接首包

C2C TCP 连接建立后,双方必须先交换固定长度的二进制首包。首包校验通过后,连接才允许继续处理 JSON 业务指令。

首包固定为 512 bit,结构如下:

bit 偏移 bit 长度 字段 规则
0 24 固定标识 三个 ASCII 字符 ADP
24 16 协议版本 16-bit 无符号整数,使用大端序,当前版本为 7
40 256 实例编号 当前节点的 instance_id,固定32字节
296 8 功能控制区 bit 0–2为功能开关,bit 3–7为保留位
304 208 全零保留区 必须全部为 0

字符串字段统一使用 UTF-8 编码。字段长度不足时在尾部使用 0x00 填充,超过字段长度时按字段长度截断。

功能控制区

功能控制区固定为8 bit,每个功能占用一个 bit:

bit 功能 0 1 当前默认值
0 UDP 主动发现 关闭 开启 1
1 额外 channel 通道 不支持 支持 1
2 WebSocket 业务端口 关闭 开启 1
3–7 保留位 必须为零 不允许 0

当前默认控制区的二进制内容为:

00000111

握手流程

  1. TCP 客户端连接 C2C 服务端。
  2. 客户端发送自己的 512 bit 二进制首包。
  3. 服务端读取并校验完整首包。
  4. 服务端校验通过后,向客户端返回自己的 512 bit 二进制首包。
  5. 客户端校验服务端首包。
  6. 双方校验均通过后,才开始发送 JSON 业务指令。

服务端会拒绝以下连接:

  • 首包长度不足 512 bit;
  • 固定标识不是 ADP;
  • 目标节点协议版本低于发起连接节点的协议版本;
  • instance_id 为空;
  • 字符串字段的补零格式错误;
  • 功能控制区保留位非零;
  • 208 bit 全零保留区存在非零数据。

该首包适用于 C2C 直连、反向连接、多跳转发、额外 channel 通道、外部 C2CSession 和本地服务探测。未实现该二进制首包的旧节点无法与新协议节点建立连接,因此升级时需要同时更新同一网络中的全部 C2C 节点。

协议版本字段固定为16 bit,使用大端序表示无符号整数,取值范围为 0–65535。客户端收到服务端首包后比较版本:目标节点版本大于或等于本机版本时允许连接,目标节点版本低于本机版本时拒绝连接。例如本机版本为 4、目标版本为 5 时允许连接;本机版本为 5、目标版本为 4 时拒绝连接。

Metadata

Release files for adp-operator 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adp-operator 1.1.1
File Size Uploaded Provenance Actions
adp_operator-1.1.1.tar.gz 111.4 kB Without provenance Details for adp_operator-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for adp-operator 1.1.1
File Interpreter ABI Platform Actions
adp_operator-1.1.1-py3-none-any.whl Python 3 none any Details for adp_operator-1.1.1-py3-none-any.whl

Total release size: 255.8 kB

Release files / adp_operator-1.1.1.tar.gz

Download URL adp_operator-1.1.1.tar.gz
Size 111.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b0b96e2f77c72c28e2379693b1b0f1de9009d5c9c4ab5d8a829f9b5cdfa83997
BLAKE2b-256 checksum
How to use checksums
e37d16c7e0c69b90b962bfe19a8fe7aa6cc23b775b04e3bec134cf4010ea1d47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / adp_operator-1.1.1-py3-none-any.whl

Download URL adp_operator-1.1.1-py3-none-any.whl
Size 144.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a05d7a51d1978167486cbe59ffd6afd7d6f5a0beacec5937a1f6f8a30009e933
BLAKE2b-256 checksum
How to use checksums
88911a1830a1bee31ce94bc45bda2733ccb88e2d6ae497038ec66a57c66192ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Security for adp-operator 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page