message_channel_ack.go 522 B

12345678910111213141516171819202122
  1. package datachannel
  2. // channelAck is used to ACK a DataChannel open
  3. type channelAck struct{}
  4. const (
  5. channelOpenAckLength = 4
  6. )
  7. // Marshal returns raw bytes for the given message
  8. func (c *channelAck) Marshal() ([]byte, error) {
  9. raw := make([]byte, channelOpenAckLength)
  10. raw[0] = uint8(dataChannelAck)
  11. return raw, nil
  12. }
  13. // Unmarshal populates the struct with the given raw data
  14. func (c *channelAck) Unmarshal(raw []byte) error {
  15. // Message type already checked in Parse and there is no further data
  16. return nil
  17. }