util

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

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

This section is empty.

Types

type HTTPRequest

type HTTPRequest struct {
	Header http.Header `json:"header"`
	Body   []byte      `json:"body"`
}

HTTPRequest is used structure used to unmarshal message content from clous

type HTTPResponse

type HTTPResponse struct {
	Header     http.Header `json:"header"`
	StatusCode int         `json:"status_code"`
	Body       []byte      `json:"body"`
}

HTTPResponse is HTTP request's response structure used to send response to cloud

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 sets client options

func (*URLClient) HTTPDo

func (client *URLClient) HTTPDo(method, 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