Skip to content

Commit

Permalink
Fix DNS record when using FQDN
Browse files Browse the repository at this point in the history
  • Loading branch information
Themimitoof committed Aug 17, 2022
1 parent 224ca01 commit 7355987
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/dns.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
package src

import "fmt"
import (
"fmt"
"strings"
)

// Generate a DNS record ready to be paste on a Bind compatible zone
func GenerateDNSRecord(ip string, ttl int, hostname string) string {
if strings.Contains(hostname, ".") && hostname[len(hostname)-1] != '.' {
hostname += "."
}

return fmt.Sprintf("%s\t%d\tIN\tAAAA\t%s", hostname, ttl, ip)
}

Expand Down

0 comments on commit 7355987

Please sign in to comment.