Documentation ¶
Index ¶
- Constants
- Variables
- type Alerts
- type Announcement
- type ChainManager
- type CloudflareSettings
- type ConfigManager
- func (m *ConfigManager) Announce() error
- func (m *ConfigManager) BandwidthLimiters() (ingress, egress *rate.Limiter)
- func (m *ConfigManager) Close() error
- func (m *ConfigManager) DiscoveredRHP2Address() string
- func (m *ConfigManager) LastAnnouncement() (Announcement, error)
- func (cm *ConfigManager) ProcessConsensusChange(cc modules.ConsensusChange)
- func (m *ConfigManager) RHP3TLSConfig() *tls.Config
- func (m *ConfigManager) ScanHeight() uint64
- func (m *ConfigManager) Settings() Settings
- func (m *ConfigManager) UpdateDDNS(force bool) error
- func (m *ConfigManager) UpdateSettings(s Settings) error
- type DNSSettings
- type DuckDNSSettings
- type NoIPSettings
- type Route53Settings
- type Settings
- type Store
- type TransactionPool
- type Wallet
Constants ¶
const ( DNSProviderCloudflare = "cloudflare" DNSProviderDuckDNS = "duckdns" DNSProviderNoIP = "noip" DNSProviderRoute53 = "route53" )
defines DNS providers
Variables ¶
var ( // DefaultSettings are the default settings for the host DefaultSettings = Settings{ AcceptingContracts: false, NetAddress: "", MaxContractDuration: 6 * blocksPerMonth, ContractPrice: types.Siacoins(1).Div64(5), BaseRPCPrice: types.Siacoins(1).Div64(1e6), SectorAccessPrice: types.Siacoins(1).Div64(1e6), CollateralMultiplier: 2.0, MaxCollateral: types.Siacoins(1000), StoragePrice: types.Siacoins(150).Div64(1 << 40).Div64(blocksPerMonth), EgressPrice: types.Siacoins(500).Div64(1 << 40), IngressPrice: types.Siacoins(10).Div64(1 << 40), PriceTableValidity: 30 * time.Minute, AccountExpiry: 30 * 24 * time.Hour, MaxAccountBalance: types.Siacoins(10), WindowSize: 144, MaxRegistryEntries: 100000, } // ErrNoSettings must be returned by the store if the host has no settings yet ErrNoSettings = errors.New("no settings found") )
Functions ¶
This section is empty.
Types ¶
type Announcement ¶ added in v0.2.2
type Announcement struct { Index types.ChainIndex `json:"index"` PublicKey types.PublicKey `json:"publicKey"` Address string `json:"address"` }
An Announcement contains the host's announced netaddress and public key
type ChainManager ¶
type ChainManager interface { TipState() consensus.State Subscribe(s modules.ConsensusSetSubscriber, ccID modules.ConsensusChangeID, cancel <-chan struct{}) error }
A ChainManager manages the current consensus state
type CloudflareSettings ¶
CloudflareSettings contains the settings for the Cloudflare DNS provider.
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
A ConfigManager manages the host's current configuration
func NewConfigManager ¶
func NewConfigManager(dir string, hostKey types.PrivateKey, rhp2Addr string, store Store, cm ChainManager, tp TransactionPool, w Wallet, a Alerts, log *zap.Logger) (*ConfigManager, error)
NewConfigManager initializes a new config manager
func (*ConfigManager) Announce ¶
func (m *ConfigManager) Announce() error
Announce announces the host to the network
func (*ConfigManager) BandwidthLimiters ¶
func (m *ConfigManager) BandwidthLimiters() (ingress, egress *rate.Limiter)
BandwidthLimiters returns the rate limiters for all traffic
func (*ConfigManager) DiscoveredRHP2Address ¶
func (m *ConfigManager) DiscoveredRHP2Address() string
DiscoveredRHP2Address returns the rhp2 address that was discovered by the gateway
func (*ConfigManager) LastAnnouncement ¶ added in v0.2.2
func (m *ConfigManager) LastAnnouncement() (Announcement, error)
LastAnnouncement returns the last announcement that was made by the host
func (*ConfigManager) ProcessConsensusChange ¶ added in v0.2.2
func (cm *ConfigManager) ProcessConsensusChange(cc modules.ConsensusChange)
ProcessConsensusChange implements modules.ConsensusSetSubscriber.
func (*ConfigManager) RHP3TLSConfig ¶
func (m *ConfigManager) RHP3TLSConfig() *tls.Config
RHP3TLSConfig returns the TLS config for the rhp3 WebSocket listener
func (*ConfigManager) ScanHeight ¶ added in v0.2.2
func (m *ConfigManager) ScanHeight() uint64
ScanHeight returns the last block height that was scanned for announcements
func (*ConfigManager) Settings ¶
func (m *ConfigManager) Settings() Settings
Settings returns the host's current settings.
func (*ConfigManager) UpdateDDNS ¶
func (m *ConfigManager) UpdateDDNS(force bool) error
UpdateDDNS triggers an update of the host's dynamic DNS records.
func (*ConfigManager) UpdateSettings ¶
func (m *ConfigManager) UpdateSettings(s Settings) error
UpdateSettings updates the host's settings.
type DNSSettings ¶
type DNSSettings struct { Provider string `json:"provider"` IPv4 bool `json:"ipv4"` IPv6 bool `json:"ipv6"` Options json.RawMessage `json:"options"` }
DNSSettings contains the settings for the host's dynamic DNS.
type DuckDNSSettings ¶
type DuckDNSSettings struct {
Token string `json:"token"`
}
DuckDNSSettings contains the settings for the DuckDNS DNS provider.
type NoIPSettings ¶
NoIPSettings contains the settings for the No-IP DNS provider.
type Route53Settings ¶
type Route53Settings struct { ID string `json:"id"` Secret string `json:"secret"` ZoneID string `json:"zoneID"` }
Route53Settings contains the settings for the Route53 DNS provider.
type Settings ¶
type Settings struct { // Host settings AcceptingContracts bool `json:"acceptingContracts"` NetAddress string `json:"netAddress"` MaxContractDuration uint64 `json:"maxContractDuration"` WindowSize uint64 `json:"windowSize"` // Pricing ContractPrice types.Currency `json:"contractPrice"` BaseRPCPrice types.Currency `json:"baseRPCPrice"` SectorAccessPrice types.Currency `json:"sectorAccessPrice"` CollateralMultiplier float64 `json:"collateralMultiplier"` MaxCollateral types.Currency `json:"maxCollateral"` StoragePrice types.Currency `json:"storagePrice"` EgressPrice types.Currency `json:"egressPrice"` IngressPrice types.Currency `json:"ingressPrice"` PriceTableValidity time.Duration `json:"priceTableValidity"` // Registry settings MaxRegistryEntries uint64 `json:"maxRegistryEntries"` // RHP3 settings AccountExpiry time.Duration `json:"accountExpiry"` MaxAccountBalance types.Currency `json:"maxAccountBalance"` // Bandwidth limiter settings IngressLimit uint64 `json:"ingressLimit"` EgressLimit uint64 `json:"egressLimit"` // DNS settings DDNS DNSSettings `json:"ddns"` SectorCacheSize uint32 `json:"sectorCacheSize"` Revision uint64 `json:"revision"` }
Settings contains configuration options for the host.
type Store ¶
type Store interface { // Settings returns the host's current settings. If the host has no // settings yet, ErrNoSettings must be returned. Settings() (Settings, error) // UpdateSettings updates the host's settings. UpdateSettings(s Settings) error LastAnnouncement() (Announcement, error) UpdateLastAnnouncement(Announcement) error RevertLastAnnouncement() error LastSettingsConsensusChange() (modules.ConsensusChangeID, uint64, error) }
A Store persists the host's settings
type TransactionPool ¶
type TransactionPool interface { AcceptTransactionSet([]types.Transaction) error RecommendedFee() types.Currency }
A TransactionPool broadcasts transactions to the network.