Implement the /mediachain/node/push protocol for accepting pushes from authorized peers.
Semantics are those of an inverted merge: the source pushes statements, and the receiver merges them and requests objects by reusing the merge protocol implementation.
Closes #23
Implementation:
[X] protobufs
[X] receiver implementation
[X] sender implementation
[X] peer authorization/API for authorizing peers
[X] namespace filtering in incoming stream
Also: changes mc/nat public ip detection service to ifconfig.co, as ifconfig.me appears to be busted.
Implement the
/mediachain/node/push
protocol for accepting pushes from authorized peers. Semantics are those of an inverted merge: the source pushes statements, and the receiver merges them and requests objects by reusing the merge protocol implementation.Closes #23
Implementation:
Also: changes mc/nat public ip detection service to ifconfig.co, as ifconfig.me appears to be busted.
Examples
Pushing to a remote peer which has authorized us
Using the
/auth
api:$ curl http://127.0.0.1:9002/auth {}
Authorize a peer (just self here)
$ curl -H "Content-Type: application/text" -d '' http://127.0.0.1:9002/auth/QmeBkfxcaBfA9pvzivRwhF2PM7sXpp4HHQbp7jfTkRCWEa OK $ curl http://127.0.0.1:9002/auth {"QmeBkfxcaBfA9pvzivRwhF2PM7sXpp4HHQbp7jfTkRCWEa":[""]} $ curl -H "Content-Type: application/text" -d ',foo.,bar.baz' http://127.0.0.1:9002/auth/QmeBkfxcaBfA9pvzivRwhF2PM7sXpp4HHQbp7jfTkRCWEa OK $ curl http://127.0.0.1:9002/auth {"QmeBkfxcaBfA9pvzivRwhF2PM7sXpp4HHQbp7jfTkRCWEa":["","foo.","bar.baz"]} $ curl http://127.0.0.1:9002/auth/QmeBkfxcaBfA9pvzivRwhF2PM7sXpp4HHQbp7jfTkRCWEa ,foo.,bar.baz
revoke authorization
$ curl -H "Content-Type: application/text" -d '' http://127.0.0.1:9002/auth/QmeBkfxcaBfA9pvzivRwhF2PM7sXpp4HHQbp7jfTkRCWEa OK $ curl http://127.0.0.1:9002/auth {}