client

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const HTTPStatusErrorBodyMaxLength = 64 * 1024

HTTPStatusErrorBodyMaxLength specifies the maximum length of HTTPStatusError.Body

Variables

This section is empty.

Functions

This section is empty.

Types

type BypassManager

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

func (BypassManager) BypassManager

func (c BypassManager) BypassManager() *BypassManager

func (BypassManager) HTTPClient

func (c BypassManager) HTTPClient() *http.Client

func (*BypassManager) ListBypass

func (bm *BypassManager) ListBypass(ctx context.Context) ([]api.BypassStatus, error)

func (*BypassManager) StartBypass

func (bm *BypassManager) StartBypass(ctx context.Context, spec api.BypassSpec) (*api.BypassStatus, error)

func (*BypassManager) StopBypass

func (bm *BypassManager) StopBypass(ctx context.Context, id string) error

type Client

type Client interface {
	HTTPClient() *http.Client
	BypassManager() *BypassManager
}

func New

func New(socketPath string) (Client, error)

New creates a client. socketPath is a path to the UNIX socket, without unix:// prefix.

func NewWithHTTPClient

func NewWithHTTPClient(hc *http.Client) Client

type HTTPStatusError

type HTTPStatusError struct {
	// StatusCode is non-2XX status code
	StatusCode int
	// Body is at most HTTPStatusErrorBodyMaxLength
	Body string
}

HTTPStatusError is created from non-2XX HTTP response

func (*HTTPStatusError) Error

func (e *HTTPStatusError) Error() string

Error implements error. If e.Body is a marshalled string of api.ErrorJSON, Error returns ErrorJSON.Message . Otherwise Error returns a human-readable string that contains e.StatusCode and e.Body.

Jump to

Keyboard shortcuts

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