我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何在Go中查看主机名是否为域名?

How can I check whether URL.Hostname is a valid domain name? I am searching for the exact same behaviour as URI.CheckHostName in the .NET framework.

The function IsDNSName from the govalidator package should do what you want. For details on installing it, see the README.

See my code here.

The function checks if the provided domain name is valid relative to the rules. It doesn't check if the domain name exist.

近期文章

  • 正则表达式强制执行两组中的至少一组
  • 在gRPC之上的REST Web服务版本控制
  • Ruby或等于的golang版本|| =
  • libgit2高山linux docker错误
  • 在切片上进行循环索引以获取范围
  • goroutine golang中的一个进程错误
  • 延迟关闭多个Goroutine?
  • 使用Golang mgo.v2的嵌套MongoDB查询
  • 返回自身的接口(可克隆)
  • Golang中的死锁错误
  • 使用Go将结构转换为[] byte
  • 在Go中,如何使用切片创建通用函数?
  • Golang:将结构转换为偏移量为0的结构
  • 如何减少golang中重复的http处理程序代码?
  • 如何从外部对golang http上传进行速率限制?
  • 如何确定转到通道的哪一侧正在等待?
  • 如何在GO中等待POST请求完成?
  • 为什么Go Map vs Slice性能在这里有10倍的速度差异
  • 什么规则决定Go软件包的安装位置?
  • 如何使用逗号连接领事模板的服务元数据

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华