code: func (c *ConnectPacket) Unpack(b io.Reader) error {
  	var err error
  	c.ProtocolName, err = decodeString(b)
  	if err != nil {
  		return err
  	}
  	c.ProtocolVersion, err = decodeByte(b)
  	if err != nil {
  		return err
  	}
  	options, err := decodeByte(b)
  	if err != nil {
  		return err
  	}
  	c.ReservedBit = 1 & options
  	c.CleanSession = 1&(options>>1) > 0
  	c.WillFlag = 1&(options>>2) > 0
  	c.WillQos = 3 & (options >> 3)
  	c.WillRetain = 1&(options>>5) > 0
  	c.PasswordFlag = 1&(options>>6) > 0
  	c.UsernameFlag = 1&(options>>7) > 0
  	c.Keepalive, err = decodeUint16(b)
  	if err != nil {
  		return err
  	}
  	c.ClientIdentifier, err = decodeString(b)
  	if err != nil {
  		return err
  	}
  	if c.WillFlag {
  		c.WillTopic, err = decodeString(b)
  		if err != nil {
  			return err
  		}
  		c.WillMessage, err = decodeBytes(b)
  		if err != nil {
  			return err
  		}
  	}
  	if c.UsernameFlag {
  		c.Username, err = decodeString(b)
  		if err != nil {
  			return err
  		}
  	}
  	if c.PasswordFlag {
  		c.Password, err = decodeBytes(b)
  		if err != nil {
  			return err
  		}
  	}
  
  	return nil
  }
docs: //Unpack decodes the details of a ControlPacket after the fixed
  //header has been read