server

package
v0.2.1455559 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: GPL-3.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hostname

func Hostname() string

Types

type APIConfig

type APIConfig struct {
	// Enabled selects whether the api is enabled
	Enabled bool `hcl:"enabled,optional"`

	// Port is the port number for this api
	Port uint64 `hcl:"port,optional"`

	// Prefix is the http prefix to expose this api
	Prefix string `hcl:"prefix,optional"`

	// Host is the address to bind the api
	Host string `hcl:"host,optional"`

	// Modules is the list of enabled api modules
	Modules []string `hcl:"modules,optional"`
}

type AccountsConfig

type AccountsConfig struct {
	// Unlock is the list of addresses to unlock in the node
	Unlock []string `hcl:"unlock,optional"`

	// PasswordFile is the file where the account passwords are stored
	PasswordFile string `hcl:"password-file,optional"`

	// AllowInsecureUnlock allows user to unlock accounts in unsafe http environment.
	AllowInsecureUnlock bool `hcl:"allow-insecure-unlock,optional"`

	// UseLightweightKDF enables a faster but less secure encryption of accounts
	UseLightweightKDF bool `hcl:"use-lightweight-kdf,optional"`
}

type CacheConfig

type CacheConfig struct {
	// Cache is the amount of cache of the node
	Cache uint64 `hcl:"cache,optional"`

	// PercGc is percentage of cache used for garbage collection
	PercGc uint64 `hcl:"perc-gc,optional"`

	// PercSnapshot is percentage of cache used for snapshots
	PercSnapshot uint64 `hcl:"perc-snapshot,optional"`

	// PercDatabase is percentage of cache used for the database
	PercDatabase uint64 `hcl:"perc-database,optional"`

	// PercTrie is percentage of cache used for the trie
	PercTrie uint64 `hcl:"perc-trie,optional"`

	// Journal is the disk journal directory for trie cache to survive node restarts
	Journal string `hcl:"journal,optional"`

	// Rejournal is the time interval to regenerate the journal for clean cache
	Rejournal    time.Duration
	RejournalRaw string `hcl:"rejournal,optional"`

	// NoPrefetch is used to disable prefetch of tries
	NoPrefetch bool `hcl:"no-prefetch,optional"`

	// Preimages is used to enable the track of hash preimages
	Preimages bool `hcl:"preimages,optional"`

	// TxLookupLimit sets the maximum number of blocks from head whose tx indices are reserved.
	TxLookupLimit uint64 `hcl:"tx-lookup-limit,optional"`
}

type Command

type Command struct {
	UI cli.Ui
	// contains filtered or unexported fields
}

Command is the command to start the sever

func (*Command) Flags

func (c *Command) Flags() *flagset.Flagset

func (*Command) Help

func (c *Command) Help() string

Help implements the cli.Command interface

func (*Command) Run

func (c *Command) Run(args []string) int

Run implements the cli.Command interface

func (*Command) Synopsis

func (c *Command) Synopsis() string

Synopsis implements the cli.Command interface

type Config

type Config struct {

	// Chain is the chain to sync with
	Chain string `hcl:"chain,optional"`

	// Name, or identity of the node
	Name string `hcl:"name,optional"`

	// Whitelist is a list of required (block number, hash) pairs to accept
	Whitelist map[string]string `hcl:"whitelist,optional"`

	// LogLevel is the level of the logs to put out
	LogLevel string `hcl:"log-level,optional"`

	// DataDir is the directory to store the state in
	DataDir string `hcl:"data-dir,optional"`

	// SyncMode selects the sync protocol
	SyncMode string `hcl:"sync-mode,optional"`

	// GcMode selects the garbage collection mode for the trie
	GcMode string `hcl:"gc-mode,optional"`

	// XXX
	Snapshot bool `hcl:"snapshot,optional"`

	// Ethstats is the address of the ethstats server to send telemetry
	Ethstats string `hcl:"ethstats,optional"`

	// P2P has the p2p network related settings
	P2P *P2PConfig `hcl:"p2p,block"`

	// Heimdall has the heimdall connection related settings
	Heimdall *HeimdallConfig `hcl:"heimdall,block"`

	// TxPool has the transaction pool related settings
	TxPool *TxPoolConfig `hcl:"txpool,block"`

	// Sealer has the validator related settings
	Sealer *SealerConfig `hcl:"sealer,block"`

	// JsonRPC has the json-rpc related settings
	JsonRPC *JsonRPCConfig `hcl:"jsonrpc,block"`

	// Gpo has the gas price oracle related settings
	Gpo *GpoConfig `hcl:"gpo,block"`

	// Telemetry has the telemetry related settings
	Telemetry *TelemetryConfig `hcl:"telemetry,block"`

	// Cache has the cache related settings
	Cache *CacheConfig `hcl:"cache,block"`

	// Account has the validator account related settings
	Accounts *AccountsConfig `hcl:"accounts,block"`

	// GRPC has the grpc server related settings
	GRPC *GRPCConfig

	// Developer has the developer mode related settings
	Developer *DeveloperConfig
	// contains filtered or unexported fields
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) Merge

