Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAddress(urlStr string) (string, error)
- func GRPCSeverBuilder() *gsvrBuilder
- func GetSingleIPAddress(addrStr string) (net.IP, error)
- func IsPublicAddr(addrStr string) bool
- func IsSameAddress(ip1str, ip2str string) bool
- func ResolveHostDomain(domainName string) ([]net.IP, error)
- type AddressType
Constants ¶
View Source
const ( DN = `^([a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*[\._]?$` IPv4 = `^((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])` IPv6 = `` /* 659-byte string literal not displayed */ )
Variables ¶
View Source
var ( DNPattern = regexp.MustCompile(DN) InvalidAddress = fmt.Errorf("invalid address") )
Functions ¶
func CheckAddress ¶
CheckAddress check if urlStr is valid address (ip or FQDN) or not.
func GRPCSeverBuilder ¶
func GRPCSeverBuilder() *gsvrBuilder
GRPCServerBuilder returns a new GRPC server builder.
func GetSingleIPAddress ¶
IGetSingleIPAddress find and get ip address of given address string. It return first ip if DNS or /etc/hosts has multiple IPs, or return err if no ip is found or addrStr is malformed.
func IsPublicAddr ¶
func IsSameAddress ¶
IsSameAddress check two string is same ip address or domain name.
Types ¶
type AddressType ¶
type AddressType int
const ( AddressTypeError AddressType = iota AddressTypeIP AddressTypeFQDN )
AddressType
func CheckAddressType ¶
func CheckAddressType(urlStr string) AddressType
CheckAddressType check type of urlStr; ip, FQDN or malformed string.
Click to show internal directories.
Click to hide internal directories.