aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-12-19 14:46:34 +0700
committerShulhan <ms@kilabit.info>2021-12-19 14:46:34 +0700
commita29a8c8396fc16af744a0abc86b5aca343aa620a (patch)
tree9254b2524eb7ff2ecdedb830562bad5b6c5bcc79
parent7ee3e4ea4658e85a40540212b95206b09686feb7 (diff)
downloadrescached-a29a8c8396fc16af744a0abc86b5aca343aa620a.tar.xz
all: realign all structs
This minimize storage size allocated by * hostBlocks: from 88 to 80 bytes (-8 bytes) * Environment: from 344 to 288 bytes (-56 bytes)
-rw-r--r--environment.go15
-rw-r--r--hosts_block.go6
2 files changed, 13 insertions, 8 deletions
diff --git a/environment.go b/environment.go
index 21cefd9..3d1bede 100644
--- a/environment.go
+++ b/environment.go
@@ -53,16 +53,19 @@ const (
// Environment for running rescached.
//
type Environment struct {
- dns.ServerOptions
- WUIListen string `ini:"rescached::wui.listen"`
- FileResolvConf string `ini:"rescached::file.resolvconf"`
+ HostsFiles map[string]*dns.HostsFile
+ Zones map[string]*dns.Zone
+
fileConfig string
+ FileResolvConf string `ini:"rescached::file.resolvconf"`
+ WUIListen string `ini:"rescached::wui.listen"`
- Debug int `ini:"rescached::debug"`
HostsBlocksRaw []string `ini:"rescached::hosts_block" json:"-"`
HostsBlocks []*hostsBlock
- HostsFiles map[string]*dns.HostsFile
- Zones map[string]*dns.Zone
+
+ dns.ServerOptions
+
+ Debug int `ini:"rescached::debug"`
}
//
diff --git a/hosts_block.go b/hosts_block.go
index b879d05..3599acd 100644
--- a/hosts_block.go
+++ b/hosts_block.go
@@ -33,12 +33,14 @@ var hostsBlockSources = []*hostsBlock{{
}}
type hostsBlock struct {
+ lastUpdated time.Time
+
Name string // Derived from hostname in URL.
URL string
LastUpdated string
- IsEnabled bool
- lastUpdated time.Time
file string
+
+ IsEnabled bool
}
func (hb *hostsBlock) init(sources []string) {