code: func (r *RequestCreateSessionV4) MarshalBinary() ([]byte, error) {
  	buf := new(bytes.Buffer)
  
  	r.NumCapabilities = uint32(len(r.Capabilities))
  
  	fields := []*uint32{
  		&r.NumCapabilities,
  		&r.MaxPacketSize,
  		&r.Flags,
  		&r.Reserved,
  	}
  
  	for _, p := range fields {
  		err := binary.Write(buf, binary.LittleEndian, p)
  		if err != nil {
  			return nil, err
  		}
  	}
  
  	for i := uint32(0); i < r.NumCapabilities; i++ {
  		err := binary.Write(buf, binary.LittleEndian, &r.Capabilities[i])
  		if err != nil {
  			return nil, err
  		}
  	}
  
  	return buf.Bytes(), nil
  }
docs: // MarshalBinary implements the encoding.BinaryMarshaler interface