core

package
v0.0.0-...-34f5af7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(cfg *Config) (*logrus.Logger, error)

Types

type Config

type Config struct {
	Hostname       string `mapstructure:"hostname"`
	ExternalIP     string `mapstructure:"external_ip"`
	MaxConnections int    `mapstructure:"max_connections"`
	LogFilePath    string `mapstructure:"log_file_path"`
	LogLevel       string `mapstructure:"log_level"`

	Web struct {
		HTTPPort int `mapstructure:"http_port"`
	} `mapstructure:"web"`

	Database struct {
		Engine   string `mapstructure:"engine"`
		Host     string `mapstructure:"host"`
		Port     int    `mapstructure:"port"`
		Name     string `mapstructure:"name"`
		Username string `mapstructure:"username"`
		Password string `mapstructure:"password"`
		SSLMode  string `mapstructure:"disable"`
	} `mapstructure:"database"`

	ShipgateServer struct {
		Port int `mapstructure:"port"`
	} `mapstructure:"shipgate_server"`

	PatchServer struct {
		PatchPort      int    `mapstructure:"patch_port"`
		DataPort       int    `mapstructure:"data_port"`
		PatchDir       string `mapstructure:"patch_dir"`
		WelcomeMessage string `mapstructure:"welcome_message"`
	} `mapstructure:"patch_server"`

	LoginServer struct {
		Port int `mapstructure:"port"`
	} `mapstructure:"login_server"`

	CharacterServer struct {
		Port int `mapstructure:"port"`
		// TODO: Restore this config option when adding support for overriding these files.
		// ParametersDir string `mapstructure:"parameters_dir"`
		ScrollMessage string `mapstructure:"scroll_message"`
	} `mapstructure:"character_server"`

	ShipServer struct {
		Port      int    `mapstructure:"port"`
		Name      string `mapstructure:"name"`
		NumBlocks int    `mapstructure:"num_blocks"`
	} `mapstructure:"ship_server"`

	BlockServer struct {
		Port       int `mapstructure:"port"`
		NumLobbies int `mapstructure:"num_lobbies"`
	} `mapstructure:"block_server"`

	Debugging struct {
		PprofEnabled           bool `mapstructure:"pprof_enabled"`
		PprofPort              int  `mapstructure:"pprof_port"`
		PacketLoggingEnabled   bool `mapstructure:"packet_logging_enabled"`
		DatabaseLoggingEnabled bool `mapstructure:"database_logging_enabled"`
	} `mapstructure:"debugging"`
	// contains filtered or unexported fields
}

Config contains all of the configuration options available to any of Archon's server components. Descriptions are in config.yaml.

func LoadConfig

func LoadConfig(configPath string) *Config

LoadConfig initializes Viper with the contents of the config file under configPath.

func (*Config) BroadcastIP

func (c *Config) BroadcastIP() [4]byte

BroadcastIP converts the configured broadcast IP string into 4 bytes to be used with the redirect packet common to several servers.

func (*Config) DatabaseURL

func (c *Config) DatabaseURL() string

DatabaseURL returns a database URL generated from the provided config values.

func (*Config) ShipgateAddress

func (c *Config) ShipgateAddress() string

ShipgateAddress returns the fully qualified address of the ship server. TODO: Since the current expectation is that the ship server is running alongside the other servers, this just uses the hostname. This should be fixed at some point to use an actual configurable address and the ship server given its own listen config.

Directories

Path Synopsis
Most of this code is copied from the golang.org/x/crypto/blowfish package.
Most of this code is copied from the golang.org/x/crypto/blowfish package.
https://github.com/Sewer56/dlang-prs
https://github.com/Sewer56/dlang-prs

Jump to

Keyboard shortcuts

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