httpservice

package
v5.6.0-rc1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: AGPL-3.0, Apache-2.0 Imports: 9 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

View Source
var AddressForbidden error = errors.New("address forbidden, you may need to set AllowedUntrustedInternalConnections to allow an integration access to your internal network")

Functions

func IsReservedIP

func IsReservedIP(ip net.IP) bool

Types

type Client

type Client struct {
	*http.Client
}

func NewHTTPClient

func NewHTTPClient(enableInsecureConnections bool, allowHost func(host string) bool, allowIP func(ip net.IP) bool) *Client

NewHTTPClient returns a variation the default implementation of Client. It uses a Transport with the same settings as the default Transport but with the following modifications:

  • shorter timeout for dial and TLS handshake (defined as constant "connectTimeout")
  • timeout for the end-to-end request (defined as constant "requestTimeout")

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

type DialContextFunction

type DialContextFunction func(ctx context.Context, network, addr string) (net.Conn, error)

type HTTPService

type HTTPService interface {
	MakeClient(trustURLs bool) *Client
	Close()
}

Wraps the functionality for creating a new http.Client to encapsulate that and allow it to be mocked when testing

func MakeHTTPService

func MakeHTTPService(configService configservice.ConfigService) HTTPService

type HTTPServiceImpl

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

func (*HTTPServiceImpl) Close

func (h *HTTPServiceImpl) Close()

func (*HTTPServiceImpl) MakeClient

func (h *HTTPServiceImpl) MakeClient(trustURLs bool) *Client

Jump to

Keyboard shortcuts

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