wire

package
v0.0.0-...-1c9500d Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PortBlockObserver     int = 52001
	PortStratumClient     int = 52002
	PortPubSubPublishers  int = 52003
	PortPubSubSubscribers int = 52004
	PortCoordinator       int = 52005
)

Variables

View Source
var MessageTypeToTypeMap = map[MessageType]reflect.Type{}

Functions

func GetMessageID

func GetMessageID(m PoolDetectiveMsg) int

Types

type AckMsg

type AckMsg struct {
	Header MsgHeader
	YourID int
}

type BlockObserverBlockObservedMsg

type BlockObserverBlockObservedMsg struct {
	Header     MsgHeader
	LocationID int
	Observed   int64
	CoinID     int
	PeerIP     []byte
	PeerPort   int
	BlockHash  [32]byte
}

BlockObserverBlockObservedMsg is sent from the block observer to the hub when one of its peers announces a block

type BlockObserverGetCoinsRequestMsg

type BlockObserverGetCoinsRequestMsg struct {
	Header MsgHeader
}

BlockObserverGetCoinsRequestMsg is sent from the block observer to the hub to discover the known coins and their ID

type BlockObserverGetCoinsResponseCoin

type BlockObserverGetCoinsResponseCoin struct {
	Ticker string
	CoinID int
}

type BlockObserverGetCoinsResponseMsg

type BlockObserverGetCoinsResponseMsg struct {
	Header MsgHeader
	Coins  []BlockObserverGetCoinsResponseCoin
}

BlockObserverBlockObservedMsg is sent from the block observer to the hub when one of its peers announces a block

type ConnectionEvent

type ConnectionEvent int8
const (
	ConnectionEventConnected               ConnectionEvent = 1
	ConnectionEventDisconnected            ConnectionEvent = 2
	ConnectionEventAuthenticationSucceeded ConnectionEvent = 3
	ConnectionEventAuthenticationFailed    ConnectionEvent = 4
	ConnectionEventShareSubmitted          ConnectionEvent = 5
	ConnectionEventShareAccepted           ConnectionEvent = 6
	ConnectionEventShareDeclined           ConnectionEvent = 7
)

type CoordinatorGetConfigRequestMsg

type CoordinatorGetConfigRequestMsg struct {
	Header     MsgHeader
	LocationID int
}

type CoordinatorGetConfigResponseMsg

type CoordinatorGetConfigResponseMsg struct {
	Header                       MsgHeader
	StratumServers               []CoordinatorGetConfigResponseStratumServer
	StratumClientPoolObserverIDs []int
}

type CoordinatorGetConfigResponseStratumServer

type CoordinatorGetConfigResponseStratumServer struct {
	ID          int
	AlgorithmID int
	Port        int
	Protocol    int
}

type CoordinatorRefreshConfigMsg

type CoordinatorRefreshConfigMsg struct {
	Header MsgHeader
}

type CoordinatorRestartPoolObserverMsg

type CoordinatorRestartPoolObserverMsg struct {
	Header         MsgHeader
	PoolObserverID int
}

type ErrorMsg

type ErrorMsg struct {
	Header MsgHeader
	YourID int
	Error  string
}

type MessageType

type MessageType int16

func GetMessageType

func GetMessageType(m PoolDetectiveMsg) MessageType

type MsgHeader

type MsgHeader struct {
	ID int
}

type PoolDetectiveConn

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

func NewClient

func NewClient(host string, port int) (*PoolDetectiveConn, error)

func NewPublisher

func NewPublisher(port int) (*PoolDetectiveConn, error)

func NewServer

func NewServer(port int) (*PoolDetectiveConn, error)

func NewSubscriber

func NewSubscriber(host string, port int) (*PoolDetectiveConn, error)

func (*PoolDetectiveConn) Close

func (pdc *PoolDetectiveConn) Close() error

func (*PoolDetectiveConn) Publish

func (pdc *PoolDetectiveConn) Publish(channel []byte, msg PoolDetectiveMsg) error

func (*PoolDetectiveConn) Recv

