package main import ( "context" "crypto/tls" "net" "os/user" "text/template" "github.com/go-kit/log/level" "tildegit.org/tjp/sliderule" ) type Modifiers struct { DirDefault string DirList bool Exec bool ExecCmd string ExtendedGophermap bool AutoAtom bool Auth *Auth Titan *Auth Templates *template.Template authName string titanName string } func (m Modifiers) Empty() bool { return (m.DirDefault == "" && !m.DirList && !m.Exec && !m.ExtendedGophermap && m.ExecCmd == "" && !m.AutoAtom && m.Titan == nil && m.titanName == "" && m.Templates == nil) } type RouteDirective struct { // Allowed: "static", "cgi", "git", "titan" Type string // " at " FsPath string URLPath string // "with ..." Modifiers Modifiers } type Server struct { Type string IP net.IP Port uint16 TLS *tls.Config Hostnames []string Routes []RouteDirective tlsKeyFile string tlsCertFile string } type Auth struct { Name string Strategy AuthStrategy } type AuthStrategy interface { Approve(context.Context, *sliderule.Request) bool } type Configuration struct { SystemUser *user.User LogLevel level.Value Servers []Server }