-
Notifications
You must be signed in to change notification settings - Fork 20
/
options.go
61 lines (53 loc) · 1.12 KB
/
options.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
package fastdialer
import (
"net"
"time"
)
// DefaultResolvers trusted
var DefaultResolvers = []string{
"1.1.1.1:53",
"1.0.0.1:53",
"8.8.8.8:53",
"8.8.4.4:53",
}
type CacheType uint8
const (
Memory CacheType = iota
Disk
Hybrid
)
type DiskDBType uint8
const (
LevelDB DiskDBType = iota
Pogreb
)
type Options struct {
BaseResolvers []string
MaxRetries int
HostsFile bool
ResolversFile bool
EnableFallback bool
Allow []string
Deny []string
CacheType CacheType
CacheMemoryMaxItems int // used by Memory cache type
DiskDbType DiskDBType
WithDialerHistory bool
WithCleanup bool
WithTLSData bool
DialerTimeout time.Duration
DialerKeepAlive time.Duration
Dialer *net.Dialer
WithZTLS bool
SNIName string
}
// DefaultOptions of the cache
var DefaultOptions = Options{
BaseResolvers: DefaultResolvers,
MaxRetries: 5,
HostsFile: true,
ResolversFile: true,
CacheType: Disk,
DialerTimeout: 10 * time.Second,
DialerKeepAlive: 10 * time.Second,
}