Skip to content

Commit

Permalink
Add AddPeerMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo committed Aug 7, 2023
1 parent cce08f1 commit 06a9aad
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions p2p/http/libp2phttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,3 +662,14 @@ func (h *HTTPHost) GetAndStorePeerProtoMap(roundtripper http.RoundTripper, serve

return meta, nil
}

// AddPeerMetadata adds a peer's protocol metadata to the http host. Useful if
// you have out-of-band knowledge of a peer's protocol mapping.
func (h *HTTPHost) AddPeerMetadata(server peer.ID, meta WellKnownProtoMap) {
h.peerMetadata.Add(server, meta)
}

// RmPeerMetadata removes a peer's protocol metadata from the http host
func (h *HTTPHost) RmPeerMetadata(server peer.ID, meta WellKnownProtoMap) {
h.peerMetadata.Remove(server)
}

0 comments on commit 06a9aad

Please sign in to comment.