reCoreD-UI/models/domain.go
Sense T 8a8ea59b71 1
2024-04-03 17:05:12 +08:00

23 lines
905 B
Go

package models
import "strings"
type Domain struct {
ID int `gorm:"primaryKey" json:"id"`
DomainName string `gorm:"unique,not null,size:255" json:"domain_name"`
//SOA Info
MainDNS string `gorm:"not null,size:255" json:"main_dns"`
AdminEmail string `gorm:"not null,size:255" json:"admin_email"`
SerialNumber int64 `gorm:"not null,default:1" json:"serial_number"`
RefreshInterval uint32 `gorm:"not null,size:255,default:\"86400\"" json:"refresh_interval"`
RetryInterval uint32 `gorm:"not null,size:255,default:\"7200\"" json:"retry_interval"`
ExpiryPeriod uint32 `gorm:"not null,size:255,default:\"3600000\"" json:"expiry_period"`
NegativeTtl uint32 `gorm:"not null,size:255,default:\"86400\"" json:"negative_ttl"`
}
func (d *Domain) EmailSOAForamt() string {
soa := strings.Replace(d.AdminEmail, ".", "\\", 1)
return strings.Replace(soa, "@", ".", 1)
}