0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-21 06:54:14 +01:00
gitea/vendor/gopkg.in/asn1-ber.v1/util.go

25 lines
455 B
Go
Raw Normal View History

2016-11-03 23:16:01 +01:00
package ber
import "io"
func readByte(reader io.Reader) (byte, error) {
bytes := make([]byte, 1, 1)
_, err := io.ReadFull(reader, bytes)
if err != nil {
if err == io.EOF {
return 0, io.ErrUnexpectedEOF
}
return 0, err
}
return bytes[0], nil
}
func isEOCPacket(p *Packet) bool {
return p != nil &&
p.Tag == TagEOC &&
p.ClassType == ClassUniversal &&
p.TagType == TypePrimitive &&
len(p.ByteValue) == 0 &&
len(p.Children) == 0
}