proxy

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxReqSize = 1024
)

Variables

This section is empty.

Functions

func ConstructRawBlockHex

func ConstructRawBlockHex(oBlock *Block, tplJob *BlockTemplateJob, tpl *BlockTemplate) (string, error)

func ScryptHashVerify

func ScryptHashVerify(oBlock *Block) bool

Types

type Block

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

type BlockTemplate

type BlockTemplate struct {
	sync.RWMutex
	Version        uint32
	Height         uint32
	PrevHash       string
	NBits          uint32
	Target         string
	Difficulty     *big.Int
	BlockTplJobMap map[string]BlockTemplateJob
	TxDetailMap    map[string]string
	// contains filtered or unexported fields
}

type BlockTemplateJob

type BlockTemplateJob struct {
	BlkTplJobId              string
	BlkTplJobTime            uint32
	TxIdList                 []string
	MerkleBranch             []string
	CoinBase1                string
	CoinBase2                string
	CoinBaseValue            int64
	JobTxsFeeTotal           int64
	DefaultWitnessCommitment string
}

type ClusterNode

type ClusterNode struct {
	NodeName string `json:"nodeName"`
	NodeId   uint16 `json:"nodeId"`
	NodeIp   string `json:"nodeIp"`
}

type Config

type Config struct {
	Name                      string        `json:"-"`
	Id                        uint16        `json:"-"`
	Log                       Log           `json:"log"`
	Cluster                   []ClusterNode `json:"cluster"`
	Proxy                     Proxy         `json:"proxy"`
	Api                       api.ApiConfig `json:"api"`
	Upstream                  []Upstream    `json:"upstream"`
	UpstreamCheckInterval     string        `json:"upstreamCheckInterval"`
	UpstreamCoinBaseEncrypted string        `json:"upstreamCoinBaseEncrypted"`
	UpstreamCoinBase          string        `json:"-"`

	Threads int `json:"threads"`

	Coin  string         `json:"coin"`
	Redis storage.Config `json:"redis"`

	BlockUnlocker payouts.UnlockerConfig `json:"unlocker"`
	Payouts       payouts.PayoutsConfig  `json:"payouts"`

	CoinBaseExtraData string `json:"coinbaseExtraData"`

	NewrelicName    string `json:"newrelicName"`
	NewrelicKey     string `json:"newrelicKey"`
	NewrelicVerbose bool   `json:"newrelicVerbose"`
	NewrelicEnabled bool   `json:"newrelicEnabled"`
}

type DiffAdjust

type DiffAdjust struct {
	Enabled          bool   `json:"enabled"`
	AdjustInv        string `json:"adjustInv"`
	ExpectShareCount int64  `json:"expectShareCount"`
}

type ErrorReply

type ErrorReply struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type JSONPushMessage

type JSONPushMessage struct {
	Id     json.RawMessage `json:"id"`
	Method string          `json:"method"`
	Params interface{}     `json:"params"`
}

type JSONRpcReq

type JSONRpcReq struct {
	Id     json.RawMessage `json:"id"`
	Method string          `json:"method"`
	Params json.RawMessage `json:"params"`
}

type JSONRpcResp

type JSONRpcResp struct {
	Id      json.RawMessage `json:"id"`
	Version string          `json:"jsonrpc"`
	Result  interface{}     `json:"result"`
	Error   interface{}     `json:"error,omitempty"`
}

type Log

type Log struct {
	LogSetLevel int `json:"logSetLevel"`
}

type Proxy

type Proxy struct {
	Enabled               bool   `json:"enabled"`
	Listen                string `json:"listen"`
	LimitHeadersSize      int    `json:"limitHeadersSize"`
	LimitBodySize         int64  `json:"limitBodySize"`
	BehindReverseProxy    bool   `json:"behindReverseProxy"`
	BlockRefreshInterval  string `json:"blockRefreshInterval"`
	BlockTemplateInterval string `json:"blockTemplateInterval"`

	Difficulty          int64  `json:"difficulty"`
	StateUpdateInterval string `json:"stateUpdateInterval"`
	HashrateExpiration  string `json:"hashrateExpiration"`

	Policy policy.Config `json:"policy"`

	MaxFails    int64 `json:"maxFails"`
	HealthCheck bool  `json:"healthCheck"`

	Stratum    Stratum    `json:"stratum"`
	DiffAdjust DiffAdjust `json:"diffAdjust"`
}

type ProxyServer

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

func NewProxy

func NewProxy(cfg *Config, backend *storage.RedisClient) *ProxyServer

func (*ProxyServer) DumpAllSessionNames

func (s *ProxyServer) DumpAllSessionNames() map[string]struct{}

func (*ProxyServer) ListenTCP

func (s *ProxyServer) ListenTCP()

func (*ProxyServer) ServeHTTP

func (s *ProxyServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*ProxyServer) Start

func (s *ProxyServer) Start()

func (*ProxyServer) UpdateAllSessionDiff

func (s *ProxyServer) UpdateAllSessionDiff()

type Session

type Session struct {

	// Stratum
	sync.Mutex
	// contains filtered or unexported fields
}

type Stratum

type Stratum struct {
	Enabled bool   `json:"enabled"`
	Listen  string `json:"listen"`
	Timeout string `json:"timeout"`
	MaxConn int    `json:"maxConn"`
}

type StratumReq

type StratumReq struct {
	JSONRpcReq
}

type SubmitReply

type SubmitReply struct {
	Status string `json:"status"`
}

type Upstream

type Upstream struct {
	Name    string `json:"name"`
	Url     string `json:"url"`
	Timeout string `json:"timeout"`
}

Jump to

Keyboard shortcuts

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