stage 1
This commit is contained in:
@@ -21,7 +21,7 @@ type Domain struct {
|
||||
NegativeTtl uint32 `gorm:"not null;size:255,default:\"86400\"" json:"negative_ttl"`
|
||||
}
|
||||
|
||||
func (d Domain) EmailSOAForamt() string {
|
||||
func (d *Domain) EmailSOAForamt() string {
|
||||
s := strings.Split(d.AdminEmail, "@")
|
||||
s[0] = strings.Replace(s[0], ".", "\\", -1)
|
||||
if !strings.HasSuffix(s[1], ".") {
|
||||
@@ -30,7 +30,7 @@ func (d Domain) EmailSOAForamt() string {
|
||||
return strings.Join(s, ".")
|
||||
}
|
||||
|
||||
func (d Domain) WithDotEnd() string {
|
||||
func (d *Domain) WithDotEnd() string {
|
||||
if strings.HasSuffix(d.DomainName, ".") {
|
||||
return d.DomainName
|
||||
} else {
|
||||
@@ -38,7 +38,7 @@ func (d Domain) WithDotEnd() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (d Domain) GenerateSOA() dns.SOARecord {
|
||||
func (d *Domain) GenerateSOA() dns.SOARecord {
|
||||
var ns string
|
||||
if !strings.HasSuffix(d.MainDNS, ".") {
|
||||
ns = fmt.Sprintf("%s.", d.MainDNS)
|
||||
|
@@ -37,23 +37,23 @@ type Record[T recordContentTypes] struct {
|
||||
RecordType string `gorm:"not null;size:255" json:"record_type"`
|
||||
}
|
||||
|
||||
func (Record[T]) TableName() string {
|
||||
func (*Record[T]) TableName() string {
|
||||
return "coredns_record"
|
||||
}
|
||||
|
||||
func (r Record[T]) CheckZone() error {
|
||||
func (r *Record[T]) CheckZone() error {
|
||||
if strings.HasSuffix(r.Zone, ".") {
|
||||
return ErrorZoneNotEndWithDot
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r Record[T]) WithOutDotTail() string {
|
||||
func (r *Record[T]) WithOutDotTail() string {
|
||||
return strings.TrimRight(r.Zone, ".")
|
||||
}
|
||||
|
||||
func (r Record[T]) ToEntity() IRecord {
|
||||
return &r
|
||||
func (r *Record[T]) ToEntity() IRecord {
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *Record[T]) FromEntity(entity any) error {
|
||||
@@ -65,7 +65,7 @@ func (r *Record[T]) FromEntity(entity any) error {
|
||||
return json.Unmarshal(b, r)
|
||||
}
|
||||
|
||||
func (r Record[T]) GetType() string {
|
||||
func (r *Record[T]) GetType() string {
|
||||
return r.RecordType
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@ type Settings struct {
|
||||
Value string `gorm:"not null;size:255"`
|
||||
}
|
||||
|
||||
func (s Settings) String() string {
|
||||
func (s *Settings) String() string {
|
||||
return fmt.Sprintf("%s: %s", s.Key, s.Value)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user