func (h Header) Check() error {
	if len(h.Options)%4 != 0 || int(h.IHL) != 5+len(h.Options)/4 {
		return ErrInvalidIHL
	} else if int(h.IHL)*4 > int(h.TotalLength) {
		return ErrInvalidTotalLength
	} else if h.CalculateChecksum() != h.Checksum {
		return ErrInvalidChecksum
	}
	return nil
}
// Check checks whether the IPv4 header is valid.
//
// The function fails if the checksum is not correct, or if the IHL field does
// not match the length of the Options byte slice.
//
// This functions can return ErrInvalidIHL, ErrInvalidChecksum or
// ErrInvalidTotalLength.
Check checks whether the IPv4 header is valid.

The function fails if the checksum is not correct, or if the IHL field does
not match the length of the Options byte slice.

This functions can return ErrInvalidIHL, ErrInvalidChecksum or
ErrInvalidTotalLength.
// Check checks whether the IPv4 header is valid . // // The function fails if the checksum is not correct or if the IHL field does // not match the length of the Options byte slice . // // This functions can return ErrInvalidIHL ErrInvalidChecksum or // ErrInvalidTotalLength .
func (h Header) Check() error {
	if len(h.Options)%4 != 0 || int(h.IHL) != 5+len(h.Options)/4 {
		return ErrInvalidIHL
	} else if int(h.IHL)*4 > int(h.TotalLength) {
		return ErrInvalidTotalLength
	} else if h.CalculateChecksum() != h.Checksum {
		return ErrInvalidChecksum
	}
	return nil
}
func ( h Header ) Check ( ) error { if len ( h . Options ) % 4 != 0 || int ( h . IHL ) != 5 + len ( h . Options ) / 4 { return ErrInvalidIHL } else if int ( h . IHL ) * 4 > int ( h . TotalLength ) { return ErrInvalidTotalLength } else if h . CalculateChecksum ( ) != h . Checksum { return ErrInvalidChecksum } return nil }
Check checks whether the IPv4 header is valid.
Check checks whether the IPv4 header is valid .