Documentation
¶
Index ¶
- Constants
- Variables
- func DNSDefaultRecords(origin string, ip net.IP) *dnsx.Records
- func DNSHandler(cfg *DNSConfig, db *database.DB, tel telemetry.Telemetry, origin string, ...) dnsx.HandlerProvider
- func DNSTelemetryHandler(tel telemetry.Telemetry, next dnsx.Handler) dnsx.Handler
- func DNSZoneFileRecords(filePath, origin string, ip net.IP) *dnsx.Records
- func FTPHandler(domain string, log *slog.Logger, tel telemetry.Telemetry, ...) netx.Handler
- func FTPTelemetry(next netx.Handler, tel telemetry.Telemetry) netx.Handler
- func HTTPDefault(w http.ResponseWriter, r *http.Request)
- func HTTPHandler(db *database.DB, tel telemetry.Telemetry, origin string, ...) http.Handler
- func HTTPTelemetry(next http.Handler, tel telemetry.Telemetry) http.Handler
- func RateLimitAllowFunc(cfg *RateLimitConfig, proto RateLimitProtoConfig, tel telemetry.Telemetry, ...) func(net.Addr) bool
- func RateLimitListenerWrapper(allow func(net.Addr) bool) func(net.Listener) net.Listener
- func Run(ctx context.Context, stdout io.Writer, stderr io.Writer, dir fs.FS, ...) error
- func SMTPHandler(domain string, log *slog.Logger, tel telemetry.Telemetry, ...) netx.Handler
- func SMTPTelemetry(next netx.Handler, tel telemetry.Telemetry) netx.Handler
- type AuditConfig
- type Config
- type Controller
- type DBConfig
- type DNSConfig
- type Event
- type EventsHandler
- type GeoIPConfig
- type ModulesConfig
- type Notifier
- type NotifyFunc
- type RateLimitConfig
- type RateLimitProtoConfig
- type TLS
- type TLSConfig
- type TLSCustomConfig
- type TLSLetsEncryptConfig
- type TelemetryConfig
Constants ¶
View Source
const ConfigFileName = "config.toml"
Variables ¶
View Source
var ConfigDefaults = map[string]any{
"admin_username": "admin",
"tls.type": "letsencrypt",
"tls.letsencrypt.directory": "./tls",
"tls.letsencrypt.ca_dir_url": "https://acme-v02.api.letsencrypt.org/directory",
"modules.enabled": "api",
"modules.api.port": 31337,
}
Functions ¶
func DNSHandler ¶
func DNSTelemetryHandler ¶
func FTPHandler ¶
func HTTPDefault ¶
func HTTPDefault(w http.ResponseWriter, r *http.Request)
func HTTPHandler ¶
func RateLimitAllowFunc ¶ added in v1.26.0
func RateLimitAllowFunc( cfg *RateLimitConfig, proto RateLimitProtoConfig, tel telemetry.Telemetry, protocol string, ) func(net.Addr) bool
RateLimitAllowFunc returns a per-IP limit check that counts rejections; it allows everything when disabled.
func RateLimitListenerWrapper ¶ added in v1.26.0
RateLimitListenerWrapper closes accepted connections over the limit.
func SMTPHandler ¶
Types ¶
type AuditConfig ¶
type AuditConfig struct {
Enabled bool
}
type Config ¶
type Config struct {
Domain string
AdminUsername string `koanf:"admin_username"`
IP string
GeoIP GeoIPConfig
DB DBConfig
Audit AuditConfig
DNS DNSConfig
TLS TLSConfig
Telemetry TelemetryConfig
RateLimit RateLimitConfig
Modules ModulesConfig
}
type Controller ¶
type Controller interface {
Start() error
}
type EventsHandler ¶
type EventsHandler struct {
// contains filtered or unexported fields
}
func NewEventsHandler ¶
func (*EventsHandler) AddNotifier ¶
func (h *EventsHandler) AddNotifier(name string, n *Notifier)
type GeoIPConfig ¶
func (GeoIPConfig) Validate ¶
func (c GeoIPConfig) Validate() valid.Problems
type ModulesConfig ¶
type ModulesConfig struct {
Enabled []string
// TODO: dynamic modules config (something like json.RawMessage) to be able to not include
// unnecessary modules in binary.
Telegram telegram.Config
API api.Config
Lark lark.Config
Slack slack.Config
}
func (ModulesConfig) Validate ¶
func (c ModulesConfig) Validate() valid.Problems
type Notifier ¶ added in v1.26.0
type Notifier struct {
// contains filtered or unexported fields
}
Notifier batches notifications per payload and sends them to a notifier from a pool of workers within the notifier's rate limit.
func NewNotifier ¶ added in v1.26.0
type RateLimitConfig ¶ added in v1.26.0
type RateLimitConfig struct {
Enabled bool
Allow []string
HTTP RateLimitProtoConfig
SMTP RateLimitProtoConfig
FTP RateLimitProtoConfig
}
func (RateLimitConfig) Validate ¶ added in v1.26.0
func (c RateLimitConfig) Validate() valid.Problems
type RateLimitProtoConfig ¶ added in v1.26.0
RateLimitProtoConfig is a per-IP limit in requests per second; zero rate disables it.
func (RateLimitProtoConfig) Validate ¶ added in v1.26.0
func (c RateLimitProtoConfig) Validate() valid.Problems
type TLSConfig ¶
type TLSConfig struct {
Type string
Custom TLSCustomConfig
LetsEncrypt TLSLetsEncryptConfig
}
type TLSCustomConfig ¶
func (TLSCustomConfig) Validate ¶
func (c TLSCustomConfig) Validate() valid.Problems
type TLSLetsEncryptConfig ¶
type TLSLetsEncryptConfig struct {
Email string
Directory string
CADirURL string `koanf:"ca_dir_url"`
CAInsecure bool `koanf:"ca_insecure"`
}
func (TLSLetsEncryptConfig) Validate ¶
func (c TLSLetsEncryptConfig) Validate() valid.Problems
type TelemetryConfig ¶
type TelemetryConfig struct {
Enabled bool
}
Click to show internal directories.
Click to hide internal directories.