http

package
v0.0.0-...-7306f8b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidURL is returned from New if the provided URL is invalid
	ErrInvalidURL = errors.New("invalid registrar URL")
)

Functions

func CloneURL

func CloneURL(u *url.URL) *url.URL

CloneURL clones the URL u. If it is nil, it returns nil.

func InvalidURL

func InvalidURL(err error) error

func IsNotFoundError

func IsNotFoundError(err error) bool

func NewHTTPErrorFromBody

func NewHTTPErrorFromBody(resp *http.Response) error

func NewHTTPErrorf

func NewHTTPErrorf(resp *http.Response, format string, args ...any) error

func NewKeylimeHTTPClient

func NewKeylimeHTTPClient(options ...HTTPClientOption) (*http.Client, error)

NewKeylimeHTTPClient will create an HTTP client which can be used in interaction with the keylime services

Types

type HTTPClientOption

type HTTPClientOption func(*httpClientConfig) error

func ClientCertificate

func ClientCertificate(certFile, keyFile string) HTTPClientOption

func InsecureSkipVerify

func InsecureSkipVerify() HTTPClientOption

func ServerCAFromDER

func ServerCAFromDER(certFile string) HTTPClientOption

func ServerCAFromPEM

func ServerCAFromPEM(certFile string) HTTPClientOption

func SystemServerCA

func SystemServerCA() HTTPClientOption

type HTTPError

type HTTPError struct {
	StatusCode int    `json:"-"`
	ReqID      string `json:"request_id,omitempty"`
	Err        string `json:"status"`
}

HTTPError is the error structure as it is always being returned for any unsuccessful HTTP requests by the seeder. Let's define it once here, and reuse it where we need it.

func (*HTTPError) Error

func (e *HTTPError) Error() string

Error implements error

func (*HTTPError) Is

func (e *HTTPError) Is(target error) bool

Jump to

Keyboard shortcuts

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