client

package
v1.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// HostParamCollateralBudget is the collateral budget of the host in
	// hastings.
	HostParamCollateralBudget = HostParam("collateralbudget")
	// HostParamMaxCollateral is the max collateral of the host in hastings.
	HostParamMaxCollateral = HostParam("maxcollateral")
	// HostParamMinContractPrice is the min contract price in hastings.
	HostParamMinContractPrice = HostParam("mincontractprice")
	// HostParamMinDownloadBandwidthPrice is the min download bandwidth price
	// in hastings/byte.
	HostParamMinDownloadBandwidthPrice = HostParam("mindownloadbandwidthprice")
	// HostParamMinUploadBandwidthPrice is the min upload bandwidth price in
	// hastings/byte.
	HostParamMinUploadBandwidthPrice = HostParam("minuploadbandwidthprice")
	// HostParamCollateral is the host's collateral in hastings/byte/block.
	HostParamCollateral = HostParam("collateral")
	// HostParamMinBaseRPCPrice is the minimum base RPC price in hastings.
	HostParamMinBaseRPCPrice = HostParam("minbaserpcprice")
	// HostParamMinSectorAccessPrice is the minimum sector access price in
	// hastings.
	HostParamMinSectorAccessPrice = HostParam("minsectoraccessprice")
	// HostParamMinStoragePrice is the minimum storage price in
	// hastings/byte/block.
	HostParamMinStoragePrice = HostParam("minstorageprice")
	// HostParamAcceptingContracts indicates if the host is accepting new
	// contracts.
	HostParamAcceptingContracts = HostParam("acceptingcontracts")
	// HostParamMaxDuration is the max duration of a contract in blocks.
	HostParamMaxDuration = HostParam("maxduration")
	// HostParamWindowSize is the size of the proof window in blocks.
	HostParamWindowSize = HostParam("windowsize")
	// HostParamMaxDownloadBatchSize is the maximum size of the download batch
	// size in bytes.
	HostParamMaxDownloadBatchSize = HostParam("maxdownloadbatchsize")
	// HostParamMaxReviseBatchSize is the maximum size of the revise batch size.
	HostParamMaxReviseBatchSize = HostParam("maxrevisebatchsize")
	// HostParamNetAddress is the announced netaddress of the host.
	HostParamNetAddress = HostParam("netaddress")
)

Variables

View Source
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 AllowanceRequestPost added in v1.4.0

type AllowanceRequestPost struct {
	// contains filtered or unexported fields
}

AllowanceRequestPost is a helper type to be able to build an allowance request.

func (*AllowanceRequestPost) Send added in v1.4.0

func (a *AllowanceRequestPost) Send() (err error)

Send finalizes and sends the request.

func (*AllowanceRequestPost) WithExpectedDownload added in v1.4.0

func (a *AllowanceRequestPost) WithExpectedDownload(expectedDownload uint64) *AllowanceRequestPost

WithExpectedDownload adds the expected download field to the request.

func (*AllowanceRequestPost) WithExpectedRedundancy added in v1.4.0

func (a *AllowanceRequestPost) WithExpectedRedundancy(expectedRedundancy float64) *AllowanceRequestPost

WithExpectedRedundancy adds the expected redundancy field to the request.

func (*AllowanceRequestPost) WithExpectedStorage added in v1.4.0

func (a *AllowanceRequestPost) WithExpectedStorage(expectedStorage uint64) *AllowanceRequestPost

WithExpectedStorage adds the expected storage field to the request.

func (*AllowanceRequestPost) WithExpectedUpload added in v1.4.0

func (a *AllowanceRequestPost) WithExpectedUpload(expectedUpload uint64) *AllowanceRequestPost

WithExpectedUpload adds the expected upload field to the request.

func (*AllowanceRequestPost) WithFunds added in v1.4.0

WithFunds adds the funds field to the request.

func (*AllowanceRequestPost) WithHosts added in v1.4.0

func (a *AllowanceRequestPost) WithHosts(hosts uint64) *AllowanceRequestPost

WithHosts adds the hosts field to the request.

func (*AllowanceRequestPost) WithMaxContractPrice added in v1.5.0

func (a *AllowanceRequestPost) WithMaxContractPrice(price types.Currency) *AllowanceRequestPost

WithMaxContractPrice adds the maxcontract field to the request.

func (*AllowanceRequestPost) WithMaxDownloadBandwidthPrice added in v1.5.0

func (a *AllowanceRequestPost) WithMaxDownloadBandwidthPrice(price types.Currency) *AllowanceRequestPost

WithMaxDownloadBandwidthPrice adds the maxdownloadbandwidthprice field to the request.

func (*AllowanceRequestPost) WithMaxPeriodChurn added in v1.5.0

func (a *AllowanceRequestPost) WithMaxPeriodChurn(maxPeriodChurn uint64) *AllowanceRequestPost

WithMaxPeriodChurn adds the expected redundancy field to the request.

func (*AllowanceRequestPost) WithMaxRPCPrice added in v1.5.0

func (a *AllowanceRequestPost) WithMaxRPCPrice(price types.Currency) *AllowanceRequestPost

WithMaxRPCPrice adds the maxrpcprice field to the request.

func (*AllowanceRequestPost) WithMaxSectorAccessPrice added in v1.5.0

func (a *AllowanceRequestPost) WithMaxSectorAccessPrice(price types.Currency) *AllowanceRequestPost

WithMaxSectorAccessPrice adds the maxsectoraccessprice field to the request.

func (*AllowanceRequestPost) WithMaxStoragePrice added in v1.5.0

func (a *AllowanceRequestPost) WithMaxStoragePrice(price types.Currency) *AllowanceRequestPost

WithMaxStoragePrice adds the maxstorageprice field to the request.

func (*AllowanceRequestPost) WithMaxUploadBandwidthPrice added in v1.5.0

func (a *AllowanceRequestPost) WithMaxUploadBandwidthPrice(price types.Currency) *AllowanceRequestPost

WithMaxUploadBandwidthPrice adds the maxuploadbandwidthprice field to the request.

func (*AllowanceRequestPost) WithPeriod added in v1.4.0

