github.com/Team-Kujira/tendermint@v0.34.24-indexer/spec/p2p/messages/pex.md (about)

     1  ---
     2  order: 6
     3  ---
     4  
     5  # Peer Exchange
     6  
     7  ## Channels
     8  
     9  Pex has one channel. The channel identifier is listed below.
    10  
    11  | Name       | Number |
    12  |------------|--------|
    13  | PexChannel | 0      |
    14  
    15  ## Message Types
    16  
    17  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, 
    18  node endpoints require a `Protocol` and `Path` hence the V2 version uses a [url](https://golang.org/pkg/net/url/#URL) instead.
    19  
    20  ### PexRequest
    21  
    22  PexRequest is an empty message requesting a list of peers.
    23  
    24  > EmptyRequest
    25  
    26  ### PexResponse
    27  
    28  PexResponse is an list of net addresses provided to a peer to dial.
    29  
    30  | Name  | Type                               | Description                              | Field Number |
    31  |-------|------------------------------------|------------------------------------------|--------------|
    32  | addresses | repeated [PexAddress](#PexAddress) | List of peer addresses available to dial | 1            |
    33  
    34  ### PexAddress
    35  
    36  PexAddress provides needed information for a node to dial a peer.
    37  
    38  | Name | Type   | Description      | Field Number |
    39  |------|--------|------------------|--------------|
    40  | id   | string | NodeID of a peer | 1            |
    41  | ip   | string | The IP of a node | 2            |
    42  | port | port   | Port of a peer   | 3            |
    43  
    44  
    45  ### PexRequestV2
    46  
    47  PexRequest is an empty message requesting a list of peers.
    48  
    49  > EmptyRequest
    50  
    51  ### PexResponseV2
    52  
    53  PexResponse is an list of net addresses provided to a peer to dial.
    54  
    55  | Name  | Type                               | Description                              | Field Number |
    56  |-------|------------------------------------|------------------------------------------|--------------|
    57  | addresses | repeated [PexAddressV2](#PexAddressV2) | List of peer addresses available to dial | 1            |
    58  
    59  ### PexAddressV2
    60  
    61  PexAddress provides needed information for a node to dial a peer.
    62  
    63  | Name | Type   | Description      | Field Number |
    64  |------|--------|------------------|--------------|
    65  | url   | string | See [golang url](https://golang.org/pkg/net/url/#URL) | 1            |
    66  
    67  ### Message
    68  
    69  Message is a [`oneof` protobuf type](https://developers.google.com/protocol-buffers/docs/proto#oneof). The one of consists of two messages.
    70  
    71  | Name         | Type                      | Description                                          | Field Number |
    72  |--------------|---------------------------|------------------------------------------------------|--------------|
    73  | pex_request  | [PexRequest](#PexRequest) | Empty request asking for a list of addresses to dial | 1            |
    74  | pex_response | [PexResponse](#PexResponse)  | List of addresses to dial                            | 2            |
    75  | pex_request_v2 | [PexRequestV2](#PexRequestV2) | Empty request asking for a list of addresses to dial | 3         |
    76  | pex_response_v2 | [PexRespinseV2](#PexResponseV2) | List of addresses to dial | 4 |