Many matchers check for a known magic prefix at the beginning of
the data being sniffed. They currently all reimplement length check +
byte by byte comparison to achieve this. This commit adds a generic
helper which can be passed the magic pattern and returns a
The matchers were exported (Gz(), Bz2(), SevenZ(), ...), this commit
removes them as I'm not sure if this was intentional. They can be easily
readded as 'var Xz = bytePrefixMatcher(xzMagic)' if needed.
I've only made changes to matchers/archive.go for now, but other
matchers could benefit from the same change.
Many matchers check for a known magic prefix at the beginning of the data being sniffed. They currently all reimplement length check + byte by byte comparison to achieve this. This commit adds a generic helper which can be passed the magic pattern and returns a
The matchers were exported (Gz(), Bz2(), SevenZ(), ...), this commit removes them as I'm not sure if this was intentional. They can be easily readded as 'var Xz = bytePrefixMatcher(xzMagic)' if needed.
I've only made changes to matchers/archive.go for now, but other matchers could benefit from the same change.