netlib

package
v1.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: GPL-3.0 Imports: 5 Imported by: 2

Documentation

Overview

Package netlib provides a simple IP and DNS functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIPv4

func IsIPv4(ip string) bool

IsIPv4 checks if the input string is a validIPv4 address

func IsIPv6

func IsIPv6(ip string) bool

IsIPv6 checks if the input string is a valid IPv6 address

func IsPrivateIP

func IsPrivateIP(ip string) bool

IsPrivateIP checks if the input string is a private IP address

func IsValidIP

func IsValidIP(ip string) bool

IsValidIP checks if the input string is a valid IP address

Types

type DNSconfig

type DNSconfig struct {
	Nameserver string
	Port       int
	TCP        bool
	Resolver   *net.Resolver
	Timeout    time.Duration
	IPv4Only   bool
	IPv6Only   bool
}

func NewResolver

func NewResolver(nameserver string, port int, tcp bool) (dns *DNSconfig)

NewResolver returns a DNSconfig object

func (*DNSconfig) LookupIP

func (dns *DNSconfig) LookupIP(hostname string) (ipEntires []net.IP, err error)

LookupIP looks up the IP address of a hostname

func (*DNSconfig) LookupSrv

func (dns *DNSconfig) LookupSrv(srv string, domain string) (srvEntries []*net.SRV, err error)

LookupSrv looks up the SRV record of a service

func (*DNSconfig) LookupTXT

func (dns *DNSconfig) LookupTXT(hostname string) (txt []string, err error)

LookupTXT looks up the TXT record of a hostname

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL