Documentation
¶
Overview ¶
Package gui implements the communication and control parts of the GUI miner. It constructs and launches the Electron front-end as well as listen for events from the front-end
Index ¶
- type Config
- type ElectronMessage
- type GUI
- func (gui *GUI) GetCoinContentJson() (string, error)
- func (gui *GUI) GetPool(id int) (PoolData, error)
- func (gui *GUI) GetPoolList() ([]PoolData, error)
- func (gui *GUI) GetPoolTemplate() (*template.Template, error)
- func (gui *GUI) GetStats(poolID int, hashrate float64, mid string) (string, error)
- func (gui *GUI) Run() error
- func (gui *GUI) SaveConfig(config Config) error
- type GlobalStats
- type PoolData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// APIEndpoint is the web endpoint where stats and pools are retrieved from
APIEndpoint string `json:"api_endpoint"`
// CoinType is the type of the coin the miner is currently minning
CoinType string `json:"coin_type"`
// CoinAlgo is the algo of the coin the miner is currently minning
CoinAlgo string `json:"coin_algo"`
// This is only for xmrig
XmrigAlgo string `json:"xmrig_algo"`
// This is only for xmrig
XmrigVariant string `json:"xmrig_variant"`
// Address to mine to
Address string `json:"address"`
// PoolID selected on startup
PoolID int `json:"pool"`
// Mid is the miner identifier
Mid string `json:"mid"`
// Miner is the config for the miner
Miner miner.Config `json:"miner"`
// The type of hardware used for mining (1 = computer with CPU only, 2 = computer with GPU)
HardwareType uint8 `json:"hardware_type"`
}
Config contains the basic configuration for a miner
type ElectronMessage ¶
type ElectronMessage struct {
Data string `json:"data"`
}
ElectronMessage is marshalled and sent to the UI
type GUI ¶
type GUI struct {
// contains filtered or unexported fields
}
GUI implements the core control for the GUI miner
func New ¶
func New( appName string, config *Config, asset bootstrap.Asset, restoreAssets bootstrap.RestoreAssets, apiEndpoint string, coinType string, coinAlgo string, XmrigAlgo string, XmrigVariant string, workingDir string, isDebug bool) (*GUI, error)
New creates a new instance of the miner application
func (*GUI) GetCoinContentJson ¶
GetCoinContent returns the content for all coins
func (*GUI) GetPoolList ¶
GetPoolList returns the list of pools available to the GUI miner
func (*GUI) GetPoolTemplate ¶
GetPoolTemplate returns the template for rendering a pool block
func (*GUI) GetStats ¶
GetStats returns stats for the interface. It requires the miner's hashrate to calculate BLOC per dat
func (*GUI) SaveConfig ¶
SaveConfig saves the configuration to disk
type GlobalStats ¶
type GlobalStats struct {
Pool PoolData `json:"pool"`
Ticker string `json:"abbreviation"`
Supply string `json:"maximum_supply"`
Circulation string `json:"circulation"`
LastBlock struct {
ID int `json:"id"`
Height int `json:"height"`
Difficulty int `json:"difficulty"`
TxCount int `json:"tx_count"`
Reward string `json:"reward"`
Timestamp string `json:"timestamp"`
} `json:"last_block"`
Difficulty string `json:"difficulty"`
Height string `json:"height"`
Volumes []struct {
Name string `json:"name"`
Value string `json:"value"`
Unit string `json:"unit"`
} `json:"volumes"`
Prices []struct {
Name string `json:"name"`
Value string `json:"value"`
Unit string `json:"unit"`
} `json:"prices"`
Volume string `json:"volume"`
VolumeUsd string `json:"volume_usd"`
Price string `json:"price"`
PriceUsd string `json:"price_usd"`
MarketCap string `json:"market_cap"`
Records struct {
Price string `json:"price"`
Volume string `json:"volume"`
} `json:"records"`
CoinsPerDay string `json:"coins_per_day"`
Hashrate string `json:"hashrate"`
// PoolHTML is injected before sending the update to the front-end. Avoids
// having to send extra packets
PoolHTML string `json:"pool_html"`
}
GlobalStats contains the current stats for the network, trading and selected mining pool
type PoolData ¶
type PoolData struct {
ID int `json:"id"`
Rank int `json:"rank"`
APIType string `json:"api_type"`
Name string `json:"name"`
URL string `json:"url"`
Endpoint string `json:"endpoint"`
Hashrate string `json:"hashrate"`
Fee string `json:"fee"`
Miners string `json:"miners"`
Payout string `json:"payout"`
LastBlock string `json:"last_block"`
Config string `json:"config"`
IsEnabled int `json:"is_enabled"`
DisplayInMiner int `json:"display_in_miner"`
LastUpdate string `json:"last_update"`
MiningPorts struct {
Cpu string `json:"cpu"`
Gpu string `json:"gpu"`
} `json:"mining_ports"`
}
PoolData contains the parsed JSON data from the pool list