connectivity

package
v4.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: Apache-2.0 Imports: 10 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*http.Client
	// contains filtered or unexported fields
}

Client is a simple wrapper for http.Client

func NewHTTPClient

func NewHTTPClient(url string) *Client

NewHTTPClient returns a client that communicates over ip using a 30 second timeout

func NewHTTPClientWithTimeout

func NewHTTPClientWithTimeout(url string, timeout time.Duration) *Client

NewHTTPClientWithTimeout returns a client that communicates over ip

func NewHTTPClientWithTimeoutAndRedirectPolicy

func NewHTTPClientWithTimeoutAndRedirectPolicy(url string, timeout time.Duration, redirectPolicyFunc func(*http.Request, []*http.Request) error) *Client

NewHTTPClientWithTimeoutAndRedirectPolicy returns a client that communicates over ip. The redirectPoliyFunc to handle the redirect behaviors on the headers before forwarding.

func NewHTTPSClient

func NewHTTPSClient(url string, transport http.RoundTripper) *Client

NewHTTPSClient returns a new https client

func NewHTTPSClientWithTimeout

func NewHTTPSClientWithTimeout(url string, transport http.RoundTripper, timeout time.Duration) *Client

NewHTTPSClientWithTimeout returns a client that communicates over ip with tls :

func NewHTTPSClientWithTimeoutAndRedirectPolicy

func NewHTTPSClientWithTimeoutAndRedirectPolicy(url string, transport http.RoundTripper, timeout time.Duration, redirectPolicyFunc func(*http.Request, []*http.Request) error) *Client

NewHTTPSClientWithTimeoutAndRedirectPolicy returns a client that communicates over ip

func NewSocketClient

func NewSocketClient(filename string) *Client

NewSocketClient returns a client that communicates over a unix socket using a 30 second connect timeout

func NewSocketClientWithTimeout

func NewSocketClientWithTimeout(filename string, timeout time.Duration) *Client

NewSocketClientWithTimeout returns a client that communicates over a unix file socket

func (*Client) DoJSON

func (client *Client) DoJSON(r *Request) (int, error)

DoJSON action on path. payload and response are expected to be structs that decode/encode from/to json Example action=POST, path=/VolumeDriver.Create ... Tries 3 times to get data from the server nolint : To avoid cyclomatic complexity error

type Request

type Request struct {
	//Action to take, ie: GET, POST, PUT, PATCH, DELETE
	Action string
	//Path is the URI
	Path string
	//Header to include one or more headers in the request
	Header map[string]string
	//Payload to send (may be nil)
	Payload interface{}
	//Response to marshal into (may be nil)
	Response interface{}
	//ResponseError to marshal error into (may be nil)
	ResponseError interface{}
}

Request encapsulates a request to the Do* family of functions

Jump to

Keyboard shortcuts

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