func (c *Config) Merge(cc ...*Config) error

type DeveloperConfig

type DeveloperConfig struct {
	// Enabled enables the developer mode
	Enabled bool `hcl:"dev,optional"`

	// Period is the block period to use in developer mode
	Period uint64 `hcl:"period,optional"`
}

type GRPCConfig

type GRPCConfig struct {
	// Addr is the bind address for the grpc rpc server
	Addr string
}

type GpoConfig

type GpoConfig struct {
	// Blocks is the number of blocks to track to compute the price oracle
	Blocks uint64 `hcl:"blocks,optional"`

	// Percentile sets the weights to new blocks
	Percentile uint64 `hcl:"percentile,optional"`

	// MaxPrice is an upper bound gas price
	MaxPrice    *big.Int
	MaxPriceRaw string `hcl:"max-price,optional"`

	// IgnorePrice is a lower bound gas price
	IgnorePrice    *big.Int
	IgnorePriceRaw string `hcl:"ignore-price,optional"`
}

type HeimdallConfig

type HeimdallConfig struct {
	// URL is the url of the heimdall server
	URL string `hcl:"url,optional"`

	// Without is used to disable remote heimdall during testing
	Without bool `hcl:"without,optional"`
}

type InfluxDBConfig

type InfluxDBConfig struct {
	// V1Enabled enables influx v1 mode
	V1Enabled bool `hcl:"v1-enabled,optional"`

	// Endpoint is the url endpoint of the influxdb service
	Endpoint string `hcl:"endpoint,optional"`

	// Database is the name of the database in Influxdb to store the metrics.
	Database string `hcl:"database,optional"`

	// Enabled is the username to authorize access to Influxdb
	Username string `hcl:"username,optional"`

	// Password is the password to authorize access to Influxdb
	Password string `hcl:"password,optional"`

	// Tags are tags attaches to all generated metrics
	Tags map[string]string `hcl:"tags,optional"`

	// Enabled enables influx v2 mode
	V2Enabled bool `hcl:"v2-enabled,optional"`

	// Token is the token to authorize access to Influxdb V2.
	Token string `hcl:"token,optional"`

	// Bucket is the bucket to store metrics in Influxdb V2.
	Bucket string `hcl:"bucket,optional"`

	// Organization is the name of the organization for Influxdb V2.
	Organization string `hcl:"organization,optional"`
}

type JsonRPCConfig

type JsonRPCConfig struct {
	// IPCDisable enables whether ipc is enabled or not
	IPCDisable bool `hcl:"ipc-disable,optional"`

	// IPCPath is the path of the ipc endpoint
	IPCPath string `hcl:"ipc-path,optional"`

	// VHost is the list of valid virtual hosts
	VHost []string `hcl:"vhost,optional"`

	// Cors is the list of Cors endpoints
	Cors []string `hcl:"cors,optional"`

	// GasCap is the global gas cap for eth-call variants.
	GasCap uint64 `hcl:"gas-cap,optional"`

	// TxFeeCap is the global transaction fee cap for send-transaction variants
	TxFeeCap float64 `hcl:"tx-fee-cap,optional"`

	// Http has the json-rpc http related settings
	Http *APIConfig `hcl:"http,block"`

	// Http has the json-rpc websocket related settings
	Ws *APIConfig `hcl:"ws,block"`

	// Http has the json-rpc graphql related settings
	Graphql *APIConfig `hcl:"graphql,block"`
}

type P2PConfig

type P2PConfig struct {
	// MaxPeers sets the maximum number of connected peers
	MaxPeers uint64 `hcl:"max-peers,optional"`

	// MaxPendPeers sets the maximum number of pending connected peers
	MaxPendPeers uint64 `hcl:"max-pend-peers,optional"`

	// Bind is the bind address
	Bind string `hcl:"bind,optional"`

	// Port is the port number
	Port uint64 `hcl:"port,optional"`

	// NoDiscover is used to disable discovery
	NoDiscover bool `hcl:"no-discover,optional"`

	// NAT it used to set NAT options
	NAT string `hcl:"nat,optional"`

	// Discovery has the p2p discovery related settings
	Discovery *P2PDiscovery `hcl:"discovery,block"`
}

