Make peerinfo output match bitcoind a bit better.
Add long option for username in btcctl.
This commit is contained in:
parent
1f087adf15
commit
b72f0c6474
2 changed files with 18 additions and 18 deletions
34
server.go
34
server.go
|
@ -200,21 +200,21 @@ func (s *server) handleBroadcastMsg(peers *list.List, bmsg *broadcastMsg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Peerinfo represents the information requested by the getpeerinfo rpc command.
|
// PeerInfo represents the information requested by the getpeerinfo rpc command.
|
||||||
type PeerInfo struct {
|
type PeerInfo struct {
|
||||||
Addr string
|
Addr string `json:"addr,omitempty"`
|
||||||
Services btcwire.ServiceFlag
|
Services btcwire.ServiceFlag `json:"services,omitempty"`
|
||||||
LastSend time.Time
|
LastSend int64 `json:"lastsend,omitempty"`
|
||||||
LastRecv time.Time
|
LastRecv int64 `json:"lastrecv,omitempty"`
|
||||||
BytesSent int
|
BytesSent int `json:"bytessent,omitempty"`
|
||||||
BytesRecv int
|
BytesRecv int `json:"bytesrecv,omitempty"`
|
||||||
ConnTime time.Time
|
ConnTime int64 `json:"conntime,omitempty"`
|
||||||
Version uint32
|
Version uint32 `json:"version,omitempty"`
|
||||||
SubVer string
|
SubVer string `json:"subver,omitempty"`
|
||||||
Inbound bool
|
Inbound bool `json:"inbound,omitempty"`
|
||||||
StartingHeight int32
|
StartingHeight int32 `json:"startingheight,omitempty"`
|
||||||
BanScore int
|
BanScore int `json:"banscore,omitempty"`
|
||||||
SyncNode bool
|
SyncNode bool `json:"syncnode,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type getConnCountMsg struct {
|
type getConnCountMsg struct {
|
||||||
|
@ -264,11 +264,11 @@ func (s *server) handleQuery(querymsg interface{}, peers *list.List, bannedPeers
|
||||||
info := &PeerInfo{
|
info := &PeerInfo{
|
||||||
Addr: peer.addr,
|
Addr: peer.addr,
|
||||||
Services: peer.services,
|
Services: peer.services,
|
||||||
LastSend: peer.lastSend,
|
LastSend: peer.lastSend.Unix(),
|
||||||
LastRecv: peer.lastRecv,
|
LastRecv: peer.lastRecv.Unix(),
|
||||||
BytesSent: 0, // TODO(oga) we need this from wire.
|
BytesSent: 0, // TODO(oga) we need this from wire.
|
||||||
BytesRecv: 0, // TODO(oga) we need this from wire.
|
BytesRecv: 0, // TODO(oga) we need this from wire.
|
||||||
ConnTime: peer.timeConnected,
|
ConnTime: peer.timeConnected.Unix(),
|
||||||
Version: peer.protocolVersion,
|
Version: peer.protocolVersion,
|
||||||
SubVer: peer.userAgent,
|
SubVer: peer.userAgent,
|
||||||
Inbound: peer.inbound,
|
Inbound: peer.inbound,
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
type config struct {
|
type config struct {
|
||||||
Help bool `short:"h" long:"help" description:"Help"`
|
Help bool `short:"h" long:"help" description:"Help"`
|
||||||
RpcUser string `short:"u" description:"RPC username"`
|
RpcUser string `short:"u" long:"rpcuser" description:"RPC username"`
|
||||||
RpcPassword string `short:"P" long:"rpcpass" description:"RPC password"`
|
RpcPassword string `short:"P" long:"rpcpass" description:"RPC password"`
|
||||||
RpcServer string `short:"s" long:"rpcserver" description:"RPC server to connect to"`
|
RpcServer string `short:"s" long:"rpcserver" description:"RPC server to connect to"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue