diff options
| author | Shulhan <ms@kilabit.info> | 2022-05-22 21:29:35 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-05-22 21:51:47 +0700 |
| commit | 0b92dbb8463dee31c005c59f67c2bf754a9eae12 (patch) | |
| tree | a95162fc3aaa88ce772f9b7c8b79747c225a0ba8 /environment.go | |
| parent | 89494ecacdd03426da17def52e35a1a66c9630eb (diff) | |
| download | rescached-0b92dbb8463dee31c005c59f67c2bf754a9eae12.tar.xz | |
all: export and rename the hostsBlock type to Blockd
In the Environment, we have a field HostsBlocks that reference
an unexported type hostsFile.
In order for any package to be able to use this field, we need to
export this type.
While at it, we rename the type from hostsBlock to Blockd to make it
simple and consistent with name.
Diffstat (limited to 'environment.go')
| -rw-r--r-- | environment.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/environment.go b/environment.go index b5c226c..1dcd2c1 100644 --- a/environment.go +++ b/environment.go @@ -76,8 +76,8 @@ type Environment struct { FileResolvConf string `ini:"rescached::file.resolvconf"` WUIListen string `ini:"rescached::wui.listen"` - HostsBlocks map[string]*hostsBlock `ini:"block.d"` - hostsBlocksFile map[string]*dns.HostsFile + HostBlockd map[string]*Blockd `ini:"block.d"` + hostBlockdFile map[string]*dns.HostsFile // The options for WUI HTTP server. HttpdOptions *libhttp.ServerOptions `json:"-"` @@ -126,8 +126,8 @@ func newEnvironment(dirBase, fileConfig string) *Environment { pathDirZone: filepath.Join(dirBase, dirZone), pathFileCaches: filepath.Join(dirBase, dirCaches, fileCaches), - fileConfig: filepath.Join(dirBase, fileConfig), - hostsBlocksFile: make(map[string]*dns.HostsFile), + fileConfig: filepath.Join(dirBase, fileConfig), + hostBlockdFile: make(map[string]*dns.HostsFile), HttpdOptions: &libhttp.ServerOptions{ Memfs: mfsWww, Address: defWuiAddress, @@ -190,9 +190,9 @@ func (env *Environment) init() (err error) { func (env *Environment) initHostsBlock() { var ( - hb *hostsBlock + hb *Blockd ) - for _, hb = range env.HostsBlocks { + for _, hb = range env.HostBlockd { hb.init(env.pathDirBlock) } } @@ -230,7 +230,7 @@ func (env *Environment) save(file string) (in *ini.Ini, err error) { var ( logp = "save" - hb *hostsBlock + hb *Blockd vstr string ) @@ -247,7 +247,7 @@ func (env *Environment) save(file string) (in *ini.Ini, err error) { in.Set(sectionNameRescached, "", keyDebug, strconv.Itoa(env.Debug)) in.Set(sectionNameRescached, "", keyWUIListen, strings.TrimSpace(env.WUIListen)) - for _, hb = range env.HostsBlocks { + for _, hb = range env.HostBlockd { in.Set(sectionNameBlockd, hb.Name, keyName, hb.Name) in.Set(sectionNameBlockd, hb.Name, keyUrl, hb.URL) } |
