sfourman / go-cgminer-api

Library for accessing the CGMiner API from Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CGMiner API for Go

Installation

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

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

API Documentation

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

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

Quickstart

package main

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

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

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

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

About

Library for accessing the CGMiner API from Go

License:MIT License


Languages

Language:Go 100.0%