nhttp

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SOCKS5 = "socks5"
	HTTPS  = "https"
	HTTP   = "http"
)

Variables

View Source
var (
	// NoKeepAliveClient is http client without keep alive
	NoKeepAliveClient = &http.Client{
		Transport: &http.Transport{
			DisableKeepAlives: true,
		},
	}
)

Functions

func GetRaw

func GetRaw(client *http.Client, requestUrl string, header http.Header, requestBody interface{}, params ...int) (data []byte, rspHeader http.Header, httpCode int, err error)

GetRaw get http raw

func GetWithUnmarshal

func GetWithUnmarshal(client *http.Client, requestUrl string, header http.Header, requestBody interface{}, resp interface{}, params ...int) error

GetWithUnmarshal do http get with unmarshal

func Head(client *http.Client, requestUrl string, header http.Header, params ...int) (rspHeader http.Header, httpStatus int, err error)

Head .

func MatchProxy added in v1.0.3

func MatchProxy(proxyType string) string

func PostRaw

func PostRaw(client *http.Client, requestUrl string, header http.Header, requestBody interface{}, params ...int) (data []byte, rspHeader http.Header, httpCode int, err error)

PostRaw do http post, returns bytes data, response headers, http code and function error params: []int{timeoutInMillis, retryTimes}

func PostWithUnmarshal

func PostWithUnmarshal(client *http.Client, requestUrl string, header http.Header, requestBody interface{}, resp interface{}, params ...int) error

PostWithUnmarshal do http post with unmarshal

Types

type ProxyOption added in v1.0.3

type ProxyOption struct {
	Host      string `json:"host"`
	Port      int    `json:"port"`
	ProxyType string `json:"proxyType"`
}

func (*ProxyOption) ProxyRawUrl added in v1.0.3

func (t *ProxyOption) ProxyRawUrl() string

Jump to

Keyboard shortcuts

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