canonicallog

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogMisbehavingPeer

func LogMisbehavingPeer(p peer.ID, peerAddr multiaddr.Multiaddr, component string, err error, msg string)

LogMisbehavingPeer 记录一个行为不当的对等节点的信息 协议应使用此函数来标识行为不当的对等节点,以便最终用户可以在不同协议和libp2p中轻松识别这些节点

参数:

  • p: 对等节点ID
  • peerAddr: 对等节点的多地址
  • component: 组件名称
  • err: 错误信息
  • msg: 附加消息

func LogMisbehavingPeerNetAddr

func LogMisbehavingPeerNetAddr(p peer.ID, peerAddr net.Addr, component string, originalErr error, msg string)

LogMisbehavingPeerNetAddr 记录一个行为不当的对等节点的信息,使用net.Addr作为地址 这是LogMisbehavingPeer的一个变体,接受标准net.Addr而不是multiaddr.Multiaddr

参数:

  • p: 对等节点ID
  • peerAddr: 对等节点的网络地址
  • component: 组件名称
  • originalErr: 原始错误信息
  • msg: 附加消息

func LogPeerStatus

func LogPeerStatus(sampleRate int, p peer.ID, peerAddr multiaddr.Multiaddr, keyVals ...string)

LogPeerStatus 记录对等节点的有用信息,带有采样率控制 此函数用于记录那些单独看似正常但大量出现可能异常的事件

参数:

  • sampleRate: 采样率,只有1/sampleRate的消息会被记录
  • p: 对等节点ID
  • peerAddr: 对等节点的多地址
  • keyVals: 键值对列表,用于记录额外信息

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL