stratum

package
v0.0.0-...-9b2c719 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

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

Callback struct

type Client

type Client struct {
	sync.RWMutex

	ID uint64

	FailsCount uint64
	// contains filtered or unexported fields
}

Client structure

func New

func New(servers string, timeout time.Duration, version, username, password, worker string, tls bool) (*Client, error)

New stratum server client

func (*Client) Auth

func (c *Client) Auth() error

Auth on stratum server

func (*Client) Close

func (c *Client) Close(noReconnect bool)

Close the connection

func (*Client) Dial

func (c *Client) Dial() (err error)

Dial connect to stratum server

func (*Client) GetWork

func (c *Client) GetWork() ([]string, error)

GetWork from stratum server

func (*Client) Read

func (c *Client) Read()

Read from stratum server

func (*Client) RegisterNotification

func (c *Client) RegisterNotification(method string, callback chan *json.RawMessage)

RegisterNotification for notifications

func (*Client) Sick

func (c *Client) Sick() bool

Sick func

func (*Client) SubmitHashrate

func (c *Client) SubmitHashrate(params interface{}) (bool, error)

SubmitHashrate to stratum server

func (*Client) SubmitWork

func (c *Client) SubmitWork(params interface{}) (bool, error)

SubmitWork to stratum server

func (*Client) Subscribe

func (c *Client) Subscribe() error

Subscribe on stratum server

func (*Client) UnregisterNotification

func (c *Client) UnregisterNotification(method string)

UnregisterNotification for notifications

func (*Client) Write

func (c *Client) Write(data []byte) error

Write to stratum server

type Req

type Req struct {
	ID     uint64      `json:"id"`
	Method string      `json:"method"`
	Params interface{} `json:"params"`
	Worker string      `json:"worker,omitempty"`
}

Req struct

type Resp

type Resp struct {
	ID      uint64           `json:"id,omitempty"`
	Method  string           `json:"method,omitempty"`
	Version string           `json:"jsonrpc,omitempty"`
	Result  *json.RawMessage `json:"result,omitempty"`
	Params  *json.RawMessage `json:"params,omitempty"`
	Error   interface{}      `json:"error,omitempty"`
}

Resp struct

Jump to

Keyboard shortcuts

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