miner

package
v0.0.0-...-ba570bd Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2018 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTrackerDurations = []time.Duration{15 * time.Second, 60 * time.Second, 15 * time.Minute}
)

Functions

func RunDefaultHashRateTrackers

func RunDefaultHashRateTrackers(inChan <-chan *HashRate)

RunDefaultHashRateTrackers sets up the default hashrate trackers as defined by DefaultTrackerDurations and runs an infinite loop listening for hashrate events and printing them. This function is expected to be run in a goroutine

func SetupHashRateTrackers

func SetupHashRateTrackers(duration time.Duration, trackerDurations []time.Duration, inChan <-chan *HashRate, outChan chan<- HashRateTrackerArray)

SetupHashRateTrackers sets up multiple hashrate trackers using the specified inChan as a source of HashRate events. Every duration, the hashrate trackers are published to outChan as a HashRateTrackerArray

Types

type Config

type Config struct {
	Algorithm         string      `json:"algo" yaml:"algo"`
	Background        bool        `json:"background" yaml:"background"`
	Colors            bool        `json:"colors" yaml:"colors"`
	DonateLevel       float64     `json:"donate-level" yaml:"donate-level"`
	LogFile           *string     `json:"log-file" yaml:"log-file"`
	PrintTime         int         `json:"print-time" yaml:"print-time"`
	Retries           int         `json:"retries" yaml:"retries"`
	RetryPause        int         `json:"retry-pause" yaml:"retry-pause"`
	Syslog            bool        `json:"syslog" yaml:"syslog"`
	OpenCLPlatform    int         `json:"opencl-platform" yaml:"opencl-platform"`
	CPUThreads        int         `json:"cpu_threads" yaml:"cpu_threads"`
	DeviceInstanceIDs []string    `json:"device_instance_ids" yaml:"device_instance_ids"`
	Threads           []GPUThread `json:"threads" yaml:"threads"`
	Pools             []Pool      `json:"pools" yaml:"pools"`
	// Arguments to support miners like cpuminer-multi
	Url   string `json:"url" yaml:"url"`
	User  string `json:"user" yaml:"user"`
	Pass  string `json:"pass" yaml:"pass"`
	Proxy string `json:"proxy" yaml:"proxy"`
}

Config structure representing config JSON file Add any relevant fields here Config structure representing config JSON file Add any relevant fields here

type GPUThread

type GPUThread struct {
	Index       int  `json:"index" yaml:"index"`
	DeviceIndex *int `json:"device_index" yaml:"device_index"`
	Intensity   int  `json:"intensity" yaml:"intensity"`
	WorkSize    int  `json:"worksize" yaml:"worksize"`
	AffineToCPU bool `json:"affine_to_cpu" yaml:"affine_to_cpu"`
}

GPUThread structure representing a GPU thread

type HashRate

type HashRate struct {
	Hashes uint32
	Time   time.Time
}

type HashRateTracker

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

func NewHashRateTracker

func NewHashRateTracker(duration time.Duration) *HashRateTracker

func (*HashRateTracker) Add

func (hrt *HashRateTracker) Add(hr *HashRate)

func (*HashRateTracker) Average

func (hrt *HashRateTracker) Average() uint32

func (*HashRateTracker) AverageAsString

func (hrt *HashRateTracker) AverageAsString() string

func (*HashRateTracker) DurationString

func (hrt *HashRateTracker) DurationString() string

func (*HashRateTracker) Hashes

func (hrt *HashRateTracker) Hashes() []uint32

func (*HashRateTracker) Times

func (hrt *HashRateTracker) Times() []float64

type HashRateTrackerArray

type HashRateTrackerArray []*HashRateTracker

HashRateTrackerArray is a wrapper for an array of HashRateTrackers. It implements the Stringer interface which provides an easy way to print out the hashrates of all trackers

func (HashRateTrackerArray) Add

func (o HashRateTrackerArray) Add(hr *HashRate)

Add a HashRate entry to all the trackers that are part of this HashRateTrackerArray

func (HashRateTrackerArray) String

func (o HashRateTrackerArray) String() string

type Interface

type Interface interface {
	Id() uint32
	Run() error
	RegisterHashrateListener(chan *HashRate)
}

type Miner

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

func New

func New(id uint32) *Miner

func (*Miner) Id

func (m *Miner) Id() uint32

func (*Miner) InformHashrate

func (m *Miner) InformHashrate(hashes uint32)

func (*Miner) LogNewWork

func (m *Miner) LogNewWork(sc *stratum.StratumContext, work *stratum.Work)

func (*Miner) RegisterHashrateListener

func (m *Miner) RegisterHashrateListener(hrChan chan *HashRate)

type Pool

type Pool struct {
	Url        string  `json:"url" yaml:"url"`
	User       string  `json:"user" yaml:"user"`
	Pass       string  `json:"pass" yaml:"pass"`
	Keepalive  bool    `json:"keepalive" yaml:"keepalive"`
	Nicehash   bool    `json:"nicehash" yaml:"nicehash"`
	Coin       *string `json:"coin" yaml:"coin"`
	PoolName   *string `json:"pool_name" yaml:"pool_name"`
	WalletName *string `json:"wallet_name" yaml:"wallet_name"`
	Label      *string `json:"label" yaml:"label"`
}

Pool structure representing a pool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL