title: Reading < 8 bits from a reader in Golang
body: <p>While handling raw IP packages in Golang I've came across a problem which I cannot seem to find a solution for:</p>
  <p>The <a href="https://www.rfc-editor.org/rfc/rfc791" rel="nofollow noreferrer">IPv4 specification</a> contains fields which are smaller than 8 bits. For example the Version or the Header Length (4 bits each) or the Flags (3 bits).</p>
  <p>How do I read those values from an io.Reader and handle them using Golang afterwards? I've been using the <a href="http://golang.org/pkg/encoding/binary/#Read" rel="nofollow noreferrer">binary.Read</a> method so far, however since the smallest integer type in Golang is an int8, that is not possible in this case.</p>