code: func readMessageHeader(r io.Reader) (int, *messageHeader, error) {
  	// Since readElements doesn't return the amount of bytes read, attempt
  	// to read the entire header into a buffer first in case there is a
  	// short read so the proper amount of read bytes are known.  This works
  	// since the header is a fixed size.
  	var headerBytes [MessageHeaderSize]byte
  	n, err := io.ReadFull(r, headerBytes[:])
  	if err != nil {
  		return n, nil, err
  	}
  	hr := bytes.NewReader(headerBytes[:])
  
  	// Create and populate a messageHeader struct from the raw header bytes.
  	hdr := messageHeader{}
  	var command [CommandSize]byte
  	readElements(hr, &hdr.magic, &command, &hdr.length, &hdr.checksum)
  
  	// Strip trailing zeros from command string.
  	hdr.command = string(bytes.TrimRight(command[:], string(0)))
  
  	return n, &hdr, nil
  }
docs: // readMessageHeader reads a bitcoin message header from r.