client

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KnownHTTPHeaders map[string][]string
)

Functions

func ParseURL

func ParseURL(url string, aliases map[string]string) (*url.URL, error)

ParseURL parses the given URL

Types

type AWSigner

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

func NewAWSigner

func NewAWSigner(sgn *v4.Signer, region string) *AWSigner

func (*AWSigner) Sign

func (s *AWSigner) Sign(r *http.Request, body io.ReadSeeker) error

type Client

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

func NewClient

func NewClient(
	settings Settings,
	clientLogger *log.Logger,
	traceLogger *log.Logger,
) (*Client, error)

func (*Client) BuildRequest

func (client *Client) BuildRequest(method string, u *url.URL, body []byte, header http.Header) (*http.Request, error)

func (*Client) Send

func (client *Client) Send(req *http.Request) (*http.Response, error)

func (*Client) Settings added in v0.13.0

func (client *Client) Settings() Settings

type DefaultSigner

type DefaultSigner struct{}

func (DefaultSigner) Sign

func (s DefaultSigner) Sign(r *http.Request, body io.ReadSeeker) error

type MIMEType

type MIMEType string
const (
	MIMETypeHTML           MIMEType = "text/html"
	MIMETypeCSV            MIMEType = "text/csv"
	MIMETypeJSON           MIMEType = "application/json"
	MIMETypeXML            MIMEType = "application/xml"
	MIMETypeFormURLEncoded MIMEType = "application/x-www-form-urlencoded"
	MIMETypeUnknown        MIMEType = "unknown"
)

func (MIMEType) String

func (m MIMEType) String() string

type RequestSigner

type RequestSigner interface {
	Sign(r *http.Request, body io.ReadSeeker) error
}

RequestSigner is used to sign request using AWS sig v4.

type Settings added in v0.13.0

type Settings struct {
	Timeout         time.Duration
	TLS             TLSOptions
	FollowRedirects bool
}

func NewSettings added in v0.13.0

func NewSettings() Settings

func (Settings) BuildHTTPClient added in v0.13.0

func (s Settings) BuildHTTPClient() (*http.Client, error)

func (Settings) WithNoFollowRedirects added in v0.13.0

func (s Settings) WithNoFollowRedirects(b bool) Settings

func (Settings) WithTLSOptions added in v0.13.0

func (s Settings) WithTLSOptions(opts TLSOptions) Settings

func (Settings) WithTimeout added in v0.13.0

func (s Settings) WithTimeout(t time.Duration) Settings

type TLSOptions added in v0.13.0

type TLSOptions struct {
	Cert               types.Option[certificate]
	MinVersion         uint16
	MaxVersion         uint16
	SkipVerifyInsecure bool
}

func NewTLSOptions added in v0.13.0

func NewTLSOptions() TLSOptions

func (TLSOptions) WithPKCS12Cert added in v0.13.0

func (tlsOptions TLSOptions) WithPKCS12Cert(pfx []byte, passw string) TLSOptions

func (TLSOptions) WithVersions added in v0.13.0

func (tlsOptions TLSOptions) WithVersions(min, max uint16) TLSOptions

func (TLSOptions) WithX509Cert added in v0.13.0

func (tlsOptions TLSOptions) WithX509Cert(certfile, keyfile string) TLSOptions

type Tracer

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

func (*Tracer) ConnectDone

func (t *Tracer) ConnectDone(network, addr string, err error)

func (*Tracer) ConnectStart

func (t *Tracer) ConnectStart(network, addr string)

func (*Tracer) DNSDone

func (t *Tracer) DNSDone(info httptrace.DNSDoneInfo)

func (*Tracer) DNSStart

func (t *Tracer) DNSStart(info httptrace.DNSStartInfo)

func (*Tracer) Report

func (t *Tracer) Report(total time.Duration)

func (*Tracer) RoundTrip

func (t *Tracer) RoundTrip(req *http.Request) (*http.Response, error)

func (*Tracer) TLSHandshakeDone

func (t *Tracer) TLSHandshakeDone(state tls.ConnectionState, err error)

func (*Tracer) TLSHandshakeStart

func (t *Tracer) TLSHandshakeStart()

Jump to

Keyboard shortcuts

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