Skip to content

Commit

Permalink
Fix FQDN in cache file
Browse files Browse the repository at this point in the history
The IP addresses will know be saved in the format 'subdomain.domain.tld'
instead of 'subdomaindomain.tld'. This fixes #2.
  • Loading branch information
Hentra committed Jun 28, 2020
1 parent 49f63a0 commit c943f4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (c *Cache) SetIPv4(domain, host, ipv4 string) {
entry := c.getEntry(domain, host)
if entry == nil {
newEntry := CacheEntry {
host: host+domain,
host: host + "." + domain,
ipv4: ipv4,
ipv6: "",
}
Expand All @@ -109,7 +109,7 @@ func (c *Cache) SetIPv6(domain, host, ipv6 string) {
entry := c.getEntry(domain, host)
if entry == nil {
newEntry := CacheEntry {
host: host+domain,
host: host + "." + domain,
ipv4: "",
ipv6: ipv6,
}
Expand Down Expand Up @@ -142,7 +142,7 @@ func (c *Cache) GetIPv6(domain, host string) string {

func (c *Cache) getEntry(domain, host string) *CacheEntry {
for i, entry := range c.entries {
if entry.host == (host+domain) {
if entry.host == (host + "." + domain) {
return &c.entries[i]
}
}
Expand Down

0 comments on commit c943f4d

Please sign in to comment.