toyblc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: MIT Imports: 14 Imported by: 0 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

This section is empty.

Variables

This section is empty.

Functions

func InitializeWebServer

func InitializeWebServer(config *Config) (server.Server, error)

InitializeWebServer sets up and initializes the web server with all necessary dependencies.

func InstallGenericAPI

func InstallGenericAPI(engine *gin.Engine)

InstallGenericAPI 注册业务无关的路由,例如 pprof、404 处理等.

func NewAggregatorServer

func NewAggregatorServer(serverConfig *ServerConfig) (server.Server, error)

Types

type AggregatorServer

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

func (*AggregatorServer) GracefulStop

func (s *AggregatorServer) GracefulStop(ctx context.Context)

func (*AggregatorServer) RunOrDie

func (s *AggregatorServer) RunOrDie()

type Config

type Config struct {
	Miner           bool
	MinMineInterval time.Duration
	Address         string
	Accounts        map[string]string
	HTTPOptions     *genericoptions.HTTPOptions
	TLSOptions      *genericoptions.TLSOptions
	P2PAddr         string
	Peers           []string
}

Config contains application-related configurations.

func (*Config) NewServer

func (cfg *Config) NewServer(ctx context.Context) (*Server, error)

NewServer initializes and returns a new Server instance.

type Server

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

Server represents the web server.

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run starts the server and listens for termination signals. It gracefully shuts down the server upon receiving a termination signal.

type ServerConfig

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

ServerConfig contains the core dependencies and configurations of the server.

func (*ServerConfig) InstallRESTAPI

func (c *ServerConfig) InstallRESTAPI(engine *gin.Engine)

注册 API 路由。路由的路径和 HTTP 方法,严格遵循 REST 规范.

func (*ServerConfig) NewBlockChainServer

func (c *ServerConfig) NewBlockChainServer() *blcServer

func (*ServerConfig) NewP2PServer

func (c *ServerConfig) NewP2PServer() *p2pServer

Directories

Path Synopsis
pkg
blc
ws

Jump to

Keyboard shortcuts

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