2023-05-25 23:18:16 -06:00
|
|
|
// Config provides a configuration system for routers.
|
2023-05-25 16:08:56 -06:00
|
|
|
package config
|
|
|
|
|
|
|
|
import "crypto/tls"
|
|
|
|
|
2023-05-25 23:18:16 -06:00
|
|
|
// Config is an interface that configuration objects must fulfill.
|
2023-05-25 16:08:56 -06:00
|
|
|
type Config interface {
|
|
|
|
User (name string) User
|
|
|
|
OverUsers (func (name string, user User) bool)
|
|
|
|
|
|
|
|
RconEnable () bool
|
|
|
|
|
|
|
|
RouterPort () int
|
|
|
|
HTTPSPort () int
|
|
|
|
HTTPSEnable () bool
|
|
|
|
HTTPPort () int
|
|
|
|
HTTPEnable () bool
|
|
|
|
GeminiPort () int
|
|
|
|
GeminiEnable () bool
|
|
|
|
Certificate () tls.Certificate
|
|
|
|
|
|
|
|
ResolveAlias (alias string) string
|
|
|
|
AliasFallback () string
|
|
|
|
OverAliases (func (alias, target string) bool)
|
|
|
|
}
|
|
|
|
|
2023-05-25 23:18:16 -06:00
|
|
|
// User represents a Hnakra user.
|
2023-05-25 16:08:56 -06:00
|
|
|
type User interface {
|
|
|
|
Validate (key []byte) bool
|
|
|
|
RconAllow () bool
|
|
|
|
|
|
|
|
OverPatterns (func (pattern string) bool)
|
|
|
|
CanMountOn (scheme, host, path string) bool
|
|
|
|
}
|