WithPeriod adds the period field to the request.

func (*AllowanceRequestPost) WithRenewWindow added in v1.4.0

func (a *AllowanceRequestPost) WithRenewWindow(renewWindow types.BlockHeight) *AllowanceRequestPost

WithRenewWindow adds the renewwindow field to the request.

type Client

type Client struct {
	Options
}

A Client makes requests to the spd HTTP API.

func New

func New(opts Options) *Client

New creates a new Client using the provided address. The password will be set using build.APIPasssword and the user agent will be set to "ScPrime-Agent". Both can be changed manually by the caller after the client is returned.

func (*Client) ConsensusBlocksHeightGet added in v1.3.3

func (c *Client) ConsensusBlocksHeightGet(height types.BlockHeight) (cbg api.ConsensusBlocksGet, err error)

ConsensusBlocksHeightGet requests the /consensus/blocks api resource

func (*Client) ConsensusBlocksIDGet added in v1.3.3

func (c *Client) ConsensusBlocksIDGet(id types.BlockID) (cbg api.ConsensusBlocksGet, err error)

ConsensusBlocksIDGet requests the /consensus/blocks api resource

func (*Client) ConsensusGet

func (c *Client) ConsensusGet() (cg api.ConsensusGET, err error)

ConsensusGet requests the /consensus api resource

func (*Client) ConsensusSetSubscribe added in v1.5.0

func (c *Client) ConsensusSetSubscribe(subscriber modules.ConsensusSetSubscriber, ccid modules.ConsensusChangeID, cancel <-chan struct{}) (<-chan error, func())

ConsensusSetSubscribe polls the /consensus/subscribe endpoint, streaming consensus changes to the subscriber indefinitely. First, it will stream changes until the subscriber is fully caught up. It will send any error encountered down the returned channel, or nil. Consequently, the caller should always wait for the first error before proceeding with initialization. Subsequent errors may be handled asynchronously. It also returns a function that can be called to unsubscribe from further changes.

func (*Client) ConsensusSubscribeSingle added in v1.5.0

func (c *Client) ConsensusSubscribeSingle(subscriber modules.ConsensusSetSubscriber, ccid modules.ConsensusChangeID, cancel <-chan struct{}) (modules.ConsensusChangeID, error)

ConsensusSubscribeSingle streams consensus changes from the /consensus/subscribe endpoint to the provided subscriber. Multiple calls may be required before the subscriber is fully caught up. It returns the latest change ID; if no changes were sent, this will be the same as the input ID.

func (*Client) DaemonAlertsGet added in v1.5.0

func (c *Client) DaemonAlertsGet() (dag api.DaemonAlertsGet, err error)

DaemonAlertsGet requests the /daemon/alerts resource.

func (*Client) DaemonGlobalRateLimitPost added in v1.5.0

func (c *Client) DaemonGlobalRateLimitPost(downloadSpeed, uploadSpeed int64) (err error)

DaemonGlobalRateLimitPost uses the /daemon/settings endpoint to change the spd's bandwidth rate limit. downloadSpeed and uploadSpeed are interpreted as bytes/second.

func (*Client) DaemonSettingsGet added in v1.5.0

func (c *Client) DaemonSettingsGet() (dsg api.DaemonSettingsGet, err error)

DaemonSettingsGet requests the /daemon/settings api resource.

func (*Client) DaemonStackGet added in v1.5.0

func (c *Client) DaemonStackGet() (dsg api.DaemonStackGet, err error)

DaemonStackGet requests the /daemon/stack api resource.

func (*Client) DaemonStopGet

func (c *Client) DaemonStopGet() (err error)

DaemonStopGet stops the daemon using the /daemon/stop endpoint.

func (*Client) DaemonUpdateGet added in v1.3.3

func (c *Client) DaemonUpdateGet() (dig api.DaemonUpdateGet, err error)

DaemonUpdateGet checks for an available daemon update.

func (*Client) DaemonUpdatePost added in v1.3.3

func (c *Client) DaemonUpdatePost() (err error)

DaemonUpdatePost updates the daemon.

func (*Client) DaemonVersionGet

func (c *Client) DaemonVersionGet() (dvg api.DaemonVersionGet, err error)

DaemonVersionGet requests the /daemon/version resource.

func (*Client) GatewayAppendBlocklistPost added in v1.5.0

func (c *Client) GatewayAppendBlocklistPost(addresses []string) (err error)

GatewayAppendBlocklistPost uses the /gateway/blocklist endpoint to append addresses to the Gateway's blocklist

func (*Client) GatewayBandwidthGet added in v1.5.0

func (c *Client) GatewayBandwidthGet() (gbg api.GatewayBandwidthGET, err error)

GatewayBandwidthGet requests the /gateway/bandwidth api resource

func (*Client) GatewayBlocklistGet added in v1.5.0

func (c *Client) GatewayBlocklistGet() (gbg api.GatewayBlocklistGET, err error)

GatewayBlocklistGet uses the /gateway/blocklist endpoint to request the Gateway's blocklist

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) GatewayDisconnectPost added in v1.3.3

func (c *Client) GatewayDisconnectPost(address modules.NetAddress) (err error)

GatewayDisconnectPost uses the /gateway/disconnect/:address endpoint to disconnect the gateway from a peer.

func (*Client) GatewayGet

func (c *Client) GatewayGet() (gwg api.GatewayGET, err error)

GatewayGet requests the /gateway api resource

func (*Client) GatewayRateLimitPost added in v1.4.0

func (c *Client) GatewayRateLimitPost(downloadSpeed, uploadSpeed int64) (err error)

GatewayRateLimitPost uses the /gateway endpoint to change the gateway's bandwidth rate limit. downloadSpeed and uploadSpeed are interpreted as bytes/second.

func (*Client) GatewayRemoveBlocklistPost added in v1.5.0

func (c *Client) GatewayRemoveBlocklistPost(addresses []string) (err error)

GatewayRemoveBlocklistPost uses the /gateway/blocklist endpoint to remove addresses from the Gateway's blocklist

func (*Client) GatewaySetBlocklistPost added in v1.5.0

