From 421f4c54a057f52e272c30513db66c2ebf3d1de2 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 24 Jan 2014 13:34:03 -0600 Subject: [PATCH] Add support for GetAddedNodeInfoResult. ok @jcvernaleo. --- jsonapi.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/jsonapi.go b/jsonapi.go index b0514929..9ae4153d 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -207,6 +207,20 @@ type ListUnSpentResult struct { Confirmations float64 `json:"confirmations"` } +// GetAddedNodeInfoResultAddr models the data of the addresses portion of the +// getaddednodeinfo command. +type GetAddedNodeInfoResultAddr struct { + Address string `json:"address"` + Connected string `json:"connected"` +} + +// GetAddedNodeInfoResult models the data from the getaddednodeinfo command. +type GetAddedNodeInfoResult struct { + AddedNode string `json:"addednode"` + Connected *bool `json:"connected,omitempty"` + Addresses *[]GetAddedNodeInfoResultAddr `json:"addresses,omitempty"` +} + // Error models the error field of the json returned by a bitcoin client. When // there is no error, this should be a nil pointer to produce the null in the // json that bitcoind produces. @@ -822,6 +836,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { // generate put the results in the proper structure. // We handle the error condition after the switch statement. switch cmd { + case "getaddednodeinfo": + var res []GetAddedNodeInfoResult + err = json.Unmarshal(objmap["result"], &res) + if err == nil { + result.Result = res + } case "getinfo": var res InfoResult err = json.Unmarshal(objmap["result"], &res)