util

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MimeTypeM3U8 = "application/vnd.apple.mpegurl"
)

Variables

This section is empty.

Functions

func Broadcast

func Broadcast(msg io.WriterTo, localIp net.IP, remoteAddr *net.UDPAddr) (err error)

func DefaultNumber

func DefaultNumber[T Number](value T, defValue T) T

func DefaultString

func DefaultString(value string, defValue string) string

func DefaultStringFunc

func DefaultStringFunc(value string, defFunc func() string) string

func ForAllIPs

func ForAllIPs(skipLoopback bool, fn func(net.IP))

ForAllIPs calls fn with all local IPs

func GetMimeType added in v1.0.4

func GetMimeType(filename string) string

func GetMimeTypeForExt added in v1.0.4

func GetMimeTypeForExt(ext string) string

func InterfaceHasIPv4

func InterfaceHasIPv4(nif *net.Interface) bool

func IsImageFile added in v1.0.4

func IsImageFile(filename string) bool

func ListenUdp4Packet added in v1.0.2

func ListenUdp4Packet(addr string) (net.PacketConn, error)

func OsVersion

func OsVersion() string

func RenderXML

func RenderXML(rw http.ResponseWriter, doc any)

func SendXML

func SendXML(rw http.ResponseWriter, body []byte)

Types

type Number

type Number interface {
	int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64
}

type TTLCache added in v1.0.1

type TTLCache[V any] struct {
	// contains filtered or unexported fields
}

func NewCache added in v1.0.1

func NewCache[V any](ttl time.Duration) *TTLCache[V]

func (*TTLCache[V]) Get added in v1.0.1

func (c *TTLCache[V]) Get(key string) (value V, ok bool)

func (*TTLCache[V]) Put added in v1.0.1

func (c *TTLCache[V]) Put(key string, value V)

func (*TTLCache[V]) Remove added in v1.0.1

func (c *TTLCache[V]) Remove(key string)

Jump to

Keyboard shortcuts

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