config

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug added in v0.1.6

func Debug() bool

func DumpPretty

func DumpPretty(cfg interface{}) string

DumpPretty format config to string in pretty format

func GetConfigDir

func GetConfigDir() string

GetConfigDir returns the directory of goworld.ini

func GetConfigFilePath added in v0.1.2

func GetConfigFilePath() string

GetConfigFilePath returns the config file path

func GetDispatcherIDs added in v0.1.2

func GetDispatcherIDs() []uint16

GetDispatcherIDs returns all dispatcher IDs

func GetGameIDs

func GetGameIDs() []uint16

GetGameIDs returns all game IDs

func GetGamesNum added in v0.1.4

func GetGamesNum() int

GetGameNum returns the number of games

func GetGateIDs

func GetGateIDs() []uint16

GetGateIDs returns all gate IDs

func GetGatesNum added in v0.1.4

func GetGatesNum() int

GetGatesNum returns the number of gates

func SetConfigFile

func SetConfigFile(f string)

SetConfigFile sets the config file path (goworld.ini by default)

Types

type DebugConfig added in v0.1.6

type DebugConfig struct {
	Debug bool
}

type DispatcherConfig

type DispatcherConfig struct {
	BindIp    string
	BindPort  int
	Ip        string
	Port      int
	LogFile   string
	LogStderr bool
	HTTPIp    string
	HTTPPort  int
	LogLevel  string
}

DispatcherConfig defines fields of dispatcher config

func GetDispatcher

func GetDispatcher(dispid uint16) *DispatcherConfig

GetDispatcher returns the dispatcher config

type GameConfig

type GameConfig struct {
	BootEntity             string
	SaveInterval           time.Duration
	LogFile                string
	LogStderr              bool
	HTTPIp                 string
	HTTPPort               int
	LogLevel               string
	GoMaxProcs             int
	PositionSyncIntervalMS int
	BanBootEntity          bool
}

GameConfig defines fields of game config

func GetGame

func GetGame(gameid uint16) *GameConfig

GetGame gets the game config of specified game ID

type GateConfig

type GateConfig struct {
	Ip                     string
	Port                   int
	LogFile                string
	LogStderr              bool
	HTTPIp                 string
	HTTPPort               int
	LogLevel               string
	GoMaxProcs             int
	CompressConnection     bool
	CompressFormat         string
	EncryptConnection      bool
	RSAKey                 string
	RSACertificate         string
	HeartbeatCheckInterval int
	PositionSyncIntervalMS int
}

GateConfig defines fields of gate config

func GetGate

func GetGate(gateid uint16) *GateConfig

GetGate gets the gate config of specified gate ID

type GoWorldConfig

type GoWorldConfig struct {
	DispatcherCommon DispatcherConfig
	GameCommon       GameConfig
	GateCommon       GateConfig
	Dispatchers      map[int]*DispatcherConfig
	Games            map[int]*GameConfig
	Gates            map[int]*GateConfig
	Storage          StorageConfig
	KVDB             KVDBConfig
	Debug            DebugConfig
}

GoWorldConfig defines the total GoWorld config file structure

func Get

func Get() *GoWorldConfig

Get returns the total GoWorld config

func Reload

func Reload() *GoWorldConfig

Reload forces goworld server to reload the whole config

type KVDBConfig

type KVDBConfig struct {
	Type       string
	Url        string // MongoDB
	DB         string // MongoDB
	Collection string // MongoDB
	Driver     string // SQL Driver: e.x. mysql
	StartNodes common.StringSet
}

KVDBConfig defines fields of KVDB config

func GetKVDB

func GetKVDB() *KVDBConfig

GetKVDB returns the KVDB config

type StorageConfig

type StorageConfig struct {
	Type       string // Type of storage (filesystem, mongodb, redis, mysql)
	Directory  string // Directory of filesystem storage (filesystem)
	Url        string // Connection URL (mongodb, redis, mysql)
	DB         string // Database name (mongodb, redis)
	Driver     string // SQL Driver name (mysql)
	StartNodes common.StringSet
}

StorageConfig defines fields of storage config

func GetStorage

func GetStorage() *StorageConfig

GetStorage returns the storage config

Jump to

Keyboard shortcuts

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