func (c *Client) GatewaySetBlocklistPost(addresses []string) (err error)

GatewaySetBlocklistPost uses the /gateway/blocklist endpoint to set the Gateway's blocklist

func (*Client) HostAnnounceAddrPost added in v1.3.3

func (c *Client) HostAnnounceAddrPost(address modules.NetAddress) (err error)

HostAnnounceAddrPost uses the /host/anounce endpoint to announce the host to the network using the provided address.

func (*Client) HostAnnouncePost

func (c *Client) HostAnnouncePost() (err error)

HostAnnouncePost uses the /host/announce endpoint to announce the host to the network

func (*Client) HostBandwidthGet added in v1.5.0

func (c *Client) HostBandwidthGet() (gbg api.GatewayBandwidthGET, err error)

HostBandwidthGet requests the /host/bandwidth api resource

func (*Client) HostContractGet added in v1.5.2

func (c *Client) HostContractGet(obligationID types.FileContractID) (cg api.HostContractGET, err error)

HostContractGet uses the /host/contracts/:id endpoint to get information about a contract on the host.

func (*Client) HostContractInfoGet added in v1.3.3

func (c *Client) HostContractInfoGet() (cg api.ContractInfoGET, err error)

HostContractInfoGet uses the /host/contracts endpoint to get information about contracts on the host.

func (*Client) HostDbActiveGet

func (c *Client) HostDbActiveGet() (hdag api.HostdbActiveGET, err error)

HostDbActiveGet requests the /hostdb/active endpoint's resources.

func (*Client) HostDbAllGet added in v1.3.3

func (c *Client) HostDbAllGet() (hdag api.HostdbAllGET, err error)

HostDbAllGet requests the /hostdb/all endpoint's resources.

func (*Client) HostDbFilterModeGet added in v1.5.0

func (c *Client) HostDbFilterModeGet() (hdfmg api.HostdbFilterModeGET, err error)

HostDbFilterModeGet requests the /hostdb/filtermode GET endpoint

func (*Client) HostDbFilterModePost added in v1.4.0

func (c *Client) HostDbFilterModePost(fm modules.FilterMode, hosts []types.SiaPublicKey) (err error)

HostDbFilterModePost requests the /hostdb/filtermode POST endpoint

func (*Client) HostDbGet added in v1.3.3

func (c *Client) HostDbGet() (hdg api.HostdbGet, err error)

HostDbGet requests the /hostdb endpoint's resources.

func (*Client) HostDbHostsGet added in v1.3.3

func (c *Client) HostDbHostsGet(pk types.SiaPublicKey) (hhg api.HostdbHostsGET, err error)

HostDbHostsGet request the /hostdb/hosts/:pubkey endpoint's resources.

func (*Client) HostEstimateScoreGet added in v1.3.3

func (c *Client) HostEstimateScoreGet(param, value string) (eg api.HostEstimateScoreGET, err error)

HostEstimateScoreGet requests the /host/estimatescore endpoint.

func (*Client) HostGet

func (c *Client) HostGet() (hg api.HostGET, err error)

HostGet requests the /host endpoint.

func (*Client) HostModifySettingPost added in v1.3.3

func (c *Client) HostModifySettingPost(param HostParam, value interface{}) (err error)

HostModifySettingPost uses the /host endpoint to change a param of the host settings to a certain value.

func (*Client) HostStorageFoldersAddPost

func (c *Client) HostStorageFoldersAddPost(path string, size uint64) (err error)

HostStorageFoldersAddPost uses the /host/storage/folders/add api endpoint to add a storage folder to a host

func (*Client) HostStorageFoldersRemovePost added in v1.3.3

func (c *Client) HostStorageFoldersRemovePost(path string, force bool) (err error)

HostStorageFoldersRemovePost uses the /host/storage/folders/remove api endpoint to remove a storage folder from a host.

func (*Client) HostStorageFoldersResizePost added in v1.3.3

func (c *Client) HostStorageFoldersResizePost(path string, size uint64) (err error)

HostStorageFoldersResizePost uses the /host/storage/folders/resize api endpoint to resize an existing storage folder.

func (*Client) HostStorageGet added in v1.3.3

func (c *Client) HostStorageGet() (sg api.StorageGET, err error)

HostStorageGet requests the /host/storage endpoint.

func (*Client) HostStorageSectorsDeletePost added in v1.3.3

func (c *Client) HostStorageSectorsDeletePost(root crypto.Hash) (err error)

HostStorageSectorsDeletePost uses the /host/storage/sectors/delete endpoint to delete a sector from the host.

func (*Client) MinerBlockPost added in v1.5.0

func (c *Client) MinerBlockPost(b types.Block) (err error)

MinerBlockPost uses the /miner/block endpoint to submit a solved block.

func (*Client) MinerGet added in v1.3.3

func (c *Client) MinerGet() (mg api.MinerGET, err error)

MinerGet requests the /miner endpoint's resources.

func (*Client) MinerHeaderGet

func (c *Client) MinerHeaderGet() (target types.Target, bh types.BlockHeader, err error)

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

func (c *Client) MinerStartGet() (err error)

MinerStartGet uses the /miner/start endpoint to start the cpu miner.

func (*Client) MinerStopGet

func (c *Client) MinerStopGet() (err error)

MinerStopGet uses the /miner/stop endpoint to stop the cpu miner.

func (*Client) MiningPoolClientsGet added in v1.3.8

func (c *Client) MiningPoolClientsGet() (clientInfos api.MiningPoolClientsInfo, err error)

MiningPoolClientsGet requests the /pool/clients client info list.

func (*Client) MiningPoolConfigGet added in v1.3.8

func (c *Client) MiningPoolConfigGet() (config api.MiningPoolConfig, err error)

MiningPoolConfigGet requests the /pool/config configuration info.

func (*Client) MiningPoolConfigPost added in v1.3.8

func (c *Client) MiningPoolConfigPost(key string, val string) (err error)

MiningPoolConfigPost uses the /pool/config endpoint to tell mining pool to use a new configuration value

func (*Client) MiningPoolGet added in v1.3.8

func (c *Client) MiningPoolGet() (mg api.MiningPoolGET, err error)

