common

package
v0.0.0-...-f7b27bb Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	Cfg Config
	Log Logger
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(name string, configFile string, logFile string) *Application

func (*Application) CreateServer

func (a *Application) CreateServer(ctx context.Context, serverName string,
	startServer func(ctx context.Context) error,
	runServer func(ctx context.Context) error,
	stopServer func(ctx context.Context) error) func() error

func (*Application) Run

func (a *Application) Run(servers []func(ctx context.Context, a *Application) func() error)

type Config

type Config struct {
	Pastel PastelConfiguration     `yaml:"pastel"`
	REST   RESTServerConfiguration `yaml:"rest"`
	P2P    P2PConfiguration        `yaml:"p2p"`
}

func (*Config) LoadConfig

func (c *Config) LoadConfig(configFile string) error

type Logger

type Logger struct {
	ErrorLog   *log.Logger
	WarningLog *log.Logger
	InfoLog    *log.Logger
}

type P2PConfiguration

type P2PConfiguration struct {
	Host  string     `yaml:"host"`
	Port  string     `yaml:"port"`
	Stun  bool       `yaml:"stun"`
	Seeds []P2PSeeds `yaml:"seeds"`
}

type P2PSeeds

type P2PSeeds struct {
	Host string `yaml:"host"`
	Port string `yaml:"port"`
}

type PastelConfiguration

type PastelConfiguration struct {
	DataDir string `yaml:"data-dir"`
	Host    string `yaml:"host"`
	Port    int    `yaml:"port"`
	User    string `yaml:"user"`
	Pwd     string `yaml:"pwd"`
}

type RESTServerConfiguration

type RESTServerConfiguration struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

Jump to

Keyboard shortcuts

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