reqh2

package
v3.0.0-rc67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	UDSPrefix  = "http:///"
	InetPrefix = "https://"
)
View Source
const (
	// VsockPrefix is the scheme of the url of the daemon of a guest, reached
	// from its hypervisor: vsock://<context id>:<port>.
	VsockPrefix = "vsock://"
)

Variables

This section is empty.

Functions

func DialVsock

func DialVsock(ctx context.Context, cid, port uint32) (net.Conn, error)

DialVsock connects to the port of the context id from a reserved source port. The bind needs CAP_NET_BIND_SERVICE, and a port in use the next one.

func NewInet

func NewInet(config Config) (apiClient *api.ClientWithResponses, err error)

NewInet returns api *api.ClientWithResponses from config.

request authorization header will be created from one of config properties:
- Username & Password
- Bearer
- BearerFunc, called once the connection is ready
- Authorization

func NewUDS

func NewUDS(config Config) (apiClient *api.ClientWithResponses, err error)

func NewUDSClient

func NewUDSClient(config Config) *http.Client

func NewVsock

func NewVsock(config Config) (*api.ClientWithResponses, error)

NewVsock returns a client of the daemon of a guest. A daemon not running is an error at the first request, with no retry: the caller has other ways to reach the guest.

func ParseVsockURL

func ParseVsockURL(s string) (cid, port uint32, err error)

ParseVsockURL returns the context id and the port of a vsock url.

Types

type Config

type Config struct {
	Certificate        string
	Key                string
	Username           string
	Password           string                 `json:"-"`
	URL                string                 `json:"url"`
	Authorization      string                 `json:"-"`
	Bearer             string                 `json:"-"`
	BearerFunc         func() (string, error) `json:"-"`
	Timeout            time.Duration
	InsecureSkipVerify bool
	RootCA             string
	ServerName         string
	Tokens             tokencache.Entry
}

Config is the agent HTTP/2 requester configuration

func (Config) String

func (t Config) String() string

type RefreshTransport

type RefreshTransport struct {
	Base http.RoundTripper

	Username string
	Password string
	// contains filtered or unexported fields
}

func (*RefreshTransport) RoundTrip

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

Jump to

Keyboard shortcuts

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