config

package
v0.0.0-...-595a13e Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProtoStratum Protocol name for Stratum
	ProtoStratum = "stratum"

	// TransportTCP Transport name for TCP
	TransportTCP = "tcp"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type C

type C struct {
	Pools   []*Pool   `toml:"pool"`
	Workers []*Worker `toml:"worker"`
}

func (*C) LookupPool

func (c *C) LookupPool(name string) (*Pool, error)

LookupPool searches for a single pool in the configuration

func (*C) LookupWorker

func (c *C) LookupWorker(username string) (*Worker, error)

LookupWorker searches for a worker configuration given the username for that worker.

func (*C) ReadConfig

func (c *C) ReadConfig(configPath string) error

func (*C) SetDefaults

func (c *C) SetDefaults()

func (*C) WriteConfig

func (c *C) WriteConfig(configPath string) error

type Pool

type Pool struct {
	Name     string
	Address  TransportAddress
	Username string
	Password string `default:"x"`
	Timeout  int    `default:"10"`
}

func (*Pool) OpenConnection

func (p *Pool) OpenConnection() (net.Conn, error)

OpenConnection creates a net.Conn to access the current pool.

type PoolRef

type PoolRef struct {
	Name string
}

type Transport

type Transport struct {
	Protocol  string
	Transport string
	Address   string
	Port      string
}

func (*Transport) AddrSpec

func (t *Transport) AddrSpec() string

AddrSpec builds the connection address with host and port.

type TransportAddress

type TransportAddress string

func (TransportAddress) Parse

func (t TransportAddress) Parse() (*Transport, error)

Parse parses a Transport Address (proto+transport://address:port) into a struct.

type Worker

type Worker struct {
	Username string
	Pool     PoolRef

	PoolConn net.Conn
}

Jump to

Keyboard shortcuts

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