miner

package
v0.0.0-...-26e86c7 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMinerAlreadyStarted = errors.New("miner already started")
	ErrMinerAlreadyStopped = errors.New("miner already stopped")
)

Functions

func Register

func Register(name string, factory MinerFactory)

Types

type Algorithm

type Algorithm string
const (
	Undefined       Algorithm = ""
	Ethash          Algorithm = "ethash"     // eth
	Etchash         Algorithm = "etchash"    // etc
	Kawpow          Algorithm = "kawpow"     // raven
	Autolykos2      Algorithm = "autolykos2" // ergo
	Verthash        Algorithm = "verthash"   // ctx
	Nimiq           Algorithm = "nimiw"      // (nimiq)
	Lyra2z          Algorithm = "lyra2z"
	Phi2            Algorithm = "phi2" // (lux, argoneum)
	Lyra2rev3       Algorithm = "lyra2rev3"
	X16r            Algorithm = "x16r"
	X16rv2          Algorithm = "x16rv2"
	X16s            Algorithm = "x16s"             // (pgn, xsh)
	X16rt           Algorithm = "x16rt"            // (gin)
	Mtp             Algorithm = "mtp"              // (zcoin)
	Cuckatoo31Grin  Algorithm = "cuckatoo31_grin"  // (grin)
	Cuckarood29Grin Algorithm = "cuckarood29_grin" // (grin)
	Cnv8            Algorithm = "cnv8"
	Cnr             Algorithm = "cnr"          // (old monero)
	Cnv8Half        Algorithm = "cnv8_half"    // (stellite, masari)
	Cnv8Dbl         Algorithm = "cnv8_dbl"     // (x-cash)
	Cnv8Rwz         Algorithm = "cnv8_rwz"     // (graft)
	Cnv8Trtl        Algorithm = "cnv8_trtl"    // (old turtlecoin, loki)
	Cnv8Upx2        Algorithm = "cnv8_upx2"    // (uplexa)
	CnHeavy         Algorithm = "cn_heavy"     // (classic CN heavy)
	CnHaven         Algorithm = "cn_haven"     // (haven)
	CnSaber         Algorithm = "cn_saber"     // (bittube)
	CnConceal       Algorithm = "cn_conceal"   // (conceal)
	TrtlChukwa      Algorithm = "trtl_chukwa"  // (turtlecoin)
	TrtlChukwa2     Algorithm = "trtl_chukwa2" // (turtlecoin)
)

type Device

type Device interface {
	Next() bool
	Scan(v ...interface{}) error
}

type DeviceProvider

type DeviceProvider interface {
	Select(query *DeviceQuery, target interface{}) (Device, error)
}

type DeviceQuery

type DeviceQuery struct {
	ByIndex int
	ByName  string
	ByBus   string
	By      DeviceSelectBy
}

func ParseDeviceQuery

func ParseDeviceQuery(queryStr string) (*DeviceQuery, error)

func (*DeviceQuery) String

func (q *DeviceQuery) String() string

type DeviceSelectBy

type DeviceSelectBy string
const (
	ByIndex DeviceSelectBy = "index"
	ByName  DeviceSelectBy = "name"
	ByBus   DeviceSelectBy = "bus"
)

func (DeviceSelectBy) Valid

func (b DeviceSelectBy) Valid() bool

type Downloadable

type Downloadable interface {
	Download(ctx context.Context) <-chan error
}

type Executor

type Executor interface {
	Execute(ctx context.Context, name string, args []string) *exec.Cmd
}

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) Close

func (m *Manager) Close(ctx context.Context) error

func (*Manager) Init

func (m *Manager) Init(ctx context.Context, c config.Config) error

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context) error

type Miner

type Miner interface {
	api.Module
	Name() string
	Algorithms() []Algorithm
	Start(ctx context.Context) error
	Stop() error
	Available() bool
}

type MinerFactory

type MinerFactory func(*Settings) Miner

type MiningConfig

type MiningConfig struct {
	Miner  string `mapstructure:"miner"`
	Pool   string `mapstructure:"pool"`
	Device string `mapstructure:"device"`
}

type Option

type Option interface {
	Configure(o *Settings)
}

func WithDevice

func WithDevice(device *DeviceQuery) Option

func WithDeviceByBus

func WithDeviceByBus(bus string) Option

func WithDeviceByIndex

func WithDeviceByIndex(index int) Option

func WithDeviceByName

func WithDeviceByName(name string) Option

func WithExecutor

func WithExecutor(executor Executor) Option

func WithPool

func WithPool(pool Pool) Option

type OptionFunc

type OptionFunc func(o *Settings)

func (OptionFunc) Configure

func (f OptionFunc) Configure(o *Settings)

type PathExecutor

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

func NewPathExecutor

func NewPathExecutor(basePath string) *PathExecutor

func (*PathExecutor) Execute

func (e *PathExecutor) Execute(ctx context.Context, name string, args []string) *exec.Cmd

type Pool

type Pool struct {
	Url       string    `mapstructure:"url"`
	User      string    `mapstructure:"user"`
	Pass      string    `mapstructure:"pass"`
	Algorithm Algorithm `mapstructure:"algorithm"`
}

type Settings

type Settings struct {
	Executor Executor
	Device   *DeviceQuery
	Pool     Pool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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