gui

package
v0.0.0-...-e04ab8b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2020 License: ISC Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info.

Types

type AccountStats

type AccountStats struct {
	MinedWork []*pool.AcceptedWork
	Payments  []*pool.Payment
	Clients   []*pool.ClientInfo
	AccountID string
}

AccountStats is a snapshot of an accounts contribution to the pool. This comprises of blocks mined by the pool and payments made to the account.

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
	// BackupPass represents the database backup password.
	BackupPass string
	// GUIPort represents the port the frontend is served on.
	GUIPort uint32
	// 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
	// Domain represents the domain name of the pool.
	Domain string
	// ActiveNet represents the active network being mined on.
	ActiveNet *chaincfg.Params
	// 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
	// MinerPorts represents the configured ports for supported miners.
	MinerPorts map[string]uint32
	// 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
	// FetchLastPaymentheight returns the last payment height of the pool.
	FetchLastPaymentHeight func() uint32
	// AddPaymentRequest creates a payment request from the provided account
	// if not already requested.
	AddPaymentRequest func(addr string) error
	// FetchMinedWork returns the last ten mined blocks 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)
	// FetchPoolHashRate returns the hash rate of the pool.
	FetchPoolHashRate func() (*big.Rat, map[string][]*pool.ClientInfo)
	// BackupDB streams a backup of the database over an http response.
	BackupDB func(w http.ResponseWriter) error
	// FetchClientInfo returns connection details about all pool clients.
	FetchClientInfo func() map[string][]*pool.ClientInfo
	// AccountExists checks if the provided account id references a pool account.
	AccountExists func(accountID string) bool
	// FetchMinedWorkByAccount returns a list of mined work by the provided address.
	FetchMinedWorkByAccount func(id string) ([]*pool.AcceptedWork, error)
	// FetchPaymentsForAccount returns a list or payments made to the provided address.
	FetchPaymentsForAccount func(id string) ([]*pool.Payment, error)
	// FetchAccountClientInfo returns all clients belonging to the provided
	// account id.
	FetchAccountClientInfo func(accountID string) []*pool.ClientInfo
}

type GUI

type GUI struct {
	// contains filtered or unexported fields
}

GUI represents the the mining pool user interface.

func NewGUI

func NewGUI(cfg *Config) (*GUI, error)

NewGUI creates an instance of the user interface.

func (*GUI) GetAdmin

func (ui *GUI) GetAdmin(w http.ResponseWriter, r *http.Request)

func (*GUI) GetIndex

func (ui *GUI) GetIndex(w http.ResponseWriter, r *http.Request)

func (*GUI) PostAdmin

func (ui *GUI) PostAdmin(w http.ResponseWriter, r *http.Request)

func (*GUI) PostBackup

func (ui *GUI) PostBackup(w http.ResponseWriter, r *http.Request)

func (*GUI) PostLogout

func (ui *GUI) PostLogout(w http.ResponseWriter, r *http.Request)

func (*GUI) Run

func (ui *GUI) Run(ctx context.Context)

Run starts the user interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