MiningPoolGet requests the /pool endpoint's resources.

func (*Client) NewRequest

func (c *Client) NewRequest(method, resource string, body io.Reader) (*http.Request, error)

NewRequest constructs a request to the spd HTTP API, setting the correct User-Agent and Basic Auth. The resource path must begin with /.

func (*Client) RenterAllContractsGet added in v1.5.0

func (c *Client) RenterAllContractsGet() (rc api.RenterContracts, err error)

RenterAllContractsGet requests the /renter/contracts resource with all options set to true

func (*Client) RenterAllowanceCancelPost added in v1.5.0

func (c *Client) RenterAllowanceCancelPost() (err error)

RenterAllowanceCancelPost uses the /renter/allowance/cancel endpoint to cancel the allowance.

func (*Client) RenterBackups added in v1.5.0

func (c *Client) RenterBackups() (ubs api.RenterBackupsGET, err error)

RenterBackups lists the backups the renter has uploaded to hosts.

func (*Client) RenterBackupsOnHost added in v1.5.0

func (c *Client) RenterBackupsOnHost(host types.SiaPublicKey) (ubs api.RenterBackupsGET, err error)

RenterBackupsOnHost lists the backups that the renter has uploaded to a specific host.

func (*Client) RenterCancelDownloadPost added in v1.5.0

func (c *Client) RenterCancelDownloadPost(id modules.DownloadID) (err error)

RenterCancelDownloadPost requests the /renter/download/cancel endpoint to cancel an ongoing doing.

func (*Client) RenterClearAllDownloadsPost added in v1.3.4

func (c *Client) RenterClearAllDownloadsPost() (err error)

RenterClearAllDownloadsPost requests the /renter/downloads/clear resource with no parameters

func (*Client) RenterClearDownloadsAfterPost added in v1.3.4

func (c *Client) RenterClearDownloadsAfterPost(after time.Time) (err error)

RenterClearDownloadsAfterPost requests the /renter/downloads/clear resource with only the after timestamp provided

func (*Client) RenterClearDownloadsBeforePost added in v1.3.4

func (c *Client) RenterClearDownloadsBeforePost(before time.Time) (err error)

RenterClearDownloadsBeforePost requests the /renter/downloads/clear resource with only the before timestamp provided

func (*Client) RenterClearDownloadsRangePost added in v1.3.4

func (c *Client) RenterClearDownloadsRangePost(after, before time.Time) (err error)

RenterClearDownloadsRangePost requests the /renter/downloads/clear resource with both before and after timestamps provided

func (*Client) RenterContractCancelPost added in v1.3.4

func (c *Client) RenterContractCancelPost(id types.FileContractID) (err error)

RenterContractCancelPost uses the /renter/contract/cancel endpoint to cancel a contract

func (*Client) RenterContractRecoveryProgressGet added in v1.4.0

func (c *Client) RenterContractRecoveryProgressGet() (rrs api.RenterRecoveryStatusGET, err error)

RenterContractRecoveryProgressGet returns information about potentially ongoing contract recovery scans.

func (*Client) RenterContractStatus added in v1.5.0

func (c *Client) RenterContractStatus(fcID types.FileContractID) (status modules.ContractWatchStatus, err error)

RenterContractStatus requests the /watchdog/contractstatus resource and returns the status of a contract.

func (*Client) RenterContractorChurnStatus added in v1.5.0

func (c *Client) RenterContractorChurnStatus() (churnStatus modules.ContractorChurnStatus, err error)

RenterContractorChurnStatus uses the /renter/contractorchurnstatus endpoint to get the current contractor churn status.

func (*Client) RenterContractsGet

func (c *Client) RenterContractsGet() (rc api.RenterContracts, err error)

RenterContractsGet requests the /renter/contracts resource and returns Contracts and ActiveContracts

func (*Client) RenterCreateBackupPost added in v1.4.0

func (c *Client) RenterCreateBackupPost(name string) (err error)

RenterCreateBackupPost creates a backup of the SiaFiles of the renter and uploads it to hosts.

func (*Client) RenterCreateLocalBackupPost deprecated added in v1.5.0

func (c *Client) RenterCreateLocalBackupPost(dst string) (err error)

RenterCreateLocalBackupPost creates a local backup of the SiaFiles of the renter.

Deprecated: Use RenterCreateBackupPost instead.

func (*Client) RenterDirCreatePost added in v1.4.0

func (c *Client) RenterDirCreatePost(siaPath modules.SiaPath) (err error)

RenterDirCreatePost uses the /renter/dir/ endpoint to create a directory for the renter

func (*Client) RenterDirCreateWithModePost added in v1.5.0

func (c *Client) RenterDirCreateWithModePost(siaPath modules.SiaPath, mode os.FileMode) (err error)

RenterDirCreateWithModePost uses the /renter/dir/ endpoint to create a directory for the renter with the specified permissions.

func (*Client) RenterDirDeletePost added in v1.4.0

func (c *Client) RenterDirDeletePost(siaPath modules.SiaPath) (err error)

RenterDirDeletePost uses the /renter/dir/ endpoint to delete a directory for the renter

func (*Client) RenterDirDeleteRootPost added in v1.5.0

func (c *Client) RenterDirDeleteRootPost(siaPath modules.SiaPath) (err error)

RenterDirDeleteRootPost uses the /renter/dir/ endpoint to delete a directory for the renter. It passes the `root=true` flag to indicate an absolute path.

func (*Client) RenterDirGet added in v1.5.0

func (c *Client) RenterDirGet(siaPath modules.SiaPath) (rd api.RenterDirectory, err error)

RenterDirGet uses the /renter/dir/ endpoint to query a directory

func (*Client) RenterDirRenamePost added in v1.4.0

func (c *Client) RenterDirRenamePost(siaPath, newSiaPath modules.SiaPath) (err error)

RenterDirRenamePost uses the /renter/dir/ endpoint to rename a directory for the renter

func (*Client) RenterDirRootGet added in v1.5.0

func (c *Client) RenterDirRootGet(siaPath modules.SiaPath) (rd api.RenterDirectory, err error)

