mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2024-12-26 23:30:27 +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.
|
// ConnStat is an interface mixin for connection types that provide connection statistics.
|
||||||
type ConnStat interface {
|
type ConnStat interface {
|
||||||
// Stat stores metadata pertaining to this conn.
|
// Stat stores metadata pertaining to this conn.
|
||||||
Stat() Stat
|
Stat() ConnStats
|
||||||
}
|
}
|
||||||
|
@ -96,8 +96,15 @@ func (r Reachability) String() string {
|
|||||||
return str[r]
|
return str[r]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stat stores metadata pertaining to a given Stream/Conn.
|
// ConnStats stores metadata pertaining to a given Conn.
|
||||||
type Stat struct {
|
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 specifies whether this is an inbound or an outbound connection.
|
||||||
Direction Direction
|
Direction Direction
|
||||||
// Opened is the timestamp when this connection was opened.
|
// Opened is the timestamp when this connection was opened.
|
||||||
|
@ -21,7 +21,7 @@ type Stream interface {
|
|||||||
SetProtocol(id protocol.ID)
|
SetProtocol(id protocol.ID)
|
||||||
|
|
||||||
// Stat returns metadata pertaining to this stream.
|
// Stat returns metadata pertaining to this stream.
|
||||||
Stat() Stat
|
Stat() Stats
|
||||||
|
|
||||||
// Conn returns the connection this stream is part of.
|
// Conn returns the connection this stream is part of.
|
||||||
Conn() Conn
|
Conn() Conn
|
||||||
|
Loading…
Reference in New Issue
Block a user