requester

package
v0.0.0-...-cc86db0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgentHeader = "User-Agent"
)

Variables

View Source
var (
	ErrNotProvided = errors.New("not provided")
)
View Source
var (
	UserAgentValue string = fmt.Sprintf("%s_%s/%s", runtime.GOOS, runtime.GOARCH, version.AssistVersion)
)

Functions

func GetExtraHTTPHeaders

func GetExtraHTTPHeaders(logger logrus.FieldLogger) (map[string]string, error)

GetExtraHTTPHeaders would provide effective extra HTTP headers only when API server is determined

func GetHTTPTransport

func GetHTTPTransport(logger logrus.FieldLogger) *http.Transport

func GetProxyFunc

func GetProxyFunc(logger logrus.FieldLogger) func(*http.Request) (*url.URL, error)

func GetRegionId

func GetRegionId(logger logrus.FieldLogger) (string, error)

func GetRootCAs

func GetRootCAs(logger logrus.FieldLogger) *x509.CertPool

func GetServerDomain

func GetServerDomain(logger logrus.FieldLogger) (string, error)

func PeekHTTPTransport

func PeekHTTPTransport(logger logrus.FieldLogger) *http.Transport

PeekHTTPTransport: return a deep copy of _httpTransport. PeekHTTPTransport must be called after GetHTTPTransport

func PeekRefreshedRootCAs

func PeekRefreshedRootCAs(logger logrus.FieldLogger) *x509.CertPool

PeekRefreshedRootCAs returns refreshed certs instead cached, and won't modify the certs cache

func RefreshHTTPCas

func RefreshHTTPCas(logger logrus.FieldLogger, certPool *x509.CertPool)

func SetAPIServerProviders

func SetAPIServerProviders(providers []APIServerProvider)

func SetRegionIdProviders

func SetRegionIdProviders(providers []RegionIdProvider)

func SetRootCAProviders

func SetRootCAProviders(providers []CACertificateProvider)

func UpdateRootCAs

func UpdateRootCAs(logger logrus.FieldLogger, certPool *x509.CertPool)

Types

type APIServerProvider

type APIServerProvider interface {
	Name() string

	ServerDomain(logger logrus.FieldLogger) (string, error)

	ExtraHTTPHeaders(logger logrus.FieldLogger) (map[string]string, error)
}

type CACertificateProvider

type CACertificateProvider interface {
	Name() string

	CACertificate(logger logrus.FieldLogger, refresh bool) (pemCerts []byte, err error)
}

type HttpErrorCode

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

func NewHttpErrorCode

func NewHttpErrorCode(code int) *HttpErrorCode

func (*HttpErrorCode) Error

func (e *HttpErrorCode) Error() string

func (*HttpErrorCode) GetCode

func (e *HttpErrorCode) GetCode() int

type RegionIdProvider

type RegionIdProvider interface {
	Name() string

	RegionId(logger logrus.FieldLogger) (string, error)
}

Jump to

Keyboard shortcuts

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