mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-28 08:47:42 +08:00
peer: golint
This commit is contained in:

committed by
Brian Tiger Chow

parent
71e411e538
commit
5dea384510
@ -21,6 +21,7 @@ func (id ID) Equal(other ID) bool {
|
|||||||
return bytes.Equal(id, other)
|
return bytes.Equal(id, other)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pretty returns a b58-encoded string of the ID
|
||||||
func (id ID) Pretty() string {
|
func (id ID) Pretty() string {
|
||||||
return b58.Encode(id)
|
return b58.Encode(id)
|
||||||
}
|
}
|
||||||
@ -73,6 +74,7 @@ func (p *Peer) NetAddress(n string) *ma.Multiaddr {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetLatency retrieves the current latency measurement.
|
||||||
func (p *Peer) GetLatency() (out time.Duration) {
|
func (p *Peer) GetLatency() (out time.Duration) {
|
||||||
p.latenLock.RLock()
|
p.latenLock.RLock()
|
||||||
out = p.latency
|
out = p.latency
|
||||||
@ -80,6 +82,7 @@ func (p *Peer) GetLatency() (out time.Duration) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetLatency sets the latency measurement.
|
||||||
// TODO: Instead of just keeping a single number,
|
// TODO: Instead of just keeping a single number,
|
||||||
// keep a running average over the last hour or so
|
// keep a running average over the last hour or so
|
||||||
func (p *Peer) SetLatency(laten time.Duration) {
|
func (p *Peer) SetLatency(laten time.Duration) {
|
||||||
|
Reference in New Issue
Block a user