Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ZeroInt is the default value for a big.Int. ZeroInt = new(big.Int).SetInt64(0) // ZeroRat is the default value for a big.Rat. ZeroRat = new(big.Rat).SetInt64(0) // KiloHash is 1 KH represented as a big.Rat. KiloHash = new(big.Rat).SetInt64(1000) // MegaHash is 1MH represented as a big.Rat. MegaHash = new(big.Rat).SetInt64(1000000) // GigaHash is 1GH represented as a big.Rat. GigaHash = new(big.Rat).SetInt64(1000000000) // TeraHash is 1TH represented as a big.Rat. TeraHash = new(big.Rat).SetInt64(1000000000000) // PetaHash is 1PH represented as a big.Rat PetaHash = new(big.Rat).SetInt64(1000000000000000) )
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache stores data which is required for the GUI. Each field has a setter and getter, and they are protected by a mutex so they are safe for concurrent access. Data returned by the getters is already formatted for display in the GUI, so the formatting does not need to be repeated.
func InitCache ¶
func InitCache(work []*pool.AcceptedWork, quotas []*pool.Quota, hashData map[string][]*pool.HashData, pendingPmts []*pool.Payment, archivedPmts []*pool.Payment, blockExplorerURL string, lastPmtHeight uint32, lastPmtPaidOn, lastPmtCreatedOn int64) *Cache
InitCache initialises and returns a cache for use in the GUI.
type Config ¶
type Config struct { // SoloPool represents the solo pool mining mode. SoloPool bool // PaymentMethod represents the pool payment method. PaymentMethod string // GUIDir represents the GUI directory. GUIDir string // CSRFSecret represents the frontend's CSRF secret. CSRFSecret []byte // AdminPass represents the admin password. AdminPass string // GUIListen represents the listening address the frontend is served on. GUIListen string // TLSCertFile represents the TLS certificate file path. TLSCertFile string // TLSKeyFile represents the TLS key file path. TLSKeyFile string // UseLEHTTPS represents Letsencrypt HTTPS mode. UseLEHTTPS bool // NoGUITLS starts the webserver listening for plain HTTP. NoGUITLS bool // Domain represents the domain name of the pool. Domain string // ActiveNetName is the name of the active network being mined on. ActiveNetName string // BlockExplorerURL represents the active network block explorer. BlockExplorerURL string // Designation represents the codename of the pool. Designation string // PoolFee represents the fee charged to participating accounts of the pool. PoolFee float64 // MinerListen represents the listening address for miner connections. MinerListen string // WithinLimit returns if a client is within its request limits. WithinLimit func(string, int) bool // FetchLastWorkHeight returns the last work height of the pool. FetchLastWorkHeight func() uint32 // FetchLastPaymentInfo returns the height, paid on time, and created on time, // for the last payment made by the pool. FetchLastPaymentInfo func() (uint32, int64, int64, error) // FetchMinedWork returns all blocks mined by the pool. FetchMinedWork func() ([]*pool.AcceptedWork, error) // FetchWorkQuotas returns the reward distribution to pool accounts // based on work contributed per the payment scheme used by the pool. FetchWorkQuotas func() ([]*pool.Quota, error) // HTTPBackupDB streams a backup of the database over an http response. HTTPBackupDB func(w http.ResponseWriter) error // FetchHashData returns all hash data from connected pool clients. FetchHashData func() (map[string][]*pool.HashData, error) // AccountExists checks if the provided account id references a pool account. AccountExists func(accountID string) bool // FetchArchivedPayments fetches all paid payments. FetchArchivedPayments func() ([]*pool.Payment, error) // FetchPendingPayments fetches all unpaid payments. FetchPendingPayments func() ([]*pool.Payment, error) // FetchCacheChannel returns the gui cache signal channel. FetchCacheChannel func() chan pool.CacheUpdateEvent }
Config contains all of the required configuration values for the GUI component
type GUI ¶
type GUI struct {
// contains filtered or unexported fields
}
GUI represents the the mining pool user interface.
type WebsocketServer ¶
type WebsocketServer struct {
// contains filtered or unexported fields
}
WebsocketServer maintains a list of connected websocket clients (protected by a mutex), and is able to send payloads to them. It is used for sending updated pool stats to connected GUI clients.
func NewWebsocketServer ¶
func NewWebsocketServer() *WebsocketServer
NewWebsocketServer returns an initialized websocket server.