Better way for endpoints display
Created by: M5oul
It would be better to store endpoints on a dict (key => value). Should ever client implement something an annoying parsing algo or should the node do it?
curl http://moul.re:8999/network/peering
{
"version": 2,
"currency": "test_net",
"endpoints": [
"BASIC_MERKLED_API misc.moul.re 78.227.107.45 8999",
"BASIC_MERKLED_API desktop.moul.re 78.227.107.45 2a01:e34:ee36:b2d0:e79:cd45:ed65:147 24723"
],
"block": "38338-0000FDEA57D2784A1E0F6288E7B5C5312D6E3A42021833288C9D99FAFE5F80C8",
"signature": "CFsAT5VnDnRcCDRK17iOVmIe4JB+jxwVka02z8hX/c5Ox07hhNTZRcopyxx83J13qPOV7OKBVgrPhqhRpIrSBw==",
"raw": "Version: 2\nType: Peer\nCurrency: test_net\nPublicKey: J78bPUvLjxmjaEkdjxWLeENQtcfXm7iobqB49uT1Bgp3\nBlock: 38338-0000FDEA57D2784A1E0F6288E7B5C5312D6E3A42021833288C9D99FAFE5F80C8\nEndpoints:\nBASIC_MERKLED_API misc.moul.re 78.227.107.45 8999\nBASIC_MERKLED_API desktop.moul.re 78.227.107.45 2a01:e34:ee36:b2d0:e79:cd45:ed65:147 24723\n",
"pubkey": "J78bPUvLjxmjaEkdjxWLeENQtcfXm7iobqB49uT1Bgp3"
}⏎
From client point of view, parsing implementation seems annoying to do even with one endpoint.
Sometimes domain
or ipv6
fields are not here.
It could looks like:
"endpoints": [
{
"protocol": "BASIC_MERKLED_API",
"domain": "misc.moul.re",
"ip6": null,
"ip4": "78.227.107.45",
"port": "8999"
},
{
"protocol": "BASIC_MERKLED_API",
"domain": "desktop.moul.re",
"ip6": "2a01:e34:ee36:b2d0:e79:cd45:ed65:147",
"ip4": "78.227.107.45",
"port": "24723"
},
{
"protocol": "ESLASTIC_SEARCH_API",
"domain": "es.moul.re",
"ip6": "2a01:e34:ee36:b2d0:e79:cd45:ed65:147",
"ip4": "78.227.107.45",
"port": "45454"
}
]