server

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: GPL-2.0 Imports: 37 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	JsonrpcAddress = "http.addr"
	JsonrpcPort    = "http.port"
)
View Source
const (
	NoDiscoverFlag  = "no-discover"
	BootnodeFlag    = "bootnode"
	LogLevelFlag    = "log-level"
	GRPCAddressFlag = "grpc-address"
)
View Source
const (
	JSONOutputFlag = "json"
)

Variables

This section is empty.

Functions

func GetGRPCAddress

func GetGRPCAddress(cmd *cobra.Command) string

func GetRPCAddress

func GetRPCAddress(cmd *cobra.Command) string

func GetRPCPort

func GetRPCPort(cmd *cobra.Command) string

func PreRun

func PreRun(cmd *cobra.Command, _ []string) error

func ResolveAddr

func ResolveAddr(address string, defaultIP string) (*net.TCPAddr, error)

ResolveAddr resolves the passed in TCP address The second param is the default ip to bind to, if no ip address is specified

func Run

func Run(cmd *cobra.Command, args []string)

func SetFlags

func SetFlags(cmd *cobra.Command)

Types

type CLIOutput

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

func (*CLIOutput) SetCommandResult

func (c *CLIOutput) SetCommandResult(result CommandResult)

func (*CLIOutput) SetError

func (c *CLIOutput) SetError(err error)

func (*CLIOutput) WriteOutput

func (cli *CLIOutput) WriteOutput()

type CommandResult

type CommandResult interface {
	GetOutput() string
}

type Config

type Config struct {
	GenesisPath       string   `json:"chain_config"`
	SecretsConfigPath string   `json:"secrets_config"`
	DataDir           string   `json:"data_dir"`
	BlockGasTarget    string   `json:"block_gas_target"`
	GRPCAddr          string   `json:"grpc_addr"`
	HttpAddr          string   `json:"rpc_addr"`
	HttpPort          string   `json:"rpc_port"`
	Network           *Network `json:"network"`
	LogLevel          string   `json:"log_level"`
	BlockTime         uint64   `json:"block_time_s"`
	Headers           *Headers `json:"headers"`
	LogFilePath       string   `json:"log_to"`
}

Config defines the server configuration params

func DefaultConfig

func DefaultConfig() *Config

type Headers

type Headers struct {
	AccessControlAllowOrigins []string `json:"access_control_allow_origins"`
}

Headers defines the HTTP response headers required to enable CORS.

type JSONOutput

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

func (*JSONOutput) SetCommandResult

func (c *JSONOutput) SetCommandResult(result CommandResult)

func (*JSONOutput) SetError

func (c *JSONOutput) SetError(err error)

func (*JSONOutput) WriteOutput

func (jo *JSONOutput) WriteOutput()

type Network

type Network struct {
	NoDiscover       bool   `json:"no_discover"`
	Libp2pAddr       string `json:"libp2p_addr"`
	NatAddr          string `json:"nat_addr"`
	DNSAddr          string `json:"dns_addr"`
	MaxPeers         int64  `json:"max_peers,omitempty"`
	MaxOutboundPeers int64  `json:"max_outbound_peers,omitempty"`
	MaxInboundPeers  int64  `json:"max_inbound_peers,omitempty"`
}

Network defines the network configuration params

type OutputFormatter

type OutputFormatter interface {

	// SetError sets the encountered error
	SetError(err error)

	// SetCommandResult sets the result of the command execution
	SetCommandResult(result CommandResult)

	// WriteOutput writes the result / error output
	WriteOutput()
	// contains filtered or unexported methods
}

OutputFormatter is the standardized interface all output formatters should use

func InitializeOutputter

func InitializeOutputter(cmd *cobra.Command) OutputFormatter

type Server

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

func NewServer

func NewServer(ctx context.Context, config *ServerConfig) (*Server, error)

NewServer creates a new Minimal server, using the passed in configuration

func (*Server) Close

func (s *Server) Close() error

Close closes the Minimal server (blockchain, networking, consensus)

func (*Server) JoinPeer

func (s *Server) JoinPeer(rawPeerMultiaddr string) error

JoinPeer attempts to add a new peer to the networking server

type ServerConfig

type ServerConfig struct {
	Chain *chain.Chain

	EnableGraphQL bool
	GRPCAddr      *net.TCPAddr
	LibP2PAddr    *net.TCPAddr
	RpcAddr       string
	RpcPort       string

	PriceLimit            uint64
	MaxSlots              uint64
	BlockTime             uint64
	PruneTickSeconds      uint64
	PromoteOutdateSeconds uint64

	Network *network.Config

	DataDir     string
	RestoreFile *string

	Seal           bool
	SecretsManager *secrets.SecretsManagerConfig

	LogLevel    hclog.Level
	LogFilePath string

	Daemon       bool
	ValidatorKey string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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