Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ID is the protocol.ID of version 1.0.0 of the identify service. ID = "/ipfs/id/1.0.0" // IDPush is the protocol.ID of the Identify push protocol. // It sends full identify messages containing the current state of the peer. IDPush = "/ipfs/id/push/1.0.0" // DefaultTimeout for all id interactions, incoming / outgoing, id / id-push. DefaultTimeout = 5 * time.Second // ServiceName is the default identify service name ServiceName = "libp2p.identify" )
Variables ¶
This section is empty.
Functions ¶
func HasConsistentTransport ¶
HasConsistentTransport returns true if the address 'a' shares a protocol set with any address in the green set. This is used to check if a given address might be one of the addresses a peer is listening on.
Types ¶
type IDService ¶
type IDService interface {
// IdentifyConn synchronously triggers an identify request on the connection and
// waits for it to complete. If the connection is being identified by another
// caller, this call will wait. If the connection has already been identified,
// it will return immediately.
IdentifyConn(network.Conn)
// IdentifyWait triggers an identify (if the connection has not already been
// identified) and returns a channel that is closed when the identify protocol
// completes.
IdentifyWait(network.Conn) <-chan struct{}
Start()
io.Closer
}
type MetricsTracer ¶ added in v0.25.0
type MetricsTracer interface {
// TriggeredPushes counts IdentifyPushes triggered by event
TriggeredPushes(event any)
// ConnPushSupport counts peers by Push Support
ConnPushSupport(identifyPushSupport)
// IdentifyReceived tracks metrics on receiving an identify response
IdentifyReceived(isPush bool, numProtocols int, numAddrs int)
// IdentifySent tracks metrics on sending an identify response
IdentifySent(isPush bool, numProtocols int, numAddrs int)
}
func NewMetricsTracer ¶ added in v0.25.0
func NewMetricsTracer(opts ...MetricsTracerOption) MetricsTracer
type MetricsTracerOption ¶ added in v0.26.0
type MetricsTracerOption func(*metricsTracerSetting)
func WithRegisterer ¶ added in v0.26.0
func WithRegisterer(reg prometheus.Registerer) MetricsTracerOption
type Option ¶ added in v0.4.0
type Option func(*config)
Option is an option function for identify.
func DisableSignedPeerRecord ¶ added in v0.9.0
func DisableSignedPeerRecord() Option
DisableSignedPeerRecord disables populating signed peer records on the outgoing Identify response and ONLY sends the unsigned addresses.
func ProtocolVersion ¶ added in v0.23.0
ProtocolVersion sets the protocol version string that will be used to identify the family of protocols used by the peer.
func UserAgent ¶ added in v0.4.0
UserAgent sets the user agent this node will identify itself with to peers.
func WithMetricsTracer ¶ added in v0.25.0
func WithMetricsTracer(tr MetricsTracer) Option
func WithTimeout ¶ added in v0.42.0
WithTimeout sets the timeout for identify interactions.
Click to show internal directories.
Click to hide internal directories.