Documentation
¶
Index ¶
- Constants
- Variables
- func Get(url string, header ...map[string]any) ([]byte, error)
- func HttpRequest(url string, method string, header ...map[string]any) ([]byte, error)
- func Post(url string, content string, header ...map[string]any) (data []byte, err error)
- func Request(url string, method string, content string, header ...map[string]any) (data []byte, lastModified time.Time, err error)
- type Response
Constants ¶
View Source
const ( // DefaultRedirects is the default number of times an Attacker follows // redirects. DefaultRedirects = 10 // DefaultTimeout is the default amount of time an Attacker waits for a request // before it times out. DefaultTimeout = 30 * time.Second // DefaultConnections is the default amount of max open idle connections per // target host. DefaultConnections = 10000 // DefaultMaxConnections is the default amount of connections per target // host. DefaultMaxConnections = 0 // DefaultWorkers is the default initial number of workers used to carry an attack. DefaultWorkers = 10 // DefaultMaxWorkers is the default maximum number of workers used to carry an attack. DefaultMaxWorkers = math.MaxUint64 // DefaultMaxBody is the default max number of bytes to be read from response bodies. // Defaults to no limit. DefaultMaxBody = int64(-1) // NoFollow is the value when redirects are not followed but marked successful NoFollow = -1 )
View Source
const ( MethodGet = http.MethodGet MethodPost = http.MethodPost MethodHead = http.MethodHead MethodPut = http.MethodPut MethodPatch = http.MethodPatch // RFC 5789 MethodDelete = http.MethodDelete MethodConnect = http.MethodConnect MethodOptions = http.MethodOptions MethodTrace = http.MethodTrace ContentEncoding = "Content-Encoding" ContextType = "Content-Type" LastModified = "Last-Modified" IfModifiedSince = "If-Modified-Since" ApplicationJson = "application/json" + ";" + charsetUtf8 ApplicationForm = "application/x-www-form-urlencoded" + ";" + charsetUtf8 )
Variables ¶
View Source
var ( TimeZero = time.Unix(0, 0) NotFound = exception.New(http.StatusNotFound, http.StatusText(http.StatusNotFound)) )
View Source
var DefaultRoundTripper http.RoundTripper = &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, }).DialContext, IdleConnTimeout: 30 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ResponseHeaderTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, MaxIdleConns: 100, MaxIdleConnsPerHost: DefaultConnections, MaxConnsPerHost: DefaultMaxConnections, }
DefaultRoundTripper is used if no RoundTripper is set in Config.
Functions ¶
func HttpRequest ¶
HttpRequest HTTP 请求
Types ¶
Click to show internal directories.
Click to hide internal directories.