sgminer

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

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

Go to latest
Published: May 18, 2015 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

SGMiner API for Go

Installation

# install the library:
go get github.com/Nitron/go-sgminer-api

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

API Documentation

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

http://godoc.org/github.com/Nitron/go-sgminer-api

Quickstart

package main

import (
    "github.com/Nitron/go-sgminer-api"
    "log"
)

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

    // Convert hashrate into KH/s
    hashrate := summary.MHSav * 1000.0

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Devs

type Devs struct {
	GPU                 int64
	Enabled             string
	Status              string
	GPULoad             int64 `json:"GPU Load"`
	Temperature         float64
	FanSpeed            int     `json:"Fan Speed"`
	FanPercent          int64   `json:"Fan Percent"`
	GPUClock            int64   `json:"GPU Clock"`
	MemoryClock         int64   `json:"Memory Clock"`
	GPUVoltage          float64 `json:"GPU Voltage"`
	Powertune           int64
	MHSav               float64 `json:"MHS av"`
	MHS5s               float64 `json:"MHS 5s"`
	Accepted            int64
	Rejected            int64
	HardwareErrors      int64 `json:"Hardware Errors"`
	Utility             float64
	Intensity           string
	LastSharePool       int64   `json:"Last Share Pool"`
	LashShareTime       int64   `json:"Lash Share Time"`
	TotalMH             float64 `json:"TotalMH"`
	Diff1Work           float64 `json:"Diff1 Work"`
	DifficultyAccepted  float64 `json:"Difficulty Accepted"`
	DifficultyRejected  float64 `json:"Difficulty Rejected"`
	LastShareDifficulty float64 `json:"Last Share Difficulty"`
	LastValidWork       int64   `json:"Last Valid Work"`
	DeviceHardware      float64 `json:"Device Hardware%"`
	DeviceRejected      float64 `json:"Device Rejected%"`
	DeviceElapsed       int64   `json:"Device Elapsed"`
}

type Pool

type Pool struct {
	Algorithm              string
	Accepted               int64
	BestShare              float64 `json:"Best Share"`
	Diff1Shares            float64 `json:"Diff1 Shares"`
	DifficultyAccepted     float64 `json:"Difficulty Accepted"`
	DifficultyRejected     float64 `json:"Difficulty Rejected"`
	DifficultyStale        float64 `json:"Difficulty Stale"`
	Discarded              int64
	GetFailures            int64 `json:"Get Failures"`
	Getworks               int64
	HasGBT                 bool    `json:"Has GBT"`
	HasStratum             bool    `json:"Has Stratum"`
	LastShareDifficulty    float64 `json:"Last Share Difficulty"`
	LastShareTime          int64   `json:"Last Share Time"`
	LongPoll               string  `json:"Long Poll"`
	Name                   string
	Pool                   int64   `json:"POOL"`
	PoolRejectedPercentage float64 `json:"Pool Rejected%"`
	PoolStalePercentage    float64 `json:"Pool Stale%"`
	Priority               int64
	ProxyType              string `json:"Proxy Type"`
	Proxy                  string
	Quota                  int64
	Rejected               int64
	RemoteFailures         int64 `json:"Remote Failures"`
	Stale                  int64
	Status                 string
	StratumActive          bool   `json:"Stratum Active"`
	StratumURL             string `json:"Stratum URL"`
	URL                    string
	User                   string
	Works                  int64
}

type SGMiner

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

func New

func New(hostname string, port int64) *SGMiner

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

func (*SGMiner) AddPool

func (miner *SGMiner) AddPool(url, username, password string) error

AddPool adds the given URL/username/password combination to the miner's pool list.

func (*SGMiner) Delete

func (miner *SGMiner) Delete(pool *Pool) error

func (*SGMiner) Devs

func (miner *SGMiner) Devs() (*[]Devs, error)

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

func (*SGMiner) Disable

func (miner *SGMiner) Disable(pool *Pool) error

func (*SGMiner) Enable

func (miner *SGMiner) Enable(pool *Pool) error

func (*SGMiner) Pools

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

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

func (*SGMiner) Quit

func (miner *SGMiner) Quit() error

func (*SGMiner) Restart

func (miner *SGMiner) Restart() error

func (*SGMiner) Run

func (miner *SGMiner) Run(command, argument string) (string, error)

func (*SGMiner) Summary

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

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

func (*SGMiner) SwitchPool

func (miner *SGMiner) SwitchPool(pool *Pool) error

type Summary

type Summary struct {
	Accepted               int64
	BestShare              float64 `json:"Best Share"`
	DeviceHardwarePercent  float64 `json:"Device Hardware%"`
	DeviceRejectedPercent  float64 `json:"Device Rejected%"`
	DifficultyAccepted     float64 `json:"Difficulty Accepted"`
	DifficultyRejected     float64 `json:"Difficulty Rejected"`
	DifficultyStale        float64 `json:"Difficulty Stale"`
	Discarded              int64
	Elapsed                int64
	FoundBlocks            int64 `json:"Found Blocks"`
	GetFailures            int64 `json:"Get Failures"`
	Getworks               int64
	HardwareErrors         int64   `json:"Hardware Errors"`
	LocalWork              int64   `json:"Local Work"`
	MHS5s                  float64 `json:"MHS 5s"`
	MHSav                  float64 `json:"MHS av"`
	NetworkBlocks          int64   `json:"Network Blocks"`
	PoolRejectedPercentage float64 `json:"Pool Rejected%"`
	PoolStalePercentage    float64 `json:"Pool Stale%"`
	Rejected               int64
	RemoteFailures         int64 `json:"Remote Failures"`
	Stale                  int64
	TotalMH                float64 `json:"Total MH"`
	Utilty                 float64
	WorkUtility            float64 `json:"Work Utility"`
}

Jump to

Keyboard shortcuts

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