/
slashquery.go
67 lines (51 loc) · 1.37 KB
/
slashquery.go
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 slashquery
//go:generate go run genroutes.go -f examples/slashquery.yml
import (
"time"
"github.com/slashquery/resolver"
)
// Slashquery structure
type Slashquery struct {
Config map[string]string
Plugins map[string][]string
Resolver *resolver.Resolver
Routes map[string]*Route
Servers map[string]*Servers
Upstreams map[string]*Upstream
}
// Route define an upstream
type Route struct {
// URL of the upstream, if set, Scheme, Host, Path and Upstream
// will be set from it, the upstream will named has the host
// after parsing the URL
URL string
// Scheme http or https
Scheme string
// Host hostname to use when doing the request
Host string
// Path to use when doing the request
Path string
// Upstream identifier to use
Upstream string
// Methods list of allowed methods, example: GET, POST, HEAD
Methods []string
// Plugins list of plugins to use (middleware)
Plugins []string
// Insecure is set to yes will skip the certificate verification
Insecure bool
// DisableKeepAlive if set to yes won't cache/reuse the connections
DisableKeepAlive bool
// rawQuery encoded query values, without '?'
rawQuery string
}
// Upstream structure
type Upstream struct {
Servers []string
Timeout int
}
// Servers keep IP's from upstreams (needs a resolver)
type Servers struct {
Addresses []string
Expire time.Time
last string
}