type P2PDiscovery

type P2PDiscovery struct {
	// V5Enabled is used to enable disc v5 discovery mode
	V5Enabled bool `hcl:"v5-enabled,optional"`

	// Bootnodes is the list of initial bootnodes
	Bootnodes []string `hcl:"bootnodes,optional"`

	// BootnodesV4 is the list of initial v4 bootnodes
	BootnodesV4 []string `hcl:"bootnodesv4,optional"`

	// BootnodesV5 is the list of initial v5 bootnodes
	BootnodesV5 []string `hcl:"bootnodesv5,optional"`

	// StaticNodes is the list of static nodes
	StaticNodes []string `hcl:"static-nodes,optional"`

	// TrustedNodes is the list of trusted nodes
	TrustedNodes []string `hcl:"trusted-nodes,optional"`

	// DNS is the list of enrtree:// URLs which will be queried for nodes to connect to
	DNS []string `hcl:"dns,optional"`
}

type SealerConfig

type SealerConfig struct {
	// Enabled is used to enable validator mode
	Enabled bool `hcl:"enabled,optional"`

	// Etherbase is the address of the validator
	Etherbase string `hcl:"etherbase,optional"`

	// ExtraData is the block extra data set by the miner
	ExtraData string `hcl:"extra-data,optional"`

	// GasCeil is the target gas ceiling for mined blocks.
	GasCeil uint64 `hcl:"gas-ceil,optional"`

	// GasPrice is the minimum gas price for mining a transaction
	GasPrice    *big.Int
	GasPriceRaw string `hcl:"gas-price,optional"`
}

type Server

type Server struct {
	proto.UnimplementedBorServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(config *Config) (*Server, error)

func (*Server) ChainSetHead

func (*Server) ChainWatch

func (s *Server) ChainWatch(req *proto.ChainWatchRequest, reply proto.Bor_ChainWatchServer) error

func (*Server) PeersAdd

func (*Server) PeersList

func (*Server) PeersRemove

func (*Server) PeersStatus

func (*Server) Pprof

func (s *Server) Pprof(req *proto.PprofRequest, stream proto.Bor_PprofServer) error

func (*Server) Status

func (s *Server) Status(ctx context.Context, _ *empty.Empty) (*proto.StatusResponse, error)

func (*Server) Stop

func (s *Server) Stop()

type TelemetryConfig

type TelemetryConfig struct {
	// Enabled enables metrics
	Enabled bool `hcl:"enabled,optional"`

	// Expensive enables expensive metrics
	Expensive bool `hcl:"expensive,optional"`

	// InfluxDB has the influxdb related settings
	InfluxDB *InfluxDBConfig `hcl:"influx,block"`

	// Prometheus Address
	PrometheusAddr string `hcl:"prometheus-addr,optional"`

	// Open collector endpoint
	OpenCollectorEndpoint string `hcl:"opencollector-endpoint,optional"`
}

type TxPoolConfig

type TxPoolConfig struct {
	// Locals are the addresses that should be treated by default as local
	Locals []string `hcl:"locals,optional"`

	// NoLocals enables whether local transaction handling should be disabled
	NoLocals bool `hcl:"no-locals,optional"`

	// Journal is the path to store local transactions to survive node restarts
	Journal string `hcl:"journal,optional"`

	// Rejournal is the time interval to regenerate the local transaction journal
	Rejournal    time.Duration
	RejournalRaw string `hcl:"rejournal,optional"`

	// PriceLimit is the minimum gas price to enforce for acceptance into the pool
	PriceLimit uint64 `hcl:"price-limit,optional"`

	// PriceBump is the minimum price bump percentage to replace an already existing transaction (nonce)
	PriceBump uint64 `hcl:"price-bump,optional"`

	// AccountSlots is the number of executable transaction slots guaranteed per account
	AccountSlots uint64 `hcl:"account-slots,optional"`

	// GlobalSlots is the maximum number of executable transaction slots for all accounts
	GlobalSlots uint64 `hcl:"global-slots,optional"`

	// AccountQueue is the maximum number of non-executable transaction slots permitted per account
	AccountQueue uint64 `hcl:"account-queue,optional"`

	// GlobalQueueis the maximum number of non-executable transaction slots for all accounts
	GlobalQueue uint64 `hcl:"global-queue,optional"`

	// Lifetime is the maximum amount of time non-executable transaction are queued
	LifeTime    time.Duration
	LifeTimeRaw string `hcl:"lifetime,optional"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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