core

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API           = "https://api.dnslab.link/"
	IP            = API + "IP/"
	PING          = API + "IP/Ping?hostOrIPAddress=%s"
	OPEN          = API + "IP/IsIPAndPortOpen?hostOrIPAddress=%s&port=%d"
	DNS_LOOKUP    = API + "DNSLookUp/Query?Query=%s&queryType=%s"
	REVERSELookup = API + "DNSLookUp/QueryReverse?IPAddress=%s"
	DNS_REF       = API + "DNS/UDIBT?k=%s"
)

* all url and path for request to api * %s set in program

Variables

View Source
var (
	CONNECTION_ERR = errors.New("can't connect to api")
	REQUEST_ERR    = errors.New("request error: ")
	DECODE_ERR     = errors.New("decode data error: ")
	AUTH_ERR       = errors.New("Auth error: ")
)

Functions

This section is empty.

Types

type BaseConf

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

* basic config for request to api

func New

func New(
	token string,
	log contract.Logger,
	retryTime time.Duration,
	retryCount uint,
) *BaseConf

func (*BaseConf) CheckIP

func (c *BaseConf) CheckIP() (map[string]any, error)

* check system ip with request to api.dnslab.link * and set ip4 and ip6 and port for config

func (BaseConf) DnsLookup

func (c BaseConf) DnsLookup(ipOrHost, q string) ([]map[string]any, error)

* get response with out pars data with * response models type query!

func (BaseConf) OpenPort

func (c BaseConf) OpenPort(ipOrHost string, prot uint16) (bool, error)

* check one port form on ip is open or not

func (*BaseConf) Ping

func (c *BaseConf) Ping(ipOrHost string) (map[string]any, error)

* ping your ip for check get response or not

func (BaseConf) ReverseLookup

func (c BaseConf) ReverseLookup(ip string) (string, error)

* Reverse lookup ip/host and return string

func (BaseConf) UpdateIp

func (c BaseConf) UpdateIp() (bool, error)

* update ip and check response is ok or not * this needed valid token * and run with timing * for example every 1 hour run this

Jump to

Keyboard shortcuts

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