Documentation ¶
Index ¶
- Variables
- func AddressesToSubnets(resolvedAddresses []string) ([]string, error)
- func Auth(password string, unauthenticatedDownloads bool) func(http.Handler) http.Handler
- func DoRequest(req *http.Request, resp interface{}) (http.Header, int, error)
- func HumanReadableSize(b int) string
- func IsErr(err error, target error) bool
- func IsSynced(b types.Block) bool
- func IsVersion(str string) bool
- func ListenTCP(addr string, logger *zap.Logger) (net.Listener, error)
- func OpenBrowser(url string) error
- func ResolveHostIP(ctx context.Context, hostIP string) (ips []string, private bool, _ error)
- func VersionCmp(a, b string) int
- func WrapErr(ctx context.Context, fnName string, err *error)
- type AccountsKey
- type DataPoints
- type Float64Data
- type MasterKey
- type TreeMux
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoRouteToHost = errors.New("no route to host") ErrNoSuchHost = errors.New("no such host") ErrConnectionRefused = errors.New("connection refused") ErrConnectionTimedOut = errors.New("connection timed out") ErrConnectionResetByPeer = errors.New("connection reset by peer") ErrIOTimeout = errors.New("i/o timeout") )
Common i/o related errors
var ( // ErrHostTooManyAddresses is returned by the worker API when a host has // more than two addresses of the same type. ErrHostTooManyAddresses = errors.New("host has more than two addresses, or two of the same type") )
Functions ¶
func AddressesToSubnets ¶ added in v1.1.0
func HumanReadableSize ¶ added in v1.1.0
func IsErr ¶
IsErr can be used to compare an error to a target and also works when used on errors that haven't been wrapped since it will fall back to a string comparison. Useful to check errors returned over the network.
func IsVersion ¶ added in v1.1.0
IsVersion returns whether str is a valid release version with no -rc component.
func OpenBrowser ¶ added in v1.1.0
func ResolveHostIP ¶ added in v1.0.8
func VersionCmp ¶ added in v1.1.0
VersionCmp returns an int indicating the difference between a and b. It follows the convention of bytes.Compare and big.Cmp:
-1 if a < b 0 if a == b +1 if a > b
One important quirk is that "1.1.0" is considered newer than "1.1", despite being numerically equal.
Types ¶
type AccountsKey ¶ added in v1.1.0
type AccountsKey types.PrivateKey
func (*AccountsKey) DeriveAccountKey ¶ added in v1.1.0
func (key *AccountsKey) DeriveAccountKey(hk types.PublicKey) types.PrivateKey
DeriveAccountKey derives an account plus key for a given host and worker. Each worker has its own account for a given host. That makes concurrency around keeping track of an accounts balance and refilling it a lot easier in a multi-worker setup.
type DataPoints ¶ added in v1.1.0
type DataPoints struct { stats.Float64Data // contains filtered or unexported fields }
func NewDataPoints ¶ added in v1.1.0
func NewDataPoints(halfLife time.Duration) *DataPoints
func (*DataPoints) Average ¶ added in v1.1.0
func (a *DataPoints) Average() float64
func (*DataPoints) P90 ¶ added in v1.1.0
func (a *DataPoints) P90() float64
func (*DataPoints) Recompute ¶ added in v1.1.0
func (a *DataPoints) Recompute()
func (*DataPoints) Track ¶ added in v1.1.0
func (a *DataPoints) Track(p float64)
type Float64Data ¶ added in v1.1.0
type Float64Data = stats.Float64Data
type MasterKey ¶ added in v1.1.0
type MasterKey [32]byte
func (*MasterKey) DeriveAccountsKey ¶ added in v1.1.0
func (key *MasterKey) DeriveAccountsKey(workerID string) AccountsKey
DeriveAccountsKey derives an accounts key from a masterkey which is used to derive individual account keys from.
func (*MasterKey) DeriveContractKey ¶ added in v1.1.0
func (key *MasterKey) DeriveContractKey(hostKey types.PublicKey) types.PrivateKey
DeriveContractKey derives a contract key from a masterkey which is used to form, renew and revise contracts.