config

package
v0.0.0-...-e7dcbf3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Network{
	SessionExpiration:  Duration(10 * time.Minute),
	PostMessageCooloff: Duration(500 * time.Millisecond),
	Banned:             make(map[string]string),
}

Functions

This section is empty.

Types

type Duration

type Duration time.Duration

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

func (Duration) String

func (d Duration) String() string

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type HexString

type HexString []byte

func (HexString) MarshalText

func (hs HexString) MarshalText() ([]byte, error)

func (HexString) String

func (hs HexString) String() string

func (*HexString) UnmarshalText

func (hs *HexString) UnmarshalText(text []byte) error

type IRC

type IRC struct {
	Operators []IRCOp
	Services  []Service
}

IRC is the IRC-related configuration.

type IRCOp

type IRCOp struct {
	Name     string
	Password string
}

type Network

type Network struct {
	Revision uint64 `toml:"-"`

	IRC IRC

	// Time interval after which a session without any activity is terminated
	// by the server. The client should send a PING every minute.
	SessionExpiration Duration

	// Enforced cooloff between two messages sent by a user. Set to 0 to disable throttling.
	PostMessageCooloff Duration

	// TrustedBridges is a map from X-Bridge-Auth header to human-readable
	// name. For all bridges which send a configured header, the
	// X-Forwarded-For header is respected.
	TrustedBridges map[string]string

	// CaptchaURL points to an instance of robustirc/captchasrv
	CaptchaURL string
	// CaptchaHMACSecret is a 32 byte secret key (use e.g. openssl
	// rand -hex 32 to generate) which must match the key specified in
	// the -hmac_secret_key flag for the robustirc/captchasrv
	// instance.
	CaptchaHMACSecret HexString

	// CaptchaRequiredForLogin forces users to solve a captcha to
	// solve before they can login to the IRC network.
	CaptchaRequiredForLogin bool

	MaxSessions uint64
	MaxChannels uint64

	// Banned is a map from remote address to ban reason, managed via the GLINE
	// IRC command.
	Banned map[string]string

	// WhitelistedOrigins contains HTTP origins
	// (e.g. https://webchat.example.com) which are whitelisted for cross-origin
	// HTTP requests.
	WhitelistedOrigins map[string]bool
}

Network is the network configuration, i.e. the top level.

func FromString

func FromString(input string) (Network, error)

type Service

type Service struct {
	Password string
}

Jump to

Keyboard shortcuts

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