client

package
v4.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultClient

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

DefaultClient denotes the default client used for all requests

func NewDefault

func NewDefault(addr string, opts ...Option) *DefaultClient

NewDefault creates a new default client that can be used for all calls to goProbe APIs

func (*DefaultClient) Client

func (c *DefaultClient) Client() *http.Client

Client returns the client's *http.Client

func (*DefaultClient) Modify

func (c *DefaultClient) Modify(_ context.Context, req *httpc.Request) *httpc.Request

Modify activates retry behavior, timeout handling and authorization via the stored key

func (*DefaultClient) NewURL

func (c *DefaultClient) NewURL(path string) string

NewURL synthesizes a new URL for a given path depending on how the client was configured.

Example:

http://localhost:8145/status

type Option

type Option func(*DefaultClient)

Option configures the client

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the API key to be presented to the API server

func WithName

func WithName(name string) Option

WithName sets the name which is included in the User-Agent header

func WithRequestLogging

func WithRequestLogging(b bool) Option

WithRequestLogging enables logging of client requests

func WithRequestTimeout

func WithRequestTimeout(timeout time.Duration) Option

WithRequestTimeout sets the timeout for every request

func WithScheme

func WithScheme(scheme string) Option

WithScheme sets the scheme for client requests. http is the default

Jump to

Keyboard shortcuts

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