本文整理匯總了Golang中github.com/rafaeljusto/shelter/model.Domain.Owners方法的典型用法代碼示例。如果您正苦於以下問題:Golang Domain.Owners方法的具體用法?Golang Domain.Owners怎麽用?Golang Domain.Owners使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/rafaeljusto/shelter/model.Domain
的用法示例。
在下文中一共展示了Domain.Owners方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: newDomain
// Function to mock a domain object
func newDomain() model.Domain {
var domain model.Domain
domain.FQDN = "rafael.net.br"
domain.Nameservers = []model.Nameserver{
{
Host: "ns1.rafael.net.br",
IPv4: net.ParseIP("127.0.0.1"),
IPv6: net.ParseIP("::1"),
},
{
Host: "ns2.rafael.net.br",
IPv4: net.ParseIP("127.0.0.2"),
},
}
domain.DSSet = []model.DS{
{
Keytag: 1234,
Algorithm: model.DSAlgorithmRSASHA1,
Digest: "A790A11EA430A85DA77245F091891F73AA740483",
},
}
owner, _ := mail.ParseAddress("[email protected]")
domain.Owners = []model.Owner{
{
Email: owner,
Language: "pt-BR",
},
}
return domain
}
示例2: generateAndSignDomain
func generateAndSignDomain(fqdn string) (
model.Domain, *dns.DNSKEY, *dns.RRSIG, time.Time, time.Time,
) {
dnskey, rrsig, err := utils.GenerateKSKAndSignZone(fqdn)
if err != nil {
utils.Fatalln("Error creating KSK DNSSEC keys and signatures", err)
}
ds := dnskey.ToDS(uint8(model.DSDigestTypeSHA1))
domain := model.Domain{
FQDN: fqdn,
Nameservers: []model.Nameserver{
{
Host: fmt.Sprintf("ns1.%s", fqdn),
IPv4: net.ParseIP("127.0.0.1"),
},
},
DSSet: []model.DS{
{
Keytag: dnskey.KeyTag(),
Algorithm: utils.ConvertKeyAlgorithm(dnskey.Algorithm),
DigestType: model.DSDigestTypeSHA1,
Digest: ds.Digest,
},
},
}
owner, _ := mail.ParseAddress("[email protected]")
domain.Owners = []model.Owner{
{
Email: owner,
Language: "pt-BR",
},
}
lastCheckAt := time.Now().Add(-72 * time.Hour)
lastOKAt := lastCheckAt.Add(-24 * time.Hour)
// Set all nameservers with error and the last check equal of the error check interval,
// this will force the domain to be checked
for index, _ := range domain.Nameservers {
domain.Nameservers[index].LastCheckAt = lastCheckAt
domain.Nameservers[index].LastOKAt = lastOKAt
domain.Nameservers[index].LastStatus = model.NameserverStatusServerFailure
}
// Set all DS records with error and the last check equal of the error check interval,
// this will force the domain to be checked
for index, _ := range domain.DSSet {
domain.DSSet[index].LastCheckAt = lastCheckAt
domain.DSSet[index].LastOKAt = lastOKAt
domain.DSSet[index].LastStatus = model.DSStatusTimeout
}
return domain, dnskey, rrsig, lastCheckAt, lastOKAt
}
示例3: generateAndSaveDomain
// Function to mock a domain
func generateAndSaveDomain(fqdn string, domainDAO dao.DomainDAO, dnskey *dns.DNSKEY) {
ds := dnskey.ToDS(uint8(model.DSDigestTypeSHA1))
domain := model.Domain{
FQDN: fqdn,
Nameservers: []model.Nameserver{
{
Host: fmt.Sprintf("ns1.%s", fqdn),
IPv4: net.ParseIP("127.0.0.1"),
},
},
DSSet: []model.DS{
{
Keytag: dnskey.KeyTag(),
Algorithm: utils.ConvertKeyAlgorithm(dnskey.Algorithm),
DigestType: model.DSDigestTypeSHA1,
Digest: ds.Digest,
},
},
}
owner, _ := mail.ParseAddress("[email protected]")
domain.Owners = []model.Owner{
{
Email: owner,
Language: "pt-BR",
},
}
lastCheckAt := time.Now().Add(-72 * time.Hour)
lastOKAt := lastCheckAt.Add(-24 * time.Hour)
// Set all nameservers with error and the last check equal of the error check interval,
// this will force the domain to be checked
for index, _ := range domain.Nameservers {
domain.Nameservers[index].LastCheckAt = lastCheckAt
domain.Nameservers[index].LastOKAt = lastOKAt
domain.Nameservers[index].LastStatus = model.NameserverStatusServerFailure
}
// Set all DS records with error and the last check equal of the error check interval,
// this will force the domain to be checked
for index, _ := range domain.DSSet {
domain.DSSet[index].LastCheckAt = lastCheckAt
domain.DSSet[index].LastOKAt = lastOKAt
domain.DSSet[index].LastStatus = model.DSStatusTimeout
}
if err := domainDAO.Save(&domain); err != nil {
utils.Fatalln(fmt.Sprintf("Fail to save domain %s", domain.FQDN), err)
}
}