app

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = "canary"
	APIPrefix = "/api/v1"
)

Functions

This section is empty.

Types

type App

type App struct {
	Config  *Config
	Client  *ent.Client
	LogCore *auralog.Logger
	LogAPI  *auralog.Logger

	IPList    map[string]string
	BanList   map[string]bool
	MapList   map[string]uint32
	AdminList map[string]bool
}

func New

func New(cfg *Config) *App

func (*App) LoadAdminList

func (a *App) LoadAdminList(path string) error

func (*App) LoadBanList

func (a *App) LoadBanList(path string) error

func (*App) LoadIPList

func (a *App) LoadIPList(path string) error

func (*App) LoadMapList

func (a *App) LoadMapList(path string) error

func (*App) MigrateConfig

func (a *App) MigrateConfig() error

func (*App) SetClient added in v1.3.0

func (a *App) SetClient(client *ent.Client)

func (*App) SetupClient

func (a *App) SetupClient() error

func (*App) SetupLoggers

func (a *App) SetupLoggers(logcore *auralog.Logger, logapi *auralog.Logger)

type Config

type Config struct {
	Core struct {
		Address    string
		Port       int
		MaxThreads int
		Debug      bool
	}
	Database struct {
		Conn            string
		MaxIdleConns    int
		MaxOpenConns    int
		ConnMaxLifetime string
	}
	RateLimit struct {
		MaxRequests int
		MaxAge      string
	}
	Cert struct {
		Enable bool
		Domain string
	}
	ApiAuth struct {
		EnforceKey bool
		EnforceIP  bool
		IPListFile string
	}
	Verify struct {
		EnforceBan    bool
		EnforceMap    bool
		EnforceSC     bool
		MapListFile   string
		BanListFile   string
		AdminListFile string
		SCHash        uint32
		Useragent     string
	}
	Char struct {
		MaxBackups int
		BackupTime string
	}
	Log struct {
		Level      string
		Dir        string
		ExpireTime string
	}
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

Jump to

Keyboard shortcuts

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