mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2026-08-21 15:23:28 +08:00
changes for the new interface
This commit is contained in:
@@ -164,9 +164,9 @@ func (pb *memoryProtoBook) SupportsProtocols(p peer.ID, protos ...string) ([]str
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (pb *memoryProtoBook) SupportsAnyProtocol(p peer.ID, protos ...string) (bool, error) {
|
||||
func (pb *memoryProtoBook) FirstSupportedProtocol(p peer.ID, protos ...string) (string, error) {
|
||||
if err := p.Validate(); err != nil {
|
||||
return false, err
|
||||
return "", err
|
||||
}
|
||||
|
||||
s := pb.segments.get(p)
|
||||
@@ -175,8 +175,8 @@ func (pb *memoryProtoBook) SupportsAnyProtocol(p peer.ID, protos ...string) (boo
|
||||
|
||||
for _, proto := range protos {
|
||||
if _, ok := s.protocols[p][proto]; ok {
|
||||
return true, nil
|
||||
return proto, nil
|
||||
}
|
||||
}
|
||||
return false, nil
|
||||
return "", nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user