gg_net_dns

package
v0.2.37 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDomain

func GetDomain(name string) string

func GetIpVersion

func GetIpVersion(ip string) (version uint8)

Types

type DnsHelper

type DnsHelper struct {
	// contains filtered or unexported fields
}

func NewDnsHelper

func NewDnsHelper() (instance *DnsHelper)

func (*DnsHelper) CanSendEmails

func (instance *DnsHelper) CanSendEmails(addr string) (response bool, err error)

func (*DnsHelper) GetDomainName

func (instance *DnsHelper) GetDomainName(addr string) (response string, err error)

func (*DnsHelper) GetInfo

func (instance *DnsHelper) GetInfo(addr string) (response *DnsInfo, err error)

func (*DnsHelper) GetIpVersion

func (instance *DnsHelper) GetIpVersion(ip string) (version uint8)

func (*DnsHelper) GetLocalAddress

func (instance *DnsHelper) GetLocalAddress() (address string, err error)

GetLocalAddress return local IP

func (*DnsHelper) GetPublicAddress

func (instance *DnsHelper) GetPublicAddress() (address string, err error)

GetPublicAddress return IP of current ISP provider using IPIFY.org

func (*DnsHelper) IsIPAddress

func (instance *DnsHelper) IsIPAddress(value string) (success bool)

func (*DnsHelper) LookupAddr

func (instance *DnsHelper) LookupAddr(ip string) (response []string, err error)

LookupAddr does a reverse lookup for the address and returns a list of names that map to the address. The LookupAddr() function performs a reverse finding for the address and returns a list of names that map to the given address. USage: LookupAddr("6.8.8.8")

func (*DnsHelper) LookupCNAME

func (instance *DnsHelper) LookupCNAME(host string) (response string, err error)

LookupCNAME returns the final name after following zero or more CNAME records. CNAME is the abbreviation for canonical name. CNAMEs are essentially domain and subdomain text aliases to bind traffic. The LookupCNAME() function accepts a host-name(m.facebook.com) as a string and returns a single canonical domain name for the given host. Usage: LookupCNAME("m.facebook.com")

func (*DnsHelper) LookupHost

func (instance *DnsHelper) LookupHost(host string) (addrs []string, err error)

LookupHost returns the host addresses using the local resolver. Usage: LookupHost("localhost")

func (*DnsHelper) LookupIP

func (instance *DnsHelper) LookupIP(host string) (response []net.IPAddr, err error)

LookupIP returns a hosts IP addresses. It is now preferred over the Hosts method to resolve a name to IP. The LookupIP() function accepts a string(domain-name) and returns a slice of net.IP objects that contains host's IPv4 and IPv6 addresses. Usage: LookupIP("google.com)

func (*DnsHelper) LookupMX

func (instance *DnsHelper) LookupMX(name string) (response []*net.MX, err error)

LookupMX returns the DNS MX records for the domain name, sorted by preference. These records identify the servers that can exchange emails. The LookupMX() function takes a domain name as a string and returns a slice of MX structs sorted by preference. An MX struct is made up of a Host as a string and Pref as a uint16. Usage: LookupMX("google.com")

func (*DnsHelper) LookupNS

func (instance *DnsHelper) LookupNS(name string) (response []*net.NS, err error)

LookupNS returns DNS NS records for the domain name. The NS records describe the authorized name servers for the zone. The NS also delegates subdomains to other organizations on zone files. The LookupNS() function takes a domain name(facebook.com) as a string and returns DNS-NS records as a slice of NS structs. Usage: LookupNS("gmail.com")

func (*DnsHelper) LookupSRVTcp

func (instance *DnsHelper) LookupSRVTcp(service, name string) (cname string, response []*net.SRV, err error)

LookupSRVTcp attempts to resolve an SRV query of the service, protocol (tcp), and domain name, sorted by priority and randomized by weight within a priority. Usage: LookupSRVTcp("xmpp-server", "google.com")

func (*DnsHelper) LookupSRVUdp

func (instance *DnsHelper) LookupSRVUdp(service, name string) (cname string, response []*net.SRV, err error)

LookupSRVUdp attempts to resolve an SRV query of the service, protocol (udp), and domain name, sorted by priority and randomized by weight within a priority. Usage: LookupSRVUdp("xmpp-server", "google.com")

func (*DnsHelper) LookupTXT

func (instance *DnsHelper) LookupTXT(name string) (response []string, err error)

LookupTXT returns DNS TXT records for the domain name. This text record stores information about the SPF that can identify the authorized server to send email on behalf of your organization. The LookupTXT() function takes a domain name(facebook.com) as a string and returns a list of DNS TXT records as a slice of strings.

func (*DnsHelper) SetServer

func (instance *DnsHelper) SetServer(value string) *DnsHelper

func (*DnsHelper) SetServerGoogle

func (instance *DnsHelper) SetServerGoogle() *DnsHelper

type DnsIPInfo

type DnsIPInfo struct {
	IPAddress string `json:"ip-address"`
	IPVersion uint8  `json:"ip-version"`
}

func (*DnsIPInfo) String

func (instance *DnsIPInfo) String() string

type DnsISPInfo

type DnsISPInfo struct {
	IP          string `json:"ip"`
	ASN         string `json:"asn"`
	ISPName     string `json:"name"`
	Country     string `json:"country"`
	Registry    string `json:"registry"`
	Range       string `json:"range"`
	AllocatedAt string `json:"time"`
}

func (*DnsISPInfo) String

func (instance *DnsISPInfo) String() string

type DnsInfo

type DnsInfo struct {
	InitialRawAddress string        `json:"initial-raw-address"` // requested
	Domain            string        `json:"domain"`
	IPInfo            []*DnsIPInfo  `json:"ip-info"`
	ISPInfo           []*DnsISPInfo `json:"isp-info"`
	CanSendEmails     bool          `json:"can-send-email"`
	TXT               []string      `json:"txt"`
	ISPName           string        `json:"isp-name"`
	ISPCountry        string        `json:"isp-country"`
	Errors            []string      `json:"errors"`
}

func (*DnsInfo) AddError

func (instance *DnsInfo) AddError(context string, err error) *DnsInfo

func (*DnsInfo) AddIP

func (instance *DnsInfo) AddIP(ips ...string) *DnsInfo

func (*DnsInfo) AddISP

func (instance *DnsInfo) AddISP(isp *ipisp.Response) *DnsInfo

func (*DnsInfo) String

func (instance *DnsInfo) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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