code: func (c *PomeloPacketDecoder) Decode(data []byte) ([]*packet.Packet, error) {
  	buf := bytes.NewBuffer(nil)
  	buf.Write(data)
  
  	var (
  		packets []*packet.Packet
  		err     error
  	)
  	// check length
  	if buf.Len() < HeadLength {
  		return nil, nil
  	}
  
  	// first time
  	size, typ, err := c.forward(buf)
  	if err != nil {
  		return nil, err
  	}
  
  	for size <= buf.Len() {
  		p := &packet.Packet{Type: typ, Length: size, Data: buf.Next(size)}
  		packets = append(packets, p)
  
  		// more packet
  		if buf.Len() < HeadLength {
  			break
  		}
  
  		size, typ, err = c.forward(buf)
  		if err != nil {
  			return nil, err
  		}
  	}
  
  	return packets, nil
  }
docs: // Decode decode the network bytes slice to packet.Packet(s)