-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
37 lines (31 loc) · 956 Bytes
/
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
package main
// Based on https://github.com/mdouchement/geoblock
// Rule data types.
const (
RuleTypeCountry RuleType = "country"
RuleTypeCIDR RuleType = "cidr"
)
// Supported default actions.
const (
DefaultActionAllow = "allow"
DefaultActionBlock = "block"
)
type (
// A Configuration defines the proxy configuration.
Configuration struct {
Endpoints []string `yaml:"endpoints"`
Metrics string `yaml:"metrics"`
Logger string `yaml:"logger"`
Databases []string `yaml:"databases"` // Path to ip2location database files.
DefaultAction string `yaml:"default_action"` // Default action to perform when there is no specified rule.
Allowlist []Rule `yaml:"allowlist"`
Blocklist []Rule `yaml:"blocklist"`
}
// A RuleType defines the type of a rule.
RuleType string
// A Rule is used to define if a request can be allowed or blocked.
Rule struct {
Type RuleType
Value string
}
)