blob: 3dd3935242bb27ff98f4110ace465fe6b4a5107e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
package main
import (
"context"
"crypto/tls"
"net"
"os/user"
"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
Titan *Auth
titanName string
}
func (m Modifiers) Empty() bool {
return m.DirDefault == "" && !m.DirList && !m.Exec && !m.ExtendedGophermap
}
type RouteDirective struct {
// Allowed: "static", "cgi", "git", "titan"
Type string
// "<FsPath> at <URLPath>"
FsPath string
URLPath string
// "with ..."
Modifiers Modifiers
Auth *Auth
authName string
}
type Server struct {
Type string
IP net.IP
Port uint16
TLS *tls.Config
Hostnames []string
Routes []RouteDirective
}
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
}
|