forked from nginx/nginx-gateway-fabric
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
88 lines (75 loc) · 1.86 KB
/
config.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package http
// Server holds all configuration for an HTTP server.
type Server struct {
SSL *SSL
ServerName string
Locations []Location
IsDefaultHTTP bool
IsDefaultSSL bool
Port int32
}
// Location holds all configuration for an HTTP location.
type Location struct {
Return *Return
Rewrites []string
Path string
ProxyPass string
HTTPMatchVar string
ProxySetHeaders []Header
Internal bool
}
// Header defines a HTTP header to be passed to the proxied server.
type Header struct {
Name string
Value string
}
// Return represents an HTTP return.
type Return struct {
Body string
Code StatusCode
}
// SSL holds all SSL related configuration.
type SSL struct {
Certificate string
CertificateKey string
}
// StatusCode is an HTTP status code.
type StatusCode int
const (
// StatusFound is the HTTP 302 status code.
StatusFound StatusCode = 302
// StatusNotFound is the HTTP 404 status code.
StatusNotFound StatusCode = 404
// StatusInternalServerError is the HTTP 500 status code.
StatusInternalServerError StatusCode = 500
)
// Upstream holds all configuration for an HTTP upstream.
type Upstream struct {
Name string
Servers []UpstreamServer
}
// UpstreamServer holds all configuration for an HTTP upstream server.
type UpstreamServer struct {
Address string
}
// SplitClient holds all configuration for an HTTP split client.
type SplitClient struct {
VariableName string
Distributions []SplitClientDistribution
}
// SplitClientDistribution maps Percentage to Value in a SplitClient.
type SplitClientDistribution struct {
Percent string
Value string
}
// Map defines an NGINX map.
type Map struct {
Source string
Variable string
Parameters []MapParameter
}
// Parameter defines a Value and Result pair in a Map.
type MapParameter struct {
Value string
Result string
}