move subfolders in pkg/

This commit is contained in:
aler9
2020-11-15 17:26:09 +01:00
parent 65f6afcd9f
commit c31922be16
43 changed files with 34 additions and 34 deletions

38
pkg/base/utils.go Normal file
View File

@@ -0,0 +1,38 @@
package base
import (
"bufio"
"fmt"
)
const (
rtspMaxContentLength = 4096
)
func readByteEqual(rb *bufio.Reader, cmp byte) error {
byt, err := rb.ReadByte()
if err != nil {
return err
}
if byt != cmp {
return fmt.Errorf("expected '%c', got '%c'", cmp, byt)
}
return nil
}
func readBytesLimited(rb *bufio.Reader, delim byte, n int) ([]byte, error) {
for i := 1; i <= n; i++ {
byts, err := rb.Peek(i)
if err != nil {
return nil, err
}
if byts[len(byts)-1] == delim {
rb.Discard(len(byts))
return byts, nil
}
}
return nil, fmt.Errorf("buffer length exceeds %d", n)
}