通道
Pex 有一个通道。通道标识符如下所示。| 名称 | 编号 |
|---|---|
| PexChannel | 0 |
消息类型
当前的 PEX 服务有两个版本。第一个版本使用 IP/端口对,但由于 p2p 栈正朝着与传输无关的方案演进, 节点端点需要Protocol 和 Path,因此 V2 版本改为使用 url。
PexRequest
PexRequest 是一个空消息,用于请求对等节点列表。EmptyRequest
PexResponse
PexResponse 是提供给对等节点用于拨号连接的网络地址列表。| 名称 | 类型 | 描述 | 字段编号 |
|---|---|---|---|
| addresses | repeated PexAddress | 可用于拨号连接的对等节点地址列表 | 1 |
PexAddress
PexAddress 提供节点拨号连接对等节点所需的信息。| 名称 | 类型 | 描述 | 字段编号 |
|---|---|---|---|
| id | string | 对等节点的 NodeID | 1 |
| ip | string | 节点的 IP | 2 |
| port | port | 对等节点的端口 | 3 |
PexRequestV2
PexRequest 是一个空消息,用于请求对等节点列表。EmptyRequest
PexResponseV2
PexResponse 是提供给对等节点用于拨号连接的网络地址列表。| 名称 | 类型 | 描述 | 字段编号 |
|---|---|---|---|
| addresses | repeated PexAddressV2 | 可用于拨号连接的对等节点地址列表 | 1 |
PexAddressV2
PexAddress 提供节点拨号连接对等节点所需的信息。| 名称 | 类型 | 描述 | 字段编号 |
|---|---|---|---|
| url | string | 参见 golang url | 1 |
Message
Message 是一种oneof protobuf 类型。该 oneof 由两类消息组成。
| 名称 | 类型 | 描述 | 字段编号 |
|---|---|---|---|
| pex_request | PexRequest | 请求可拨号地址列表的空请求 | 1 |
| pex_response | PexResponse | 可拨号的地址列表 | 2 |
| pex_request_v2 | PexRequestV2 | 请求可拨号地址列表的空请求 | 3 |
| pex_response_v2 | PexRespinseV2 | 可拨号的地址列表 | 4 |
Channels
Pex has one channel. The channel identifier is listed below.| Name | Number |
|---|---|
| PexChannel | 0 |
Message Types
The current PEX service has two versions. The first uses IP/port pair but since the p2p stack is moving towards a transport agnostic approach, node endpoints require aProtocol and Path hence the V2 version uses a url instead.
PexRequest
PexRequest is an empty message requesting a list of peers.EmptyRequest
PexResponse
PexResponse is an list of net addresses provided to a peer to dial.| Name | Type | Description | Field Number |
|---|---|---|---|
| addresses | repeated PexAddress | List of peer addresses available to dial | 1 |
PexAddress
PexAddress provides needed information for a node to dial a peer.| Name | Type | Description | Field Number |
|---|---|---|---|
| id | string | NodeID of a peer | 1 |
| ip | string | The IP of a node | 2 |
| port | port | Port of a peer | 3 |
PexRequestV2
PexRequest is an empty message requesting a list of peers.EmptyRequest
PexResponseV2
PexResponse is an list of net addresses provided to a peer to dial.| Name | Type | Description | Field Number |
|---|---|---|---|
| addresses | repeated PexAddressV2 | List of peer addresses available to dial | 1 |
PexAddressV2
PexAddress provides needed information for a node to dial a peer.| Name | Type | Description | Field Number |
|---|---|---|---|
| url | string | See golang url | 1 |
Message
Message is aoneof protobuf type. The one of consists of two messages.
| Name | Type | Description | Field Number |
|---|---|---|---|
| pex_request | PexRequest | Empty request asking for a list of addresses to dial | 1 |
| pex_response | PexResponse | List of addresses to dial | 2 |
| pex_request_v2 | PexRequestV2 | Empty request asking for a list of addresses to dial | 3 |
| pex_response_v2 | PexRespinseV2 | List of addresses to dial | 4 |