Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrStratumStaleWork = fmt.Errorf("Stale work, throwing away")
ErrStratumStaleWork indicates that the work to send to the pool was stale.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
Types ¶
type BasicReply ¶
type BasicReply struct {
ID interface{} `json:"id"`
Error StratErr `json:"error,omitempty"`
Result bool `json:"result"`
}
Basic reply is a reply type for any of the simple messages.
type Config ¶
type Config struct {
Pool string
User string
Pass string
Proxy string
ProxyUser string
ProxyPass string
Version string
}
Config holdes the config options that may be used by a stratum pool.
type NotifyRes ¶
type NotifyRes struct {
JobID string
Hash string
GenTX1 string
GenTX2 string
MerkleBranches []string
BlockVersion string
Nbits string
Ntime string
CleanJobs bool
}
NotifyRes models the json from a mining.notify message.
type NotifyWork ¶
type NotifyWork struct {
Clean bool
ExtraNonce1 string
ExtraNonce2 uint64
ExtraNonce2Length float64
Nonce2 uint32
CB1 string
CB2 string
Height int64
NtimeDelta int64
JobID string
Hash string
Nbits string
Ntime string
Version string
NewWork bool
Work *work.Work
}
NotifyWork holds all the info recieved from a mining.notify message along with the Work data generate from it.
type StratErr ¶
type StratErr struct {
ErrNum uint64
ErrStr string
Result *json.RawMessage `json:"result,omitempty"`
}
StratErr is the basic error type (a number and a string) sent by the stratum server.
type Stratum ¶
type Stratum struct {
// The following variables must only be used atomically.
sync.Mutex
Conn net.Conn
Reader *bufio.Reader
ID uint64
Diff float64
Target *big.Int
PoolWork NotifyWork
// contains filtered or unexported fields
}
Stratum holds all the shared information for a stratum connection. XXX most of these should be unexported and use getters/setters.
func StratumConn ¶
StratumConn starts the initial connection to a stratum pool and sets defaults in the pool object.
func (*Stratum) Listen ¶
func (s *Stratum) Listen()
Listen is the listener for the incoming messages from the stratum pool.
func (*Stratum) PrepSubmit ¶
PrepSubmit formats a mining.sumbit message from the solved work.
func (*Stratum) Reconnect ¶
Reconnect reconnects to a stratum server if the connection has been lost.
type StratumMsg ¶
type StratumMsg struct {
Method string `json:"method"`
// Need to make generic.
Params []string `json:"params"`
ID interface{} `json:"id"`
}
StratumMsg is the basic message object from stratum.
type StratumRsp ¶
type StratumRsp struct {
Method string `json:"method"`
// Need to make generic.
ID interface{} `json:"id"`
Error StratErr `json:"error,omitempty"`
Result *json.RawMessage `json:"result,omitempty"`
}
StratumRsp is the basic response type from stratum.
type Submit ¶
type Submit struct {
Params []string `json:"params"`
ID interface{} `json:"id"`
Method string `json:"method"`
}
Submit models a submission message.
type SubscribeReply ¶
SubscribeReply models the server response to a subscribe message.