Documentation
¶
Index ¶
- type AbstractResponse
- type CGMiner
- func (c *CGMiner) AddPool(url, username, password string) error
- func (c *CGMiner) AddPoolContext(ctx context.Context, url, username, password string) error
- func (c *CGMiner) Call(cmd Command, out AbstractResponse) error
- func (c *CGMiner) CallContext(ctx context.Context, cmd Command, out AbstractResponse) error
- func (c *CGMiner) Devs() (*[]Devs, error)
- func (c *CGMiner) DevsContext(ctx context.Context) (*[]Devs, error)
- func (c *CGMiner) DisablePool(pool *Pool) error
- func (c *CGMiner) DisablePoolContext(ctx context.Context, pool *Pool) error
- func (c *CGMiner) EnablePool(pool *Pool) error
- func (c *CGMiner) EnablePoolContext(ctx context.Context, pool *Pool) error
- func (c *CGMiner) Pools() ([]Pool, error)
- func (c *CGMiner) PoolsContext(ctx context.Context) ([]Pool, error)
- func (c *CGMiner) Quit() error
- func (c *CGMiner) RawCall(ctx context.Context, cmd Command) ([]byte, error)
- func (c *CGMiner) RemovePool(pool *Pool) error
- func (c *CGMiner) Restart() error
- func (c *CGMiner) Stats() (Stats, error)
- func (c *CGMiner) StatsContext(ctx context.Context) (Stats, error)
- func (c *CGMiner) Summary() (*Summary, error)
- func (c *CGMiner) SummaryContext(ctx context.Context) (*Summary, error)
- func (c *CGMiner) SwitchPool(pool *Pool) error
- func (c *CGMiner) Version() (*Version, error)
- func (c *CGMiner) VersionContext(ctx context.Context) (*Version, error)
- type Command
- type ConnectError
- type Devs
- type Dialer
- type GenericResponse
- type GenericStats
- type JSONTransport
- type Number
- type Pool
- type Stats
- type StatsD3
- type StatsL3
- type StatsS7
- type StatsS9
- type StatsT9
- type Status
- type Summary
- type Transport
- type Version
- type VersionResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbstractResponse ¶ added in v1.0.0
type AbstractResponse interface { // HasError returns status error HasError() error }
AbstractResponse is generic command response which provides execution status
type CGMiner ¶
type CGMiner struct { // Address is API endpoint address (host:port) Address string // Timeout is request timeout Timeout time.Duration // Dialer is network dialer Dialer Dialer // Transport is request and response decoder. // // CGMiner might have one of two API formats - JSON or plain text. // JSON is default one. Transport Transport }
CGMiner is cgminer API client
func NewCGMiner ¶
NewCGMiner returns a CGMiner client with JSON API transport
func (*CGMiner) AddPool ¶
AddPool adds the given URL/username/password combination to the miner's pool list.
func (*CGMiner) AddPoolContext ¶ added in v1.0.0
AddPoolContext adds the given URL/username/password combination to the miner's pool list with provided context.
func (*CGMiner) Call ¶ added in v1.0.0
func (c *CGMiner) Call(cmd Command, out AbstractResponse) error
Call sends command to cgminer API and writes result to passed response output or returns error.
If command doesn't returns any response, nil "out" value should be passed.
For context-based requests, use `CallContext()`
func (*CGMiner) CallContext ¶ added in v1.0.0
CallContext sends command to cgminer API using the provided context.
If command doesn't returns any response, nil "out" value should be passed.
func (*CGMiner) DevsContext ¶ added in v1.0.0
DevsContext returns basic information on the miner. See the Devs struct.
func (*CGMiner) DisablePool ¶ added in v1.0.0
func (*CGMiner) DisablePoolContext ¶ added in v1.0.0
func (*CGMiner) EnablePool ¶ added in v1.0.0
func (*CGMiner) EnablePoolContext ¶ added in v1.0.0
func (*CGMiner) PoolsContext ¶ added in v0.2.0
PoolsContext returns a slice of Pool structs, one per pool.
func (*CGMiner) RawCall ¶ added in v1.1.0
RawCall sends command to CGMiner API and returns raw response as slice of bytes.
Response error check should be performed manually.
func (*CGMiner) RemovePool ¶ added in v1.0.0
func (*CGMiner) StatsContext ¶ added in v0.2.0
StatsContext returns basic information on the miner. See the Stats struct.
func (*CGMiner) SummaryContext ¶ added in v0.2.0
SummaryContext returns basic information on the miner. See the Summary struct.
func (*CGMiner) SwitchPool ¶
type Command ¶ added in v1.0.0
type Command struct { Command string `json:"command"` Parameter string `json:"parameter,omitempty"` }
func NewCommand ¶ added in v1.0.0
func NewCommandWithoutParameter ¶ added in v1.0.0
type ConnectError ¶ added in v1.0.0
type ConnectError struct {
// contains filtered or unexported fields
}
ConnectError represents API connection error
func NewConnectError ¶ added in v1.0.2
func NewConnectError(baseError error) ConnectError
NewConnectError wraps error as ConnectError
func (ConnectError) Error ¶ added in v1.0.0
func (err ConnectError) Error() string
Error implements error
func (ConnectError) Unwrap ¶ added in v1.0.0
func (err ConnectError) Unwrap() error
Unwrap implements error
type Devs ¶
type Devs struct { GPU int64 Enabled string Status string 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 TotalMH float64 `json:"TotalMH"` Diff1Work int64 `json:"Diff1 Work"` DifficultyAccepted float64 `json:"Difficulty Accepted"` DifficultyRejected float64 `json:"Difficulty Rejected"` LastValidWork int64 `json:"Last Valid Work"` DeviceHardware float64 `json:"Device Hardware%"` DeviceRejected float64 `json:"Device Rejected%"` DeviceElapsed int64 `json:"Device Elapsed"` }
Devs - device info
type Dialer ¶ added in v1.0.1
type Dialer interface { DialContext(ctx context.Context, network, address string) (net.Conn, error) Dial(network, address string) (net.Conn, error) }
Dialer is abstract network dialer
type GenericResponse ¶
GenericResponse - default struct for all responses
func (GenericResponse) HasError ¶ added in v1.0.0
func (r GenericResponse) HasError() error
HasError implements AbstractResponse interface
type GenericStats ¶
type GenericStats struct { BMMiner string CGMiner string `json:"CGMiner,omitempty"` Miner string CompileTime string Type string MinerID string `json:"miner_id"` MinerVersion string `json:"miner_version"` MinerCount int16 `json:"miner_count"` Elapsed int64 `json:"Elapsed"` Wait float64 DeviceHardwarePercent float64 `json:"Device Hardware%"` Stats int `json:"STATS"` Max float64 NotMatchingWork int `json:"no_matching_work"` ID string Calls int Min float64 TotalAcn int16 `json:"total_acn"` TotalRate float32 `json:"total_rate"` TotalRateIdeal float32 `json:"total_rateideal"` TotalFrequencyAvg float32 `json:"total_freqavg"` Frequency float32 `json:"frequency,string"` FrequencyAvg1 float32 `json:"freq_avg1"` FrequencyAvg2 float32 `json:"freq_avg2"` FrequencyAvg3 float32 `json:"freq_avg3"` FrequencyAvg4 float32 `json:"freq_avg4"` FrequencyAvg5 float32 `json:"freq_avg5"` FrequencyAvg6 float32 `json:"freq_avg6"` FrequencyAvg7 float32 `json:"freq_avg7"` FrequencyAvg8 float32 `json:"freq_avg8"` FrequencyAvg9 float32 `json:"freq_avg9"` FrequencyAvg10 float32 `json:"freq_avg10"` FrequencyAvg11 float32 `json:"freq_avg11"` FrequencyAvg12 float32 `json:"freq_avg12"` FrequencyAvg13 float32 `json:"freq_avg13"` FrequencyAvg14 float32 `json:"freq_avg14"` FrequencyAvg15 float32 `json:"freq_avg15"` FrequencyAvg16 float32 `json:"freq_avg16"` FanNum int16 `json:"fan_num"` Fan1 int16 `json:"fan1"` Fan2 int16 `json:"fan2"` Fan3 int16 `json:"fan3"` Fan4 int16 `json:"fan4"` Fan5 int16 `json:"fan5"` Fan6 int16 `json:"fan6"` Fan7 int16 `json:"fan7"` Fan8 int16 `json:"fan8"` TempMax int16 `json:"temp_max"` TempNum int16 `json:"temp_num"` Temp1 int16 `json:"temp1"` Temp2 int16 `json:"temp2"` Temp3 int16 `json:"temp3"` Temp4 int16 `json:"temp4"` Temp5 int16 `json:"temp5"` Temp6 int16 `json:"temp6"` Temp7 int16 `json:"temp7"` Temp8 int16 `json:"temp8"` Temp9 int16 `json:"temp9"` Temp10 int16 `json:"temp10"` Temp11 int16 `json:"temp11"` Temp12 int16 `json:"temp12"` Temp13 int16 `json:"temp13"` Temp14 int16 `json:"temp14"` Temp15 int16 `json:"temp15"` Temp16 int16 `json:"temp16"` Temp2_1 int16 `json:"temp2_1"` Temp2_2 int16 `json:"temp2_2"` Temp2_3 int16 `json:"temp2_3"` Temp2_4 int16 `json:"temp2_4"` Temp2_5 int16 `json:"temp2_5"` Temp2_6 int16 `json:"temp2_6"` Temp2_7 int16 `json:"temp2_7"` Temp2_8 int16 `json:"temp2_8"` Temp2_9 int16 `json:"temp2_9"` Temp2_10 int16 `json:"temp2_10"` Temp2_11 int16 `json:"temp2_11"` Temp2_12 int16 `json:"temp2_12"` Temp2_13 int16 `json:"temp2_13"` Temp2_14 int16 `json:"temp2_14"` Temp2_15 int16 `json:"temp2_15"` Temp2_16 int16 `json:"temp2_16"` Temp3_1 int16 `json:"temp3_1"` Temp3_2 int16 `json:"temp3_2"` Temp3_3 int16 `json:"temp3_3"` Temp3_4 int16 `json:"temp3_4"` Temp3_5 int16 `json:"temp3_5"` Temp3_6 int16 `json:"temp3_6"` Temp3_7 int16 `json:"temp3_7"` Temp3_8 int16 `json:"temp3_8"` Temp3_9 int16 `json:"temp3_9"` Temp3_10 int16 `json:"temp3_10"` Temp3_11 int16 `json:"temp3_11"` Temp3_12 int16 `json:"temp3_12"` Temp3_13 int16 `json:"temp3_13"` Temp3_14 int16 `json:"temp3_14"` Temp3_15 int16 `json:"temp3_15"` Temp3_16 int16 `json:"temp3_16"` // this from L3+ Temp31 int16 `json:"temp31"` Temp32 int16 `json:"temp32"` Temp33 int16 `json:"temp33"` Temp34 int16 `json:"temp34"` Temp4_1 int16 `json:"temp4_1"` Temp4_2 int16 `json:"temp4_2"` Temp4_3 int16 `json:"temp4_3"` Temp4_4 int16 `json:"temp4_4"` // interfcace{} - because S7 has valid value, but all others have quoted value Ghs5s Number `json:"GHS 5s"` GhsAverage float64 `json:"GHS av"` ChainHW1 int `json:"chain_hw1"` ChainHW2 int `json:"chain_hw2"` ChainHW3 int `json:"chain_hw3"` ChainHW4 int `json:"chain_hw4"` ChainHW5 int `json:"chain_hw5"` ChainHW6 int `json:"chain_hw6"` ChainHW7 int `json:"chain_hw7"` ChainHW8 int `json:"chain_hw8"` ChainHW9 int `json:"chain_hw9"` ChainHW10 int `json:"chain_hw10"` ChainHW11 int `json:"chain_hw11"` ChainHW12 int `json:"chain_hw12"` ChainHW13 int `json:"chain_hw13"` ChainHW14 int `json:"chain_hw14"` ChainHW15 int `json:"chain_hw15"` ChainHW16 int `json:"chain_hw16"` ChainAcs1 string `json:"chain_acs1"` ChainAcs2 string `json:"chain_acs2"` ChainAcs3 string `json:"chain_acs3"` ChainAcs4 string `json:"chain_acs4"` ChainAcs5 string `json:"chain_acs5"` ChainAcs6 string `json:"chain_acs6"` ChainAcs7 string `json:"chain_acs7"` ChainAcs8 string `json:"chain_acs8"` ChainAcs9 string `json:"chain_acs9"` ChainAcs10 string `json:"chain_acs10"` ChainAcs11 string `json:"chain_acs11"` ChainAcs12 string `json:"chain_acs12"` ChainAcs13 string `json:"chain_acs13"` ChainAcs14 string `json:"chain_acs14"` ChainAcs15 string `json:"chain_acs15"` ChainAcs16 string `json:"chain_acs16"` ChainAcn1 int `json:"chain_acn1"` ChainAcn2 int `json:"chain_acn2"` ChainAcn3 int `json:"chain_acn3"` ChainAcn4 int `json:"chain_acn4"` ChainAcn5 int `json:"chain_acn5"` ChainAcn6 int `json:"chain_acn6"` ChainAcn7 int `json:"chain_acn7"` ChainAcn8 int `json:"chain_acn8"` ChainAcn9 int `json:"chain_acn9"` ChainAcn10 int `json:"chain_acn10"` ChainAcn11 int `json:"chain_acn11"` ChainAcn12 int `json:"chain_acn12"` ChainAcn13 int `json:"chain_acn13"` ChainAcn14 int `json:"chain_acn14"` ChainAcn15 int `json:"chain_acn15"` ChainAcn16 int `json:"chain_acn16"` // Number because we cannot parse empty string "" to float // S9(), D3() and other interface methods will correct represent this value as float32 ChainRate1 Number `json:"chain_rate1"` ChainRate2 Number `json:"chain_rate2"` ChainRate3 Number `json:"chain_rate3"` ChainRate4 Number `json:"chain_rate4"` ChainRate5 Number `json:"chain_rate5"` ChainRate6 Number `json:"chain_rate6"` ChainRate7 Number `json:"chain_rate7"` ChainRate8 Number `json:"chain_rate8"` ChainRate9 Number `json:"chain_rate9"` ChainRate10 Number `json:"chain_rate10"` ChainRate11 Number `json:"chain_rate11"` ChainRate12 Number `json:"chain_rate12"` ChainRate13 Number `json:"chain_rate13"` ChainRate14 Number `json:"chain_rate14"` ChainRate15 Number `json:"chain_rate15"` ChainRate16 Number `json:"chain_rate16"` ChainRateIdeal1 float32 `json:"chain_rateideal1"` ChainRateIdeal2 float32 `json:"chain_rateideal2"` ChainRateIdeal3 float32 `json:"chain_rateideal3"` ChainRateIdeal4 float32 `json:"chain_rateideal4"` ChainRateIdeal5 float32 `json:"chain_rateideal5"` ChainRateIdeal6 float32 `json:"chain_rateideal6"` ChainRateIdeal7 float32 `json:"chain_rateideal7"` ChainRateIdeal8 float32 `json:"chain_rateideal8"` ChainRateIdeal9 float32 `json:"chain_rateideal9"` ChainRateIdeal10 float32 `json:"chain_rateideal10"` ChainRateIdeal11 float32 `json:"chain_rateideal11"` ChainRateIdeal12 float32 `json:"chain_rateideal12"` ChainRateIdeal13 float32 `json:"chain_rateideal13"` ChainRateIdeal14 float32 `json:"chain_rateideal14"` ChainRateIdeal15 float32 `json:"chain_rateideal15"` ChainRateIdeal16 float32 `json:"chain_rateideal16"` ChainOpenCore1 int `json:"chain_opencore_1,string"` ChainOpenCore2 int `json:"chain_opencore_2,string"` ChainOpenCore3 int `json:"chain_opencore_3,string"` ChainOpenCore4 int `json:"chain_opencore_4,string"` ChainOpenCore5 int `json:"chain_opencore_5,string"` ChainOpenCore6 int `json:"chain_opencore_6,string"` ChainOpenCore7 int `json:"chain_opencore_7,string"` ChainOpenCore8 int `json:"chain_opencore_8,string"` ChainOpenCore9 int `json:"chain_opencore_9,string"` ChainOpenCore10 int `json:"chain_opencore_10,string"` ChainOpenCore11 int `json:"chain_opencore_11,string"` ChainOpenCore12 int `json:"chain_opencore_12,string"` ChainOpenCore13 int `json:"chain_opencore_13,string"` ChainOpenCore14 int `json:"chain_opencore_14,string"` ChainOpenCore15 int `json:"chain_opencore_15,string"` ChainOpenCore16 int `json:"chain_opencore_16,string"` ChainOffside1 int `json:"chain_offside_1,string"` ChainOffside2 int `json:"chain_offside_2,string"` ChainOffside3 int `json:"chain_offside_3,string"` ChainOffside4 int `json:"chain_offside_4,string"` ChainOffside5 int `json:"chain_offside_5,string"` ChainOffside6 int `json:"chain_offside_6,string"` ChainOffside7 int `json:"chain_offside_7,string"` ChainOffside8 int `json:"chain_offside_8,string"` ChainOffside9 int `json:"chain_offside_9,string"` ChainOffside10 int `json:"chain_offside_10,string"` ChainOffside11 int `json:"chain_offside_11,string"` ChainOffside12 int `json:"chain_offside_12,string"` ChainOffside13 int `json:"chain_offside_13,string"` ChainOffside14 int `json:"chain_offside_14,string"` ChainOffside15 int `json:"chain_offside_15,string"` ChainOffside16 int `json:"chain_offside_16,string"` ChainXtime1 string `json:"chain_xtime1"` ChainXtime2 string `json:"chain_xtime2"` ChainXtime3 string `json:"chain_xtime3"` ChainXtime4 string `json:"chain_xtime4"` ChainXtime5 string `json:"chain_xtime5"` ChainXtime6 string `json:"chain_xtime6"` ChainXtime7 string `json:"chain_xtime7"` ChainXtime8 string `json:"chain_xtime8"` ChainXtime9 string `json:"chain_xtime9"` ChainXtime10 string `json:"chain_xtime10"` ChainXtime11 string `json:"chain_xtime11"` ChainXtime12 string `json:"chain_xtime12"` ChainXtime13 string `json:"chain_xtime13"` ChainXtime14 string `json:"chain_xtime14"` ChainXtime15 string `json:"chain_xtime15"` ChainXtime16 string `json:"chain_xtime16"` // s7 Baud int `json:"baud"` AsicCount int `json:"asic_count"` Timeout int `json:"timeout"` Voltage float32 `json:"voltage,string"` USBPipe int `json:"USB Pipe,string"` HWv1 int `json:"hwv1"` HWv2 int `json:"hwv2"` HWv3 int `json:"hwv3"` HWv4 int `json:"hwv4"` TempAvg int16 `json:"temp_avg"` }
GenericStats - generic antminer stats struct
func (*GenericStats) D3 ¶
func (s *GenericStats) D3() (*StatsD3, error)
D3 - get struct fields only related to D3
func (*GenericStats) Generic ¶ added in v1.0.0
func (s *GenericStats) Generic() *GenericStats
Generic returns generic stats
func (*GenericStats) L3 ¶
func (s *GenericStats) L3() (*StatsL3, error)
L3 - get struct fields only related to L3+
func (*GenericStats) S7 ¶
func (s *GenericStats) S7() (*StatsS7, error)
S7 - get struct fields only related to S7
func (*GenericStats) S9 ¶
func (s *GenericStats) S9() (*StatsS9, error)
S9 - get struct fields only related to S9
func (*GenericStats) T9 ¶
func (s *GenericStats) T9() (*StatsT9, error)
T9 - get struct fields only related to T9+
type JSONTransport ¶ added in v1.0.0
type JSONTransport struct{}
func NewJSONTransport ¶ added in v1.0.0
func NewJSONTransport() JSONTransport
NewJSONTransport returns JSON encoding/decoding transport
func (JSONTransport) DecodeResponse ¶ added in v1.1.0
func (t JSONTransport) DecodeResponse(conn net.Conn, cmd Command, out AbstractResponse) error
DecodeResponse implements Transport interface
func (JSONTransport) SendCommand ¶ added in v1.0.0
func (t JSONTransport) SendCommand(conn net.Conn, cmd Command) error
SendCommand implements Transport interface
type Number ¶ added in v0.2.0
type Number float64
Number is CGMiner API JSON number value that can be null, int or empty string.
This type serves as json.Number replacement because empty string cannot be unmarshaled into integer with json.Number since Go 1.14.
See: https://golang.org/doc/go1.14#encoding/json
func (*Number) MarshalJSON ¶ added in v1.0.0
func (*Number) UnmarshalJSON ¶ added in v1.0.0
type Pool ¶
type Pool struct { Accepted int64 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"` LongPoll string `json:"Long Poll"` Pool int64 `json:"POOL"` PoolRejectedPercent float64 `json:"Pool Rejected%"` PoolStalePercent 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 `json:"URL"` User string `json:"User"` Works int64 }
Pool - get working pools
type Stats ¶
type Stats interface { Generic() *GenericStats S7() (*StatsS7, error) S9() (*StatsS9, error) D3() (*StatsD3, error) L3() (*StatsL3, error) T9() (*StatsT9, error) }
Stats is a generic stats interface, returned by method Stats()
type StatsD3 ¶
type StatsD3 struct { Stats int `json:"STATS"` CGMiner string `json:"CGMiner,omitempty"` Miner string CompileTime string Type string ID string Elapsed int64 `json:"Elapsed"` Calls int Wait float64 Min float64 Max float64 Ghs5s float64 `json:"GHS 5s,string"` GhsAverage float64 `json:"GHS av"` MinerCount int16 `json:"miner_count"` Frequency float32 `json:"frequency,string"` FanNum int16 `json:"fan_num"` Fan1 int16 `json:"fan1"` Fan2 int16 `json:"fan2"` DeviceHardwarePercent float64 `json:"Device Hardware%"` NotMatchingWork int `json:"no_matching_work"` TempNum int16 `json:"temp_num"` Temp1 int16 `json:"temp1"` Temp2 int16 `json:"temp2"` Temp3 int16 `json:"temp3"` Temp4 int16 `json:"temp4"` Temp2_1 int16 `json:"temp2_1"` Temp2_2 int16 `json:"temp2_2"` Temp2_3 int16 `json:"temp2_3"` TempMax int16 `json:"temp_max"` ChainAcn1 int `json:"chain_acn1"` ChainAcn2 int `json:"chain_acn2"` ChainAcn3 int `json:"chain_acn3"` ChainAcs1 string `json:"chain_acs1"` ChainAcs2 string `json:"chain_acs2"` ChainAcs3 string `json:"chain_acs3"` ChainHW1 int `json:"chain_hw1"` ChainHW2 int `json:"chain_hw2"` ChainHW3 int `json:"chain_hw3"` ChainRate1 float32 `json:"chain_rate1"` ChainRate2 float32 `json:"chain_rate2"` ChainRate3 float32 `json:"chain_rate3"` }
StatsD3 - antminer stats related to D3
type StatsL3 ¶
type StatsL3 struct { CGMiner string Miner string CompileTime string Type string MinerCount int16 `json:"miner_count"` Elapsed int64 `json:"Elapsed"` Wait float64 DeviceHardwarePercent float64 `json:"Device Hardware%"` NotMatchingWork int `json:"no_matching_work"` Stats int `json:"STATS"` Min float64 Max float64 ID string Calls int Frequency float32 `json:"frequency,string"` FanNum int16 `json:"fan_num"` Fan1 int16 `json:"fan1"` Fan2 int16 `json:"fan2"` TempMax int16 `json:"temp_max"` TempNum int16 `json:"temp_num"` Temp1 int16 `json:"temp1"` Temp2 int16 `json:"temp2"` Temp3 int16 `json:"temp3"` Temp4 int16 `json:"temp4"` Temp2_1 int16 `json:"temp2_1"` Temp2_2 int16 `json:"temp2_2"` Temp2_3 int16 `json:"temp2_3"` Temp2_4 int16 `json:"temp2_4"` Temp3_1 int16 `json:"temp31"` Temp3_2 int16 `json:"temp32"` Temp3_3 int16 `json:"temp33"` Temp3_4 int16 `json:"temp34"` Temp4_1 int16 `json:"temp4_1"` Temp4_2 int16 `json:"temp4_2"` Temp4_3 int16 `json:"temp4_3"` Temp4_4 int16 `json:"temp4_4"` Ghs5s float64 `json:"GHS 5s,string"` GhsAverage float64 `json:"GHS av"` ChainHW1 int `json:"chain_hw1"` ChainHW2 int `json:"chain_hw2"` ChainHW3 int `json:"chain_hw3"` ChainHW4 int `json:"chain_hw4"` ChainAcs1 string `json:"chain_acs1"` ChainAcs2 string `json:"chain_acs2"` ChainAcs3 string `json:"chain_acs3"` ChainAcs4 string `json:"chain_acs4"` ChainAcn1 int `json:"chain_acn1"` ChainAcn2 int `json:"chain_acn2"` ChainAcn3 int `json:"chain_acn3"` ChainAcn4 int `json:"chain_acn4"` ChainRate1 float32 `json:"chain_rate1"` ChainRate2 float32 `json:"chain_rate2"` ChainRate3 float32 `json:"chain_rate3"` ChainRate4 float32 `json:"chain_rate4"` }
StatsL3 - antminer stats related to L3+
type StatsS7 ¶
type StatsS7 struct { CGMiner string `json:"CGMiner,omitempty"` Miner string CompileTime string Type string Stats int `json:"STATS"` ID string Elapsed int64 `json:"Elapsed"` Calls int Wait float64 Max float64 Min float64 Ghs5s float64 `json:"GHS 5s"` GhsAverage float64 `json:"GHS av"` Baud int `json:"baud"` MinerCount int16 `json:"miner_count"` AsicCount int `json:"asic_count"` Timeout int `json:"timeout"` Frequency float32 `json:"frequency,string"` Voltage float32 `json:"voltage,string"` FanNum int16 `json:"fan_num"` Fan1 int16 `json:"fan1"` Fan3 int16 `json:"fan3"` TempNum int16 `json:"temp_num"` Temp1 int16 `json:"temp1"` Temp2 int16 `json:"temp2"` Temp3 int16 `json:"temp3"` TempAvg int16 `json:"temp_avg"` TempMax int16 `json:"temp_max"` DeviceHardwarePercent float64 `json:"Device Hardware%"` NotMatchingWork int `json:"no_matching_work"` USBPipe int `json:"USB Pipe,string"` HWv1 int `json:"hwv1"` HWv2 int `json:"hwv2"` HWv3 int `json:"hwv3"` HWv4 int `json:"hwv4"` ChainAcn1 int `json:"chain_acn1"` ChainAcn2 int `json:"chain_acn2"` ChainAcn3 int `json:"chain_acn3"` ChainAcs1 string `json:"chain_acs1"` ChainAcs2 string `json:"chain_acs2"` ChainAcs3 string `json:"chain_acs3"` }
StatsS7 - generic antminer stats struct
type StatsS9 ¶
type StatsS9 struct { BMMiner string API string Miner string CompileTime string Type string MinerID string `json:"miner_id"` MinerVersion string `json:"miner_version"` MinerCount int16 `json:"miner_count"` Elapsed int64 `json:"Elapsed"` Wait float64 DeviceHardwarePercent float64 `json:"Device Hardware%"` Stats int `json:"STATS"` Max float64 NotMatchingWork int `json:"no_matching_work"` ID string Calls int Min float64 TotalAcn int16 `json:"total_acn"` TotalRate float32 `json:"total_rate"` TotalRateIdeal float32 `json:"total_rateideal"` TotalFrequencyAvg float32 `json:"total_freqavg"` Frequency float32 `json:"frequency,string"` FrequencyAvg6 float32 `json:"freq_avg6"` FrequencyAvg7 float32 `json:"freq_avg7"` FrequencyAvg8 float32 `json:"freq_avg8"` FanNum int16 `json:"fan_num"` Fan3 int16 `json:"fan3"` Fan6 int16 `json:"fan6"` TempMax int16 `json:"temp_max"` TempNum int16 `json:"temp_num"` Temp6 int16 `json:"temp6"` Temp7 int16 `json:"temp7"` Temp8 int16 `json:"temp8"` Temp2_6 int16 `json:"temp2_6"` Temp2_7 int16 `json:"temp2_7"` Temp2_8 int16 `json:"temp2_8"` Ghs5s float64 `json:"GHS 5s,string"` GhsAverage float64 `json:"GHS av"` ChainHW6 int `json:"chain_hw6"` ChainHW7 int `json:"chain_hw7"` ChainHW8 int `json:"chain_hw8"` ChainAcs6 string `json:"chain_acs6"` ChainAcs7 string `json:"chain_acs7"` ChainAcs8 string `json:"chain_acs8"` ChainAcn6 int `json:"chain_acn6"` ChainAcn7 int `json:"chain_acn7"` ChainAcn8 int `json:"chain_acn8"` ChainRate6 float32 `json:"chain_rate6"` ChainRate7 float32 `json:"chain_rate7"` ChainRate8 float32 `json:"chain_rate8"` ChainRateIdeal6 float32 `json:"chain_rateideal6"` ChainRateIdeal7 float32 `json:"chain_rateideal7"` ChainRateIdeal8 float32 `json:"chain_rateideal8"` ChainOpenCore6 int `json:"chain_opencore_6,string"` ChainOpenCore7 int `json:"chain_opencore_7,string"` ChainOpenCore8 int `json:"chain_opencore_8,string"` ChainOffside6 int `json:"chain_offside_6,string"` ChainOffside7 int `json:"chain_offside_7,string"` ChainOffside8 int `json:"chain_offside_8,string"` // ChainXtime6 need to be parsed? ChainXtime6 string `json:"chain_xtime6"` ChainXtime7 string `json:"chain_xtime7"` ChainXtime8 string `json:"chain_xtime8"` }
StatsS9 - get stats from antminer S9
type StatsT9 ¶
type StatsT9 struct { BMMiner string Miner string CompileTime string Type string ID string Stats int `json:"STATS"` Elapsed int64 `json:"Elapsed"` Calls int Wait float64 Max float64 Min float64 Ghs5s float64 `json:"GHS 5s,string"` GhsAverage float64 `json:"GHS av"` MinerCount int16 `json:"miner_count"` Frequency float32 `json:"frequency,string"` FanNum int16 `json:"fan_num"` Fan3 int16 `json:"fan3"` Fan6 int16 `json:"fan6"` TempNum int16 `json:"temp_num"` Temp2 int16 `json:"temp2"` Temp3 int16 `json:"temp3"` Temp4 int16 `json:"temp4"` Temp9 int16 `json:"temp9"` Temp10 int16 `json:"temp10"` Temp11 int16 `json:"temp11"` Temp12 int16 `json:"temp12"` Temp13 int16 `json:"temp13"` Temp14 int16 `json:"temp14"` Temp2_2 int16 `json:"temp2_2"` Temp2_3 int16 `json:"temp2_3"` Temp2_4 int16 `json:"temp2_4"` Temp2_9 int16 `json:"temp2_9"` Temp2_10 int16 `json:"temp2_10"` Temp2_11 int16 `json:"temp2_11"` Temp2_12 int16 `json:"temp2_12"` Temp2_13 int16 `json:"temp2_13"` Temp2_14 int16 `json:"temp2_14"` TempMax int16 `json:"temp_max"` FrequencyAvg2 float32 `json:"freq_avg2"` FrequencyAvg3 float32 `json:"freq_avg3"` FrequencyAvg4 float32 `json:"freq_avg4"` FrequencyAvg5 float32 `json:"freq_avg5"` FrequencyAvg6 float32 `json:"freq_avg6"` FrequencyAvg7 float32 `json:"freq_avg7"` FrequencyAvg8 float32 `json:"freq_avg8"` FrequencyAvg9 float32 `json:"freq_avg9"` FrequencyAvg10 float32 `json:"freq_avg10"` FrequencyAvg11 float32 `json:"freq_avg11"` FrequencyAvg12 float32 `json:"freq_avg12"` FrequencyAvg13 float32 `json:"freq_avg13"` FrequencyAvg14 float32 `json:"freq_avg14"` TotalRateIdeal float32 `json:"total_rateideal"` TotalFrequencyAvg float32 `json:"total_freqavg"` TotalAcn int16 `json:"total_acn"` TotalRate float32 `json:"total_rate"` ChainRateIdeal2 float32 `json:"chain_rateideal2"` ChainRateIdeal3 float32 `json:"chain_rateideal3"` ChainRateIdeal4 float32 `json:"chain_rateideal4"` ChainRateIdeal9 float32 `json:"chain_rateideal9"` ChainRateIdeal10 float32 `json:"chain_rateideal10"` ChainRateIdeal11 float32 `json:"chain_rateideal11"` ChainRateIdeal12 float32 `json:"chain_rateideal12"` ChainRateIdeal13 float32 `json:"chain_rateideal13"` ChainRateIdeal14 float32 `json:"chain_rateideal14"` DeviceHardwarePercent float64 `json:"Device Hardware%"` NotMatchingWork int `json:"no_matching_work"` ChainAcn2 int `json:"chain_acn2"` ChainAcn3 int `json:"chain_acn3"` ChainAcn4 int `json:"chain_acn4"` ChainAcn9 int `json:"chain_acn9"` ChainAcn10 int `json:"chain_acn10"` ChainAcn11 int `json:"chain_acn11"` ChainAcn12 int `json:"chain_acn12"` ChainAcn13 int `json:"chain_acn13"` ChainAcn14 int `json:"chain_acn14"` ChainAcs2 string `json:"chain_acs2"` ChainAcs3 string `json:"chain_acs3"` ChainAcs4 string `json:"chain_acs4"` ChainAcs9 string `json:"chain_acs9"` ChainAcs10 string `json:"chain_acs10"` ChainAcs11 string `json:"chain_acs11"` ChainAcs12 string `json:"chain_acs12"` ChainAcs13 string `json:"chain_acs13"` ChainAcs14 string `json:"chain_acs14"` ChainHW2 int `json:"chain_hw2"` ChainHW3 int `json:"chain_hw3"` ChainHW4 int `json:"chain_hw4"` ChainHW9 int `json:"chain_hw9"` ChainHW10 int `json:"chain_hw10"` ChainHW11 int `json:"chain_hw11"` ChainHW12 int `json:"chain_hw12"` ChainHW13 int `json:"chain_hw13"` ChainHW14 int `json:"chain_hw14"` ChainRate2 float32 `json:"chain_rate2"` ChainRate3 float32 `json:"chain_rate3"` ChainRate4 float32 `json:"chain_rate4"` ChainRate9 float32 `json:"chain_rate9"` ChainRate10 float32 `json:"chain_rate10"` ChainRate11 float32 `json:"chain_rate11"` ChainRate12 float32 `json:"chain_rate12"` ChainRate13 float32 `json:"chain_rate13"` ChainRate14 float32 `json:"chain_rate14"` ChainXtime2 string `json:"chain_xtime2"` ChainXtime3 string `json:"chain_xtime3"` ChainXtime4 string `json:"chain_xtime4"` ChainXtime9 string `json:"chain_xtime9"` ChainXtime10 string `json:"chain_xtime10"` ChainXtime11 string `json:"chain_xtime11"` ChainXtime12 string `json:"chain_xtime12"` ChainXtime13 string `json:"chain_xtime13"` ChainXtime14 string `json:"chain_xtime14"` ChainOffside2 int `json:"chain_offside_2,string"` ChainOffside3 int `json:"chain_offside_3,string"` ChainOffside4 int `json:"chain_offside_4,string"` ChainOffside9 int `json:"chain_offside_9,string"` ChainOffside10 int `json:"chain_offside_10,string"` ChainOffside11 int `json:"chain_offside_11,string"` ChainOffside12 int `json:"chain_offside_12,string"` ChainOffside13 int `json:"chain_offside_13,string"` ChainOffside14 int `json:"chain_offside_14,string"` ChainOpenCore2 int `json:"chain_opencore_2,string"` ChainOpenCore3 int `json:"chain_opencore_3,string"` ChainOpenCore4 int `json:"chain_opencore_4,string"` ChainOpenCore9 int `json:"chain_opencore_9,string"` ChainOpenCore10 int `json:"chain_opencore_10,string"` ChainOpenCore11 int `json:"chain_opencore_11,string"` ChainOpenCore12 int `json:"chain_opencore_12,string"` ChainOpenCore13 int `json:"chain_opencore_13,string"` ChainOpenCore14 int `json:"chain_opencore_14,string"` MinerID string `json:"miner_id"` MinerVersion string `json:"miner_version"` }
StatsT9 - generic antminer stats struct
type Status ¶
type Status struct { Status string `json:"STATUS"` When int Code int Msg string Description string }
Status - status of request
type Summary ¶
type Summary struct { Accepted int64 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"` // non s7/s9/d3 etc. MHS5s float64 `json:"MHS 5s"` MHSav float64 `json:"MHS av"` // s7 and later GHS5s float64 `json:"GHS 5s,string"` GHSav float64 `json:"GHS av"` NetworkBlocks int64 `json:"Network Blocks"` PoolRejectedPercent float64 `json:"Pool Rejected%"` PoolStalePercent float64 `json:"Pool Stale%"` Rejected int64 RemoteFailures int64 `json:"Remote Failures"` Stale int64 TotalMH float64 `json:"Total MH"` Utility float64 WorkUtility float64 `json:"Work Utility"` LastGetWork int `json:"Last getwork"` }
Summary - miner summary
type Transport ¶ added in v1.0.0
type Transport interface { // SendCommand encodes and sends passed command SendCommand(conn net.Conn, cmd Command) error // DecodeResponse reads and decodes response from CGMiner API connection. // // Response destination is passed to "out" and should be pointer. // // nil "out" value can be passed if command doesn't returns any response. DecodeResponse(conn net.Conn, cmd Command, out AbstractResponse) error }
Transport encodes request and decodes response from cgminer API.
CGMiner have two communication formats: JSON and plain-text. One of them or both might be enabled.
Use corresponding transport for specific case.
type VersionResponse ¶
type VersionResponse struct { GenericResponse Version []Version `json:"VERSION"` }
VersionResponse - returned by "version" command