Documentation ¶
Index ¶
- Variables
- func ChunkStringSlice(sl []string, chunkSize int) [][]string
- func Contains(s []string, e string) bool
- func CountDigits(i int) int
- func Difference(a, b []string) []string
- func GetFile(path string) (io.ReadCloser, string, error)
- func GetM3U(path string) (*m3uplus.Playlist, error)
- func GetStringMapKeys(s map[string]struct{}) []string
- func GetTCPAddr(key string) *net.TCPAddr
- func GetXMLTV(path string) (*xmltv.TV, error)
- func KebabCase(s string) string
- func PadNumberWithZeros(value int, expectedLength int) string
- func SnakeCase(s string) string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // SafeStringsRegex will match any usernames, passwords or tokens in a string. SafeStringsRegex = regexp.MustCompile(`(?m)(username|password|token)=[\w=]+(&?)`) // StringSafer will replace sensitive values (username, password and token) with safed values. StringSafer = func(input string) string { ret := input if strings.HasPrefix(input, "username=") { ret = "username=REDACTED" } else if strings.HasPrefix(input, "password=") { ret = "password=REDACTED" } else if strings.HasPrefix(input, "token=") { ret = "token=bm90Zm9yeW91" } if strings.HasSuffix(input, "&") { return fmt.Sprintf("%s&", ret) } return ret } )
Functions ¶
func ChunkStringSlice ¶
ChunkStringSlice will return a slice of slice of strings for the given chunkSize.
func Contains ¶
Contains returns true if the given element "e" is found inside the slice of strings "s".
func CountDigits ¶
CountDigits will count the number of digits in an integer.
func Difference ¶
Difference returns the elements in a that aren't in b
func GetFile ¶
func GetFile(path string) (io.ReadCloser, string, error)
GetFile is a helper function to download/open and parse a file.
func GetStringMapKeys ¶
GetStringMapKeys returns a slice of strings for the keys of a map.
func GetTCPAddr ¶
GetTCPAddr attempts to convert a string found via viper to a net.TCPAddr. Will panic on error.
func PadNumberWithZeros ¶
PadNumberWithZeros will pad the given value integer with 0's until expectedLength is met.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.