proxy

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Generated from https://github.com/streamrail/concurrent-map

Index

Constants

View Source
const (
	MaxReqSize = 1 * 1024
)

Variables

View Source
var SHARD_COUNT = 32

Functions

This section is empty.

Types

type Block

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

func (Block) Difficulty

func (b Block) Difficulty() *big.Int

func (Block) HashNoNonce

func (b Block) HashNoNonce() common.Hash

func (Block) MixDigest

func (b Block) MixDigest() common.Hash

func (Block) Nonce

func (b Block) Nonce() uint64

func (Block) NumberU64

func (b Block) NumberU64() uint64

func (Block) Version added in v0.5.3

func (b Block) Version() params.HeaderVersion

type BlockTemplate

type BlockTemplate struct {
	Header     string
	Seed       string
	Target     string
	Difficulty *big.Int
	Height     uint64
	// contains filtered or unexported fields
}

type Config

type Config struct {
	HttpClient            *http.Client `json:"-"`
	Proxy                 Proxy        `json:"proxy"`
	Frontend              Frontend     `json:"frontend"`
	Upstream              []Upstream   `json:"upstream"`
	UpstreamCheckInterval string       `json:"upstreamCheckInterval"`

	Threads int `json:"threads"`

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

type ErrorReply

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

type Frontend

type Frontend struct {
	Listen     string `json:"listen"`
	Login      string `json:"login"`
	Password   string `json:"password"`
	ForceEmbed bool   `json:"forceEmbed"`
}

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 JobReplyData

type JobReplyData struct {
	Blob   string `json:"blob"`
	JobId  string `json:"job_id"`
	Target string `json:"target"`
}

type Miner

type Miner struct {
	sync.RWMutex
	Id string
	IP string
	// contains filtered or unexported fields
}

func NewMiner

func NewMiner(id, ip string) *Miner

type MinersMap

type MinersMap []*MinersMapShared

A "thread" safe map of type string:*Miner. To avoid lock bottlenecks this map is dived to several (SHARD_COUNT) map shards.

func NewMinersMap

func NewMinersMap() MinersMap

Creates a new concurrent map.

func (MinersMap) Count

func (m MinersMap) Count() int

Returns the number of elements within the map.

func (MinersMap) Get

func (m MinersMap) Get(key string) (*Miner, bool)

Retrieves an element from map under given key.

func (MinersMap) GetShard

func (m MinersMap) GetShard(key string) *MinersMapShared

Returns shard under given key

func (*MinersMap) Has

func (m *MinersMap) Has(key string) bool

Looks up an item under specified key

func (*MinersMap) IsEmpty

func (m *MinersMap) IsEmpty() bool

Checks if map is empty.

func (MinersMap) Iter

func (m MinersMap) Iter() <-chan Tuple

Returns an iterator which could be used in a for range loop.

func (MinersMap) IterBuffered

func (m MinersMap) IterBuffered() <-chan Tuple

Returns a buffered iterator which could be used in a for range loop.

func (*MinersMap) Remove

func (m *MinersMap) Remove(key string)

Removes an element from the map.

func (*MinersMap) Set

func (m *MinersMap) Set(key string, value *Miner)

Sets the given value under the specified key.

type MinersMapShared

type MinersMapShared struct {
	sync.RWMutex // Read Write mutex, guards access to internal map.
	// contains filtered or unexported fields
}

type Proxy

type Proxy struct {
	Listen               string `json:"listen"`
	ClientTimeout        string `json:"clientTimeout"`
	BlockRefreshInterval string `json:"blockRefreshInterval"`
	HashrateWindow       string `json:"hashrateWindow"`
	SubmitHashrate       bool   `json:"submitHashrate"`
	LuckWindow           string `json:"luckWindow"`
	LargeLuckWindow      string `json:"largeLuckWindow"`
}

type ProxyServer

type ProxyServer struct {
	Context context.Context
	Cancel  context.CancelCauseFunc
	// contains filtered or unexported fields
}

func NewEndpoint

func NewEndpoint(cfg *Config) (*ProxyServer, error)

func (*ProxyServer) ServeHTTP

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

func (*ProxyServer) StatsIndex

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

type Session

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

type SubmitReply

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

type Tuple

type Tuple struct {
	Key string
	Val *Miner
}

Used by the Iter & IterBuffered functions to wrap two variables together over a channel,

type Upstream

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

Jump to

Keyboard shortcuts

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