tractor.dev/toolkit-go@v0.0.0-20241010005851-214d91207d07/duplex/mux/frame/message_eof.go (about) 1 package frame 2 3 import ( 4 "bytes" 5 "encoding/binary" 6 "fmt" 7 ) 8 9 type EOFMessage struct { 10 ChannelID uint32 11 } 12 13 func (msg EOFMessage) String() string { 14 return fmt.Sprintf("{EOFMessage ChannelID:%d}", msg.ChannelID) 15 } 16 17 func (msg EOFMessage) Channel() (uint32, bool) { 18 return msg.ChannelID, true 19 } 20 21 func (msg EOFMessage) Bytes() []byte { 22 buf := new(bytes.Buffer) 23 buf.WriteByte(msgChannelEOF) 24 binary.Write(buf, binary.BigEndian, msg) 25 return buf.Bytes() 26 }