mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2024-12-25 23:20:10 +08:00
rename network.Stat to Stats, introduce ConnStats (#226)
This commit is contained in:
parent
975f71b238
commit
ed7a5ab432
@ -63,5 +63,5 @@ type ConnMultiaddrs interface {
|
||||
// ConnStat is an interface mixin for connection types that provide connection statistics.
|
||||
type ConnStat interface {
|
||||
// Stat stores metadata pertaining to this conn.
|
||||
Stat() Stat
|
||||
Stat() ConnStats
|
||||
}
|
||||
|
@ -96,8 +96,15 @@ func (r Reachability) String() string {
|
||||
return str[r]
|
||||
}
|
||||
|
||||
// Stat stores metadata pertaining to a given Stream/Conn.
|
||||
type Stat struct {
|
||||
// ConnStats stores metadata pertaining to a given Conn.
|
||||
type ConnStats struct {
|
||||
Stats
|
||||
// NumStreams is the number of streams on the connection.
|
||||
NumStreams int
|
||||
}
|
||||
|
||||
// Stats stores metadata pertaining to a given Stream / Conn.
|
||||
type Stats struct {
|
||||
// Direction specifies whether this is an inbound or an outbound connection.
|
||||
Direction Direction
|
||||
// Opened is the timestamp when this connection was opened.
|
||||
|
@ -21,7 +21,7 @@ type Stream interface {
|
||||
SetProtocol(id protocol.ID)
|
||||
|
||||
// Stat returns metadata pertaining to this stream.
|
||||
Stat() Stat
|
||||
Stat() Stats
|
||||
|
||||
// Conn returns the connection this stream is part of.
|
||||
Conn() Conn
|
||||
|
Loading…
Reference in New Issue
Block a user