mynet

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpMethodGet  = "GET"
	HttpMethodPost = "POST"
)
View Source
const (
	ContentTypeJson           = "application/json"
	ContentTypeFormUrlencoded = "application/x-www-form-urlencoded"
)

Variables

This section is empty.

Functions

func DigNS

func DigNS(domain string, timeout time.Duration) (nss []string)

func DoReq

func DoReq(method string, url string, reqCB ReqCallback, parseCB ParseCallback, client *http.Client) (err error)

func GetJson

func GetJson(url string, inParam any, timeout time.Duration, parseCb ParseCallback, client *http.Client) (err error)

func GetLocalDNSServer

func GetLocalDNSServer() ([]string, error)

func GetLocalIP

func GetLocalIP() (net.IP, error)

func GetPublicIP

func GetPublicIP() (ip string, err error)

func GetQuery

func GetQuery(url string, param url.Values, timeout time.Duration, parseCb ParseCallback, client *http.Client) error

func IsLocalIP

func IsLocalIP(ip string) bool

func IsPublicIP

func IsPublicIP(IP net.IP) bool

func LookupAddr

func LookupAddr(addr string) (domains []string, err error)

func LookupAddrEx

func LookupAddrEx(addr string, timeout time.Duration) (domains []string, err error)

func LookupCName

func LookupCName(domain string) (cname string, err error)

func LookupCNameEx

func LookupCNameEx(domain string, timeout time.Duration) (cname string, err error)

func LookupIP

func LookupIP(domain string) (ipRec []net.IP, err error)

func LookupIPEx

func LookupIPEx(domain string, timeout time.Duration) (ipRec []net.IP, err error)

func LookupNS

func LookupNS(domain string) (ns []string, err error)

func LookupNSEx

func LookupNSEx(domain string, timeout time.Duration) (ns []string, err error)

func LookupNSWithSer

func LookupNSWithSer(domain string, timeout time.Duration, serIP string) (list []string, err error)

func LookupTXT

func LookupTXT(domain string) (txt []string, err error)

func LookupTXTEx

func LookupTXTEx(domain string, timeout time.Duration) (txt []string, err error)

func NewLongClient

func NewLongClient() *http.Client

func PostForm

func PostForm(url string, values url.Values, timeout time.Duration, parseCb ParseCallback, client *http.Client) error

func PostJson

func PostJson(url string, inParam any, timeout time.Duration, parseCb ParseCallback, client *http.Client) (err error)

func RemoteIP

func RemoteIP(r *http.Request) string

RemoteIP 通过 RemoteAddr 获取 IP 地址, 只是一个快速解析方法。

func SyncOP

func SyncOP(listOP ...OPInfo) map[string]any

func SyncOPByNum

func SyncOPByNum(goNum uint, listOP ...OPInfo) map[string]any

Types

type OPInfo

type OPInfo struct {
	Key  string
	Fn   any
	Args []any
	// contains filtered or unexported fields
}

func (*OPInfo) Check

func (self *OPInfo) Check() error

func (*OPInfo) Exec

func (self *OPInfo) Exec() any

type ParseCallback

type ParseCallback func(ret []byte, httpCode int) error

type ReqCallback

type ReqCallback func(r *http.Request) (isTls bool, timeout time.Duration, err error)

Jump to

Keyboard shortcuts

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