This commit is contained in:
m5r
2023-12-13 22:27:51 +01:00
parent da1b496653
commit 3b00fc9c13
2 changed files with 8 additions and 10 deletions

View File

@ -14,7 +14,6 @@ import (
type Xip struct {
server dns.Server
zone string
nameServers []*dns.NS
}
@ -26,6 +25,11 @@ type HardcodedRecord struct {
CNAME []*dns.CNAME
}
const (
zone = "local-ip.sh."
nameservers = "ns1.local-ip.sh.,ns2.local-ip.sh."
)
var (
flyRegion = os.Getenv("FLY_REGION")
dottedIpV4Regex = regexp.MustCompile(`(?:^|(?:[\w\d])+\.)(((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4})($|[.-])`)
@ -369,10 +373,10 @@ func (xip *Xip) StartServer() {
}
}
func NewXip(zone string, nameservers []string, port int) (xip *Xip) {
func NewXip(port int) (xip *Xip) {
xip = &Xip{}
for _, ns := range nameservers {
for _, ns := range strings.Split(nameservers, ",") {
xip.nameServers = append(xip.nameServers, &dns.NS{Ns: ns})
}