config

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const (
	PROTOCOL_HTTP  = "http"
	PROTOCOL_HTTPS = "https"
	PROTOCOL_gRPC  = "grpc"
	PROTOCOL_gRPCS = "grpcs"
)

Variables

View Source
var Config = &ConfigDef{}

Functions

func OverLoad added in v1.5.1

func OverLoad(file string) error

Overload will load the new config and add, modify, remove hosts and components config - Listeners, engines and list of components are not supported for now - Certificates will NOT be reloaded if any change.for now - Plugins are not modified for now - Logs are not rebuild for now What is working: + changes of listeners of host ( if they are already loaded ) + changes of hostnames + changes of every components config + changes of logs format What to do: * If new host and/or new certificates, rebuild Listener with certificates, restart listener * If new listener, start listener * If del listener, stop listener * If modif listener, stop/start listener LET THE ONGOING REQUESTS FINISH TO SERVER before restart ???? * Load new plugins * Load new Engines * Load new components, rebuild encapsulate handlers on listeners

Types

type Auth

type Auth struct {
	Enabled bool   `json:"enabled"`
	Realm   string `json:"realm"`
	User    string `json:"user"`
	Pass    string `json:"pass"`
	Users   []User `json:"users"`
}

type Browser

type Browser struct {
	Enabled   bool      `json:"enabled"`
	UserAgent UserAgent `json:"useragent"`
}

type CMS

type CMS struct {
	Enabled     bool            `json:"enabled"`
	Engines     map[string]bool `json:"engines"`
	Browser     Browser         `json:"browser"`
	ConfigFiles []string        `json:"config"`
	Config      *xconfig.XConfig
}

type Component

type Component struct {
	Name        string `json:"name"`
	Source      string `json:"source"`
	Librarypath string `json:"librarypath"`
	Library     string `json:"library"`
	// Status is 0 = nothing new, 1 = new, 2 = changed, 3 = deleted
	Status int
}

type ComponentDef

type ComponentDef struct {
	Name    string
	Enabled bool
	Status  int

	Params map[string]interface{}
	Config interface{}
}

type ComponentList

type ComponentList []Component

func (*ComponentList) Exists

func (ccl *ComponentList) Exists(compcc Component) bool

func (*ComponentList) UnmarshalJSON

func (ccl *ComponentList) UnmarshalJSON(buf []byte) error

type Compress

type Compress struct {
	Enabled bool     `json:"enabled"`
	Mimes   []string `json:"mimes"`
	Files   []string `json:"files"`
}

type ConfigDef

type ConfigDef struct {
	Version      string
	File         string
	PluginPrefix string        `json:"pluginprefix"`
	Listeners    ListenerList  `json:"listeners"`
	Hosts        HostList      `json:"hosts"`
	Components   ComponentList `json:"components"`
	Engines      EngineList    `json:"engines"`
	Log          Log           `json:"log"`
	Include      []string      `json:"include"`
}

func (*ConfigDef) GetHost added in v1.5.1

func (c *ConfigDef) GetHost(id string) *Host

func (*ConfigDef) GetListener

func (c *ConfigDef) GetListener(host string, port string, secure bool) (*Host, *Listener)

func (*ConfigDef) IsComponentLoaded

func (c *ConfigDef) IsComponentLoaded(name string) bool

func (*ConfigDef) Load

func (c *ConfigDef) Load(file string) error

Then main xamboo runner

func (*ConfigDef) SearchListener

func (c *ConfigDef) SearchListener(name string) *Listener

func (*ConfigDef) SysLoad

func (c *ConfigDef) SysLoad(file string) error

type Engine

type Engine struct {
	Name        string `json:"name"`
	Source      string `json:"source"`
	Librarypath string `json:"librarypath"`
	Library     string `json:"library"`
	// Status is 0 = nothing new, 1 = new, 2 = changed, 3 = deleted
	Status int
}

type EngineList

type EngineList []Engine

func (*EngineList) Exists

func (ecl *EngineList) Exists(compec Engine) bool

func (*EngineList) UnmarshalJSON

func (ecl *EngineList) UnmarshalJSON(buf []byte) error

type Error added in v1.5.3

type Error struct {
	Enabled bool `json:"enabled"`
}

type FileServer

type FileServer struct {
	Enabled    bool   `json:"enabled"`
	TakeOver   bool   `json:"takeover"`
	StaticPath string `json:"static"`
}

