Documentation ¶
Overview ¶
torequtil has utility functions used by toreq and toreqnew which don't require the Traffic Ops client, and thus can be shared.
Index ¶
- Constants
- func CookieCacheFileName(userName string) string
- func CookieCachePath(userName string) string
- func CookiesToString(cookies []*http.Cookie) string
- func GetRetry(numRetries int, objName string, obj interface{}, ...) error
- func GetTOToolNameAndURL(globalParams []tc.Parameter) (string, string)
- func MaybeHdrStr(hdr http.Header, hdrName string) string
- func MaybeIPStr(addr net.Addr) string
- func RetryBackoffSeconds(currentRetry int) int
- func StringToCookies(cookiesStr string) []*http.Cookie
- type Cookie
- type FsCookie
Constants ¶
const CookieCacheDir = `/var/lib/trafficcontrol-cache-config/`
Variables ¶
This section is empty.
Functions ¶
func CookieCacheFileName ¶
func CookieCachePath ¶
func CookiesToString ¶
func GetRetry ¶
func GetRetry(numRetries int, objName string, obj interface{}, getter func(obj interface{}) error) error
GetRetry attempts to get the given object, retrying with exponential backoff up to cfg.NumRetries. The objName is not used in actual fetching or logic, but only for logging. It can be any printable string, but should be unique and reflect the object being fetched.
func GetTOToolNameAndURL ¶
func MaybeHdrStr ¶
MaybeHdrStr returns the header text if hdr isn't nil, or the empty string if it is. This is intended for logging, to allow logging with one line, whether a header object is nil or not.
The hdrName must be the canonically-capitalized header name.
func MaybeIPStr ¶
MaybeIPStr returns the addr string if it isn't nil, or the empty string if it is. This is intended for logging, to allow logging with one line, whether addr is nil or not.