-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement ipni-sync http over libp2p (#113)
* Implement ipni-sync http over libp2p Use the new libp2phttp functionality for serving and requesting ipnisync over libp2p. * Move libp2phttp functionality inside ipnisync * Subscriber does not use existing http client * Add HttpTimeout option for subscriber * Add option to use retryable http client * Change option name from `WithServer` to `WithStartServer` * Sync gets addrs from peerstore if none supplied * If server is not libp2phttp, then use address to choose plain HTTP or dtsync. * If publisher HTTP is not available at IPNI path, then retry without IPNI path. This supports legacy HTTP served without IPNI path. * ignore emtpy http listen addrs * Update log messages * Log peer.ID consistently as peer * Convert most tests to use ipnisync publisher * Change AsyncErr to Err in SyncFinished * Move old p2p head client/server (legs protocol ID) into dtsync, since that is the only place it is used. * Add tests for libp2phttp * gostream package relocated * update graphsync * Use IPNIPath for libp2p protocol ID
- Loading branch information
Showing
21 changed files
with
1,159 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
package ipnisync | ||
|
||
import "path" | ||
import "github.com/libp2p/go-libp2p/core/protocol" | ||
|
||
const protoVersion = "v1" | ||
|
||
var IpniPath = path.Join("/ipni", protoVersion, "ad") | ||
const ( | ||
// IPNIPath is the path that the Publisher expects as the last port of the | ||
// HTTP request URL path. The sync client automatically adds this to the | ||
// request path. | ||
IPNIPath = "/ipni/v1/ad" | ||
// ProtocolID is the libp2p protocol ID used to identify the ipni-sync | ||
// protocol. With libp2phttp this protocol ID maps directly to a single | ||
// HTTP path, so the value of the protocol ID is the same as the IPNI path | ||
// for the ipni-sync protocol. | ||
ProtocolID = protocol.ID(IPNIPath) | ||
) |
Oops, something went wrong.