clientUtil

package
v0.0.0-...-3f9575c Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

clientUtil is a thin wrapper over http.Client and net.* to provide different timeout,number of retries,time to wait between each retry for each http and net request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(dialer *net.Dialer, network, address string, reqInfo *RequestInfo) (net.Conn, error)

Dial. call Go net.Dial underlying but with the retry feature based on the passed in reqInfo parameter.

func DialContext

func DialContext(dialer *net.Dialer, network, address string, reqInfo *RequestInfo) (net.Conn, error)

DialContext. call Go net.DialContext underlying but with the retry feature based on the passed in reqInfo parameter.

func DialIP

func DialIP(network, address string, reqInfo *RequestInfo) (*net.IPConn, error)

DialIP. call Go net.DialContext underlying but with the retry feature based on the passed in reqInfo parameter.

func DialTCP

func DialTCP(network, address string, reqInfo *RequestInfo) (*net.TCPConn, error)

DialTCP. call Go net.DialContext underlying but with the retry feature based on the passed in reqInfo parameter.

func DialTimeout

func DialTimeout(network, address string, reqInfo *RequestInfo) (net.Conn, error)

DialTimeout. call Go net.DialTimeout underlying but with the retry feature based on the passed in reqInfo parameter.

func DialUDP

func DialUDP(network, address string, reqInfo *RequestInfo) (*net.UDPConn, error)

DialUDP. call Go net.DialContext underlying but with the retry feature based on the passed in reqInfo parameter.

func DialUnix

func DialUnix(network, address string, reqInfo *RequestInfo) (*net.UnixConn, error)

DialUnix. call Go net.DialContext underlying but with the retry feature based on the passed in reqInfo parameter.

func HttpDo

func HttpDo(r *http.Request, reqInfo *RequestInfo) ([]byte, error)

HttpDo. call Go client.Do underlying but with the retry feature based on the passed in reqInfo parameter.

func HttpGet

func HttpGet(url string, reqInfo *RequestInfo) ([]byte, error)

HttpGet. call Go client.Get underlying but with the retry feature based on the passed in reqInfo parameter.

func HttpHead

func HttpHead(url string, reqInfo *RequestInfo) ([]byte, error)

HttpHead. call Go client.Head underlying but with the retry feature based on the passed in reqInfo parameter.

func HttpNewRequest

func HttpNewRequest(method string, url string, body io.Reader) (*http.Request, error)

HttpNewRequest. call Go http.NewRequest underlying

func HttpPost

func HttpPost(url string, contentType string, body io.Reader, reqInfo *RequestInfo) ([]byte, error)

HttpPost. call Go client.Post underlying but with the retry feature based on the passed in reqInfo parameter.

func HttpPostForm

func HttpPostForm(url string, data url.Values, reqInfo *RequestInfo) ([]byte, error)

HttpPostForm. call Go client.PostForm underlying but with the retry feature based on the passed in reqInfo parameter.

func LookupAddr

func LookupAddr(resolver *net.Resolver, addr string, reqInfo *RequestInfo) (names []string, err error)

LookupAddr. call Go resolver.LookupAddr underlying but with the retry feature based on the passed in reqInfo parameter.

func LookupCNAME

func LookupCNAME(resolver *net.Resolver, host string, reqInfo *RequestInfo) (cname string, err error)

LookupCNAME. call Go resolver.LookupCNAME underlying but with the retry feature based on the passed in reqInfo parameter.

func LookupHost

func LookupHost(resolver *net.Resolver, host string, reqInfo *RequestInfo) (addrs []string, err error)

LookupHost. call Go resolver.LookupHost underlying but with the retry feature based on the passed in reqInfo parameter.

func LookupIPAddr

func LookupIPAddr(resolver *net.Resolver, host string, reqInfo *RequestInfo) ([]net.IPAddr, error)

LookupIPAddr. call Go resolver.LookupIPAddr underlying but with the retry feature based on the passed in reqInfo parameter.

func LookupMX

func LookupMX(resolver *net.Resolver, name string, reqInfo *RequestInfo) ([]*net.MX, error)

LookupMX. call Go resolver.LookupMX underlying but with the retry feature based on the passed in reqInfo parameter.

func LookupNS

func LookupNS(resolver *net.Resolver, name string, reqInfo *RequestInfo) ([]*net.NS, error)

LookupNS. call Go resolver.LookupNS underlying but with the retry feature based on the passed in reqInfo parameter.

func LookupPort

func LookupPort(resolver *net.Resolver, network, service string, reqInfo *RequestInfo) (port int, err error)

LookupPort. call Go resolver.LookupPort underlying but with the retry feature based on the passed in reqInfo parameter.

func LookupSRV

func LookupSRV(resolver *net.Resolver, service, proto, name string, reqInfo *RequestInfo) (cname string, addrs []*net.SRV, err error)

LookupSRV. call Go resolver.LookupSRV underlying but with the retry feature based on the passed in reqInfo parameter.

func LookupTXT

func LookupTXT(resolver *net.Resolver, name string, reqInfo *RequestInfo) ([]string, error)

LookupTXT. call Go resolver.LookupTXT underlying but with the retry feature based on the passed in reqInfo parameter.

func NewSmtpClient

func NewSmtpClient(network, address string, reqInfo *RequestInfo) (*smtp.Client, error)

NewSmtpClient. call Go net.Dial follow by smtp.NewClient underlying but with the retry feature based on the passed in reqInfo parameter.

Types

type RequestInfo

type RequestInfo struct {
	TimeoutSec         int
	RetryTimes         int
	WaitBeforeRetrySec int
}

RequestInfo is the struct to store the information for doing retry.

Jump to

Keyboard shortcuts

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