network

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	POST = "POST"
	GET  = "GET"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Http

type Http struct {
	Trans  *http.Transport
	Client *http.Client
	Errs   error
}

func NewHttp

func NewHttp() *Http

func (*Http) DownloadFile

func (obj *Http) DownloadFile(url, savePath string) (string, error)

* 下载文件 url:下载地址 savePath:保存路径(包含文件名)

func (*Http) Get

func (obj *Http) Get(url string, data map[string]interface{}, header map[string]string) ([]byte, error)

http get请求

func (*Http) GetUrlBody

func (*Http) GetUrlBody(url string) ([]byte, error)

* 获取url返回的内容

func (*Http) GetUrlRedirect

func (*Http) GetUrlRedirect(url string) (*url.URL, error)

* 获取Url地址重写向地址

func (*Http) Post

func (obj *Http) Post(url string, data map[string]interface{}, header map[string]string) ([]byte, error)

http post请求

func (*Http) Request

func (obj *Http) Request(method, requestUrl string, data map[string]interface{}, header map[string]string) ([]byte, error)

http 通用请求

func (*Http) SetCookieJar

func (obj *Http) SetCookieJar(urlStr string, cookies []*http.Cookie) *Http

设置cookie

func (*Http) SetProxyHttp

func (obj *Http) SetProxyHttp(ip string, port int64) *Http

设置Http代理 全局设置: os.Setenv("HTTP_PROXY", "http://127.0.0.1:9743") os.Setenv("HTTPS_PROXY", "https://127.0.0.1:9743")

func (*Http) SetProxySocks

func (obj *Http) SetProxySocks(ip string, port int64, name, password string) *Http

设置Socks代理

type Net

type Net struct {
}

func NewNet

func NewNet() *Net

func (*Net) LocalIP

func (*Net) LocalIP() (string, error)

func (*Net) LocalMac

func (*Net) LocalMac() (string, error)

func (*Net) TcpGather

func (*Net) TcpGather(ip, port string) bool

tcp端口检测

Jump to

Keyboard shortcuts

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