Documentation ¶
Overview ¶
Package hostdb defines types and functions relevant to scanning hosts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostPublicKey ¶
type HostPublicKey string
A HostPublicKey is the public key announced on the blockchain by a host. A HostPublicKey can be assumed to uniquely identify a host. Hosts should always be identified by their public key, since other identifying information (like a host's current IP address) may change at a later time.
The format of a HostPublicKey is:
specifier:keydata
Where specifier identifies the signature scheme used and keydata contains the hex-encoded bytes of the actual key. Currently, all public keys on Sia use the Ed25519 signature scheme, specified as "ed25519".
func (HostPublicKey) Ed25519 ¶
func (hpk HostPublicKey) Ed25519() ed25519.PublicKey
Ed25519 returns the HostPublicKey as an ed25519.PublicKey. The returned key is invalid if hpk is not a Ed25519 key.
func (HostPublicKey) Key ¶
func (hpk HostPublicKey) Key() string
Key returns the keydata portion of a HostPublicKey.
func (HostPublicKey) ShortKey ¶
func (hpk HostPublicKey) ShortKey() string
ShortKey returns the keydata portion of a HostPublicKey, truncated to 8 characters. This is 32 bits of entropy, which is sufficient to prevent collisions in typical usage scenarios. A ShortKey is the preferred way to reference a HostPublicKey in user interfaces.
func (HostPublicKey) SiaPublicKey ¶
func (hpk HostPublicKey) SiaPublicKey() (spk types.SiaPublicKey)
SiaPublicKey returns the HostPublicKey as a types.SiaPublicKey.
func (HostPublicKey) VerifyHash ¶ added in v0.2.0
func (hpk HostPublicKey) VerifyHash(hash crypto.Hash, sig []byte) bool
VerifyHash verifies that hash was signed by the public key.
type HostSettings ¶
type HostSettings struct { AcceptingContracts bool MaxDownloadBatchSize uint64 MaxDuration types.BlockHeight MaxReviseBatchSize uint64 NetAddress modules.NetAddress RemainingStorage uint64 SectorSize uint64 TotalStorage uint64 UnlockHash types.UnlockHash WindowSize types.BlockHeight Collateral types.Currency MaxCollateral types.Currency BaseRPCPrice types.Currency ContractPrice types.Currency DownloadBandwidthPrice types.Currency SectorAccessPrice types.Currency StoragePrice types.Currency UploadBandwidthPrice types.Currency RevisionNumber uint64 Version string }
HostSettings are the settings reported by a host.
type ScannedHost ¶
type ScannedHost struct { HostSettings PublicKey HostPublicKey Latency time.Duration }
ScannedHost groups a host's settings with its public key and other scan- related metrics.
func Scan ¶
func Scan(ctx context.Context, addr modules.NetAddress, pubkey HostPublicKey) (host ScannedHost, err error)
Scan dials the host with the given NetAddress and public key and requests its settings.