RenterDirRootGet uses the /renter/dir/ endpoint to query a directory, starting from the root path.

func (*Client) RenterDisabledContractsGet added in v1.5.0

func (c *Client) RenterDisabledContractsGet() (rc api.RenterContracts, err error)

RenterDisabledContractsGet requests the /renter/contracts resource with the disabled flag set to true

func (*Client) RenterDownloadFullGet added in v1.3.3

func (c *Client) RenterDownloadFullGet(siaPath modules.SiaPath, destination string, async bool) (modules.DownloadID, error)

RenterDownloadFullGet uses the /renter/download endpoint to download a full file.

func (*Client) RenterDownloadGet

func (c *Client) RenterDownloadGet(siaPath modules.SiaPath, destination string, offset, length uint64, async bool, disableLocalFetch bool) (modules.DownloadID, error)

RenterDownloadGet uses the /renter/download endpoint to download a file to a destination on disk.

func (*Client) RenterDownloadHTTPResponseGet

func (c *Client) RenterDownloadHTTPResponseGet(siaPath modules.SiaPath, offset, length uint64, disableLocalFetch bool) (modules.DownloadID, []byte, error)

RenterDownloadHTTPResponseGet uses the /renter/download endpoint to download a file and return its data.

func (*Client) RenterDownloadInfoGet added in v1.5.0

func (c *Client) RenterDownloadInfoGet(uid modules.DownloadID) (di api.DownloadInfo, err error)

RenterDownloadInfoGet uses the /renter/downloadinfo endpoint to fetch information about a download from the history.

func (*Client) RenterDownloadsGet

func (c *Client) RenterDownloadsGet() (rdq api.RenterDownloadQueue, err error)

RenterDownloadsGet requests the /renter/downloads resource

func (*Client) RenterExpiredContractsGet added in v1.3.4

func (c *Client) RenterExpiredContractsGet() (rc api.RenterContracts, err error)

RenterExpiredContractsGet requests the /renter/contracts resource with the expired flag set to true

func (*Client) RenterFileDeletePost added in v1.5.0

func (c *Client) RenterFileDeletePost(siaPath modules.SiaPath) (err error)

RenterFileDeletePost uses the /renter/delete endpoint to delete a file.

func (*Client) RenterFileDeleteRootPost added in v1.5.0

func (c *Client) RenterFileDeleteRootPost(siaPath modules.SiaPath) (err error)

RenterFileDeleteRootPost uses the /renter/delete endpoint to delete a file. It passes the `root=true` flag to indicate an absolute path.

func (*Client) RenterFileGet added in v1.3.3

func (c *Client) RenterFileGet(siaPath modules.SiaPath) (rf api.RenterFile, err error)

RenterFileGet uses the /renter/file/:siapath endpoint to query a file.

func (*Client) RenterFileRootGet added in v1.5.0

func (c *Client) RenterFileRootGet(siaPath modules.SiaPath) (rf api.RenterFile, err error)

RenterFileRootGet uses the /renter/file/:siapath endpoint to query a file. It passes the `root=true` flag to indicate an absolute path.

func (*Client) RenterFilesGet

func (c *Client) RenterFilesGet(cached bool) (rf api.RenterFiles, err error)

RenterFilesGet requests the /renter/files resource.

func (*Client) RenterFuse added in v1.5.0

func (c *Client) RenterFuse() (fi api.RenterFuseInfo, err error)

RenterFuse uses the /renter/fuse endpoint to return information about the current fuse mount point.

func (*Client) RenterFuseMount added in v1.5.0

func (c *Client) RenterFuseMount(mount string, siaPath modules.SiaPath, opts modules.MountOptions) (err error)

RenterFuseMount uses the /renter/fuse/mount endpoint to mount a fuse filesystem serving the provided siapath.

func (*Client) RenterFuseUnmount added in v1.5.0

func (c *Client) RenterFuseUnmount(mount string) (err error)

RenterFuseUnmount uses the /renter/fuse/unmount endpoint to unmount the currently-mounted fuse filesystem.

func (*Client) RenterGet added in v1.3.3

func (c *Client) RenterGet() (rg api.RenterGET, err error)

RenterGet requests the /renter resource.

func (*Client) RenterIPRestrictionGet added in v1.5.0

func (c *Client) RenterIPRestrictionGet() (numhosts int, err error)

RenterIPRestrictionGet uses the /renter endpoint to read the IP restriction setting.

func (*Client) RenterIPRestrictionPost added in v1.5.0

func (c *Client) RenterIPRestrictionPost(numhosts int) (err error)

RenterIPRestrictionPost uses the /renter endpoint to enable/disable the IP violation check in the renter and set the number of allowed hosts from the same subnet.

func (*Client) RenterInactiveContractsGet added in v1.3.4

func (c *Client) RenterInactiveContractsGet() (rc api.RenterContracts, err error)

RenterInactiveContractsGet requests the /renter/contracts resource with the inactive flag set to true

func (*Client) RenterInitContractRecoveryScanPost added in v1.4.0

func (c *Client) RenterInitContractRecoveryScanPost() (err error)

RenterInitContractRecoveryScanPost initializes a contract recovery scan using the /renter/recoveryscan endpoint.

func (*Client) RenterPost

func (c *Client) RenterPost(values url.Values) (err error)

RenterPost uses the /renter POST endpoint to set fields of the renter. Values are encoded as a query string in the body

func (*Client) RenterPostAllowance added in v1.3.3

func (c *Client) RenterPostAllowance(allowance modules.Allowance) error

RenterPostAllowance uses the /renter endpoint to change the renter's allowance

func (*Client) RenterPostPartialAllowance added in v1.4.0

func (c *Client) RenterPostPartialAllowance() *AllowanceRequestPost

RenterPostPartialAllowance starts an allowance request which can be extended using its methods.

func (*Client) RenterPricesGet added in v1.3.3

func (c *Client) RenterPricesGet(allowance modules.Allowance) (rpg api.RenterPricesGET, err error)

RenterPricesGet requests the /renter/prices endpoint's resources.

func (*Client) RenterRateLimitPost added in v1.5.0

