http

package
v0.9.23 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package http [allows sending customized http traffic]

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRequest

func InitRequest(c RequestConfig, req *fasthttp.Request)

InitRequest is used to populate data from request config to fasthttp.Request

Types

type Client added in v0.8.2

type Client interface {
	Do(req *fasthttp.Request, resp *fasthttp.Response) error
}

func NewClient

func NewClient(ctx context.Context, clientConfig ClientConfig, logger *zap.Logger) Client

NewClient creates a fasthttp client based on the config.

type ClientConfig

type ClientConfig struct {
	StaticHost      *StaticHostConfig
	TLSClientConfig *tls.Config
	Timeout         *time.Duration
	ReadTimeout     *time.Duration
	WriteTimeout    *time.Duration
	IdleTimeout     *time.Duration
	MaxIdleConns    *int
	Proxy           *utils.ProxyParams
}

ClientConfig is a http client configuration structure

type RequestConfig

type RequestConfig struct {
	Path    string
	Method  string
	Body    string
	Headers map[string]string
	Cookies map[string]string
}

RequestConfig is a struct representing the config of a single request

type StaticHostClient added in v0.8.23

type StaticHostClient struct {
	// contains filtered or unexported fields
}

Not a very effective way but hey, it does it's job

func (*StaticHostClient) Do added in v0.8.23

type StaticHostConfig added in v0.8.2

type StaticHostConfig struct {
	Addr  string
	IsTLS *bool
}

Jump to

Keyboard shortcuts

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