Documentation
¶
Index ¶
- Variables
- func CanonicalAddr(addr netip.Addr) netip.Addr
- func CanonicalPrefix(pfx netip.Prefix) (netip.Prefix, error)
- func EnsurePrefix(s string, prefix string) string
- func EnsureSuffix(s string, suffix string) string
- func FromQuery[T any](query url.Values) (*T, error)
- func FromRequest[T any](r *http.Request) (*T, error)
- func Hostname() string
- func HostnameOrErr(allowPanic ...bool) (string, error)
- func IPKeyToPrefix(ip string) (netip.Prefix, error)
- func IsIn[T comparable](first T, slice ...T) bool
- func Parse[T Parsed](s string) (result T, err error)
- func ProbeInto(ctx context.Context, path string, res any, args map[string]any) error
- func Query[T any](obj T) url.Values
- func RandString(n int) string
- func RandToken(n int) (string, error)
- func RegisterQueryConverter[T any](encode func(v reflect.Value) string, decode func(s string) reflect.Value)
- func TimeTrack(f func()) (d time.Duration)
- type ContextKey
- type FFMpegProbe
- type FullyHidden
- type HiddenString
- type IPTree
- func (t *IPTree[V]) Delete(ipCidr string) error
- func (t *IPTree[V]) Insert(ipCidr string, val V) error
- func (t *IPTree[V]) Lookup(ip netip.Addr) (V, bool)
- func (t *IPTree[V]) LookupString(ip string) (V, bool)
- func (t *IPTree[V]) PutIPs(val V, ips ...netip.Addr) error
- func (t *IPTree[V]) PutPrefixes(val V, pfxs ...netip.Prefix) error
- type IPTreeSet
- type Parsed
- type PartiallyHidden
- type ResponseWriter
- type Set
- type StringHider
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrObjectNotFound = errors.New("object not found") ErrNotImplemented = errors.New("not implemented") )
View Source
var ErrInvalidIP = errors.New("invalid IP")
Functions ¶
func CanonicalAddr ¶
CanonicalAddr returns the IPv4 form of an IPv4-mapped IPv6 address and strips any IPv6 zone.
func EnsurePrefix ¶
func EnsureSuffix ¶
func HostnameOrErr ¶
func IsIn ¶
func IsIn[T comparable](first T, slice ...T) bool
func RandString ¶
func RegisterQueryConverter ¶
Types ¶
type ContextKey ¶
type ContextKey struct {
Name string
}
func (*ContextKey) String ¶
func (k *ContextKey) String() string
type FFMpegProbe ¶
type FFMpegProbe struct {
Format struct {
Duration string `json:"duration"`
Filename string `json:"filename"`
NbStreams int `json:"nb_streams"`
NbPrograms int `json:"nb_programs"`
FormatName string `json:"format_name"`
FormatLongName string `json:"format_long_name"`
StartTime string `json:"start_time"`
Size string `json:"size"`
BitRate string `json:"bit_rate"`
ProbeScore int `json:"probe_score"`
} `json:"format"`
}
func (FFMpegProbe) Duration ¶
func (p FFMpegProbe) Duration() (float64, error)
type FullyHidden ¶
type FullyHidden = HiddenString[starHider]
type HiddenString ¶
type HiddenString[T StringHider] string
func (HiddenString[T]) MarshalJSON ¶
func (c HiddenString[T]) MarshalJSON() ([]byte, error)
func (HiddenString[T]) String ¶
func (c HiddenString[T]) String() string
type IPTree ¶
type IPTree[V any] struct { // contains filtered or unexported fields }
func (*IPTree[V]) LookupString ¶
type IPTreeSet ¶
type IPTreeSet struct {
// contains filtered or unexported fields
}
func NewIPTreeSet ¶
func NewIPTreeSet() *IPTreeSet
type Parsed ¶
type Parsed interface {
constraints.Integer | constraints.Unsigned | constraints.Float | ~bool | ~string
}
type PartiallyHidden ¶
type PartiallyHidden = HiddenString[partialHider]
type ResponseWriter ¶
type ResponseWriter struct {
http.ResponseWriter
// contains filtered or unexported fields
}
ResponseWriter wrapper to allows middleware to set headers without worrying about the response header being written already.
func UnwrapResponseWriter ¶
func UnwrapResponseWriter(w http.ResponseWriter) (rw *ResponseWriter, ok bool)
Unwrap the response writer
func WrapResponseWriter ¶
func WrapResponseWriter(w http.ResponseWriter) *ResponseWriter
func (*ResponseWriter) Hijack ¶
func (rw *ResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
func (*ResponseWriter) StatusCode ¶
func (w *ResponseWriter) StatusCode() int
type Set ¶
type Set[K comparable] struct { // contains filtered or unexported fields }
Set implements a hashset, using the hashmap as the underlying storage.
func SetDiff ¶
func SetDiff[K comparable](a, b Set[K]) Set[K]
func SetIntersection ¶
func SetIntersection[K comparable](a, b Set[K]) (intersection Set[K])
func SetOf ¶
func SetOf[K comparable](vals ...K) Set[K]
Of returns a new hashset initialized with the given 'vals'
func SetUnion ¶
func SetUnion[K comparable](a, b Set[K]) Set[K]
type StringHider ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.