networking

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilTransport      = errors.New("Transport is nil")
	ErrBadChallenge      = errors.New("Challenge is bad")
	ErrAlgNotImplemented = errors.New("Alg not implemented")
)

Functions

func DefaultTimeoutClient added in v0.1.2

func DefaultTimeoutClient() *http.Client

func DigestAuthParams added in v0.1.2

func DigestAuthParams(r *http.Response) map[string]string

Parse Authorization header from the http.Request. Returns a map of auth parameters or nil if the header is not a valid parsable Digest auth header.

func H added in v0.1.2

func H(data string, encryptionType string) string

func MD5 added in v0.1.7

func MD5(data string) string

H function for MD5 algorithm (returns a lower-case hex MD5 digest)

func NewTimeoutClient added in v0.1.2

func NewTimeoutClient(cTimeout time.Duration, rwTimeout time.Duration) *http.Client

apps will set three OS variables:

func RandomKey added in v0.1.2

func RandomKey() string

func Request added in v0.1.5

func Request(method, url string, reqBody []byte, pHeaders map[string]string, cli *http.Client) (*http.Response, error)

func SHA256 added in v0.1.7

func SHA256(data string) string

func SendSoap

func SendSoap(httpClient *http.Client, endpoint, message string, username, password string, urlType string) (*http.Response, error)

SendSoap send soap message

Types

type RestClientAuth added in v0.1.2

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

func (*RestClientAuth) Request added in v0.1.2

func (this *RestClientAuth) Request(method string, url string, reqBody []byte, headers map[string]string, timeout time.Duration, encryptionType string) RestResponse

func (*RestClientAuth) SetAuth added in v0.1.2

func (this *RestClientAuth) SetAuth(user, pwd string)

type RestResponse added in v0.1.2

type RestResponse struct {
	ReqString  string
	RespBody   []byte
	StatusCode int
	Err        error
}

func Auth added in v0.1.2

func Auth(username string, password string, url, uri string, method string, requestBody []byte, headerMap *map[string]string, timeout time.Duration, encryptionType string) RestResponse

func NewRestResponse added in v0.1.2

func NewRestResponse(body []byte, code int, err error) RestResponse

func NewRestResponseEx added in v0.1.2

func NewRestResponseEx(body []byte, code int, err error, req string) RestResponse

func SendSoapEx added in v0.1.2

func SendSoapEx(endpoint, message string, username, password string, urlType string, encryptionType string) RestResponse

// SendSoap send soap message

type Transport added in v0.0.9

type Transport struct {
	Username  string
	Password  string
	Transport http.RoundTripper
}

Transport is an implementation of http.RoundTripper that takes care of http digest authentication.

func NewTransport added in v0.0.9

func NewTransport(username, password string, urlType string) *Transport

NewTransport creates a new digest transport using the http.DefaultTransport.

func (*Transport) Client added in v0.0.9

func (t *Transport) Client() (*http.Client, error)

Client returns an HTTP client that uses the digest transport.

func (*Transport) RoundTrip added in v0.0.9

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip makes a request expecting a 401 response that will require digest authentication. It creates the credentials it needs and makes a follow-up request.

Jump to

Keyboard shortcuts

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