Documentation
¶
Index ¶
- func CastStringLikeSlice[T ~string, V ~string](in []T) []V
- func EscapeMarkdownCharacters(s string) string
- func GetUniquifiedIP(remoteAddress string) string
- func NewRateLimiterMemoryStoreWithContext(ctx context.Context, config *memorystore.Config) (limiter.Store, error)
- func ReplaceAllStringSubmatchFunc(re *regexp.Regexp, str string, repl func([]string) string) string
- func ReplaceAllStringSubmatchFuncExcludingInside(re, excludeInside *regexp.Regexp, str string, repl func([]string) string) string
- func SliceToSet[T comparable](s []T) map[T]struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CastStringLikeSlice ¶
CastStringLikeSlice converts between slices of string-like types
func EscapeMarkdownCharacters ¶
EscapeMarkdown is like escape.MarkdownCharacters but aware of JungleTV-specific chat markdown extensions
func GetUniquifiedIP ¶
GetUniquifiedIP returns a uniquified version of an IP address (sets the lower bits of a IPv6 to zero, leaves IPv4 untouched)
func NewRateLimiterMemoryStoreWithContext ¶
func NewRateLimiterMemoryStoreWithContext(ctx context.Context, config *memorystore.Config) (limiter.Store, error)
NewRateLimiterMemoryStoreWithContext creates a new in-memory rate limiter with the given config and takes care of its closure when the context is done
func ReplaceAllStringSubmatchFunc ¶
ReplaceAllStringSubmatchFunc is a version of func (*regexp.Regexp) ReplaceAllStringFunc that passes submatches to the callback. It follows the "semantic naming" convention for functions in the regexp package. Based on the implementation found at https://elliotchance.medium.com/go-replace-string-with-regular-expression-callback-f89948bad0bb
func ReplaceAllStringSubmatchFuncExcludingInside ¶
func ReplaceAllStringSubmatchFuncExcludingInside(re, excludeInside *regexp.Regexp, str string, repl func([]string) string) string
ReplaceAllStringSubmatchFuncExcludingInside works like ReplaceAllStringSubmatchFunc, but it does not perform any replacements in regions that match the regexp passed as the second argument
func SliceToSet ¶
func SliceToSet[T comparable](s []T) map[T]struct{}
SliceToSet returns a map-based set with the elements of the specified slice
Types ¶
This section is empty.