Documentation
¶
Index ¶
- Constants
- Variables
- func BytesReceivedConversion(b int) string
- func CheckUUID(s string) bool
- func Contains(all []string, target string) bool
- func DebugHTTP(r *http.Request, showBody bool) string
- func DebugHTTPDump(l *zerolog.Logger, r *http.Request, showBody bool)
- func DurationSeconds(duration time.Duration) int
- func GenKSUID() string
- func GenRandomString(n int) string
- func GenUUID() string
- func GetIP(r *http.Request) string
- func HTTPDownload(w http.ResponseWriter, description, filename string, filesize int64)
- func HTTPResponse(w http.ResponseWriter, cType string, code int, data interface{})
- func InFutureTime(t time.Time) string
- func Intersect(slice1, slice2 []uint) []uint
- func PastFutureTimes(t time.Time) string
- func PastFutureTimesEpoch(ts int64) string
- func PastTimeAgo(t time.Time) string
- func RandomForNames() string
- func SendRequest(reqType, reqURL string, params io.Reader, headers map[string]string) (int, []byte, error)
- func StringToBoolean(s string) bool
- func StringToInteger(s string) int64
- func StringifyTime(seconds int) string
- func TimeTimestamp(t time.Time) string
Constants ¶
const Authorization string = "Authorization"
Authorization for header key
const CacheControl string = "Cache-Control"
CacheControl for header key
const CacheControlMustRevalidate string = "must-revalidate, post-check=0, pre-check=0"
CacheControlMustRevalidate for header key
const Connection string = "Connection"
Connection for header key
const ContentDescription string = "Content-Description"
ContentDescription for header key
const ContentDisposition string = "Content-Disposition"
ContentDisposition for header key
const ContentLength string = "Content-Length"
ContentLength for header key
const ContentTransferEncoding string = "Content-Transfer-Encoding"
ContentTransferEncoding for header key
const ContentType string = "Content-Type"
ContentType for header key
const Expires string = "Expires"
Expires for header key
const JSONApplication string = "application/json"
JSONApplication for Content-Type headers
const JSONApplicationUTF8 string = JSONApplication + "; charset=UTF-8"
JSONApplicationUTF8 for Content-Type headers, UTF charset
const KeepAlive string = "Keep-Alive"
KeepAlive for Connection headers
const OctetStream string = "application/octet-stream"
OctetStream for Content-Type headers
const OsctrlUserAgent string = "osctrl-http-client/1.1"
OsctrlUserAgent for customized User-Agent
const Pragma string = "Pragma"
Pragma for header key
const PragmaPublic string = "public"
PragmaPublic for header key
const TextPlain string = "text/plain"
TextPlain for Content-Type headers
const TextPlainUTF8 string = TextPlain + "; charset=UTF-8"
TextPlainUTF8 for Content-Type headers, UTF charset
const TransferEncodingBinary string = "binary"
TransferEncodingBinary for header key
const UserAgent string = "User-Agent"
UserAgent for header key
const XForwardedFor string = "X-Forwarded-For"
const XRealIP string = "X-Real-IP"
XRealIP for header key
Variables ¶
Functions ¶
func BytesReceivedConversion ¶
BytesReceivedConversion - Helper to format bytes received into KB, MB, TB... Binary format
func DebugHTTPDump ¶
DebugHTTPDump - Helper for debugging purposes and dump a full HTTP request
func DurationSeconds ¶
DurationSeconds - Helper to get the seconds value fom a Duration
func GenKSUID ¶
func GenKSUID() string
GenKSUID - Helper to generate a KSUID See https://github.com/segmentio/ksuid for more info about KSUIDs
func GenRandomString ¶
GenRandomString - Helper to generate a random string of n characters
func GenUUID ¶
func GenUUID() string
GenUUID - Helper to generate a UUID See https://github.com/google/uuid for more info about UUIDs
func HTTPDownload ¶
func HTTPDownload(w http.ResponseWriter, description, filename string, filesize int64)
HTTPDownload - Helper to send HTTP response with a file
func HTTPResponse ¶
func HTTPResponse(w http.ResponseWriter, cType string, code int, data interface{})
HTTPResponse - Helper to send HTTP response
func InFutureTime ¶
InFutureTime - Helper to format future times only returning one value (minute, hour, day)
func PastFutureTimes ¶
PastFutureTimes - Helper to format past or future times
func PastFutureTimesEpoch ¶
PastFutureTimesEpoch - Helper to format past or future times
func PastTimeAgo ¶
PastTimeAgo - Helper to format past times only returning one value (minute, hour, day)
func RandomForNames ¶
func RandomForNames() string
Helper to generate a random MD5 to be used with queries/carves
func SendRequest ¶
func SendRequest(reqType, reqURL string, params io.Reader, headers map[string]string) (int, []byte, error)
SendRequest - Helper function to send HTTP requests
func StringToBoolean ¶
StringToBoolean - Helper to convert a string into boolean
func StringToInteger ¶
StringToInteger - Helper to convert a string into integer
func StringifyTime ¶
StringifyTime - Helper to get a string based on the difference of two times
func TimeTimestamp ¶
TimeTimestamp - Helper to format times in timestamp format
Types ¶
This section is empty.