ht

package
v0.0.0-...-f69e0f1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GET

func GET(urllink string, params map[string]string, headers map[string]string, transport *http.Transport, timeout time.Duration) (*http.Response, error)

func Get

func Get(urllink string, params map[string]string, headers map[string]string, transport *http.Transport, timeout time.Duration) (bytes []byte, err error)

func GetBody

func GetBody(urllink string, body []byte, headers map[string]string, transport *http.Transport, timeout time.Duration) (bs []byte, err error)

func GetBodyJson

func GetBodyJson(urllink string, params map[string]string, headers map[string]string, transport *http.Transport, timeout time.Duration) (bytes []byte, err error)

func GetForm

func GetForm(urllink string, params map[string]string, headers map[string]string, transport *http.Transport, timeout time.Duration) (bytes []byte, err error)

func NewClient

func NewClient(proxy *http.Transport, timeout time.Duration) *c

NewClient 创建一个请求客户端 proxy 代理信息,可以通过 NewProxy 来创建 timeout 超时,如果为0,则默认(官方http包默认)。

func NewHeaders

func NewHeaders(header Header) map[string]string

NewHeaders 创建一个浏览器header UA

func NewProxy

func NewProxy(rawurl string) (*http.Transport, error)

NewProxy 创建一个代理,用于发送请求的时候使用。 NewProxy("socks5://admin:password@192.168.1.2:8888")

func POST

func POST(urllink string, params map[string]string, headers map[string]string, transport *http.Transport, timeout time.Duration) (*http.Response, error)

func Post

func Post(urllink string, params map[string]string, headers map[string]string, transport *http.Transport, timeout time.Duration) (bytes []byte, err error)

func PostBody

func PostBody(urllink string, body []byte, headers map[string]string, transport *http.Transport, timeout time.Duration) (bs []byte, err error)

func PostBodyJson

func PostBodyJson(urllink string, params map[string]string, headers map[string]string, transport *http.Transport, timeout time.Duration) (bytes []byte, err error)

func PostForm

func PostForm(urllink string, params map[string]string, headers map[string]string, transport *http.Transport, timeout time.Duration) (bytes []byte, err error)

Types

type Header string
const (
	HeaderPcWinMicrosoftEdge   Header = `` /* 130-byte string literal not displayed */
	HeaderPcWinFirefox         Header = `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0`
	HeaderPcWinGoogleChrome    Header = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36`
	HeaderPcWin360Browser      Header = `Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36`
	HeaderAndroidUCBrowser     Header = `` /* 159-byte string literal not displayed */
	HeaderAndroidHuaWeiBrowser Header = `` /* 134-byte string literal not displayed */
)

Jump to

Keyboard shortcuts

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