util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MimeTypeM3U8 = "application/vnd.apple.mpegurl"
	MimeTypeM2TS = "video/mp2t"

	MimeTypeDefault = "application/octet-stream"
)

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 GetAbsoluteUrl added in v1.1.0

func GetAbsoluteUrl(originUrl, relativePath string) string

func GetBaseUrl added in v1.1.0

func GetBaseUrl(rawUrl string) string

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 GetRootUrl added in v1.1.0

func GetRootUrl(rawUrl 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
}

Jump to

Keyboard shortcuts

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