Documentation ¶
Index ¶
- Constants
- Variables
- func HttpGET(url string) (resp *http.Response, err error)
- func HttpGETAuthenticated(url string, password string) (resp *http.Response, err error)
- func HttpPOST(url string, data string) (resp *http.Response, err error)
- func HttpPOSTAuthenticated(url string, data string, password string) (resp *http.Response, err error)
- func NewLimitStreamer(s modules.Streamer, offset, size uint64) (modules.Streamer, error)
- func ParseDataAndParityPieces(strDataPieces, strParityPieces string) (dataPieces, parityPieces int, err error)
- func RequirePassword(h httprouter.Handle, password string) httprouter.Handle
- func RequireUserAgent(h http.Handler, ua string) http.Handler
- func UnrecognizedCallHandler(w http.ResponseWriter, req *http.Request)
- func WriteError(w http.ResponseWriter, err Error, code int)
- func WriteJSON(w http.ResponseWriter, obj interface{})
- func WriteSuccess(w http.ResponseWriter)
- type API
- type ConsensusBlocksGet
- type ConsensusBlocksGetFileContract
- type ConsensusBlocksGetSiacoinOutput
- type ConsensusBlocksGetSiafundOutput
- type ConsensusBlocksGetTxn
- type ConsensusGET
- type ConsensusHeadersGET
- type ContractInfoGET
- type DaemonAlertsGet
- type DaemonSettingsGet
- type DaemonUpdateGet
- type DaemonVersion
- type DaemonVersionGet
- type DownloadInfo
- type Error
- type ExplorerBlock
- type ExplorerBlockGET
- type ExplorerGET
- type ExplorerHashGET
- type ExplorerTransaction
- type ExtendedHostDBEntry
- type FeeManagerAddFeePOST
- type FeeManagerGET
- type FeeManagerPaidFeesGET
- type FeeManagerPendingFeesGET
- type GatewayBandwidthGET
- type GatewayBlacklistGET
- type GatewayBlacklistPOST
- type GatewayGET
- type HalfLifeDistribution
- type HostEstimateScoreGET
- type HostGET
- type HostdbActiveGET
- type HostdbAllGET
- type HostdbFilterModeGET
- type HostdbFilterModePOST
- type HostdbGet
- type HostdbHostsGET
- type MinerGET
- type RenterBackupsGET
- type RenterContract
- type RenterContracts
- type RenterDirectory
- type RenterDownloadQueue
- type RenterFile
- type RenterFiles
- type RenterFuseInfo
- type RenterGET
- type RenterLoad
- type RenterPricesGET
- type RenterRecoveryStatusGET
- type RenterShareASCII
- type RenterUploadReadyGet
- type RenterUploadedBackup
- type RequestTimeDistribution
- type SiaConstants
- type SkykeyGET
- type SkykeysGET
- type SkynetBlacklistGET
- type SkynetBlacklistPOST
- type SkynetPerformanceStats
- type SkynetPortalsGET
- type SkynetPortalsPOST
- type SkynetSkyfileHandlerPOST
- type SkynetStats
- type SkynetStatsGET
- type SkynetVersion
- type StorageGET
- type TpoolConfirmedGET
- type TpoolFeeGET
- type TpoolRawGET
- type TpoolTxnsGET
- type UpdateInfo
- type WalletAddressGET
- type WalletAddressesGET
- type WalletGET
- type WalletInitPOST
- type WalletSeedsGET
- type WalletSiacoinsPOST
- type WalletSiafundsPOST
- type WalletSignPOSTParams
- type WalletSignPOSTResp
- type WalletSweepPOST
- type WalletTransactionGETid
- type WalletTransactionsGET
- type WalletTransactionsGETaddr
- type WalletUnlockConditionsGET
- type WalletUnlockConditionsPOSTParams
- type WalletUnspentGET
- type WalletVerifyAddressGET
- type WalletVerifyPasswordGET
- type WalletWatchGET
- type WalletWatchPOST
Constants ¶
const ( // DefaultSkynetDefaultPath is the defaultPath value we use when the user // hasn't specified one and `index.html` exists in the skyfile. DefaultSkynetDefaultPath = "index.html" // DefaultSkynetRequestTimeout is the default request timeout for routes // that have a timeout query string parameter. If the request can not be // resolved within the given amount of time, it times out. This is used for // Skynet routes where a request times out if the DownloadByRoot project // does not finish in due time. DefaultSkynetRequestTimeout = 30 * time.Second // MaxSkynetRequestTimeout is the maximum a user is allowed to set as // request timeout. This to prevent an attack vector where the attacker // could cause a go-routine leak by creating a bunch of requests with very // high timeouts. MaxSkynetRequestTimeout = 15 * 60 // in seconds )
const StatusModuleNotLoaded = 490
StatusModuleNotLoaded is a custom http code to indicate that a module wasn't loaded by the Daemon and can therefore not be reached. It is used instead of the previous status code 404 to make a clear distinction between a module not being loaded and a resource which would usually be provided a module not being found.
Variables ¶
var ( // ErrInvalidRPCDownloadRatio is returned if the user tries to set a value // for the download price or the base RPC Price that violates the maximum // ratio ErrInvalidRPCDownloadRatio = errors.New("invalid ratio between the download price and the base RPC price, base cost of 100M request should be cheaper than downloading 4TB") // ErrInvalidSectorAccessDownloadRatio is returned if the user tries to set // a value for the download price or the Sector Access Price that violates // the maximum ratio ErrInvalidSectorAccessDownloadRatio = errors.New("invalid ratio between the download price and the sector access price, base cost of 10M accesses should be cheaper than downloading 4TB") )
var ( // ErrFundsNeedToBeSet is the error returned when the funds are not set for // the allowance ErrFundsNeedToBeSet = errors.New("funds needs to be set if it hasn't been set before") // ErrPeriodNeedToBeSet is the error returned when the period is not set for // the allowance ErrPeriodNeedToBeSet = errors.New("period needs to be set if it hasn't been set before") )
var ErrAPICallNotRecognized = errors.New("API call not recognized")
ErrAPICallNotRecognized is returned by API client calls made to modules that are not yet loaded.
var ( // ErrInvalidDefaultPath is returned when the specified default path is not // valid, e.g. the file it points to does not exist. ErrInvalidDefaultPath = errors.New("invalid default path provided") )
Functions ¶
func HttpGET ¶
HttpGET is a utility function for making http get requests to sia with a whitelisted user-agent. A non-2xx response does not return an error.
func HttpGETAuthenticated ¶
HttpGETAuthenticated is a utility function for making authenticated http get requests to sia with a whitelisted user-agent and the supplied password. A non-2xx response does not return an error.
func HttpPOST ¶
HttpPOST is a utility function for making post requests to sia with a whitelisted user-agent. A non-2xx response does not return an error.
func HttpPOSTAuthenticated ¶
func HttpPOSTAuthenticated(url string, data string, password string) (resp *http.Response, err error)
HttpPOSTAuthenticated is a utility function for making authenticated http post requests to sia with a whitelisted user-agent and the supplied password. A non-2xx response does not return an error.
func NewLimitStreamer ¶ added in v1.4.4
NewLimitStreamer wraps the given modules.Streamer and ensures it can only be read from within the given offset and size boundary. It does this by wrapping both the Read and Seek calls and adjusting the offset and size of the returned byte slice appropriately.
func ParseDataAndParityPieces ¶ added in v1.4.3
func ParseDataAndParityPieces(strDataPieces, strParityPieces string) (dataPieces, parityPieces int, err error)
ParseDataAndParityPieces parse the numeric values for dataPieces and parityPieces from the input strings
func RequirePassword ¶
func RequirePassword(h httprouter.Handle, password string) httprouter.Handle
RequirePassword is middleware that requires a request to authenticate with a password using HTTP basic auth. Usernames are ignored. Empty passwords indicate no authentication is required.
func RequireUserAgent ¶
RequireUserAgent is middleware that requires all requests to set a UserAgent that contains the specified string.
func UnrecognizedCallHandler ¶
func UnrecognizedCallHandler(w http.ResponseWriter, req *http.Request)
UnrecognizedCallHandler handles calls to unknown pages (404).
func WriteError ¶
func WriteError(w http.ResponseWriter, err Error, code int)
WriteError an error to the API caller.
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, obj interface{})
WriteJSON writes the object to the ResponseWriter. If the encoding fails, an error is written instead. The Content-Type of the response header is set accordingly.
func WriteSuccess ¶
func WriteSuccess(w http.ResponseWriter)
WriteSuccess writes the HTTP header with status 204 No Content to the ResponseWriter. WriteSuccess should only be used to indicate that the requested action succeeded AND there is no data to return.
Types ¶
type API ¶
type API struct { Shutdown func() error // contains filtered or unexported fields }
API encapsulates a collection of modules and implements a http.Handler to access their methods.
func New ¶
func New(cfg *modules.SiadConfig, requiredUserAgent string, requiredPassword string, cs modules.ConsensusSet, e modules.Explorer, fm modules.FeeManager, g modules.Gateway, h modules.Host, m modules.Miner, r modules.Renter, tp modules.TransactionPool, w modules.Wallet) *API
New creates a new Sia API from the provided modules. The API will require authentication using HTTP basic auth for certain endpoints of the supplied password is not the empty string. Usernames are ignored for authentication.
func (*API) ServeHTTP ¶
func (api *API) ServeHTTP(w http.ResponseWriter, r *http.Request)
api.ServeHTTP implements the http.Handler interface.
func (*API) SetModules ¶ added in v1.4.1
func (api *API) SetModules(cs modules.ConsensusSet, e modules.Explorer, fm modules.FeeManager, g modules.Gateway, h modules.Host, m modules.Miner, r modules.Renter, tp modules.TransactionPool, w modules.Wallet)
SetModules allows for replacing the modules in the API at runtime.
type ConsensusBlocksGet ¶ added in v1.3.3
type ConsensusBlocksGet struct { ID types.BlockID `json:"id"` Height types.BlockHeight `json:"height"` ParentID types.BlockID `json:"parentid"` Nonce types.BlockNonce `json:"nonce"` Difficulty types.Currency `json:"difficulty"` Timestamp types.Timestamp `json:"timestamp"` MinerPayouts []types.SiacoinOutput `json:"minerpayouts"` Transactions []ConsensusBlocksGetTxn `json:"transactions"` }
ConsensusBlocksGet contains all fields of a types.Block and additional fields for ID and Height.
type ConsensusBlocksGetFileContract ¶ added in v1.3.3
type ConsensusBlocksGetFileContract struct { ID types.FileContractID `json:"id"` FileSize uint64 `json:"filesize"` FileMerkleRoot crypto.Hash `json:"filemerkleroot"` WindowStart types.BlockHeight `json:"windowstart"` WindowEnd types.BlockHeight `json:"windowend"` Payout types.Currency `json:"payout"` ValidProofOutputs []ConsensusBlocksGetSiacoinOutput `json:"validproofoutputs"` MissedProofOutputs []ConsensusBlocksGetSiacoinOutput `json:"missedproofoutputs"` UnlockHash types.UnlockHash `json:"unlockhash"` RevisionNumber uint64 `json:"revisionnumber"` }
ConsensusBlocksGetFileContract contains all fields of a types.FileContract and an additional ID field.
type ConsensusBlocksGetSiacoinOutput ¶ added in v1.3.3
type ConsensusBlocksGetSiacoinOutput struct { ID types.SiacoinOutputID `json:"id"` Value types.Currency `json:"value"` UnlockHash types.UnlockHash `json:"unlockhash"` }
ConsensusBlocksGetSiacoinOutput contains all fields of a types.SiacoinOutput and an additional ID field.
type ConsensusBlocksGetSiafundOutput ¶ added in v1.3.3
type ConsensusBlocksGetSiafundOutput struct { ID types.SiafundOutputID `json:"id"` Value types.Currency `json:"value"` UnlockHash types.UnlockHash `json:"unlockhash"` }
ConsensusBlocksGetSiafundOutput contains all fields of a types.SiafundOutput and an additional ID field.
type ConsensusBlocksGetTxn ¶ added in v1.3.3
type ConsensusBlocksGetTxn struct { ID types.TransactionID `json:"id"` SiacoinInputs []types.SiacoinInput `json:"siacoininputs"` SiacoinOutputs []ConsensusBlocksGetSiacoinOutput `json:"siacoinoutputs"` FileContracts []ConsensusBlocksGetFileContract `json:"filecontracts"` FileContractRevisions []types.FileContractRevision `json:"filecontractrevisions"` StorageProofs []types.StorageProof `json:"storageproofs"` SiafundInputs []types.SiafundInput `json:"siafundinputs"` SiafundOutputs []ConsensusBlocksGetSiafundOutput `json:"siafundoutputs"` MinerFees []types.Currency `json:"minerfees"` ArbitraryData [][]byte `json:"arbitrarydata"` TransactionSignatures []types.TransactionSignature `json:"transactionsignatures"` }
ConsensusBlocksGetTxn contains all fields of a types.Transaction and an additional ID field.
type ConsensusGET ¶
type ConsensusGET struct { // Consensus status values. Synced bool `json:"synced"` Height types.BlockHeight `json:"height"` CurrentBlock types.BlockID `json:"currentblock"` Target types.Target `json:"target"` Difficulty types.Currency `json:"difficulty"` // Consensus code constants. BlockFrequency types.BlockHeight `json:"blockfrequency"` BlockSizeLimit uint64 `json:"blocksizelimit"` ExtremeFutureThreshold types.Timestamp `json:"extremefuturethreshold"` FutureThreshold types.Timestamp `json:"futurethreshold"` GenesisTimestamp types.Timestamp `json:"genesistimestamp"` MaturityDelay types.BlockHeight `json:"maturitydelay"` MedianTimestampWindow uint64 `json:"mediantimestampwindow"` SiafundCount types.Currency `json:"siafundcount"` SiafundPortion *big.Rat `json:"siafundportion"` InitialCoinbase uint64 `json:"initialcoinbase"` MinimumCoinbase uint64 `json:"minimumcoinbase"` RootTarget types.Target `json:"roottarget"` RootDepth types.Target `json:"rootdepth"` SiacoinPrecision types.Currency `json:"siacoinprecision"` }
ConsensusGET contains general information about the consensus set, with tags to support idiomatic json encodings.
type ConsensusHeadersGET ¶ added in v1.3.3
ConsensusHeadersGET contains information from a blocks header.
type ContractInfoGET ¶ added in v1.3.3
type ContractInfoGET struct {
Contracts []modules.StorageObligation `json:"contracts"`
}
ContractInfoGET contains the information that is returned after a GET request to /host/contracts - information for the host about stored obligations.
type DaemonAlertsGet ¶ added in v1.4.2
type DaemonAlertsGet struct { Alerts []modules.Alert `json:"alerts"` CriticalAlerts []modules.Alert `json:"criticalalerts"` ErrorAlerts []modules.Alert `json:"erroralerts"` WarningAlerts []modules.Alert `json:"warningalerts"` }
DaemonAlertsGet contains information about currently registered alerts across all loaded modules.
type DaemonSettingsGet ¶ added in v1.4.1
type DaemonSettingsGet struct { MaxDownloadSpeed int64 `json:"maxdownloadspeed"` MaxUploadSpeed int64 `json:"maxuploadspeed"` Modules configModules `json:"modules"` }
DaemonSettingsGet contains information about global daemon settings.
type DaemonUpdateGet ¶ added in v1.3.3
DaemonUpdateGet contains information about a potential available update for the daemon.
type DaemonVersion ¶ added in v1.4.1
type DaemonVersion struct { Version string `json:"version"` GitRevision string `json:"gitrevision"` BuildTime string `json:"buildtime"` }
DaemonVersion holds the version information for siad
type DaemonVersionGet ¶
DaemonVersionGet contains information about the running daemon's version.
type DownloadInfo ¶
type DownloadInfo struct { Destination string `json:"destination"` // The destination of the download. DestinationType string `json:"destinationtype"` // Can be "file", "memory buffer", or "http stream". Filesize uint64 `json:"filesize"` // DEPRECATED. Same as 'Length'. Length uint64 `json:"length"` // The length requested for the download. Offset uint64 `json:"offset"` // The offset within the siafile requested for the download. SiaPath modules.SiaPath `json:"siapath"` // The siapath of the file used for the download. Completed bool `json:"completed"` // Whether or not the download has completed. EndTime time.Time `json:"endtime"` // The time when the download fully completed. Error string `json:"error"` // Will be the empty string unless there was an error. Received uint64 `json:"received"` // Amount of data confirmed and decoded. StartTime time.Time `json:"starttime"` // The time when the download was started. StartTimeUnix int64 `json:"starttimeunix"` // The time when the download was started in unix format. TotalDataTransferred uint64 `json:"totaldatatransferred"` // The total amount of data transferred, including negotiation, overdrive etc. }
DownloadInfo contains all client-facing information of a file.
type Error ¶
type Error struct { // Message describes the error in English. Typically it is set to // `err.Error()`. This field is required. Message string `json:"message"` }
Error is a type that is encoded as JSON and returned in an API response in the event of an error. Only the Message field is required. More fields may be added to this struct in the future for better error reporting.
type ExplorerBlock ¶
type ExplorerBlock struct { MinerPayoutIDs []types.SiacoinOutputID `json:"minerpayoutids"` Transactions []ExplorerTransaction `json:"transactions"` RawBlock types.Block `json:"rawblock"` modules.BlockFacts }
ExplorerBlock is a block with some extra information such as the id and height. This information is provided for programs that may not be complex enough to compute the ID on their own.
type ExplorerBlockGET ¶
type ExplorerBlockGET struct {
Block ExplorerBlock `json:"block"`
}
ExplorerBlockGET is the object returned by a GET request to /explorer/block.
type ExplorerGET ¶
type ExplorerGET struct {
modules.BlockFacts
}
ExplorerGET is the object returned as a response to a GET request to /explorer.
type ExplorerHashGET ¶
type ExplorerHashGET struct { HashType string `json:"hashtype"` Block ExplorerBlock `json:"block"` Blocks []ExplorerBlock `json:"blocks"` Transaction ExplorerTransaction `json:"transaction"` Transactions []ExplorerTransaction `json:"transactions"` }
ExplorerHashGET is the object returned as a response to a GET request to /explorer/hash. The HashType will indicate whether the hash corresponds to a block id, a transaction id, a siacoin output id, a file contract id, or a siafund output id. In the case of a block id, 'Block' will be filled out and all the rest of the fields will be blank. In the case of a transaction id, 'Transaction' will be filled out and all the rest of the fields will be blank. For everything else, 'Transactions' and 'Blocks' will/may be filled out and everything else will be blank.
type ExplorerTransaction ¶
type ExplorerTransaction struct { ID types.TransactionID `json:"id"` Height types.BlockHeight `json:"height"` Parent types.BlockID `json:"parent"` RawTransaction types.Transaction `json:"rawtransaction"` SiacoinInputOutputs []types.SiacoinOutput `json:"siacoininputoutputs"` // the outputs being spent SiacoinOutputIDs []types.SiacoinOutputID `json:"siacoinoutputids"` FileContractIDs []types.FileContractID `json:"filecontractids"` FileContractValidProofOutputIDs [][]types.SiacoinOutputID `json:"filecontractvalidproofoutputids"` // outer array is per-contract FileContractMissedProofOutputIDs [][]types.SiacoinOutputID `json:"filecontractmissedproofoutputids"` // outer array is per-contract FileContractRevisionValidProofOutputIDs [][]types.SiacoinOutputID `json:"filecontractrevisionvalidproofoutputids"` // outer array is per-revision FileContractRevisionMissedProofOutputIDs [][]types.SiacoinOutputID `json:"filecontractrevisionmissedproofoutputids"` // outer array is per-revision StorageProofOutputIDs [][]types.SiacoinOutputID `json:"storageproofoutputids"` // outer array is per-payout StorageProofOutputs [][]types.SiacoinOutput `json:"storageproofoutputs"` // outer array is per-payout SiafundInputOutputs []types.SiafundOutput `json:"siafundinputoutputs"` // the outputs being spent SiafundOutputIDs []types.SiafundOutputID `json:"siafundoutputids"` SiafundClaimOutputIDs []types.SiacoinOutputID `json:"siafundclaimoutputids"` }
ExplorerTransaction is a transcation with some extra information such as the parent block. This information is provided for programs that may not be complex enough to compute the extra information on their own.
type ExtendedHostDBEntry ¶
type ExtendedHostDBEntry struct { modules.HostDBEntry PublicKeyString string `json:"publickeystring"` }
ExtendedHostDBEntry is an extension to modules.HostDBEntry that includes the string representation of the public key, otherwise presented as two fields, a string and a base64 encoded byte slice.
type FeeManagerAddFeePOST ¶ added in v1.4.8
type FeeManagerAddFeePOST struct { // FeeUID is the UID of the Fee that was just added to the FeeManager FeeUID modules.FeeUID `json:"feeuid"` }
FeeManagerAddFeePOST is the object returned as a response to a POST request to /feemanager/add
type FeeManagerGET ¶ added in v1.4.8
type FeeManagerGET struct {
PayoutHeight types.BlockHeight `json:"payoutheight"`
}
FeeManagerGET is the object returned as a response to a GET request to /feemanager
type FeeManagerPaidFeesGET ¶ added in v1.4.8
type FeeManagerPaidFeesGET struct { // This is a full historical list of Fees that have been Paid PaidFees []modules.AppFee `json:"paidfees"` }
FeeManagerPaidFeesGET is the object returned as a response to a GET request to /feemanager/paidfees
type FeeManagerPendingFeesGET ¶ added in v1.4.8
type FeeManagerPendingFeesGET struct { // This is the list of current pending Fees PendingFees []modules.AppFee `json:"pendingfees"` }
FeeManagerPendingFeesGET is the object returned as a response to a GET request to /feemanager/pendingfees
type GatewayBandwidthGET ¶ added in v1.4.2
type GatewayBandwidthGET struct { Download uint64 `json:"download"` Upload uint64 `json:"upload"` StartTime time.Time `json:"starttime"` }
GatewayBandwidthGET contains the bandwidth usage of the gateway
type GatewayBlacklistGET ¶ added in v1.4.2
type GatewayBlacklistGET struct {
Blacklist []string `json:"blacklist"`
}
GatewayBlacklistGET contains the Blacklist of the gateway
type GatewayBlacklistPOST ¶ added in v1.4.2
type GatewayBlacklistPOST struct { Action string `json:"action"` Addresses []string `json:"addresses"` }
GatewayBlacklistPOST contains the information needed to set the Blacklist of the gateway
type GatewayGET ¶
type GatewayGET struct { NetAddress modules.NetAddress `json:"netaddress"` Peers []modules.Peer `json:"peers"` Online bool `json:"online"` MaxDownloadSpeed int64 `json:"maxdownloadspeed"` MaxUploadSpeed int64 `json:"maxuploadspeed"` }
GatewayGET contains the fields returned by a GET call to "/gateway".
type HalfLifeDistribution ¶ added in v1.4.8
type HalfLifeDistribution struct { LastUpdate time.Time `json:"lastupdate"` OneMinute RequestTimeDistribution `json:"oneminute"` // Requests with a half life of one minute. FiveMinutes RequestTimeDistribution `json:"fiveminutes"` FifteenMinutes RequestTimeDistribution `json:"fifteenminutes"` TwentyFourHours RequestTimeDistribution `json:"twentyfourhours"` Lifetime RequestTimeDistribution `json:"lifetime"` // No decay applied. }
HalfLifeDistribution contains a set of RequestTimeDistributions with different half lives, allowing for a more complete picture of how responsive the requests are over time.
func NewHalfLifeDistribution ¶ added in v1.4.8
func NewHalfLifeDistribution() HalfLifeDistribution
NewHalfLifeDistribution initializes and returns a half life distribution ready to collect stats.
func (*HalfLifeDistribution) AddRequest ¶ added in v1.4.8
func (hld *HalfLifeDistribution) AddRequest(speed time.Duration)
AddRequest will add a request to the half life distribution. Each call to add a request will update the bucket.
func (*HalfLifeDistribution) Update ¶ added in v1.4.8
func (hld *HalfLifeDistribution) Update()
Update will update the 'LastUpdate' for each bucket, applying the appropriate exponential decay to each counter. This should be called before collecting stats.
type HostEstimateScoreGET ¶
type HostEstimateScoreGET struct { EstimatedScore types.Currency `json:"estimatedscore"` ConversionRate float64 `json:"conversionrate"` }
HostEstimateScoreGET contains the information that is returned from a /host/estimatescore call.
type HostGET ¶
type HostGET struct { ExternalSettings modules.HostExternalSettings `json:"externalsettings"` FinancialMetrics modules.HostFinancialMetrics `json:"financialmetrics"` InternalSettings modules.HostInternalSettings `json:"internalsettings"` NetworkMetrics modules.HostNetworkMetrics `json:"networkmetrics"` ConnectabilityStatus modules.HostConnectabilityStatus `json:"connectabilitystatus"` WorkingStatus modules.HostWorkingStatus `json:"workingstatus"` PublicKey types.SiaPublicKey `json:"publickey"` }
HostGET contains the information that is returned after a GET request to /host - a bunch of information about the status of the host.
type HostdbActiveGET ¶
type HostdbActiveGET struct {
Hosts []ExtendedHostDBEntry `json:"hosts"`
}
HostdbActiveGET lists active hosts on the network.
type HostdbAllGET ¶
type HostdbAllGET struct {
Hosts []ExtendedHostDBEntry `json:"hosts"`
}
HostdbAllGET lists all hosts that the renter is aware of.
type HostdbFilterModeGET ¶ added in v1.4.1
type HostdbFilterModeGET struct { FilterMode string `json:"filtermode"` Hosts []string `json:"hosts"` }
HostdbFilterModeGET contains the information about the HostDB's filtermode
type HostdbFilterModePOST ¶ added in v1.4.0
type HostdbFilterModePOST struct { FilterMode string `json:"filtermode"` Hosts []types.SiaPublicKey `json:"hosts"` }
HostdbFilterModePOST contains the information needed to set the the FilterMode of the hostDB
type HostdbGet ¶ added in v1.3.3
type HostdbGet struct {
InitialScanComplete bool `json:"initialscancomplete"`
}
HostdbGet holds information about the hostdb.
type HostdbHostsGET ¶
type HostdbHostsGET struct { Entry ExtendedHostDBEntry `json:"entry"` ScoreBreakdown modules.HostScoreBreakdown `json:"scorebreakdown"` }
HostdbHostsGET lists detailed statistics for a particular host, selected by pubkey.
type MinerGET ¶
type MinerGET struct { BlocksMined int `json:"blocksmined"` CPUHashrate int `json:"cpuhashrate"` CPUMining bool `json:"cpumining"` StaleBlocksMined int `json:"staleblocksmined"` }
MinerGET contains the information that is returned after a GET request to /miner.
type RenterBackupsGET ¶ added in v1.4.1
type RenterBackupsGET struct { Backups []RenterUploadedBackup `json:"backups"` SyncedHosts []types.SiaPublicKey `json:"syncedhosts"` UnsyncedHosts []types.SiaPublicKey `json:"unsyncedhosts"` }
RenterBackupsGET lists the renter's uploaded backups, as well as the set of contracts storing all known backups.
type RenterContract ¶
type RenterContract struct { // Amount of contract funds that have been spent on downloads. DownloadSpending types.Currency `json:"downloadspending"` // Block height that the file contract ends on. EndHeight types.BlockHeight `json:"endheight"` // Fees paid in order to form the file contract. Fees types.Currency `json:"fees"` // Public key of the host the contract was formed with. HostPublicKey types.SiaPublicKey `json:"hostpublickey"` // HostVersion is the version of Sia that the host is running HostVersion string `json:"hostversion"` // ID of the file contract. ID types.FileContractID `json:"id"` // A signed transaction containing the most recent contract revision. LastTransaction types.Transaction `json:"lasttransaction"` // Address of the host the file contract was formed with. NetAddress modules.NetAddress `json:"netaddress"` // Remaining funds left for the renter to spend on uploads & downloads. RenterFunds types.Currency `json:"renterfunds"` // Size of the file contract, which is typically equal to the number of // bytes that have been uploaded to the host. Size uint64 `json:"size"` // Block height that the file contract began on. StartHeight types.BlockHeight `json:"startheight"` // Amount of contract funds that have been spent on storage. StorageSpending types.Currency `json:"storagespending"` // DEPRECATED: This is the exact same value as StorageSpending, but it has // incorrect capitalization. This was fixed in 1.3.2, but this field is kept // to preserve backwards compatibility on clients who depend on the // incorrect capitalization. This field will be removed in the future, so // clients should switch to the StorageSpending field (above) with the // correct lowercase name. StorageSpendingDeprecated types.Currency `json:"StorageSpending,siamismatch"` // Total cost to the wallet of forming the file contract. TotalCost types.Currency `json:"totalcost"` // Amount of contract funds that have been spent on uploads. UploadSpending types.Currency `json:"uploadspending"` // Signals if contract is good for uploading data GoodForUpload bool `json:"goodforupload"` // Signals if contract is good for a renewal GoodForRenew bool `json:"goodforrenew"` // Signals if a contract has been marked as bad BadContract bool `json:"badcontract"` }
RenterContract represents a contract formed by the renter.
type RenterContracts ¶
type RenterContracts struct { // Compatibility Fields Contracts []RenterContract `json:"contracts"` InactiveContracts []RenterContract `json:"inactivecontracts"` // Current Fields ActiveContracts []RenterContract `json:"activecontracts"` PassiveContracts []RenterContract `json:"passivecontracts"` RefreshedContracts []RenterContract `json:"refreshedcontracts"` DisabledContracts []RenterContract `json:"disabledcontracts"` ExpiredContracts []RenterContract `json:"expiredcontracts"` ExpiredRefreshedContracts []RenterContract `json:"expiredrefreshedcontracts"` RecoverableContracts []modules.RecoverableContract `json:"recoverablecontracts"` }
RenterContracts contains the renter's contracts.
type RenterDirectory ¶ added in v1.4.0
type RenterDirectory struct { Directories []modules.DirectoryInfo `json:"directories"` Files []modules.FileInfo `json:"files"` }
RenterDirectory lists the files and directories contained in the queried directory
type RenterDownloadQueue ¶
type RenterDownloadQueue struct {
Downloads []DownloadInfo `json:"downloads"`
}
RenterDownloadQueue contains the renter's download queue.
type RenterFile ¶ added in v1.3.3
RenterFile lists the file queried.
type RenterFiles ¶
RenterFiles lists the files known to the renter.
type RenterFuseInfo ¶ added in v1.4.2
RenterFuseInfo contains information about mounted fuse filesystems.
type RenterGET ¶
type RenterGET struct { Settings modules.RenterSettings `json:"settings"` FinancialMetrics modules.ContractorSpending `json:"financialmetrics"` CurrentPeriod types.BlockHeight `json:"currentperiod"` NextPeriod types.BlockHeight `json:"nextperiod"` }
RenterGET contains various renter metrics.
type RenterLoad ¶
type RenterLoad struct {
FilesAdded []string `json:"filesadded"`
}
RenterLoad lists files that were loaded into the renter.
type RenterPricesGET ¶
type RenterPricesGET struct { modules.RenterPriceEstimation modules.Allowance }
RenterPricesGET lists the data that is returned when a GET call is made to /renter/prices.
type RenterRecoveryStatusGET ¶ added in v1.4.0
type RenterRecoveryStatusGET struct { ScanInProgress bool `json:"scaninprogress"` ScannedHeight types.BlockHeight `json:"scannedheight"` }
RenterRecoveryStatusGET returns information about potential contract recovery scans.
type RenterShareASCII ¶
type RenterShareASCII struct {
}RenterShareASCII contains an ASCII-encoded .sia file.
type RenterUploadReadyGet ¶ added in v1.4.2
type RenterUploadReadyGet struct { // Ready indicates whether of not the renter is ready to successfully // upload to full redundancy based on the erasure coding provided and // the number of contracts Ready bool `json:"ready"` // Contract information ContractsNeeded int `json:"contractsneeded"` NumActiveContracts int `json:"numactivecontracts"` // Erasure Coding information DataPieces int `json:"datapieces"` ParityPieces int `json:"paritypieces"` }
RenterUploadReadyGet lists the upload ready status of the renter
type RenterUploadedBackup ¶ added in v1.4.1
type RenterUploadedBackup struct { Name string `json:"name"` CreationDate types.Timestamp `json:"creationdate"` Size uint64 `json:"size"` UploadProgress float64 `json:"uploadprogress"` }
RenterUploadedBackup describes an uploaded backup.
type RequestTimeDistribution ¶ added in v1.4.8
type RequestTimeDistribution struct { N60ms float64 `json:"n60ms"` // Requests taking less than 60ms N120ms float64 `json:"n120ms"` N240ms float64 `json:"n240ms"` N500ms float64 `json:"n500ms"` N1000ms float64 `json:"n1000ms"` N2000ms float64 `json:"n2000ms"` N5000ms float64 `json:"n5000ms"` N10s float64 `json:"n10s"` NLong float64 `json:"nlong"` // Requests taking longer than 10 seconds. NErr float64 `json:"nerr"` // Requests that errored out. }
RequestTimeDistribution contains a distribution of requests, bucketed by how long each request took to return. The buckets use an exponential decay to get a good measurement, which means that the number of requests in each bucket may not be a whole number. It also means that the distribution is not reliable until stats collection has been running for a large multiple of the half life of the distribution.
Exponential decay is used to limit the memory footprint and computational overhead of stats collection.
type SiaConstants ¶ added in v1.4.1
type SiaConstants struct { BlockFrequency types.BlockHeight `json:"blockfrequency"` BlockSizeLimit uint64 `json:"blocksizelimit"` ExtremeFutureThreshold types.Timestamp `json:"extremefuturethreshold"` FutureThreshold types.Timestamp `json:"futurethreshold"` GenesisTimestamp types.Timestamp `json:"genesistimestamp"` MaturityDelay types.BlockHeight `json:"maturitydelay"` MedianTimestampWindow uint64 `json:"mediantimestampwindow"` SiafundCount types.Currency `json:"siafundcount"` SiafundPortion *big.Rat `json:"siafundportion"` TargetWindow types.BlockHeight `json:"targetwindow"` InitialCoinbase uint64 `json:"initialcoinbase"` MinimumCoinbase uint64 `json:"minimumcoinbase"` RootTarget types.Target `json:"roottarget"` RootDepth types.Target `json:"rootdepth"` DefaultAllowance modules.Allowance `json:"defaultallowance"` // DEPRECATED: same values as MaxTargetAdjustmentUp and // MaxTargetAdjustmentDown. MaxAdjustmentUp *big.Rat `json:"maxadjustmentup"` MaxAdjustmentDown *big.Rat `json:"maxadjustmentdown"` MaxTargetAdjustmentUp *big.Rat `json:"maxtargetadjustmentup"` MaxTargetAdjustmentDown *big.Rat `json:"maxtargetadjustmentdown"` SiacoinPrecision types.Currency `json:"siacoinprecision"` }
SiaConstants is a struct listing all of the constants in use.
type SkykeyGET ¶ added in v1.4.8
type SkykeyGET struct { Skykey string `json:"skykey"` // base64 encoded Skykey Name string `json:"name"` ID string `json:"id"` // base64 encoded Skykey ID Type string `json:"type"` // human-readable Skykey Type }
SkykeyGET contains a base64 encoded Skykey.
type SkykeysGET ¶ added in v1.4.9
type SkykeysGET struct {
Skykeys []SkykeyGET `json:"skykeys"`
}
SkykeysGET contains a slice of Skykeys.
type SkynetBlacklistGET ¶ added in v1.4.4
SkynetBlacklistGET contains the information queried for the /skynet/blacklist GET endpoint
type SkynetBlacklistPOST ¶ added in v1.4.4
SkynetBlacklistPOST contains the information needed for the /skynet/blacklist POST endpoint to be called
type SkynetPerformanceStats ¶ added in v1.4.8
type SkynetPerformanceStats struct { // TimeToFirstByte only refers to downloads. TimeToFirstByte HalfLifeDistribution `json:"timetofirstbyte"` // Buckets based on how large a file is. The bucket size represents the // maximum size of a file in that bucket. A file will be placed in the // smallest bucket that it can fit into. Download64KB HalfLifeDistribution `json:"download64kb"` Download1MB HalfLifeDistribution `json:"download1mb"` Download4MB HalfLifeDistribution `json:"download4mb"` DownloadLarge HalfLifeDistribution `json:"downloadlarge"` // NOTE: errored uploads are not counted. Upload4MB HalfLifeDistribution `json:"upload4mb"` UploadLarge HalfLifeDistribution `json:"uploadlarge"` }
SkynetPerformanceStats contains a set of performance metrics, bucketed by request size and time window, to give a good picture of how well requests are performing on Skynet.
func NewSkynetPerformanceStats ¶ added in v1.4.8
func NewSkynetPerformanceStats() *SkynetPerformanceStats
NewSkynetPerformanceStats will return a SkynetPerformanceStats object that is ready for use.
func (*SkynetPerformanceStats) Copy ¶ added in v1.4.8
func (sps *SkynetPerformanceStats) Copy() SkynetPerformanceStats
Copy returns a copy of the Skynet performance stats that is safe to pass to other threads and callers.
func (*SkynetPerformanceStats) Update ¶ added in v1.4.8
func (sps *SkynetPerformanceStats) Update()
Update will update all half life distributions.
type SkynetPortalsGET ¶ added in v1.4.8
type SkynetPortalsGET struct {
Portals []modules.SkynetPortal `json:"portals"`
}
SkynetPortalsGET contains the information queried for the /skynet/portals GET endpoint.
type SkynetPortalsPOST ¶ added in v1.4.8
type SkynetPortalsPOST struct { Add []modules.SkynetPortal `json:"add"` Remove []modules.NetAddress `json:"remove"` }
SkynetPortalsPOST contains the information needed for the /skynet/portals POST endpoint to be called.
type SkynetSkyfileHandlerPOST ¶ added in v1.4.3
type SkynetSkyfileHandlerPOST struct { Skylink string `json:"skylink"` MerkleRoot crypto.Hash `json:"merkleroot"` Bitfield uint16 `json:"bitfield"` }
SkynetSkyfileHandlerPOST is the response that the api returns after the /skynet/ POST endpoint has been used.
type SkynetStats ¶ added in v1.4.4
SkynetStats contains statistical data about skynet
type SkynetStatsGET ¶ added in v1.4.4
type SkynetStatsGET struct { PerformanceStats SkynetPerformanceStats `json:"performancestats"` Uptime int64 `json:"uptime"` UploadStats SkynetStats `json:"uploadstats"` VersionInfo SkynetVersion `json:"versioninfo"` }
SkynetStatsGET contains the information queried for the /skynet/stats GET endpoint
type SkynetVersion ¶ added in v1.4.5
type SkynetVersion struct { Version string `json:"version"` GitRevision string `json:"gitrevision"` }
SkynetVersion contains version information
type StorageGET ¶
type StorageGET struct {
Folders []modules.StorageFolderMetadata `json:"folders"`
}
StorageGET contains the information that is returned after a GET request to /host/storage - a bunch of information about the status of storage management on the host.
type TpoolConfirmedGET ¶
type TpoolConfirmedGET struct {
Confirmed bool `json:"confirmed"`
}
TpoolConfirmedGET contains information about whether or not the transaction has been seen on the blockhain
type TpoolFeeGET ¶
type TpoolFeeGET struct { Minimum types.Currency `json:"minimum"` Maximum types.Currency `json:"maximum"` }
TpoolFeeGET contains the current estimated fee
type TpoolRawGET ¶
type TpoolRawGET struct { ID types.TransactionID `json:"id"` Parents []byte `json:"parents"` Transaction []byte `json:"transaction"` }
TpoolRawGET contains the requested transaction encoded to the raw format, along with the id of that transaction.
type TpoolTxnsGET ¶ added in v1.4.2
type TpoolTxnsGET struct {
Transactions []types.Transaction `json:"transactions"`
}
TpoolTxnsGET contains the information about the tpool's transactions
type UpdateInfo ¶ added in v1.4.1
UpdateInfo indicates whether an update is available, and to what version.
type WalletAddressGET ¶
type WalletAddressGET struct {
Address types.UnlockHash `json:"address"`
}
WalletAddressGET contains an address returned by a GET call to /wallet/address.
type WalletAddressesGET ¶
type WalletAddressesGET struct {
Addresses []types.UnlockHash `json:"addresses"`
}
WalletAddressesGET contains the list of wallet addresses returned by a GET call to /wallet/addresses.
type WalletGET ¶
type WalletGET struct { Encrypted bool `json:"encrypted"` Height types.BlockHeight `json:"height"` Rescanning bool `json:"rescanning"` Unlocked bool `json:"unlocked"` ConfirmedSiacoinBalance types.Currency `json:"confirmedsiacoinbalance"` UnconfirmedOutgoingSiacoins types.Currency `json:"unconfirmedoutgoingsiacoins"` UnconfirmedIncomingSiacoins types.Currency `json:"unconfirmedincomingsiacoins"` SiacoinClaimBalance types.Currency `json:"siacoinclaimbalance"` SiafundBalance types.Currency `json:"siafundbalance"` DustThreshold types.Currency `json:"dustthreshold"` }
WalletGET contains general information about the wallet.
type WalletInitPOST ¶
type WalletInitPOST struct {
PrimarySeed string `json:"primaryseed"`
}
WalletInitPOST contains the primary seed that gets generated during a POST call to /wallet/init.
type WalletSeedsGET ¶
type WalletSeedsGET struct { PrimarySeed string `json:"primaryseed"` AddressesRemaining int `json:"addressesremaining"` AllSeeds []string `json:"allseeds"` }
WalletSeedsGET contains the seeds used by the wallet.
type WalletSiacoinsPOST ¶
type WalletSiacoinsPOST struct { Transactions []types.Transaction `json:"transactions"` TransactionIDs []types.TransactionID `json:"transactionids"` }
WalletSiacoinsPOST contains the transaction sent in the POST call to /wallet/siacoins.
type WalletSiafundsPOST ¶
type WalletSiafundsPOST struct { Transactions []types.Transaction `json:"transactions"` TransactionIDs []types.TransactionID `json:"transactionids"` }
WalletSiafundsPOST contains the transaction sent in the POST call to /wallet/siafunds.
type WalletSignPOSTParams ¶ added in v1.3.5
type WalletSignPOSTParams struct { Transaction types.Transaction `json:"transaction"` ToSign []crypto.Hash `json:"tosign"` }
WalletSignPOSTParams contains the unsigned transaction and a set of inputs to sign.
type WalletSignPOSTResp ¶ added in v1.3.5
type WalletSignPOSTResp struct {
Transaction types.Transaction `json:"transaction"`
}
WalletSignPOSTResp contains the signed transaction.
type WalletSweepPOST ¶
type WalletSweepPOST struct { Coins types.Currency `json:"coins"` Funds types.Currency `json:"funds"` }
WalletSweepPOST contains the coins and funds returned by a call to /wallet/sweep.
type WalletTransactionGETid ¶
type WalletTransactionGETid struct {
Transaction modules.ProcessedTransaction `json:"transaction"`
}
WalletTransactionGETid contains the transaction returned by a call to /wallet/transaction/:id
type WalletTransactionsGET ¶
type WalletTransactionsGET struct { ConfirmedTransactions []modules.ProcessedTransaction `json:"confirmedtransactions"` UnconfirmedTransactions []modules.ProcessedTransaction `json:"unconfirmedtransactions"` }
WalletTransactionsGET contains the specified set of confirmed and unconfirmed transactions.
type WalletTransactionsGETaddr ¶
type WalletTransactionsGETaddr struct { ConfirmedTransactions []modules.ProcessedTransaction `json:"confirmedtransactions"` UnconfirmedTransactions []modules.ProcessedTransaction `json:"unconfirmedtransactions"` }
WalletTransactionsGETaddr contains the set of wallet transactions relevant to the input address provided in the call to /wallet/transaction/:addr
type WalletUnlockConditionsGET ¶ added in v1.3.5
type WalletUnlockConditionsGET struct {
UnlockConditions types.UnlockConditions `json:"unlockconditions"`
}
WalletUnlockConditionsGET contains a set of unlock conditions.
type WalletUnlockConditionsPOSTParams ¶ added in v1.3.5
type WalletUnlockConditionsPOSTParams struct {
UnlockConditions types.UnlockConditions `json:"unlockconditions"`
}
WalletUnlockConditionsPOSTParams contains a set of unlock conditions.
type WalletUnspentGET ¶ added in v1.3.5
type WalletUnspentGET struct {
Outputs []modules.UnspentOutput `json:"outputs"`
}
WalletUnspentGET contains the unspent outputs tracked by the wallet. The MaturityHeight field of each output indicates the height of the block that the output appeared in.
type WalletVerifyAddressGET ¶
type WalletVerifyAddressGET struct {
Valid bool `json:"valid"`
}
WalletVerifyAddressGET contains a bool indicating if the address passed to /wallet/verify/address/:addr is a valid address.
type WalletVerifyPasswordGET ¶ added in v1.4.2
type WalletVerifyPasswordGET struct {
Valid bool `json:"valid"`
}
WalletVerifyPasswordGET contains a bool indicating if the password passed to /wallet/verifypassword is the password being used to encrypt the wallet.
type WalletWatchGET ¶ added in v1.3.5
type WalletWatchGET struct {
Addresses []types.UnlockHash `json:"addresses"`
}
WalletWatchGET contains the set of addresses that the wallet is currently watching.
type WalletWatchPOST ¶ added in v1.3.5
type WalletWatchPOST struct { Addresses []types.UnlockHash `json:"addresses"` Remove bool `json:"remove"` Unused bool `json:"unused"` }
WalletWatchPOST contains the set of addresses to add or remove from the watch set.