gitlab.com/SiaPrime/SiaPrime@v1.4.1/node/api/client/daemon.go (about) 1 package client 2 3 import ( 4 "net/url" 5 "strconv" 6 7 "gitlab.com/SiaPrime/SiaPrime/node/api" 8 ) 9 10 // DaemonGlobalRateLimitPost uses the /daemon/settings endpoint to change the 11 // siad's bandwidth rate limit. downloadSpeed and uploadSpeed are interpreted 12 // as bytes/second. 13 func (c *Client) DaemonGlobalRateLimitPost(downloadSpeed, uploadSpeed int64) (err error) { 14 values := url.Values{} 15 values.Set("maxdownloadspeed", strconv.FormatInt(downloadSpeed, 10)) 16 values.Set("maxuploadspeed", strconv.FormatInt(uploadSpeed, 10)) 17 err = c.post("/daemon/settings", values.Encode(), nil) 18 return 19 } 20 21 // DaemonVersionGet requests the /daemon/version resource 22 func (c *Client) DaemonVersionGet() (dvg api.DaemonVersionGet, err error) { 23 err = c.get("/daemon/version", &dvg) 24 return 25 } 26 27 // DaemonSettingsGet requests the /daemon/settings api resource. 28 func (c *Client) DaemonSettingsGet() (dsg api.DaemonSettingsGet, err error) { 29 err = c.get("/daemon/settings", &dsg) 30 return 31 } 32 33 // DaemonStopGet stops the daemon using the /daemon/stop endpoint. 34 func (c *Client) DaemonStopGet() (err error) { 35 err = c.get("/daemon/stop", nil) 36 return 37 } 38 39 // DaemonUpdateGet checks for an available daemon update. 40 func (c *Client) DaemonUpdateGet() (dig api.DaemonUpdateGet, err error) { 41 err = c.get("/daemon/update", &dig) 42 return 43 } 44 45 // DaemonUpdatePost updates the daemon. 46 func (c *Client) DaemonUpdatePost() (err error) { 47 err = c.post("/daemon/update", "", nil) 48 return 49 }