httpclient

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

README

Http Client for Go-Chassis

Build Status This is a simple http client for Go-Chassis which is used in all internal communication with Service-Center, Config-Center and Monitoring Server.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultURLClientOption = &URLClientOption{
	Compressed:            true,
	HandshakeTimeout:      30 * time.Second,
	ResponseHeaderTimeout: 60 * time.Second,
}

DefaultURLClientOption is a struct object which has default client option

View Source
var SignRequest func(*http.Request) error

SignRequest sign a http request so that it can talk to API server

Functions

func GetX509CACertPool

func GetX509CACertPool(caCertFile string) (*x509.CertPool, error)

GetX509CACertPool is a function used to get certificate

func LoadTLSCertificate

func LoadTLSCertificate(certFile, keyFile, passphase string, cipher security.Cipher) ([]tls.Certificate, error)

LoadTLSCertificate is a function used to load a certificate

Types

type URLClient

type URLClient struct {
	*http.Client
	TLS     *tls.Config
	Request *http.Request
	// contains filtered or unexported fields
}

URLClient is a struct used for storing details of a client

func GetURLClient

func GetURLClient(option *URLClientOption) (client *URLClient, err error)

GetURLClient is a function which which sets client option

func (*URLClient) HTTPDo

func (client *URLClient) HTTPDo(method string, rawURL string, headers http.Header, body []byte) (resp *http.Response, err error)

HTTPDo is a method used for http connection

type URLClientOption

type URLClientOption struct {
	SSLEnabled            bool
	TLSConfig             *tls.Config
	Compressed            bool
	HandshakeTimeout      time.Duration
	ResponseHeaderTimeout time.Duration
	Verbose               bool
}

URLClientOption is a struct which provides options for client

Jump to

Keyboard shortcuts

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