Documentation
¶
Index ¶
- Variables
- func NewCoinhiveServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec
- func NewCoinhiveServerCodecContext(ctx context.Context, conn io.ReadWriteCloser) rpc.ServerCodec
- func NewDefaultServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec
- func NewDefaultServerCodecContext(ctx context.Context, conn io.ReadWriteCloser) rpc.ServerCodec
- type Client
- type CoinhiveServerCodec
- func (c *CoinhiveServerCodec) Close() error
- func (c *CoinhiveServerCodec) Notify(method string, args interface{}) error
- func (c *CoinhiveServerCodec) ReadRequestBody(x interface{}) error
- func (c *CoinhiveServerCodec) ReadRequestHeader(r *rpc.Request) (err error)
- func (c *CoinhiveServerCodec) WriteResponse(r *rpc.Response, x interface{}) error
- type DefaultServerCodec
- func (c *DefaultServerCodec) Close() error
- func (d *DefaultServerCodec) Notify(method string, args interface{}) error
- func (c *DefaultServerCodec) ReadRequestBody(x interface{}) error
- func (c *DefaultServerCodec) ReadRequestHeader(r *rpc.Request) (err error)
- func (c *DefaultServerCodec) WriteResponse(r *rpc.Response, x interface{}) error
- type Notification
- type Server
Constants ¶
This section is empty.
Variables ¶
var ( // CallTimeout is the amount of time we wait for a response before we return an error CallTimeout = 30 * time.Second // ErrCallTimedOut means that call did not succeed within CallTimeout ErrCallTimedOut = errors.New("rpc call timeout") )
Functions ¶
func NewCoinhiveServerCodec ¶
func NewCoinhiveServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec
NewCoinhiveServerCodec returns a new rpc.ServerCodec for handling requests from the Coinhive Miner
func NewCoinhiveServerCodecContext ¶
func NewCoinhiveServerCodecContext(ctx context.Context, conn io.ReadWriteCloser) rpc.ServerCodec
NewCoinhiveServerCodecContext is NewCoinhiveServerCodec with given context provided within parameters for compatible RPC methods.
func NewDefaultServerCodec ¶
func NewDefaultServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec
NewDefaultServerCodec returns a new rpc.ServerCodec for handling from a miner implementing the (standard?) xmr stratum+tcp protocol
func NewDefaultServerCodecContext ¶
func NewDefaultServerCodecContext(ctx context.Context, conn io.ReadWriteCloser) rpc.ServerCodec
NewDefaultServerCodecContext is NewDefaultServerCodec with given context provided within parameters for compatible RPC methods.
Types ¶
type Client ¶
func DialTimeout ¶
DialTimeout is Dial, but with the timeout specified
func NewClient ¶
func NewClient(conn io.ReadWriteCloser) *Client
NewClient returns a new Client to handle requests to the set of services at the other end of the connection.
func (*Client) Call ¶
Call wraps rpc.Call to provide a timeout - otherwise functionality is the same
func (*Client) Notifications ¶
func (c *Client) Notifications() chan Notification
type CoinhiveServerCodec ¶
type CoinhiveServerCodec struct {
// contains filtered or unexported fields
}
func (*CoinhiveServerCodec) Close ¶
func (c *CoinhiveServerCodec) Close() error
Close implements rpc.ServerCodec
func (*CoinhiveServerCodec) Notify ¶
func (c *CoinhiveServerCodec) Notify(method string, args interface{}) error
func (*CoinhiveServerCodec) ReadRequestBody ¶
func (c *CoinhiveServerCodec) ReadRequestBody(x interface{}) error
ReadRequestBody implements rpc.ServerCodec
func (*CoinhiveServerCodec) ReadRequestHeader ¶
func (c *CoinhiveServerCodec) ReadRequestHeader(r *rpc.Request) (err error)
ReadRequestHeader implements rpc.ServerCodec
func (*CoinhiveServerCodec) WriteResponse ¶
func (c *CoinhiveServerCodec) WriteResponse(r *rpc.Response, x interface{}) error
WriteResponse implements rpc.ServerCodec
type DefaultServerCodec ¶
type DefaultServerCodec struct {
// contains filtered or unexported fields
}
DefaultServerCodec handles xmr stratum+tcp requests and is capabable of sending a notification to the connection using it.
func (*DefaultServerCodec) Close ¶
func (c *DefaultServerCodec) Close() error
Close implements rpc.ServerCodec
func (*DefaultServerCodec) Notify ¶
func (d *DefaultServerCodec) Notify(method string, args interface{}) error
func (*DefaultServerCodec) ReadRequestBody ¶
func (c *DefaultServerCodec) ReadRequestBody(x interface{}) error
ReadRequestBody implements rpc.ServerCodec
func (*DefaultServerCodec) ReadRequestHeader ¶
func (c *DefaultServerCodec) ReadRequestHeader(r *rpc.Request) (err error)
ReadRequestHeader implements rpc.ServerCodec
func (*DefaultServerCodec) WriteResponse ¶
func (c *DefaultServerCodec) WriteResponse(r *rpc.Response, x interface{}) error
WriteResponse implements rpc.ServerCodec
type Notification ¶
type Notification clientRequest