type Host

type Host struct {
	Name       string   `json:"name"`
	Listeners  []string `json:"listeners"`
	HostNames  []string `json:"hostnames"`
	Cert       string   `json:"cert"`
	PrivateKey string   `json:"key"`
	Debug      bool     `json:"debug"`
	Plugins    Plugins  `json:"plugins"`
	Log        Log      `json:"log"`

	// Build after
	Status int

	// BUILT-IN Components
	Stat       Stat       `json:"stat"`
	Redirect   Redirect   `json:"redirect"`
	Auth       Auth       `json:"auth"`
	Prot       Prot       `json:"prot"`
	Compress   Compress   `json:"compress"`
	Minify     Minify     `json:"minify"`
	Origin     Origin     `json:"origin"`
	FileServer FileServer `json:"fileserver"`
	CMS        CMS        `json:"cms"`
	Error      Error      `json:"error"`
	// External components
	Remaining  []byte
	Components map[string]*ComponentDef
}

func (*Host) UnmarshalJSON

func (hc *Host) UnmarshalJSON(buf []byte) error

type HostList

type HostList []Host

func (*HostList) Exists

func (hcl *HostList) Exists(comphc Host) bool

func (*HostList) UnmarshalJSON

func (hcl *HostList) UnmarshalJSON(buf []byte) error

type Listener

type Listener struct {
	Name         string `json:"name"`
	IP           string `json:"ip"`
	Port         string `json:"port"`
	Protocol     string `json:"protocol"`
	ReadTimeOut  int    `json:"readtimeout"`
	WriteTimeOut int    `json:"writetimeout"`
	HeaderSize   int    `json:"headersize"`
	Log          Log    `json:"log"`
	Status       int
}

type ListenerList

type ListenerList []Listener

func (*ListenerList) Exists

func (lcl *ListenerList) Exists(complc Listener) bool

func (*ListenerList) UnmarshalJSON

func (lcl *ListenerList) UnmarshalJSON(buf []byte) error

type Log

type Log struct {
	Enabled     bool   `json:"enabled"`
	Pages       string `json:"pages"`
	PagesFormat string `json:"pagesformat"`
	Errors      string `json:"errors"`
	Sys         string `json:"sys"`
	Server      string `json:"server"`
	Stats       string `json:"stats"`
	Status      int
}

type Minify

type Minify struct {
	Enabled bool `json:"enabled"`
	HTML    bool `json:"html"`
	CSS     bool `json:"css"`
	JS      bool `json:"js"`
	JSON    bool `json:"json"`
	SVG     bool `json:"svg"`
	XML     bool `json:"xml"`
}

type Origin

type Origin struct {
	Enabled     bool     `json:"enabled"`
	MainDomains []string `json:"maindomains"`
	Default     string   `json:"default"`
	Methods     []string `json:"methods"`
	Headers     []string `json:"headers"`
	Credentials bool     `json:"credentials"`
}

type Plugin

type Plugin struct {
	Name        string `json:"name"`
	Librarypath string `json:"librarypath"`
	Library     string `json:"library"`
	Id          string
}

type Plugins

type Plugins []Plugin

type Prot added in v1.6.2

type Prot struct {
	Enabled     bool     `json:"enabled"`
	SQL         bool     `json:"sql"`
	Ignore      []string `json:"ignore"`
	IPBlackList []string `json:"ipblacklist"`
	//	IPWhiteList    []string `json:"ip"`
	// IPFrequency
	Threshold int
}

type Redirect

type Redirect struct {
	Enabled bool   `json:"enabled"`
	Scheme  string `json:"scheme"`
	Host    string `json:"host"`
}

type Stat

type Stat struct {
	Enabled bool `json:"enabled"`
}

BUILD IN Components

type TComponentList

type TComponentList []Component

type TEngineList

type TEngineList []Engine

type THost

type THost Host

type THostList

type THostList []Host

type TListenerList

type TListenerList []Listener

type User added in v1.7.6

type User struct {
	Enabled bool   `json:"enabled"`
	User    string `json:"user"`
	Pass    string `json:"pass"`
}

type UserAgent

type UserAgent struct {
	Enabled bool     `json:"enabled"`
	Devices []string `json:"devices"`
}

Jump to

Keyboard shortcuts

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