func handleProperties(ctx *web.Context) { r := new(common.Properties) r.Factomd_Version = common.FACTOMD_VERSION r.Protocol_Version = btcd.ProtocolVersion if p, err := json.Marshal(r); err != nil { wsLog.Error(err) ctx.WriteHeader(httpBad) ctx.Write([]byte(err.Error())) return } else { ctx.Write(p) } }
func GetProperties() (*common.Properties, error) { str := fmt.Sprintf("http://%s/v1/properties/", ipaddressFD+portNumberFD) resp, err := http.Get(str) if err != nil { return nil, err } body, err := ioutil.ReadAll(resp.Body) if err != nil { resp.Body.Close() return nil, err } resp.Body.Close() b := new(common.Properties) if err := json.Unmarshal(body, b); err != nil { return nil, err } b.Fctwallet_Version = Version return b, nil }