func (pdc *PoolDetectiveConn) Recv() (PoolDetectiveMsg, bool, error)

func (*PoolDetectiveConn) RecvSub

func (pdc *PoolDetectiveConn) RecvSub() (PoolDetectiveMsg, []byte, bool, error)

func (*PoolDetectiveConn) Send

func (pdc *PoolDetectiveConn) Send(msg PoolDetectiveMsg) error

func (*PoolDetectiveConn) Subscribe

func (pdc *PoolDetectiveConn) Subscribe(channel []byte) error

type PoolDetectiveMsg

type PoolDetectiveMsg interface {
}

func NewMessage

func NewMessage(mt MessageType) PoolDetectiveMsg

type ShareEvent

type ShareEvent int8
const (
	ShareEventSubmitted ShareEvent = 1
	ShareEventAccepted  ShareEvent = 2
	ShareEventDeclined  ShareEvent = 3
)

type StratumClientConnectionEventMsg

type StratumClientConnectionEventMsg struct {
	Header         MsgHeader
	PoolObserverID int
	Event          ConnectionEvent
	Observed       int64
}

StratumClientConnectionEventMsg is sent from the stratum client to the hub for connection-level events (connected, disconnected, authenticated, etc)

type StratumClientDifficultyMsg

type StratumClientDifficultyMsg struct {
	Header         MsgHeader
	PoolObserverID int
	Difficulty     float64
}

StratumClientDifficultyMsg is sent from the stratum client to the hub when it received a change in difficulty

type StratumClientExtraNonceMsg

type StratumClientExtraNonceMsg struct {
	Header          MsgHeader
	PoolObserverID  int
	ExtraNonce1     []byte
	ExtraNonce2Size int8
}

StratumClientExtraNonceMsg is sent from the stratum client to the hub when it received a change in extranonce data

type StratumClientJobMsg

type StratumClientJobMsg struct {
	Header            MsgHeader
	PoolObserverID    int
	Observed          int64
	JobID             []byte
	PreviousBlockHash []byte
	GenTX1            []byte
	GenTX2            []byte
	MerkleBranches    [][]byte
	BlockVersion      []byte
	DifficultyBits    []byte
	Timestamp         int64
	CleanJobs         bool
	Reserved          []byte
}

StratumClientJobMsg is sent from the stratum client to the hub when it received a new job

type StratumClientLoginDetailsRequestMsg

type StratumClientLoginDetailsRequestMsg struct {
	Header         MsgHeader
	PoolObserverID int
}

StratumClientLoginDetailsRequestMsg is sent from the stratum client to the hub to indicate it wants to receive stratum details to connect to (host, port, login, pwd)

type StratumClientLoginDetailsResponseMsg

type StratumClientLoginDetailsResponseMsg struct {
	Header   MsgHeader
	Host     string
	Port     int
	Login    string
	Password string
	Protocol int
}

StratumClientLoginDetailsResponseMsg is sent from the stratum client to the hub to indicate it wants to receive stratum details to connect to (host, port, login, pwd)

type StratumClientShareEventMsg

type StratumClientShareEventMsg struct {
	Header   MsgHeader
	ShareID  int64
	Event    ShareEvent
	Observed int64
	Details  string
}

StratumClientShareEventMsg is sent from the stratum client to the hub for share-level events (submitted, accepted, declined)

type StratumClientSubmitShareMsg

type StratumClientSubmitShareMsg struct {
	Header                 MsgHeader
	ShareID                int64
	PoolJobID              []byte
	ExtraNonce2            []byte
	Time                   int64
	Nonce                  int64
	AdditionalSolutionData [][]byte
}

StratumClientSubmitShareMsg is sent from the hub to the stratum client to have the stratum client submit the share

type StratumClientTargetMsg

type StratumClientTargetMsg struct {
	Header         MsgHeader
	PoolObserverID int
	Target         []byte
}

StratumClientTargetMsg is sent from the stratum client to the hub when it received a new target

Jump to

Keyboard shortcuts

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