本文整理汇总了Golang中github.com/letsencrypt/boulder/core.DNSResolver类的典型用法代码示例。如果您正苦于以下问题:Golang DNSResolver类的具体用法?Golang DNSResolver怎么用?Golang DNSResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DNSResolver类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: validateEmail
func validateEmail(address string, resolver core.DNSResolver) (err error) {
_, err = mail.ParseAddress(address)
if err != nil {
err = core.MalformedRequestError(fmt.Sprintf("%s is not a valid e-mail address", address))
return
}
splitEmail := strings.SplitN(address, "@", -1)
domain := strings.ToLower(splitEmail[len(splitEmail)-1])
var mx []string
mx, _, err = resolver.LookupMX(domain)
if err != nil || len(mx) == 0 {
err = core.MalformedRequestError(fmt.Sprintf("No MX record for domain %s", domain))
return
}
return
}
开发者ID:devpaul,项目名称:boulder,代码行数:16,代码来源:registration-authority.go
示例2: validateEmail
func validateEmail(address string, resolver core.DNSResolver) (rtt time.Duration, err error) {
_, err = mail.ParseAddress(address)
if err != nil {
return time.Duration(0), errUnparseableEmail
}
splitEmail := strings.SplitN(address, "@", -1)
domain := strings.ToLower(splitEmail[len(splitEmail)-1])
result, rtt, err := resolver.LookupHost(domain)
if err == nil && len(result) == 0 {
err = errEmptyDNSResponse
}
if err != nil {
problem := dns.ProblemDetailsFromDNSError(err)
err = core.MalformedRequestError(problem.Detail)
}
return
}
开发者ID:kelunik,项目名称:boulder,代码行数:18,代码来源:registration-authority.go
注:本文中的github.com/letsencrypt/boulder/core.DNSResolver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论