-
Notifications
You must be signed in to change notification settings - Fork 14
/
config_v7.go
44 lines (37 loc) · 1020 Bytes
/
config_v7.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
package config
type ConfigV7 struct {
ConfigV6 `mapstructure:",squash"`
Privacy *Privacy `json:"privacy"`
WhiteList *WhiteList `json:"whiteList"`
}
type Privacy struct {
Enable bool `json:"enable"`
PtmNode string `json:"ptmNode"`
}
type WhiteList struct {
Enable bool `json:"enable"`
WhiteListInfos []*WhiteListInfo `json:"whiteListInfo"`
}
type WhiteListInfo struct {
PeerId string `json:"peerId"`
Addr string `json:"addr"` //(for example, "192.0.2.1:25", "[2001:db8::1]:80")
Comment string `json:"comment"`
}
func DefaultConfigV7(dir string) (*ConfigV7, error) {
var cfg ConfigV7
cfg6, _ := DefaultConfigV6(dir)
cfg.ConfigV6 = *cfg6
cfg.Privacy = defaultPrivacy()
cfg.WhiteList = defaultWhiteList()
cfg.RPC.PublicModules = append(cfg.RPC.PublicModules, "privacy")
return &cfg, nil
}
func defaultPrivacy() *Privacy {
return &Privacy{}
}
func defaultWhiteList() *WhiteList {
return &WhiteList{
Enable: false,
WhiteListInfos: []*WhiteListInfo{},
}
}