func (s *Scanner) isSupportedVersion(v uint32) bool {
	return v == VersionSupported
}
isSupportedVersion returns whether version v is supported by the parser.
The current supported version is VersionSupported, defined above.
package packfile
import (
	"bufio"
	"bytes"
	"compress/zlib"
	"fmt"
	"hash"
	"hash/crc32"
	"io"
	stdioutil "io/ioutil"
	"sync"
	"gopkg.in/src-d/go-git.v4/plumbing"
	"gopkg.in/src-d/go-git.v4/utils/binary"
	"gopkg.in/src-d/go-git.v4/utils/ioutil"
)
var (
	ErrEmptyPackfile = NewError("empty packfile")
	ErrBadSignature = NewError("malformed pack file signature")
	ErrUnsupportedVersion = NewError("unsupported packfile version")
	ErrSeekNotSupported = NewError("not seek support")
)
type ObjectHeader struct {
	Type            plumbing.ObjectType
	Offset          int64
	Length          int64
	Reference       plumbing.Hash
	OffsetReference int64
}
type Scanner struct {
	r   reader
	zr  readerResetter
	crc hash.Hash32
	pendingObject    *ObjectHeader
	version, objects uint32
	IsSeekable bool
}
func NewScanner(r io.Reader) *Scanner {
	seeker, ok := r.(io.ReadSeeker)
	if !ok {
		seeker = &trackableReader{Reader: r}
	}
	crc := crc32.NewIEEE()
	return &Scanner{
		r: &teeReader{
			newByteReadSeeker(seeker),
			crc,
		},
		crc:        crc,
		IsSeekable: ok,
	}
}
func (s *Scanner) Header() (version, objects uint32, err error) {
	if s.version != 0 {
		return s.version, s.objects, nil
	}
	sig, err := s.readSignature()
	if err != nil {
		if err == io.EOF {
			err = ErrEmptyPackfile
		}
		return
	}
	if !s.isValidSignature(sig) {
		err = ErrBadSignature
		return
	}
	version, err = s.readVersion()
	s.version = version
	if err != nil {
		return
	}
	if !s.isSupportedVersion(version) {
		err = ErrUnsupportedVersion.AddDetails("%d", version)
		return
	}
	objects, err = s.readCount()
	s.objects = objects
	return
}
func (s *Scanner) readSignature() ([]byte, error) {
	var sig = make([]byte, 4)
	if _, err := io.ReadFull(s.r, sig); err != nil {
		return []byte{}, err
	}
	return sig, nil
}
func (s *Scanner) isValidSignature(sig []byte) bool {
	return bytes.Equal(sig, signature)
}
func (s *Scanner) readVersion() (uint32, error) {
	return binary.ReadUint32(s.r)
}