const sniffLen … // DetectContentType implements the algorithm described // at https://mimesniff.spec.whatwg.org/ to determine the // Content-Type of the given data. It considers at most the // first 512 bytes of data. DetectContentType always returns // a valid MIME type: if it cannot determine a more specific one, it // returns "application/octet-stream". func DetectContentType(data []byte) string { … } // isWS reports whether the provided byte is a whitespace byte (0xWS) // as defined in https://mimesniff.spec.whatwg.org/#terminology. func isWS(b byte) bool { … } // isTT reports whether the provided byte is a tag-terminating byte (0xTT) // as defined in https://mimesniff.spec.whatwg.org/#terminology. func isTT(b byte) bool { … } type sniffSig … var sniffSignatures … type exactSig … func (e *exactSig) match(data []byte, firstNonWS int) string { … } type maskedSig … func (m *maskedSig) match(data []byte, firstNonWS int) string { … } type htmlSig … func (h htmlSig) match(data []byte, firstNonWS int) string { … } var mp4ftype … var mp4 … type mp4Sig … func (mp4Sig) match(data []byte, firstNonWS int) string { … } type textSig … func (textSig) match(data []byte, firstNonWS int) string { … }