func (c *Client) RenterRateLimitPost(readBPS, writeBPS int64) (err error)

RenterRateLimitPost uses the /renter endpoint to change the renter's bandwidth rate limit.

func (*Client) RenterRecoverBackupPost added in v1.4.0

func (c *Client) RenterRecoverBackupPost(name string) (err error)

RenterRecoverBackupPost downloads and restores the specified backup.

func (*Client) RenterRecoverLocalBackupPost deprecated added in v1.5.0

func (c *Client) RenterRecoverLocalBackupPost(src string) (err error)

RenterRecoverLocalBackupPost restores the specified backup.

Deprecated: Use RenterCreateBackupPost instead.

func (*Client) RenterRecoverableContractsGet added in v1.4.0

func (c *Client) RenterRecoverableContractsGet() (rc api.RenterContracts, err error)

RenterRecoverableContractsGet requests the /renter/contracts resource with the recoverable flag set to true

func (*Client) RenterRenamePost added in v1.3.3

func (c *Client) RenterRenamePost(siaPathOld, siaPathNew modules.SiaPath, root bool) (err error)

RenterRenamePost uses the /renter/rename/:siapath endpoint to rename a file.

func (*Client) RenterSetFileStuckPost added in v1.5.0

func (c *Client) RenterSetFileStuckPost(siaPath modules.SiaPath, stuck bool) (err error)

RenterSetFileStuckPost sets the 'stuck' field of the siafile at siaPath to stuck.

func (*Client) RenterSetRepairPathPost added in v1.3.5

func (c *Client) RenterSetRepairPathPost(siaPath modules.SiaPath, newPath string) (err error)

RenterSetRepairPathPost uses the /renter/tracking endpoint to set the repair path of a file to a new location. The file at newPath must exists.

func (*Client) RenterSetStreamCacheSizePost added in v1.3.3

func (c *Client) RenterSetStreamCacheSizePost(cacheSize uint64) (err error)

RenterSetStreamCacheSizePost uses the /renter endpoint to change the renter's streamCacheSize for streaming

func (*Client) RenterStreamGet added in v1.3.3

func (c *Client) RenterStreamGet(siaPath modules.SiaPath, disableLocalFetch bool) (resp []byte, err error)

RenterStreamGet uses the /renter/stream endpoint to download data as a stream.

func (*Client) RenterStreamPartialGet added in v1.3.3

func (c *Client) RenterStreamPartialGet(siaPath modules.SiaPath, start, end uint64, disableLocalFetch bool) (resp []byte, err error)

RenterStreamPartialGet uses the /renter/stream endpoint to download a part of data as a stream.

func (*Client) RenterUploadDefaultPost added in v1.3.3

func (c *Client) RenterUploadDefaultPost(path string, siaPath modules.SiaPath) (err error)

RenterUploadDefaultPost uses the /renter/upload endpoint with default redundancy settings to upload a file.

func (*Client) RenterUploadForcePost added in v1.4.0

func (c *Client) RenterUploadForcePost(path string, siaPath modules.SiaPath, dataPieces, parityPieces uint64, force bool) (err error)

RenterUploadForcePost uses the /renter/upload endpoint to upload a file and to overwrite if the file already exists

func (*Client) RenterUploadPost

func (c *Client) RenterUploadPost(path string, siaPath modules.SiaPath, dataPieces, parityPieces uint64) (err error)

RenterUploadPost uses the /renter/upload endpoint to upload a file

func (*Client) RenterUploadReadyDefaultGet added in v1.5.0

func (c *Client) RenterUploadReadyDefaultGet() (rur api.RenterUploadReadyGet, err error)

RenterUploadReadyDefaultGet uses the /renter/uploadready endpoint to determine if the renter is ready for upload.

func (*Client) RenterUploadReadyGet added in v1.5.0

func (c *Client) RenterUploadReadyGet(dataPieces, parityPieces uint64) (rur api.RenterUploadReadyGet, err error)

RenterUploadReadyGet uses the /renter/uploadready endpoint to determine if the renter is ready for upload.

func (*Client) RenterUploadStreamPost added in v1.5.0

func (c *Client) RenterUploadStreamPost(r io.Reader, siaPath modules.SiaPath, dataPieces, parityPieces uint64, force bool) error

RenterUploadStreamPost uploads data using a stream.

func (*Client) RenterUploadStreamRepairPost added in v1.5.0

func (c *Client) RenterUploadStreamRepairPost(r io.Reader, siaPath modules.SiaPath) error

RenterUploadStreamRepairPost a siafile using a stream. If the data provided by r is not the same as the previously uploaded data, the data will be corrupted.

func (*Client) RenterUploadsPausePost added in v1.5.0

func (c *Client) RenterUploadsPausePost(duration time.Duration) (err error)

RenterUploadsPausePost uses the /renter/uploads/pause endpoint to pause the renter's uploads and repairs

func (*Client) RenterUploadsResumePost added in v1.5.0

func (c *Client) RenterUploadsResumePost() (err error)

RenterUploadsResumePost uses the /renter/uploads/resume endpoint to resume the renter's uploads and repairs

func (*Client) RenterValidateSiaPathPost added in v1.5.0

func (c *Client) RenterValidateSiaPathPost(siaPathStr string) (err error)

RenterValidateSiaPathPost uses the /renter/validatesiapath endpoint to validate a potential siapath

NOTE: This function specifically takes a string as an argument not a type SiaPath

func (*Client) RenterWorkersGet added in v1.5.0

func (c *Client) RenterWorkersGet() (wps modules.WorkerPoolStatus, err error)

RenterWorkersGet uses the /renter/workers endpoint to get the current status of the renter's workers.

func (*Client) StratumMinerGet added in v1.3.8

func (c *Client) StratumMinerGet() (mg api.StratumMinerGET, err error)

StratumMinerGet requests the /stratumminer endpoint's resources.

func (*Client) StratumMinerStartPost added in v1.3.8

func (c *Client) StratumMinerStartPost(server, username string) (err error)

StratumMinerStartPost uses the /stratumminer/start endpoint to start the stratum miner.

func (*Client) StratumMinerStopPost added in v1.3.8

