cmd

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KillProcess

func KillProcess(pid int) error

根据pid杀进程

func WriteConfig

func WriteConfig(filename string, conf *RelaySetting) error

写入配置

Types

type AppSection

type AppSection struct {
	Host    string
	Ports   []uint16
	OutPort uint16 `toml:outport`
	Prog    string
	Args    string
	Curr    int
	Pid     int
}

应用配置

func (*AppSection) GetInPort

func (app *AppSection) GetInPort(curr, next bool, number int) uint16

计算端口,优先使用next即下一个,number为指定端口下标

func (*AppSection) RunServer

func (app *AppSection) RunServer(port string, verbose bool) int

运行后端服务

type BuffSection

type BuffSection struct {
	ReadBuffSize int // 读缓冲大小(字节)
}

读缓冲配置

func (BuffSection) GetBuffSize

func (c BuffSection) GetBuffSize() int

type LogSection

type LogSection struct {
	Level  string
	Logdir string
}

日志配置

func (LogSection) GetLogger

func (c LogSection) GetLogger() *logging.Logger

type MesgSection

type MesgSection struct {
	Url      string
	Exchange string
	Routings []string
}

队列配置

func (MesgSection) Push

func (c MesgSection) Push(id int, msg *queue.Message) error

type RelaySetting

type RelaySetting map[string]*AppSection

配置,含多个应用配置

func GetConfig

func GetConfig(filename string) (*RelaySetting, error)

解析配置

func (RelaySetting) GetSection

func (conf RelaySetting) GetSection(name string) *AppSection

获取其中一个应用的配置

type ServSection

type ServSection struct {
	Host string
	Port int
	Tick int // 打点器间隔(秒)
	BuffSection
}

服务端配置

type ServSetting

type ServSetting struct {
	Log    LogSection
	Server ServSection
	Proto  BuffSection
	Rabbit MesgSection
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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