client

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clienter

type Clienter interface {
	Get(url string) (resp *http.Response, err error)
	Do(req *http.Request) (*http.Response, error)
	Post(url, contentType string, body io.Reader) (resp *http.Response, err error)
	PostForm(url string, data url.Values) (resp *http.Response, err error)
	Head(url string) (resp *http.Response, err error)
}

Clienter http client interface.

type Config

type Config struct {
	TLS       *TLS       `env:"TLS,prefix=TLS_"             json:"tls"`
	Transport *Transport `env:"TRANSPORT,prefix=TRANSPORT_" json:"transport"`
	JWT       *JWT       `env:"JWT,prefix=JWT_"             json:"jwt"`
}

Config is a struct containing client configuration values.

type DefaultClient

type DefaultClient struct {
	http.Client
	// contains filtered or unexported fields
}

DefaultClient a client struct.

func New

func New(options ...Option) *DefaultClient

New a factory function for the client.

type JWT

type JWT struct {
	ID       string `env:"ID"       json:"id"`
	KeyPath  string `env:"KEY_PATH" json:"keyPath"`
	Audience string `env:"AUDIENCE" json:"audience"`
}

JWT a JWT token signer configuration.

type Option

type Option func(p *DefaultClient)

Option function.

func WithConfig

func WithConfig(config *Config) Option

WithConfig configuration option.

type TLS

type TLS struct {
	Cert   string `env:"CERT"    json:"cert"`
	Key    string `env:"KEY"     json:"key"`
	CACert string `env:"CA_CERT" json:"caCert"`
}

TLS secure connection configuration.

type Transport

type Transport struct {
	MaxIdleConns        int           `env:"MAX_IDLE_CONNS,default=0"          json:"maxIdleConns"`
	MaxConnsPerHost     int           `env:"MAX_CONNS_PER_HOST,default=0"      json:"maxConnsPerHost"`
	MaxIdleConnsPerHost int           `env:"MAX_IDLE_CONNS_PER_HOST,default=2" json:"maxIdleConnsPerHost"`
	Timeout             time.Duration `env:"TIMEOUT,default=10s"               json:"timeout"`
}

Transport contains client transport configuration.

Jump to

Keyboard shortcuts

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