func (c *Client) StratumMinerStopPost() (err error)

StratumMinerStopPost uses the /stratumminer/stop endpoint to stop the stratum miner.

func (*Client) TransactionPoolFeeGet added in v1.3.3

func (c *Client) TransactionPoolFeeGet() (tfg api.TpoolFeeGET, err error)

TransactionPoolFeeGet uses the /tpool/fee endpoint to get a fee estimation.

func (*Client) TransactionPoolRawPost added in v1.3.3

func (c *Client) TransactionPoolRawPost(txn types.Transaction, parents []types.Transaction) (err error)

TransactionPoolRawPost uses the /tpool/raw endpoint to send a raw transaction to the transaction pool.

func (*Client) TransactionPoolTransactionConfirmed added in v1.5.2

func (c *Client) TransactionPoolTransactionConfirmed(id types.TransactionID) (tptg api.TpoolConfirmedGET, err error)

TransactionPoolTransactionConfirmed uses the /tpool/confirmed/:id endpoint for checking if transaction has already verified on the blockchain

func (*Client) TransactionPoolTransactionsGet added in v1.5.0

func (c *Client) TransactionPoolTransactionsGet() (tptg api.TpoolTxnsGET, err error)

TransactionPoolTransactionsGet uses the /tpool/transactions endpoint to get the transactions of the tpool

func (*Client) Wallet033xPost added in v1.3.3

func (c *Client) Wallet033xPost(path, password string) (err error)

Wallet033xPost uses the /wallet/033x endpoint to load a v0.3.3.x wallet into the current wallet.

func (*Client) WalletAddressGet

func (c *Client) WalletAddressGet() (wag api.WalletAddressGET, err error)

WalletAddressGet requests a new address from the /wallet/address endpoint

func (*Client) WalletAddressesGet added in v1.3.3

func (c *Client) WalletAddressesGet() (wag api.WalletAddressesGET, err error)

WalletAddressesGet requests the wallets known addresses from the /wallet/addresses endpoint.

func (*Client) WalletChangePasswordPost added in v1.3.3

func (c *Client) WalletChangePasswordPost(currentPassword, newPassword string) (err error)

WalletChangePasswordPost uses the /wallet/changepassword endpoint to change the wallet's password.

func (*Client) WalletChangePasswordWithSeedPost added in v1.5.0

func (c *Client) WalletChangePasswordWithSeedPost(seed modules.Seed, newPassword string) (err error)

WalletChangePasswordWithSeedPost uses the /wallet/changepassword endpoint to change the password used to encrypt the wallet.

func (*Client) WalletGet

func (c *Client) WalletGet() (wg api.WalletGET, err error)

WalletGet requests the /wallet api resource

func (*Client) WalletInitPost

func (c *Client) WalletInitPost(password string, force bool) (wip api.WalletInitPOST, err error)

WalletInitPost uses the /wallet/init endpoint to initialize and encrypt a wallet

func (*Client) WalletInitSeedPost added in v1.3.3

func (c *Client) WalletInitSeedPost(seed, password string, force bool) (err error)

WalletInitSeedPost uses the /wallet/init/seed endpoint to initialize and encrypt a wallet using a given seed.

func (*Client) WalletLastAddressesGet added in v1.4.0

func (c *Client) WalletLastAddressesGet(count uint64) (wag api.WalletAddressesGET, err error)

WalletLastAddressesGet returns the count last addresses generated by the wallet in reverse order. That means the last generated address will be the first one in the slice.

func (*Client) WalletLockPost added in v1.3.3

func (c *Client) WalletLockPost() (err error)

WalletLockPost uses the /wallet/lock endpoint to lock the wallet.

func (*Client) WalletScPrimeMultiPost added in v1.6.3

func (c *Client) WalletScPrimeMultiPost(coinOutputs []types.SiacoinOutput, fundOutputs []types.SiafundOutput) (wsp api.WalletBatchTransactionPOST, err error)

WalletScPrimeMultiPost uses the /wallet/siacoin api endpoint to send money to multiple addresses at once

func (*Client) WalletScpTransportAllowanceGet added in v1.9.2

func (c *Client) WalletScpTransportAllowanceGet() (wsa api.WalletScpTransportAllowanceGET, err error)

WalletScpTransportAllowanceGet uses the /wallet/scptransport/allowance endpoint to get current SCP transport allowance.

func (*Client) WalletScpTransportHistoryGet added in v1.9.2

func (c *Client) WalletScpTransportHistoryGet() (wsh api.WalletScpTransportHistoryGET, err error)

WalletScpTransportHistoryGet uses the /wallet/scptransport/history endpoint to get a list of SCP transports done by the wallet.

func (*Client) WalletScpTransportSendPost added in v1.9.2

func (c *Client) WalletScpTransportSendPost(wstParams api.WalletScpTransportSendPOSTParams) (wst api.WalletScpTransportSendPOSTResp, err error)

WalletScpTransportSendPost uses the /wallet/scptransport/send endpoint to initiate SCP transport.

func (*Client) WalletSeedPost added in v1.3.3

func (c *Client) WalletSeedPost(seed, password string) (err error)

WalletSeedPost uses the /wallet/seed endpoint to add a seed to the wallet's list of seeds.

func (*Client) WalletSeedsGet added in v1.3.3

func (c *Client) WalletSeedsGet() (wsg api.WalletSeedsGET, err error)

WalletSeedsGet uses the /wallet/seeds endpoint to return the wallet's current seeds.

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, feeIncluded bool) (wsp api.WalletSiacoinsPOST, err error)

WalletSiacoinsPost uses the /wallet/siacoins api endpoint to send money to a single address

func (*Client) WalletSiafundbsPost added in v1.7.0

func (c *Client) WalletSiafundbsPost(amount types.Currency, destination types.UnlockHash) (wsp api.WalletSiafundsPOST, err error)

WalletSiafundbsPost uses the /wallet/siafundbs api endpoint to send siafundbs to a single address.

func (*Client) WalletSiafundsPost added in v1.3.3

func (c *Client) WalletSiafundsPost(amount types.Currency, destination types.UnlockHash) (wsp api.WalletSiafundsPOST, err error)

