Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -631,23 +631,27 @@

+ 网络UDP消息结构。

以下 UDP 节点发现消息定义位于 java-tron 仓库的 `p2p/src/main/proto/Discover.proto`。

`Endpoint`:网络中节点信息存储结构.
消息体`Endpoint` 包含3个参数:
`address`:节点地址。
消息体`Endpoint` 包含4个参数:
`address`:节点的 IPv4 地址。
`port`:端口号。
`nodeId`: 节点ID信息。
`nodeId`: 节点ID信息。
`addressIpv6`:节点的 IPv6 地址。

message Endpoint {
bytes address = 1;
int32 port = 2;
bytes nodeId = 3;
bytes addressIpv6 = 4;
}

`PingMessage`:节点建立连接时所发送的消息。
`PingMessage`:用于 UDP 节点发现与存活探测的请求消息。
消息体`PingMessage` 包含4个参数:
`from`:消息来自的节点。
`to`: 消息发送的节点。
`version`: 网络版本。
`version`:发送节点的网络标识(`networkId`)。
`timestamp`:消息创建时的时间戳。

message PingMessage {
Expand All @@ -657,10 +661,10 @@
int64 timestamp = 4;
}

`PongMessage`:连接建立成功时的回复消息。
`PongMessage`:对 UDP 节点发现与存活探测请求的响应消息。
消息体`PongMessage` 包含3个参数:
`from`:消息来自的节点。
`echo`:
`echo`:响应节点的网络标识(`networkId`)。
`timestamp`:消息创建时的时间戳。

message PongMessage {
Expand All @@ -669,10 +673,10 @@
int64 timestamp = 3;
}

`FindNeighbours`:节点查询相邻节点时所发送的消息。
`FindNeighbours`:查询接近 `targetId` 的节点列表的请求消息。
消息体`FindNeighbours` 包含3个参数:
`from`: 消息来自的节点。
`targetId`: 目标节点的信息。
`targetId`: 用于查找邻近节点的目标节点 ID。
`timestamp`: 消息创建时的时间戳。

message FindNeighbours {
Expand All @@ -681,11 +685,11 @@
int64 timestamp = 3;
}

`Neighbour`:相邻接点回复消息。
`Neighbours`:对 `FindNeighbours` 请求的响应消息,返回接近 `targetId` 的节点列表。
消息体`Neighbours` 包含3个参数:
`from`: 消息来自的节点。
`neighbours`: 相邻节点。
`timestamp`: 消息创建时的时间戳。
`neighbours`: 返回的节点列表。
`timestamp`: 对应 `FindNeighbours` 请求的时间戳。

message Neighbours {
Endpoint from = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,24 +666,28 @@ Input, transaction and head block all require signature.

+ The message structure of UDP.

The following UDP discovery messages are defined in `p2p/src/main/proto/Discover.proto` in the java-tron repository.

`Endpoint`: the storage structure of nodes' information.
message`Endpoint` contains 3 parameters:
`address`: the address of nodes.
message`Endpoint` contains 4 parameters:
`address`: the node's IPv4 address.
`port`: the port number.
`nodeId`:the ID of nodes.
`nodeId`:the ID of nodes.
`addressIpv6`: the node's IPv6 address.


message Endpoint {
bytes address = 1;
int32 port = 2;
bytes nodeId = 3;
bytes addressIpv6 = 4;
}

`PingMessage`: the message sent from one node to another in the connecting process.
`PingMessage`: a UDP request for node discovery and liveness checks.
message`PingMessage` contains 4 parameters:
`from`: which node does the message send from.
`to`: which node will the message send to.
`version`: the version of the Internet.
`version`: the sending node's network identifier (`networkId`).
`timestamp`: the timestamp of message.

message PingMessage {
Expand All @@ -693,10 +697,10 @@ Input, transaction and head block all require signature.
int64 timestamp = 4;
}

`PongMessage`: the message implies that nodes are connected.
`PongMessage`: a response to a UDP node discovery and liveness probe.
message`PongMessage` contains 3 parameters:
`from`: which node does the message send from.
`echo`:
`echo`: the responding node's network identifier (`networkId`).
`timestamp`: the timestamp of message.

message PongMessage {
Expand All @@ -705,10 +709,10 @@ Input, transaction and head block all require signature.
int64 timestamp = 3;
}

`FindNeighbours`: the message sent from one node to find another one.
`FindNeighbours`: a request for nodes closest to `targetId`.
message`FindNeighbours` contains 3 parameters:
`from`: which node does the message send from.
`targetId`: the ID of targeted node.
`targetId`: the target node ID used to find nearby nodes.
`timestamp`: the timestamp of message.

message FindNeighbours {
Expand All @@ -717,11 +721,11 @@ Input, transaction and head block all require signature.
int64 timestamp = 3;
}

`FindNeighbour`: the message replied by the neighbour node.
`Neighbours`: a response to `FindNeighbours` containing nodes closest to `targetId`.
message`Neighbours` contains 3 parameters:
`from`: which node does the message send from.
`neighbours`: the neighbour node.
`timestamp`: the timestamp of message.
`neighbours`: the returned list of nodes.
`timestamp`: the timestamp copied from the corresponding `FindNeighbours` request.

message Neighbours {
Endpoint from = 1;
Expand Down
27 changes: 1 addition & 26 deletions protocol/src/main/protos/core/Discover.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,7 @@ message Endpoint {
bytes addressIpv6 = 4;
}

message PingMessage {
Endpoint from = 1;
Endpoint to = 2;
int32 version = 3;
int64 timestamp = 4;
}

message PongMessage {
Endpoint from = 1;
int32 echo = 2;
int64 timestamp = 3;
}

message FindNeighbours {
Endpoint from = 1;
bytes targetId = 2;
int64 timestamp = 3;
}

message Neighbours {
Endpoint from = 1;
repeated Endpoint neighbours = 2;
int64 timestamp = 3;
}

message BackupMessage {
bool flag = 1;
int32 priority = 2;
}
}
Loading