Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) ConsensusGet() (cg api.ConsensusGET, err error)
- func (c *Client) DaemonStopGet() (err error)
- func (c *Client) DaemonVersionGet() (dvg api.DaemonVersionGet, err error)
- func (c *Client) GatewayConnectPost(address modules.NetAddress) (err error)
- func (c *Client) GatewayGet() (gwg api.GatewayGET, err error)
- func (c *Client) HostAcceptingContractsPost(acceptingContracts bool) (err error)
- func (c *Client) HostAnnouncePost() (err error)
- func (c *Client) HostDbActiveGet() (hdag api.HostdbActiveGET, err error)
- func (c *Client) HostGet() (hg api.HostGET, err error)
- func (c *Client) HostStorageFoldersAddPost(path string, size uint64) (err error)
- func (c *Client) MinerHeaderGet() (target types.Target, bh types.BlockHeader, err error)
- func (c *Client) MinerHeaderPost(bh types.BlockHeader) (err error)
- func (c *Client) MinerStartGet() (err error)
- func (c *Client) MinerStopGet() (err error)
- func (c *Client) NewRequest(method, resource string, body io.Reader) (*http.Request, error)
- func (c *Client) RenterContractsGet() (rc api.RenterContracts, err error)
- func (c *Client) RenterDeletePost(siaPath string) (err error)
- func (c *Client) RenterDownloadGet(siaPath, destination string, offset, length uint64, async bool) (err error)
- func (c *Client) RenterDownloadHTTPResponseGet(siaPath string, offset, length uint64) (resp []byte, err error)
- func (c *Client) RenterDownloadsGet() (rdq api.RenterDownloadQueue, err error)
- func (c *Client) RenterFilesGet() (rf api.RenterFiles, err error)
- func (c *Client) RenterPost(allowance modules.Allowance) (err error)
- func (c *Client) RenterUploadPost(path, siaPath string, dataPieces, parityPieces uint64) (err error)
- func (c *Client) WalletAddressGet() (wag api.WalletAddressGET, err error)
- func (c *Client) WalletGet() (wg api.WalletGET, err error)
- func (c *Client) WalletInitPost(password string, force bool) (wip api.WalletInitPOST, err error)
- func (c *Client) WalletSiacoinsMultiPost(outputs []types.SiacoinOutput) (wsp api.WalletSiacoinsPOST, err error)
- func (c *Client) WalletSiacoinsPost(amount types.Currency, destination types.UnlockHash) (wsp api.WalletSiacoinsPOST, err error)
- func (c *Client) WalletTransactionsGet(startHeight types.BlockHeight, endHeight types.BlockHeight) (wtg api.WalletTransactionsGET, err error)
- func (c *Client) WalletUnlockPost(password string) (err error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPeerExists indicates that two peers are already connected. The string // of this error needs to be updated if the string of errPeerExists in the // gateway package is changed. ErrPeerExists = errors.New("already connected to this peer") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Address is the API address of the siad server. Address string // Password must match the password of the siad server. Password string // UserAgent must match the User-Agent required by the siad server. If not // set, it defaults to "Sia-Agent". UserAgent string }
A Client makes requests to the siad HTTP API.
func (*Client) ConsensusGet ¶
func (c *Client) ConsensusGet() (cg api.ConsensusGET, err error)
ConsensusGet requests the /consensus api resource
func (*Client) DaemonStopGet ¶
DaemonStopGet stops the daemon using the /daemon/stop endpoint.
func (*Client) DaemonVersionGet ¶
func (c *Client) DaemonVersionGet() (dvg api.DaemonVersionGet, err error)
DaemonVersionGet requests the /daemon/version resource
func (*Client) GatewayConnectPost ¶
func (c *Client) GatewayConnectPost(address modules.NetAddress) (err error)
GatewayConnectPost uses the /gateway/connect/:address endpoint to connect to the gateway at address
func (*Client) GatewayGet ¶
func (c *Client) GatewayGet() (gwg api.GatewayGET, err error)
GatewayGet requests the /gateway api resource
func (*Client) HostAcceptingContractsPost ¶
HostAcceptingContractsPost uses the /host endpoint to change the acceptingcontracts field of the host's settings
func (*Client) HostAnnouncePost ¶
HostAnnouncePost uses the /host/announce endpoint to announce the host to the network
func (*Client) HostDbActiveGet ¶
func (c *Client) HostDbActiveGet() (hdag api.HostdbActiveGET, err error)
HostDbActiveGet requests the /hostdb/active endpoint's resources
func (*Client) HostStorageFoldersAddPost ¶
HostStorageFoldersAddPost uses the /host/storage/folders/add api endpoint to add a storage folder to a host
func (*Client) MinerHeaderGet ¶
MinerHeaderGet uses the /miner/header endpoint to get a header for work.
func (*Client) MinerHeaderPost ¶
func (c *Client) MinerHeaderPost(bh types.BlockHeader) (err error)
MinerHeaderPost uses the /miner/header endpoint to submit a solved block header that was previously received from the same endpoint
func (*Client) MinerStartGet ¶
MinerStartGet uses the /miner/start endpoint to start the cpu miner.
func (*Client) MinerStopGet ¶
MinerStopGet uses the /miner/stop endpoint to stop the cpu miner.
func (*Client) NewRequest ¶
NewRequest constructs a request to the siad HTTP API, setting the correct User-Agent and Basic Auth. The resource path must begin with /.
func (*Client) RenterContractsGet ¶
func (c *Client) RenterContractsGet() (rc api.RenterContracts, err error)
RenterContractsGet requests the /renter/contracts resource
func (*Client) RenterDeletePost ¶
RenterDeletePost uses the /renter/delete endpoint to delete a file.
func (*Client) RenterDownloadGet ¶
func (c *Client) RenterDownloadGet(siaPath, destination string, offset, length uint64, async bool) (err error)
RenterDownloadGet uses the /renter/download endpoint to download a file to a destination on disk.
func (*Client) RenterDownloadHTTPResponseGet ¶
func (c *Client) RenterDownloadHTTPResponseGet(siaPath string, offset, length uint64) (resp []byte, err error)
RenterDownloadHTTPResponseGet uses the /renter/download endpoint to download a file and return its data.
func (*Client) RenterDownloadsGet ¶
func (c *Client) RenterDownloadsGet() (rdq api.RenterDownloadQueue, err error)
RenterDownloadsGet requests the /renter/downloads resource
func (*Client) RenterFilesGet ¶
func (c *Client) RenterFilesGet() (rf api.RenterFiles, err error)
RenterFilesGet requests the /renter/files resource
func (*Client) RenterPost ¶
RenterPost uses the /renter endpoint to change the renter's allowance
func (*Client) RenterUploadPost ¶
func (c *Client) RenterUploadPost(path, siaPath string, dataPieces, parityPieces uint64) (err error)
RenterUploadPost uses the /renter/upload endpoin to upload a file
func (*Client) WalletAddressGet ¶
func (c *Client) WalletAddressGet() (wag api.WalletAddressGET, err error)
WalletAddressGet requests a new address from the /wallet/address endpoint
func (*Client) WalletInitPost ¶
WalletInitPost uses the /wallet/init endpoint to initialize and encrypt a wallet
func (*Client) WalletSiacoinsMultiPost ¶
func (c *Client) WalletSiacoinsMultiPost(outputs []types.SiacoinOutput) (wsp api.WalletSiacoinsPOST, err error)
WalletSiacoinsMultiPost uses the /wallet/siacoin api endpoint to send money to multiple addresses at once
func (*Client) WalletSiacoinsPost ¶
func (c *Client) WalletSiacoinsPost(amount types.Currency, destination types.UnlockHash) (wsp api.WalletSiacoinsPOST, err error)
WalletSiacoinsPost uses the /wallet/siacoins api endpoint to send money to a single address
func (*Client) WalletTransactionsGet ¶
func (c *Client) WalletTransactionsGet(startHeight types.BlockHeight, endHeight types.BlockHeight) (wtg api.WalletTransactionsGET, err error)
WalletTransactionsGet requests the/wallet/transactions api resource for a certain startheight and endheight
func (*Client) WalletUnlockPost ¶
WalletUnlockPost uses the /wallet/unlock endpoint to unlock the wallet with a given encryption key. Per default this key is the seed.