mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-01 14:28:02 +08:00
Merge pull request #3132 from ipfs/feat/versioned-protos
use correct protocol names for ipfs services
This commit is contained in:
commit
5f933be1ec
@ -26,7 +26,8 @@ import (
|
||||
var log = logging.Logger("diagnostics")
|
||||
|
||||
// ProtocolDiag is the diagnostics protocol.ID
|
||||
var ProtocolDiag protocol.ID = "/ipfs/diagnostics"
|
||||
var ProtocolDiag protocol.ID = "/ipfs/diag/net/1.0.0"
|
||||
var ProtocolDiagOld protocol.ID = "/ipfs/diagnostics"
|
||||
|
||||
var ErrAlreadyRunning = errors.New("diagnostic with that ID already running")
|
||||
|
||||
@ -54,6 +55,7 @@ func NewDiagnostics(self peer.ID, h host.Host) *Diagnostics {
|
||||
}
|
||||
|
||||
h.SetStreamHandler(ProtocolDiag, d.handleNewStream)
|
||||
h.SetStreamHandler(ProtocolDiagOld, d.handleNewStream)
|
||||
return d
|
||||
}
|
||||
|
||||
@ -203,7 +205,7 @@ func (d *Diagnostics) getDiagnosticFromPeers(ctx context.Context, peers map[peer
|
||||
}
|
||||
|
||||
func (d *Diagnostics) getDiagnosticFromPeer(ctx context.Context, p peer.ID, pmes *pb.Message) (<-chan *DiagInfo, error) {
|
||||
s, err := d.host.NewStream(ctx, p, ProtocolDiag)
|
||||
s, err := d.host.NewStream(ctx, p, ProtocolDiag, ProtocolDiagOld)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -8,7 +8,8 @@ import (
|
||||
protocol "gx/ipfs/Qmf4ETeAWXuThBfWwonVyFqGFSgTWepUDEr1txcctvpTXS/go-libp2p/p2p/protocol"
|
||||
)
|
||||
|
||||
var ProtocolBitswap protocol.ID = "/ipfs/bitswap"
|
||||
var ProtocolBitswap protocol.ID = "/ipfs/bitswap/1.0.0"
|
||||
var ProtocolBitswapOld protocol.ID = "/ipfs/bitswap"
|
||||
|
||||
// BitSwapNetwork provides network connectivity for BitSwap sessions
|
||||
type BitSwapNetwork interface {
|
||||
|
||||
@ -26,7 +26,7 @@ func NewFromIpfsHost(host host.Host, r routing.ContentRouting) BitSwapNetwork {
|
||||
routing: r,
|
||||
}
|
||||
host.SetStreamHandler(ProtocolBitswap, bitswapNetwork.handleNewStream)
|
||||
host.SetStreamHandler("/bitswap/1.0.0", bitswapNetwork.handleNewStream)
|
||||
host.SetStreamHandler(ProtocolBitswapOld, bitswapNetwork.handleNewStream)
|
||||
host.Network().Notify((*netNotifiee)(&bitswapNetwork))
|
||||
// TODO: StopNotify.
|
||||
|
||||
@ -73,7 +73,7 @@ func (bsnet *impl) newStreamToPeer(ctx context.Context, p peer.ID) (inet.Stream,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return bsnet.host.NewStream(ctx, p, "/bitswap/1.0.0", ProtocolBitswap)
|
||||
return bsnet.host.NewStream(ctx, p, ProtocolBitswap, ProtocolBitswapOld)
|
||||
}
|
||||
|
||||
func (bsnet *impl) SendMessage(
|
||||
|
||||
@ -31,7 +31,8 @@ import (
|
||||
|
||||
var log = logging.Logger("dht")
|
||||
|
||||
var ProtocolDHT protocol.ID = "/ipfs/dht"
|
||||
var ProtocolDHT protocol.ID = "/ipfs/kad/1.0.0"
|
||||
var ProtocolDHTOld protocol.ID = "/ipfs/dht"
|
||||
|
||||
// NumBootstrapQueries defines the number of random dht queries to do to
|
||||
// collect members of the routing table.
|
||||
@ -85,6 +86,7 @@ func NewDHT(ctx context.Context, h host.Host, dstore ds.Batching) *IpfsDHT {
|
||||
dht.ctx = ctx
|
||||
|
||||
h.SetStreamHandler(ProtocolDHT, dht.handleNewStream)
|
||||
h.SetStreamHandler(ProtocolDHTOld, dht.handleNewStream)
|
||||
dht.providers = providers.NewProviderManager(dht.ctx, dht.self, dstore)
|
||||
dht.proc.AddChild(dht.providers.Process())
|
||||
goprocessctx.CloseAfterContext(dht.proc, ctx)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user