ccminer

package module
v0.0.0-...-d0b733e Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2018 License: MIT Imports: 6 Imported by: 2

README

CCMiner API for Go

Installation

# install the library:
go get github.com/Elbandi/go-ccminer-api

// Use in your .go code:
import (
    "github.com/Elbandi/go-ccminer-api"
)

API Documentation

Full godoc output from the latest code in master is available here:

http://godoc.org/github.com/Elbandi/go-ccminer-api

Quickstart

package main

import (
    "github.com/Elbandi/go-ccminer-api"
    "log"
)

func main() {
    miner := cgminer.New("localhost", 4068)
    summary, err := miner.Summary()
    if err != nil {
        log.Fatalln("Unable to connect to CCMiner: ", err)
    }

    log.Printf("Average Hashrate: %f KH/s\n", summary.Khs)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CCMiner

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

func New

func New(hostname string, port int64) *CCMiner

New returns a CGMiner pointer, which is used to communicate with a running CGMiner instance. Note that New does not attempt to connect to the miner.

func (*CCMiner) Devs

func (miner *CCMiner) Devs() ([]Device, error)

Devs returns basic information on the miner. See the Devs struct.

func (*CCMiner) Pools

func (miner *CCMiner) Pools() ([]Pool, error)

Pools returns a slice of Pool structs, one per pool.

func (*CCMiner) Summary

func (miner *CCMiner) Summary() (*Summary, error)

Summary returns basic information on the miner. See the Summary struct.

type Device

type Device struct {
	Id             uint8   `mapstructure:"GPU"`
	Bus            uint8   `mapstructure:"BUS"`
	Card           string  `mapstructure:"CARD"`
	Temp           float32 `mapstructure:"TEMP"`
	Power          uint32  `mapstructure:"POWER"`
	Fan            uint16  `mapstructure:"FAN"`
	Rpm            uint16  `mapstructure:"RPM"`
	GpuFreq        uint16  `mapstructure:"FREQ"`
	MemFreq        uint16  `mapstructure:"MEMFREQ"`
	MonitorGpuFreq uint16  `mapstructure:"GPUF"`
	MonitorMemFreq uint16  `mapstructure:"MEMF"`
	Khs            float32 `mapstructure:"KHS"`
	KhsWatt        float32 `mapstructure:"KHW"`
	PowerLimit     uint32  `mapstructure:"PLIM"`
	Accepted       uint64  `mapstructure:"ACC"`
	Rejected       uint64  `mapstructure:"REJ"`
	HardwareErrors uint64  `mapstructure:"HWF"`
	Intensity      string  `mapstructure:"I"`
	Throughput     uint64  `mapstructure:"THR"`
}

type Pool

type Pool struct {
	Name          string  `mapstructure:"POOL"`
	Algo          string  `mapstructure:"ALGO"`
	Url           string  `mapstructure:"URL"`
	User          string  `mapstructure:"USER"`
	Solved        float32 `mapstructure:"SOLV"`
	Accepted      uint64  `mapstructure:"ACC"`
	Rejected      uint64  `mapstructure:"REJ"`
	Stale         uint64  `mapstructure:"STALE"`
	Height        uint64  `mapstructure:"H"`
	LastJobId     string  `mapstructure:"JOB"`
	Diff          float32 `mapstructure:"DIFF"`
	BestShareDiff float32 `mapstructure:"BEST"`
	XNonce2Size   uint8   `mapstructure:"N2SZ"`
	Nonce2        string  `mapstructure:"N2"`
	Ping          float32 `mapstructure:"PING"`
	Disconnects   uint16  `mapstructure:"DISCO"`
	Wait          uint32  `mapstructure:"WAIT"`
	Uptime        uint32  `mapstructure:"UPTIME"`
	TimeStamp     uint64  `mapstructure:"LAST"`
}

type Summary

type Summary struct {
	Name            string  `mapstructure:"NAME"`
	Version         string  `mapstructure:"VER"`
	Api             string  `mapstructure:"API"`
	Algo            string  `mapstructure:"ALGO"`
	Gpus            uint8   `mapstructure:"GPUS"`
	Khs             float32 `mapstructure:"KHS"`
	Solved          float32 `mapstructure:"SOLV"`
	Accepted        uint64  `mapstructure:"ACC"`
	Rejected        uint64  `mapstructure:"REJ"`
	AcceptedMinutes float32 `mapstructure:"ACCMN"`
	Diff            float32 `mapstructure:"DIFF"`
	NetKhs          float32 `mapstructure:"NETKHS"`
	Pools           uint8   `mapstructure:"POOLS"`
	Wait            uint32  `mapstructure:"WAIT"`
	Uptime          uint32  `mapstructure:"UPTIME"`
	TimeStamp       uint64  `mapstructure:"UPTIME"`
}

Jump to

Keyboard shortcuts

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