-
Notifications
You must be signed in to change notification settings - Fork 0
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
support http delegated content routing protocol #45
Conversation
Protocol: proto.String(), | ||
Peer: p.Provider.ID, | ||
Addrs: p.Provider.Addrs, | ||
Metadata: plb, |
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.
the Metadata field will be dropped by the client since it is not part of the spec for the Bitswap provider record, do you need this to be accessible by the client?
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.
for graphsync records, yes - for bitswap, the plb
will be nil
and the omitempty
annotation on line 104 should result in the field not being present
@guseggert : do you need to look again to give an approval? |
we can merge / deploy to dev to create a test endpoint |
|
||
h := w.Header() | ||
h.Add("Access-Control-Allow-Origin", "*") | ||
h.Add("Access-Control-Allow-Methods", "GET, PUT, OPTIONS") |
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.
Co-authored-by: Gus Eggert <[email protected]>
46b7fd5
to
22f75df
Compare
Deploy support for the new HTTP delegated routing in `dev` environment for testing purposes. See: ipni/indexstar#45
Deploy support for the new HTTP delegated routing in `dev` environment for testing purposes. See: ipni/indexstar#45
The HTTP delegated routing uses `GET /routing/v1/providers/{CID}` to lookup CIDs. Translate the CID lookup URI. For the translation introduced #45 to work correctly, the URI needs to be changed to `/cid/{CID}`. Since delegated translator instantiates its own mux, on server handler mapping the URI prefix needs to be stripped.
The HTTP delegated routing uses `GET /routing/v1/providers/{CID}` to lookup CIDs. Translate the CID lookup URI. For the translation introduced #45 to work correctly, the URI needs to be changed to `/cid/{CID}`. Since delegated translator instantiates its own mux, on server handler mapping the URI prefix needs to be stripped.
That's the changes deployed on curl -s https://dev.cid.contact/routing/v1/providers/bafykbzacedzugqdzfjjbd4pgsvwrpkfdpk7rzfrsgwqj2kehxv2ffjy2tlny6 | jq
{
"Providers": [
{
"Protocol": "transport-bitswap",
"ID": "12D3KooWE8yt84RVwW3sFcd6WMjbUdWrZer2YtT4dmtj3dHdahSZ",
"Addrs": [
"/ip4/85.11.148.122/tcp/24001"
],
"Metadata": "gBI="
},
{
"Protocol": "transport-graphsync-filecoinv1",
"ID": "12D3KooWE8yt84RVwW3sFcd6WMjbUdWrZer2YtT4dmtj3dHdahSZ",
"Addrs": [
"/ip4/85.11.148.122/tcp/24001"
],
"Metadata": "kBKjaFBpZWNlQ0lE2CpYKAABgeIDkiAgGFQCpj6i9ZqZIog4XfYgWl6FP9616K18c44shEj+IQdsVmVyaWZpZWREZWFs9G1GYXN0UmV0cmlldmFs9Q=="
}
]
} |
per ipfs/specs#337
Note, there may be some follow-up extensions to this:
This PR should be enough to provide a compatible implementation to allow interoperability testing.