-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
51 lines (39 loc) · 1.07 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
package main
import (
"net"
"time"
"github.com/sirupsen/logrus"
)
type AccessMode interface {
Mode() string
}
type PublicMode struct{}
func (p PublicMode) Mode() string { return "Public" }
type TokenRequiredMode struct{}
func (t TokenRequiredMode) Mode() string { return "TokenRequired" }
type PreSharedKeyMode struct {
Key string
}
func (p PreSharedKeyMode) Mode() string { return "PreSharedKey" }
type CIDRRange struct {
Network *net.IPNet
}
type AppConfig struct {
Dns2tcpdConfigPath string
TunnelDatabasePath string
DomainNames []string
WatchDogTimeout time.Duration
AccessMode AccessMode
LogLevel logrus.Level
BlacklistedCIDRs []string
}
var Config = AppConfig{
Dns2tcpdConfigPath: "/tmp/dns-configs/",
TunnelDatabasePath: "./tunnels.db",
DomainNames: []string{"abc.io", "thc.io"},
WatchDogTimeout: 15 * time.Minute,
AccessMode: PublicMode{},
LogLevel: logrus.DebugLevel,
BlacklistedCIDRs: []string{"192.168.1.0/24"},
//BlacklistedCIDRs: []string{"192.168.1.0/24", "10.0.0.0/8", "127.0.0.0/8"},
}