fshttp

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultUserAgent = "fsgo/1.0"

DefaultUserAgent default user agent

Functions

This section is empty.

Types

type Transport

type Transport struct {
	// Proxy 可选, 当前已支持 http_proxy、https_proxy
	// 若 Proxy 为 nil,将使用 http.ProxyFromEnvironment
	Proxy func(*http.Request) (*url.URL, error)

	// DialContext 可选,拨号
	DialContext func(ctx context.Context, network, addr string) (net.Conn, error)

	// DialTLSContext 可选,TLS 拨号
	DialTLSContext func(ctx context.Context, network, addr string) (net.Conn, error)

	// TLSClientConfig 可选
	TLSClientConfig *tls.Config

	// WriteTimeout 可选,设置写超时时间
	WriteTimeout func(req *http.Request, conn net.Conn) error

	// ReadTimeout 可选,设置读超时时间
	ReadTimeout func(req *http.Request, conn net.Conn) error
}

Transport 一个简单的 Transport

不管理连接,可以使用外部连接池

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error)

RoundTrip 发送请求

Jump to

Keyboard shortcuts

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