v0.5.0
What's Changed
Use the new libp2phttp functionality for serving and requesting ipnisync over libp2p and HTTP.
The new publisher can publish ipnisync-http over libp2p if supplied with a stream host, over plain HTTP if supplied with a listen address, or both. The publisher also works as an HTTP handler to allow it to be used with existing HTTP listeners.
The sync client works with ipnisync-http over libp2p, plain HTTP, and legacy data-transfer sync. It is able to detect which protocol and transport to use with any provider, new or old.
Protocol negotiation
When a Syncer
is created to sync with a specific advertisement publisher, it first uses libp2phttp to negotiate with the publisher whether to use HTTP with or without libp2p. If the publisher is an older publisher that does not support this negotiation, then the client tries to use plain HTTP or the legacy data-transfer/graphsync protocol depending on the publisher address.
If a publisher is newer, but uses an existing HTTP server, it can still support protocol negotiation by supporting the /.well-known/
HTTP endpoint. Here is an example of adding support for this. This is optional, and the cost for not supporting it is one additional HTTP round trip between the indexer and publisher per sync operation.
API Changes
This version has some minor ipnisync
API changes to be aware of.
Publisher API Changes:
- The
NewPublisher
function does not take a single HTTP listen address as its first argument. It now takes a list of HTTP address as an option,WithHTTPListenAddrs
, since HTTP listen addresses are not required when using a libp2p stream host or with an existing HTTP server. - The
NewPublisher
can be given a libp2p stream host to serve advertisements, by specifying the optionWithStreamHost
. - The
dagsync/p2p/protocol/head
package has moved todagsync/dtsync/head
since it is only used indtsync
. This should not affect any external applications. - The
WithServer
has been renamed toWithStartServer
. - A new option,
WithRequireTLS
tells whether to require https or allow the publisher to serve non-secure http. Default is false, allowing non-secure HTTP.
Sync client API changes:
- The
NewSync
function does not take anhttp.Client
. Options are used to configure a default or retryable HTTP client. - New options are available to the
NewSync
function:ClientAuthServerPeerID
tells the sync client that it must authenticate the Server's PeerID.ClientHTTPTimeout
specifies a time limit for HTTP requestsClientStreamHost
specifies an optional stream based libp2p hostClientHTTPRetry
configures a retriable HTTP client
- The
NewSyncer
function now takes a singlepeer.AddrInfo
instead of a separatepeer.ID
and[]multiaddr.Multiaddr
arguments.
dagsync.Subscriber
API changes:
NewSubscriber
no longer has aHttpClient
option. It now supports the following options:HttpTimeout
which is passed through to the theClientHttpTimeout
optionRetryableHTTPClient
which is passed through to theClientHTTPRetry
option.
EoL Notice for data-transfer/graphsync
Support for advertisement sync using data-transfer/graphsync is being discontinued in future releases. It remains in this release as a temporary backup in case there is some failure to publish when a publisher upgrades.
Any applications using the dagsync/dtsync
package must switch to using dagsync/ipnisync
as soon as possible.
Please also read the v0.4.0 Release Notes if converting from an earlier version of this package.
Full Changelog: v0.4.0...v0.5.0