Skip to main content

Peering API Methods

The peering API allows retrieving basic information about autopeering.

The API provides the following functions and endpoints:

Client lib APIs:

/autopeering/neighbors#

Returns the chosen and accepted neighbors of the node.

Parameters#

Parameterknown
Required or Optionaloptional
DescriptionReturn all known peers, set to 1 (default: 0)
Typeint

Examples#

cURL#

curl --location 'http://localhost:8080/autopeering/neighbors?known=1'

Client lib - GetAutopeeringNeighbors#

Messages can be retrieved via GetAutopeeringNeighbors(knownPeers bool) (*jsonmodels.GetNeighborsResponse, error)

neighbors, err := goshimAPI.GetAutopeeringNeighbors(false)if err != nil {    // return error}
// will print the responsefmt.Println(string(neighbors))

Response examples#

{  "chosen": [    {      "id": "PtBSYhniWR2",      "publicKey": "BogpestCotcmbB2EYKSsyVMywFYvUt1MwGh6nUot8g5X",      "services": [        {          "id": "peering",          "address": "178.254.42.235:14626"        },        {          "id": "gossip",          "address": "178.254.42.235:14666"        },        {          "id": "FPC",          "address": "178.254.42.235:10895"        }      ]    }  ],  "accepted": [    {      "id": "CRPFWYijV1T",      "publicKey": "GUdTwLDb6t6vZ7X5XzEnjFNDEVPteU7tVQ9nzKLfPjdo",      "services": [        {          "id": "peering",          "address": "35.214.101.88:14626"        },        {          "id": "gossip",          "address": "35.214.101.88:14666"        },        {          "id": "FPC",          "address": "35.214.101.88:10895"        }      ]    }  ]}

Results#

  • Returned type
Return fieldTypeDescription
known[]NeighborList of known peers. Only returned when parameter is set.
chosen[]NeighborList of chosen peers.
accepted[]NeighborList of accepted peers.
errorstringError message. Omitted if success.
  • Type Neighbor
fieldTypeDescription
idstringComparable node identifier.
publicKeystringPublic key used to verify signatures.
services[]PeerServiceList of exposed services.
  • Type PeerService
fieldTypeDescription
idstringType of service.
addressstringNetwork address of the service.