Documentation ¶
Index ¶
- Constants
- func AllOrNoneReqd(opts ...string) (ok bool)
- func CreateTLSConfiguration(tlsConfig *TLSConfig) (t *tls.Config, err error)
- func DefInt(envVarName string, defValue int) int
- func GetMapString(genericMap map[string]interface{}, key string) string
- func GetenvOrDefault(varName, defaultVal string) string
- func GetenvOrDefaultLowerCase(varName, defaultVal string) string
- func GetenvOrDefaultUpperCase(varName, defaultVal string) string
- func MarshalToYAML(conf interface{}) (yamlBytes []byte, err error)
- func ParseHosts(filename string) (map[string]string, error)
- func StrToAddress(desc string, strAddr string) (addr ethbinding.Address, err error)
- func UUIDv4() string
- func YAMLorJSONPayload(req *http.Request) (map[string]interface{}, error)
- type HTTPRequester
- type HTTPRequesterConf
- type TLSConfig
Constants ¶
const (
// MaxPayloadSize max size of content
MaxPayloadSize = 1024 * 1024
)
Variables ¶
This section is empty.
Functions ¶
func AllOrNoneReqd ¶
AllOrNoneReqd util for checking parameters that must be provided together
func CreateTLSConfiguration ¶
CreateTLSConfiguration creates a tls.Config structure based on parsing the configuration passed in via a TLSConfig structure
func DefInt ¶
DefInt defaults an integer to a value in an Env var, and if not the default integer provided
func GetMapString ¶
GetMapString is a helper to safely extract strings from generic interface maps
func GetenvOrDefault ¶
func MarshalToYAML ¶
MarshalToYAML marshals a JSON annotated structure into YAML, by first going to JSON
func ParseHosts ¶
ParseHosts - credit to github.com/jaytaylor/go-hostsfile
func StrToAddress ¶
func StrToAddress(desc string, strAddr string) (addr ethbinding.Address, err error)
StrToAddress is a helper to parse eth addresses with useful errors
Types ¶
type HTTPRequester ¶
type HTTPRequester struct {
// contains filtered or unexported fields
}
HTTPRequester performs common HTTP request logging/processing for utilities
func NewHTTPRequester ¶
func NewHTTPRequester(name string, conf *HTTPRequesterConf) *HTTPRequester
NewHTTPRequester constructor
func (*HTTPRequester) DoRequest ¶
func (hr *HTTPRequester) DoRequest(method, url string, bodyMap map[string]interface{}) (map[string]interface{}, error)
DoRequest performs a single HTTP request processing the response as JSON
func (*HTTPRequester) GetResponseString ¶
func (hr *HTTPRequester) GetResponseString(m map[string]interface{}, p string, emptyOK bool) (string, error)
GetResponseString returns a string from a response map, asserting its existencer
type HTTPRequesterConf ¶
HTTPRequesterConf configuration for making HTTP reuqests