Browse Source

pex: update pex messages (#352)

pull/7804/head
Callum Waters 3 years ago
committed by GitHub
parent
commit
a524e95b19
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 50 deletions
  1. +6
    -17
      proto/tendermint/p2p/pex.proto
  2. +4
    -33
      spec/p2p/messages/pex.md

+ 6
- 17
proto/tendermint/p2p/pex.proto View File

@ -6,9 +6,9 @@ option go_package = "github.com/tendermint/tendermint/proto/tendermint/p2p";
import "gogoproto/gogo.proto"; import "gogoproto/gogo.proto";
message PexAddress { message PexAddress {
string id = 1 [(gogoproto.customname) = "ID"];
string ip = 2 [(gogoproto.customname) = "IP"];
uint32 port = 3;
string url = 1 [(gogoproto.customname) = "URL"];
reserved 2, 3; // See https://github.com/tendermint/spec/pull/352
} }
message PexRequest {} message PexRequest {}
@ -17,21 +17,10 @@ message PexResponse {
repeated PexAddress addresses = 1 [(gogoproto.nullable) = false]; repeated PexAddress addresses = 1 [(gogoproto.nullable) = false];
} }
message PexAddressV2 {
string url = 1 [(gogoproto.customname) = "URL"];
}
message PexRequestV2 {}
message PexResponseV2 {
repeated PexAddressV2 addresses = 1 [(gogoproto.nullable) = false];
}
message PexMessage { message PexMessage {
reserved 1, 2; // See https://github.com/tendermint/spec/pull/352
oneof sum { oneof sum {
PexRequest pex_request = 1;
PexResponse pex_response = 2;
PexRequestV2 pex_request_v2 = 3;
PexResponseV2 pex_response_v2 = 4;
PexRequest pex_request = 3;
PexResponse pex_response = 4;
} }
} }

+ 4
- 33
spec/p2p/messages/pex.md View File

@ -14,9 +14,6 @@ Pex has one channel. The channel identifier is listed below.
## Message Types ## 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 a `Protocol` and `Path` hence the V2 version uses a [url](https://golang.org/pkg/net/url/#URL) instead.
### PexRequest ### PexRequest
PexRequest is an empty message requesting a list of peers. PexRequest is an empty message requesting a list of peers.
@ -33,32 +30,8 @@ PexResponse is an list of net addresses provided to a peer to dial.
### PexAddress ### 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](#PexAddressV2) | List of peer addresses available to dial | 1 |
### PexAddressV2
PexAddress provides needed information for a node to dial a peer.
PexAddress provides needed information for a node to dial a peer. This is in the form of a `URL` that gets parsed
into a `NodeAddress`. See [ParseNodeAddress](https://github.com/tendermint/tendermint/blob/f2a8f5e054cf99ebe246818bb6d71f41f9a30faa/internal/p2p/address.go#L43) for more details.
| Name | Type | Description | Field Number | | Name | Type | Description | Field Number |
|------|--------|------------------|--------------| |------|--------|------------------|--------------|
@ -70,7 +43,5 @@ Message is a [`oneof` protobuf type](https://developers.google.com/protocol-buff
| Name | Type | Description | Field Number | | Name | Type | Description | Field Number |
|--------------|---------------------------|------------------------------------------------------|--------------| |--------------|---------------------------|------------------------------------------------------|--------------|
| pex_request | [PexRequest](#PexRequest) | Empty request asking for a list of addresses to dial | 1 |
| pex_response | [PexResponse](#PexResponse) | List of addresses to dial | 2 |
| pex_request_v2 | [PexRequestV2](#PexRequestV2) | Empty request asking for a list of addresses to dial | 3 |
| pex_response_v2 | [PexRespinseV2](#PexResponseV2) | List of addresses to dial | 4 |
| pex_request | [PexRequest](#PexRequest) | Empty request asking for a list of addresses to dial | 3 |
| pex_response | [PexResponse](#PexResponse) | List of addresses to dial | 4 |

Loading…
Cancel
Save