DotEnd
This commit is contained in:
parent
613ef7fdd9
commit
e18781ba25
@ -22,7 +22,7 @@ func (c *Controller) CreateDomain(d *models.Domain) (*models.Domain, error) {
|
||||
}
|
||||
|
||||
r := &models.RecordWithType[dns.SOARecord]{}
|
||||
r.Zone = fmt.Sprintf("%s.", d.DomainName)
|
||||
r.Zone = d.WithDotEnd()
|
||||
r.Name = "@"
|
||||
r.RecordType = models.RecordTypeSOA
|
||||
r.Content.Ns = d.MainDNS
|
||||
|
@ -1,6 +1,9 @@
|
||||
package models
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Domain struct {
|
||||
ID int `gorm:"primaryKey" json:"id"`
|
||||
@ -21,3 +24,11 @@ func (d *Domain) EmailSOAForamt() string {
|
||||
s[0] = strings.Replace(s[0], ".", "\\", -1)
|
||||
return strings.Join(s, ".")
|
||||
}
|
||||
|
||||
func (d *Domain) WithDotEnd() string {
|
||||
if strings.HasSuffix(d.DomainName, ".") {
|
||||
return d.DomainName
|
||||
} else {
|
||||
return fmt.Sprintf("%s.", d.DomainName)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user