common

package
v0.0.0-...-b77c001 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAssetsPath

func GetAssetsPath() string

func NewGLogger

func NewGLogger() *glog.LoggingT

func SetArgs

func SetArgs(args *ArgsBase)

func SetLogger

func SetLogger(log ILogger)

Types

type App

type App struct {
	Derived AppInterface
	Type    int
	Args    IArgs
	Logger  ILogger
	Node    interface{}
	// contains filtered or unexported fields
}

func (*App) Close

func (this *App) Close()

func (*App) Run

func (this *App) Run()

type AppInterface

type AppInterface interface {
	OnAppReady()
	OnAppShutDown()
}

type ArgsBase

type ArgsBase struct {
	Common    ArgsCommon  // 一些基础参数
	Pending   ArgsPending // 悬而未决的配置,OnInit()函数内用户最终设置。不同的节点会有针对性的设置。
	DbAccount ArgsRedis   // 帐号数据库(Redis)
	DbToken   ArgsRedis   // Token数据库(Redis)
	DbServer  ArgsRedis   // Server数据库(Redis)
}

func GetArgs

func GetArgs() *ArgsBase

func (*ArgsBase) GetBase

func (this *ArgsBase) GetBase() *ArgsBase

func (*ArgsBase) Init

func (this *ArgsBase) Init(derived IArgs)

type ArgsCommon

type ArgsCommon struct {
	Version       string `default:""`  // 版本号
	LogDir        string `default:""`  // log路径
	LogLevel      int    `default:2`   // log等级
	Debug         bool   `default:0`   // debug版本标志
	IntranetToken string `default:""`  // 内部服务器验证TOKEN
	MsgCmdOffset  int    `default:100` // 消息号 = 服务类型 * MsgCmdOffset + 数字
}

type ArgsPending

type ArgsPending struct {
	WatchNodeTypes []int `default:""` // 本节点要watch其他节点的节点类型
}

type ArgsRedis

type ArgsRedis struct {
	Name     string   `default:""`
	Addrs    []string `default:""`
	Password string   `default:""`
	DBIndex  int      `default:0`
}

type CommonServerType

type CommonServerType int
const (
	Client            CommonServerType = iota // 0
	Login                                     // 1
	Gateway                                   // 2
	Hub                                       // 3
	COMMON_SERVER_END = 9                     // 9
)

type DefaultLogger

type DefaultLogger struct {
}

func NewDefaultLogger

func NewDefaultLogger() *DefaultLogger

func (*DefaultLogger) Debug

func (this *DefaultLogger) Debug(args ...interface{})

func (*DefaultLogger) Debugf

func (this *DefaultLogger) Debugf(format string, args ...interface{})

func (*DefaultLogger) Debugln

func (this *DefaultLogger) Debugln(args ...interface{})

func (*DefaultLogger) Error

func (this *DefaultLogger) Error(args ...interface{})

func (*DefaultLogger) Errorf

func (this *DefaultLogger) Errorf(format string, args ...interface{})

func (*DefaultLogger) Errorln

func (this *DefaultLogger) Errorln(args ...interface{})

func (*DefaultLogger) Fatal

func (this *DefaultLogger) Fatal(args ...interface{})

func (*DefaultLogger) Fatalf

func (this *DefaultLogger) Fatalf(format string, args ...interface{})

func (*DefaultLogger) Fatalln

func (this *DefaultLogger) Fatalln(args ...interface{})

func (*DefaultLogger) Flush

func (this *DefaultLogger) Flush()

func (*DefaultLogger) Info

func (this *DefaultLogger) Info(args ...interface{})

func (*DefaultLogger) Infof

func (this *DefaultLogger) Infof(format string, args ...interface{})

func (*DefaultLogger) Infoln

func (this *DefaultLogger) Infoln(args ...interface{})

func (*DefaultLogger) Print

func (this *DefaultLogger) Print(args ...interface{})

func (*DefaultLogger) Printf

func (this *DefaultLogger) Printf(format string, args ...interface{})

func (*DefaultLogger) Println

func (this *DefaultLogger) Println(args ...interface{})

func (*DefaultLogger) SetLogDir

func (this *DefaultLogger) SetLogDir(dir string)

func (*DefaultLogger) SetLogLevel

func (this *DefaultLogger) SetLogLevel(level int)

func (*DefaultLogger) Warning

func (this *DefaultLogger) Warning(args ...interface{})

func (*DefaultLogger) Warningf

func (this *DefaultLogger) Warningf(format string, args ...interface{})

func (*DefaultLogger) Warningln

func (this *DefaultLogger) Warningln(args ...interface{})

type IArgs

type IArgs interface {
	IArgsBase
	OnInit()
}

type IArgsBase

type IArgsBase interface {
	GetBase() *ArgsBase
	Init(derived IArgs)
}

type ILogger

type ILogger interface {
	Debug(args ...interface{})
	Debugln(args ...interface{})
	Debugf(format string, args ...interface{})
	Print(args ...interface{})
	Println(args ...interface{})
	Printf(format string, args ...interface{})
	Info(args ...interface{})
	Infoln(args ...interface{})
	Infof(format string, args ...interface{})
	Warning(args ...interface{})
	Warningln(args ...interface{})
	Warningf(format string, args ...interface{})
	Error(args ...interface{})
	Errorln(args ...interface{})
	Errorf(format string, args ...interface{})
	Fatal(args ...interface{})
	Fatalln(args ...interface{})
	Fatalf(format string, args ...interface{})
	Flush()
	SetLogLevel(level int)
	SetLogDir(dir string)
}

func GetLogger

func GetLogger() ILogger

type ServerTypeConfig

type ServerTypeConfig struct {
	ServerType []ServerTypeInfo
}

type ServerTypeInfo

type ServerTypeInfo struct {
	Type      int
	Name      string
	Namespace string
}

type TcpServer

type TcpServer struct {
	*gotcp.Server
}

func NewTcpServer

func NewTcpServer() *TcpServer

func (*TcpServer) Close

func (this *TcpServer) Close()

func (*TcpServer) Start

func (this *TcpServer) Start() bool

type WebService

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

func NewWebService

func NewWebService() *WebService

func (*WebService) Close

func (this *WebService) Close()

func (*WebService) HandleFunc

func (this *WebService) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

func (*WebService) ListenAndServe

func (this *WebService) ListenAndServe(addr string)

Directories

Path Synopsis
k8s

Jump to

Keyboard shortcuts

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