Documentation
¶
Index ¶
- Variables
- func BasicAuth(u, p string, next http.HandlerFunc) http.HandlerFunc
- func BigLittleSwap(v uint) uint
- func Bit1(b byte, index int) bool
- func ByteToUint32(data []byte, bigEndian bool) (ret uint32, err error)
- func ByteToUint32N(data []byte) (ret uint32, err error)
- func ByteToUint64N(data []byte) (ret uint64, err error)
- func CORS(next http.HandlerFunc) http.HandlerFunc
- func Clone[T any](x T) *T
- func ConvertNum[F Integer, T Integer](from F, to T) T
- func CreateShutdownScript() error
- func CurrentDir(path ...string) string
- func Exist(filename string) bool
- func GetBE[T Integer](b []byte, num *T) T
- func GetFillBytes(data byte, n int) []byte
- func GetPCR(v uint64) uint64
- func GetPtsDts(v uint64) uint64
- func GetUev(buff []byte, start int) (value int, pos int)
- func LastElement[T any](s []T) T
- func ListenUDP(address string, networkBuffer int) (*net.UDPConn, error)
- func PutBE[T Integer](b []byte, num T) []byte
- func PutPCR(pcr uint64) uint64
- func PutPtsDts(v uint64) uint64
- func ReadBE[T Integer](b []byte) (num T)
- func ReadByteToUint16(r io.Reader, bigEndian bool) (data uint16, err error)
- func ReadByteToUint24(r io.Reader, bigEndian bool) (data uint32, err error)
- func ReadByteToUint32(r io.Reader, bigEndian bool) (data uint32, err error)
- func ReadByteToUint40(r io.Reader, bigEndian bool) (data uint64, err error)
- func ReadByteToUint48(r io.Reader, bigEndian bool) (data uint64, err error)
- func ReadByteToUint64(r io.Reader, bigEndian bool) (data uint64, err error)
- func ReadByteToUint8(r io.Reader) (data uint8, err error)
- func ReturnJson[T any](fetch func() T, tickDur time.Duration, rw http.ResponseWriter, r *http.Request)
- func SizeOfBuffers[T ~[]byte](buf []T) (size int)
- func SplitBuffers[T ~[]byte](buf []T, size int) (result [][]T)
- func ToFloat64(num interface{}) float64
- func Uint32ToByte(data uint32, bigEndian bool) (ret []byte, err error)
- func WaitTerm(cancel context.CancelFunc)
- func WriteUint16ToByte(w io.Writer, data uint16, bigEndian bool) error
- func WriteUint24ToByte(w io.Writer, data uint32, bigEndian bool) error
- func WriteUint32ToByte(w io.Writer, data uint32, bigEndian bool) error
- func WriteUint40ToByte(w io.Writer, data uint64, bigEndian bool) error
- func WriteUint48ToByte(w io.Writer, data uint64, bigEndian bool) error
- func WriteUint64ToByte(w io.Writer, data uint64, bigEndian bool) error
- func WriteUint8ToByte(w io.Writer, data uint8) error
- type Buffer
- func (b Buffer) CanRead() bool
- func (b Buffer) Cap() int
- func (b *Buffer) Glow(n int)
- func (b Buffer) Len() int
- func (b *Buffer) Malloc(count int) Buffer
- func (b *Buffer) ReadByte() byte
- func (b *Buffer) ReadFloat64() float64
- func (b *Buffer) ReadN(n int) Buffer
- func (b *Buffer) ReadUint16() uint16
- func (b *Buffer) ReadUint24() uint32
- func (b *Buffer) ReadUint32() uint32
- func (b *Buffer) ReadUint64() uint64
- func (b *Buffer) Reset()
- func (b Buffer) SubBuf(start int, length int) Buffer
- func (b *Buffer) Write(a []byte) (n int, err error)
- func (b *Buffer) WriteByte(v byte)
- func (b *Buffer) WriteFloat64(v float64)
- func (b *Buffer) WriteString(a string)
- func (b *Buffer) WriteUint16(v uint16)
- func (b *Buffer) WriteUint24(v uint32)
- func (b *Buffer) WriteUint32(v uint32)
- type Crc32Reader
- type Crc32Writer
- type IOVec
- type IOVecWriter
- type Integer
- type Map
- func (m *Map[K, V]) Add(k K, v V) bool
- func (m *Map[K, V]) Delete(k K)
- func (m *Map[K, V]) Get(k K) V
- func (m *Map[K, V]) Has(k K) (ok bool)
- func (m *Map[K, V]) Init()
- func (m *Map[K, V]) Len() int
- func (m *Map[K, V]) Range(f func(V))
- func (m *Map[K, V]) Set(k K, v V)
- func (m *Map[K, V]) ToList() (r []V)
- type Promise
- type Ring
- type SSE
- type SafeChan
- type Slice
- type SysIOVec
Constants ¶
This section is empty.
Variables ¶
var BigEndian bigEndian
BigEndian is the big-endian implementation of ByteOrder.
var Crc32_Table = []uint32{}/* 256 elements not displayed */
var LittleEndian littleEndian
var Null = struct{}{}
Functions ¶
func BasicAuth ¶
func BasicAuth(u, p string, next http.HandlerFunc) http.HandlerFunc
func BigLittleSwap ¶
func ByteToUint32 ¶
千万注意大小端,RTMP是大端
func CORS ¶
func CORS(next http.HandlerFunc) http.HandlerFunc
func ConvertNum ¶
func CreateShutdownScript ¶
func CreateShutdownScript() error
func CurrentDir ¶
func GetFillBytes ¶
func LastElement ¶
func LastElement[T any](s []T) T
func ReturnJson ¶
func SplitBuffers ¶
SplitBuffers 按照一定大小分割 Buffers
func WaitTerm ¶
func WaitTerm(cancel context.CancelFunc)
Types ¶
type Buffer ¶
type Buffer []byte
func (*Buffer) ReadFloat64 ¶
func (*Buffer) ReadUint16 ¶
func (*Buffer) ReadUint24 ¶
func (*Buffer) ReadUint32 ¶
func (*Buffer) ReadUint64 ¶
func (*Buffer) WriteFloat64 ¶
func (*Buffer) WriteString ¶
func (*Buffer) WriteUint16 ¶
func (*Buffer) WriteUint24 ¶
func (*Buffer) WriteUint32 ¶
type Crc32Reader ¶
func (*Crc32Reader) ReadCrc32UIntAndCheck ¶
func (cr *Crc32Reader) ReadCrc32UIntAndCheck() (err error)
type Crc32Writer ¶
type IOVecWriter ¶
type IOVecWriter struct {
// contains filtered or unexported fields
}
func NewIOVecWriter ¶
func NewIOVecWriter(w io.Writer) (iow *IOVecWriter)
func (*IOVecWriter) Flush ¶
func (iow *IOVecWriter) Flush() error
type Promise ¶
func NewPromise ¶
type Ring ¶
type Ring[T any] struct { Value T // for use by client; untouched by this library // contains filtered or unexported fields }
A Ring is an element of a circular list, or ring. Rings do not have a beginning or end; a pointer to any ring element serves as reference to the entire ring. Empty rings are represented as nil Ring pointers. The zero value for a Ring is a one-element ring with a nil Value.
func (*Ring[T]) Do ¶
func (r *Ring[T]) Do(f func(T))
Do calls function f on each element of the ring, in forward order. The behavior of Do is undefined if f changes *r.
func (*Ring[T]) Len ¶
Len computes the number of elements in ring r. It executes in time proportional to the number of elements.
func (*Ring[T]) Link ¶
Link connects ring r with ring s such that r.Next() becomes s and returns the original value for r.Next(). r must not be empty.
If r and s point to the same ring, linking them removes the elements between r and s from the ring. The removed elements form a subring and the result is a reference to that subring (if no elements were removed, the result is still the original value for r.Next(), and not nil).
If r and s point to different rings, linking them creates a single ring with the elements of s inserted after r. The result points to the element following the last element of s after insertion.
func (*Ring[T]) Move ¶
Move moves n % r.Len() elements backward (n < 0) or forward (n >= 0) in the ring and returns that ring element. r must not be empty.
type SafeChan ¶
type SafeChan[T any] struct { C chan T // contains filtered or unexported fields }
SafeChan安全的channel,可以防止close后被写入的问题
type Slice ¶
type Slice[T comparable] []T
func (*Slice[T]) ResetAppend ¶
func (s *Slice[T]) ResetAppend(first T)