cmd/syncthing: Add more stats to usage reports (ref #3628)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4347
This commit is contained in:
Audrius Butkevicius
2017-10-12 06:16:46 +00:00
committed by Jakob Borg
parent 813e6ddf83
commit 2760d032ca
23 changed files with 358 additions and 117 deletions

View File

@@ -25,6 +25,7 @@ type Connection interface {
protocol.Connection
io.Closer
Type() string
Transport() string
RemoteAddr() net.Addr
}
@@ -74,10 +75,27 @@ func (t connType) String() string {
}
}
func (t connType) Transport() string {
switch t {
case connTypeRelayClient, connTypeRelayServer:
return "relay"
case connTypeTCPClient, connTypeTCPServer:
return "tcp"
case connTypeKCPClient, connTypeKCPServer:
return "kcp"
default:
return "unknown"
}
}
func (c internalConn) Type() string {
return c.connType.String()
}
func (c internalConn) Transport() string {
return c.connType.Transport()
}
func (c internalConn) String() string {
return fmt.Sprintf("%s-%s/%s", c.LocalAddr(), c.RemoteAddr(), c.connType.String())
}
@@ -116,6 +134,7 @@ type genericListener interface {
OnAddressesChanged(func(genericListener))
String() string
Factory() listenerFactory
NATType() string
}
type Model interface {