-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Hesiod (class HS) metadata resolver #102
Conversation
5dd788e
to
500a423
Compare
0833941
to
6d64cc7
Compare
src/hesiod.c
Outdated
if (hsk_dns_is_subdomain(req->name, "peers.pool.hnsd.")) { | ||
hsk_peer_t *peerIter, *next; | ||
for (peerIter = ns->pool->head; peerIter; peerIter = next) { | ||
if (!hsk_hesiod_txt_push_peer(peerIter, an)) | ||
goto fail; | ||
|
||
next = peerIter->next; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be great if instead of peer id, a normal counter is used. Peer ID itself isn't really useful since the ip:port can act as an identifier and a parser's complexity increases when the numbers are non-deterministic.
Technically the parser can get around this by ignoring the number and just pushing onto an array, but imo it's cleaner if the numbers in the names are in order and consecutive.
Otherwise it ends up looking like:
{
chain: {
tip: {
hash: '0000000000000004289e32985c3325ccfcafe6facbbdf3d77908cd2787c6e55c',
height: '145177',
time: '1667733359'
},
synced: 'true',
progress: '1.000000'
},
pool: { size: '2', peers: [ {}, {}, [Object], [Object] ] }
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in 6e88475
Other than the peer id comment, everything works great! I liked the wildcard graphql-like selective query part. Was thinking if we could send more info on peers like state, but the lack of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LFG!! 🚀 🚀
@rithvikvibhu thanks for reviewing and feedback! I'm going to merge as is for now and we can do follow-ups in future PRs. |
TODO:
|
Built on top of #101 waiting for review and merge
See original idea in handshake-org/hsd#443
API schema
The HS API can be thought of like a single JSON object:
The object properties and sub-objects are addressed like a sort of backwards JSON notation, with an implied "wildcard" (
*
) prepended to the query string. So queryingsub.domain.
is equivalent to querying*.sub.domain
and all the data at or below that level will be returned.Examples
Retrieve the entire object:
Retrieve the chain sync progress only:
Retrieve data about chain tip block header: