helper

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressWithGzip added in v1.1.0

func CompressWithGzip(data io.Reader) (io.ReadCloser, error)

CompressWithGzip takes an io.Reader as input and pipes it through a gzip.Writer returning an io.Reader containing the gzipped data. An error is returned if passing data to the gzip.Writer fails

func GetBadge

func GetBadge(code string) ([]byte, error)

GetBadge transform badge code into SVG badge

func Match added in v1.2.0

func Match(pattern, str string) bool

Match finds whether the string matches the pattern. Supports '*' and '?' wildcards in the pattern string.

func ParseClientIP

func ParseClientIP(r *http.Request) string

ParseClientIP extract client IP from HTTP request

func ParseHostname

func ParseHostname(s string) string

ParseHostname extract hostname from an URL

func ParseInt added in v1.2.0

func ParseInt(s string, fallback int) int

ParseIntWithFallback convert string to int and use the fallback if impossible

func ParsePathname

func ParsePathname(s string) string

ParsePathname extract path with leading slash

func WriteBadgeBeacon

func WriteBadgeBeacon(w http.ResponseWriter, trackingStatus, code string)

WriteBadgeBeacon write SVG badge beacon in HTTP response

func WriteGifBeacon

func WriteGifBeacon(w http.ResponseWriter, trackingStatus string)

WriteGifBeacon write GIF beacon in HTTP response

Types

type ReadWaitCloser added in v1.1.0

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

ReadWaitCloser structure

Jump to

Keyboard shortcuts

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