config

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromBuffer

func FromBuffer(buf *bytes.Buffer, cfg *Config) error

FromBuffer loads default global configuration from a specified byte buffer.

func FromFile

func FromFile(configFile string, cfg *Config) error

FromFile loads default global configuration from a specified file.

Types

type BadgerDb

type BadgerDb struct {
	DataDir string `yaml:"data_dir"`
}

BadgerDB represents BadgerDB storage configuration.

type C2S

type C2S struct {
	Domains []string
}

C2S represents a client-to-server manager configuration.

func (*C2S) UnmarshalYAML

func (c *C2S) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML satisfies Unmarshaler interface.

type ChannelBindingMechanism

type ChannelBindingMechanism int

ChannelBindingMechanism represents a scram channel binding mechanism.

const (
	// TLSUnique represents 'tls-unique' channel binding mechanism.
	TLSUnique ChannelBindingMechanism = iota
)

type Compression

type Compression struct {
	Level CompressionLevel
}

Compression represents a server stream compression configuration.

func (*Compression) UnmarshalYAML

func (c *Compression) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML satisfies Unmarshaler interface.

type CompressionLevel

type CompressionLevel int

CompressionLevel represents a stream compression level.

const (
	// NoCompression represents no stream compression.
	NoCompression CompressionLevel = iota

	// DefaultCompression represents 'default' stream compression level.
	DefaultCompression

	// BestCompression represents 'best for size' stream compression level.
	BestCompression

	// SpeedCompression represents 'best for speed' stream compression level.
	SpeedCompression
)

func (CompressionLevel) String

func (cl CompressionLevel) String() string

String returns CompressionLevel string representation.

type Config

type Config struct {
	PIDFile string `yaml:"pid_path"`
	Debug   struct {
		Port int `yaml:"port"`
	} `yaml:"debug"`
	Logger  Logger   `yaml:"logger"`
	Storage Storage  `yaml:"storage"`
	C2S     C2S      `yaml:"c2s"`
	Servers []Server `yaml:"servers"`
}

Config represents a global configuration.

type LogLevel

type LogLevel int

LogLevel represents log level type.

const (
	// DebugLevel represents DEBUG log level.
	DebugLevel LogLevel = iota

	// InfoLevel represents INFO log level.
	InfoLevel

	// WarningLevel represents WARNING log level.
	WarningLevel

	// ErrorLevel represents ERROR log level.
	ErrorLevel

	// FatalLevel represents FATAL log level.
	FatalLevel
)

type Logger

type Logger struct {
	Level   LogLevel
	LogPath string
}

Logger represents a logger manager configuration.

func (*Logger) UnmarshalYAML

func (l *Logger) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML satisfies Unmarshaler interface.

type ModOffline

type ModOffline struct {
	QueueSize int `yaml:"queue_size"`
}

ModOffline represents Offline Storage module configuration.

type ModPing

type ModPing struct {
	Send         bool `yaml:"send"`
	SendInterval int  `yaml:"send_interval"`
}

ModPing represents XMPP Ping module (XEP-0199) configuration.

type ModRegistration

type ModRegistration struct {
	AllowRegistration bool `yaml:"allow_registration"`
	AllowChange       bool `yaml:"allow_change"`
	AllowCancel       bool `yaml:"allow_cancel"`
}

ModRegistration represents XMPP In-Band Registration module (XEP-0077) configuration.

type ModVersion

type ModVersion struct {
	ShowOS bool `yaml:"show_os"`
}

ModVersion represents XMPP Software Version module (XEP-0092) configuration.

type MySQLDb

type MySQLDb struct {
	Host     string `yaml:"host"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Database string `yaml:"database"`
	PoolSize int    `yaml:"pool_size"`
}

MySQLDb represents MySQL storage configuration.

type ResourceConflictPolicy

type ResourceConflictPolicy int

ResourceConflictPolicy represents a resource conflict policy.

const (
	// Override represents 'override' resource conflict policy.
	Override ResourceConflictPolicy = iota

	// Reject represents 'reject' resource conflict policy.
	Reject

	// Replace represents 'replace' resource conflict policy.
	Replace
)

type Server

type Server struct {
	ID               string
	Type             ServerType
	ResourceConflict ResourceConflictPolicy
	Transport        Transport
	SASL             []string
	TLS              TLS
	Modules          map[string]struct{}
	Compression      Compression
	ModOffline       ModOffline
	ModRegistration  ModRegistration
	ModVersion       ModVersion
	ModPing          ModPing
}

Server represents an XMPP server configuration.

func (*Server) UnmarshalYAML

func (s *Server) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML satisfies Unmarshaler interface.

type ServerType

type ServerType int

ServerType represents a server type (c2s, s2s).

const (
	// C2SServerType represents a client to client server type.
	C2SServerType ServerType = iota
	// S2SServerType represents a server-to-client server type.
	S2SServerType
)

func (ServerType) String

func (st ServerType) String() string

String returns ServerType string representation.

type Storage

type Storage struct {
	Type     StorageType
	MySQL    *MySQLDb
	BadgerDB *BadgerDb
}

Storage represents an storage manager configuration.

func (*Storage) UnmarshalYAML

func (s *Storage) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML satisfies Unmarshaler interface.

type StorageType

type StorageType int

StorageType represents a storage manager type.

const (
	// MySQL represents a MySQL storage type.
	MySQL StorageType = iota

	// BadgerDB represents a BadgerDB storage type.
	BadgerDB

	// Mock represents a in-memory storage type.
	Mock
)

type TLS

type TLS struct {
	CertFile    string `yaml:"cert_path"`
	PrivKeyFile string `yaml:"privkey_path"`
}

TLS represents a server TLS configuration.

type Transport

type Transport struct {
	Type           TransportType
	BindAddress    string
	Port           int
	ConnectTimeout int
	KeepAlive      int
	BufferSize     int
}

Transport represents an XMPP stream transport configuration.

func (*Transport) UnmarshalYAML

func (t *Transport) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML satisfies Unmarshaler interface.

type TransportType

type TransportType int

TransportType represents a stream transport type (socket).

const (
	// Socket represents a socket transport.
	Socket TransportType = iota
)

func (TransportType) String

func (tt TransportType) String() string

String returns TransportType string representation.

Jump to

Keyboard shortcuts

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