code: func (p *CONNECT) connectFlags() byte {
  	// Create a byte which represents the Connect Flags.
  	var b byte
  
  	// Set 1 to the Bit 7 if the Packet has the User Name.
  	if len(p.userName) > 0 {
  		b |= 0x80
  	}
  
  	// Set 1 to the Bit 6 if the Packet has the Password.
  	if len(p.password) > 0 {
  		b |= 0x40
  	}
  
  	// Set 1 to the Bit 5 if the Will Retain is true.
  	if p.willRetain {
  		b |= 0x20
  	}
  
  	// Set the value of the Will QoS to the Bit 4 and 3.
  	b |= p.willQoS << 3
  
  	// Set 1 to the Bit 2 if the Packet has the Will Topic and the Will Message.
  	if p.will() {
  		b |= 0x04
  	}
  
  	// Set 1 to the Bit 1 if the Clean Session is true.
  	if p.cleanSession {
  		b |= 0x02
  	}
  
  	// Return the byte.
  	return b
  }
docs: // connectFlags creates and returns a byte which represents the Connect Flags.