WalletSiafundsPost uses the /wallet/siafunds api endpoint to send siafunds to a single address.

func (*Client) WalletSiagKeyPost added in v1.3.3

func (c *Client) WalletSiagKeyPost(keyfiles, password string) (err error)

WalletSiagKeyPost uses the /wallet/siagkey endpoint to load a siag key into the wallet.

func (*Client) WalletSignPost added in v1.3.5

func (c *Client) WalletSignPost(txn types.Transaction, toSign []crypto.Hash) (wspr api.WalletSignPOSTResp, err error)

WalletSignPost uses the /wallet/sign api endpoint to sign a transaction.

func (*Client) WalletSpfTransportAllowanceGet added in v1.8.5

func (c *Client) WalletSpfTransportAllowanceGet(spfType types.SpfType) (wsa api.WalletSpfTransportAllowanceGET, err error)

WalletSpfTransportAllowanceGet uses the /wallet/spftransport/allowance endpoint to get current SPF transport allowance.

func (*Client) WalletSpfTransportHistoryGet added in v1.8.5

func (c *Client) WalletSpfTransportHistoryGet() (wsh api.WalletSpfTransportHistoryGET, err error)

WalletSpfTransportHistoryGet uses the /wallet/spftransport/history endpoint to get a list of SPF transports done by the wallet.

func (*Client) WalletSpfTransportSendPost added in v1.8.5

func (c *Client) WalletSpfTransportSendPost(wstParams api.WalletSpfTransportSendPOSTParams) (wst api.WalletSpfTransportSendPOSTResp, err error)

WalletSpfTransportSendPost uses the /wallet/spftransport/send endpoint to initiate SPF transport.

func (*Client) WalletSweepPost added in v1.3.3

func (c *Client) WalletSweepPost(seed string) (wsp api.WalletSweepPOST, err error)

WalletSweepPost uses the /wallet/sweep/seed endpoint to sweep a seed into the current wallet.

func (*Client) WalletTransactionGet added in v1.3.3

func (c *Client) WalletTransactionGet(id types.TransactionID) (wtg api.WalletTransactionGETid, err error)

WalletTransactionGet requests the /wallet/transaction/:id api resource for a certain TransactionID.

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) WalletUnlockConditionsGet added in v1.3.5

func (c *Client) WalletUnlockConditionsGet(addr types.UnlockHash) (wucg api.WalletUnlockConditionsGET, err error)

WalletUnlockConditionsGet requests the /wallet/unlockconditions endpoint and returns the UnlockConditions of addr.

func (*Client) WalletUnlockPost

func (c *Client) WalletUnlockPost(password string) (err error)

WalletUnlockPost uses the /wallet/unlock endpoint to unlock the wallet with a given encryption key. Per default this key is the seed.

func (*Client) WalletUnspentGet added in v1.3.5

func (c *Client) WalletUnspentGet() (wug api.WalletUnspentGET, err error)

WalletUnspentGet requests the /wallet/unspent endpoint and returns all of the unspent outputs related to the wallet.

func (*Client) WalletVerifyPasswordGet added in v1.5.0

func (c *Client) WalletVerifyPasswordGet(password string) (wvpg api.WalletVerifyPasswordGET, err error)

WalletVerifyPasswordGet uses the /wallet/verifypassword endpoint to check the wallet's password.

func (*Client) WalletVerifyPasswordSeedGet added in v1.5.0

func (c *Client) WalletVerifyPasswordSeedGet(seed modules.Seed) (wvpg api.WalletVerifyPasswordGET, err error)

WalletVerifyPasswordSeedGet takes a seed and generates a seed string to submit to the /wallet/verifypassword endpoint

func (*Client) WalletWatchAddPost added in v1.3.5

func (c *Client) WalletWatchAddPost(addrs []types.UnlockHash, unused bool) error

WalletWatchAddPost uses the /wallet/watch endpoint to add a set of addresses to the watch set. The unused flag should be set to true if the addresses have never appeared in the blockchain.

func (*Client) WalletWatchGet added in v1.3.5

func (c *Client) WalletWatchGet() (wwg api.WalletWatchGET, err error)

WalletWatchGet requests the /wallet/watch endpoint and returns the set of currently watched addresses.

func (*Client) WalletWatchRemovePost added in v1.3.5

func (c *Client) WalletWatchRemovePost(addrs []types.UnlockHash, unused bool) error

WalletWatchRemovePost uses the /wallet/watch endpoint to remove a set of addresses from the watch set. The unused flag should be set to true if the addresses have never appeared in the blockchain.

type HostParam added in v1.3.3

type HostParam string

HostParam is a parameter in the host's settings that can be changed via the API. It is primarily used as a helper struct to ensure type safety.

type Options added in v1.5.0

type Options struct {
	// Address is the API address of the spd server.
	Address string

	// Password must match the password of the spd server.
	Password string

	// UserAgent must match the User-Agent required by the spd server. If not
	// set, it defaults to "ScPrime-Agent".
	UserAgent string
}

Options defines the options that are available when creating a client.

func DefaultOptions added in v1.5.0

func DefaultOptions() (Options, error)

DefaultOptions returns the default options for a client. This includes setting the default spd user agent to "ScPrime-Agent" and setting the password using the build.APIPassword() function.

type UnsafeClient added in v1.5.0

type UnsafeClient struct {
	Client
}

A UnsafeClient is a Client with additional access to unsafe methods that are easy to misuse. It should only be used for testing.

func NewUnsafeClient added in v1.5.0

func NewUnsafeClient(client Client) *UnsafeClient

NewUnsafeClient creates a new UnsafeClient using the provided address.

func (*UnsafeClient) Get added in v1.5.0

func (uc *UnsafeClient) Get(resource string, obj interface{}) error

Get requests the specified resource. The response, if provided, will be decoded into obj. The resource path must begin with /.

func (*UnsafeClient) Post added in v1.5.0

func (uc *UnsafeClient) Post(resource string, data string, obj interface{}) error

Post makes a POST request to the resource at `resource`, using `data` as the request body. The response, if provided, will be decoded into `obj`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL