torpedo_common

package module
v0.0.0-...-bceca87 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: BSD-2-Clause Imports: 17 Imported by: 50

README

torpedo_common

Documentation

Index

Constants

View Source
const User_Agent = "Mozilla/5.0 (https://github.com/tb0hdan/torpedo; tb0hdan@gmail.com) Go-http-client/1.1"

Variables

This section is empty.

Functions

func CalculateMessageRate

func CalculateMessageRate(tdiff, msgcount int64) (result string)

func ChannelsUploadImage

func ChannelsUploadImage(channels []string, fname, fpath, ftype string, api_i interface{})

func FileExists

func FileExists(fpath string) (exists bool)

func FormatTDiff

func FormatTDiff(ts int64) (int64, int64, int64, int64)

func GetLimitPage

func GetLimitPage(search_string string, limit_default, page_default int) (limit, page int)

func GetRequestedFeature

func GetRequestedFeature(full_command string, usage ...string) (requestedFeature, command, message string)

func GetStripEnv

func GetStripEnv(envvar string) (result string)

func IsInArray

func IsInArray(str string, arr []string) (result bool)

func MD5Hash

func MD5Hash(message string) (result string)

func SHA1Hash

func SHA1Hash(message string) (result string)

func SHA256Hash

func SHA256Hash(message string) (result string)

func SHA512Hash

func SHA512Hash(message string) (result string)

func UnformatURL

func UnformatURL(url string) (newurl string)

Types

type Utils

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

func (*Utils) DownloadToTmp

func (cu *Utils) DownloadToTmp(url string) (fname string, mimetype string, is_image bool, err error)

func (*Utils) GetMIMEType

func (cu *Utils) GetMIMEType(fname string) (mimetype, extension string, is_image bool, err error)

func (*Utils) GetURLBytes

func (cu *Utils) GetURLBytes(url string) (result []byte, err error)

func (*Utils) GetURLUnmarshal

func (cu *Utils) GetURLUnmarshal(url string, result interface{}) (err error)

func (*Utils) HTTPClient

func (cu *Utils) HTTPClient(req_type, url, content_type string, body *strings.Reader) (result []byte, err error)

func (*Utils) NewLog

func (cu *Utils) NewLog(prefix string) (logger *log.Logger)

func (*Utils) PostURLBytes

func (cu *Utils) PostURLBytes(url, content_type string, body *strings.Reader) (result []byte, err error)

func (*Utils) PostURLFormUnmarshal

func (cu *Utils) PostURLFormUnmarshal(url string, data url.Values, result interface{}) (err error)

func (*Utils) PostURLUnmarshal

func (cu *Utils) PostURLUnmarshal(url, content_type string, body *strings.Reader, result interface{}) (err error)

func (*Utils) SetLogger

func (cu *Utils) SetLogger(logger *log.Logger)

func (*Utils) SetLoggerPrefix

func (cu *Utils) SetLoggerPrefix(prefix string) (logger *log.Logger)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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