RI-Req, RI-Rsp, RI-Ack

This commit is contained in:
Josh Deprez 2024-03-15 16:49:53 +11:00
parent 78c19bd166
commit caad2d1d4f
No known key found for this signature in database
2 changed files with 37 additions and 1 deletions

View file

@ -403,6 +403,27 @@ func parseOpenRsp(p []byte) (*OpenRspPacket, error) {
}, nil
}
type RIReqPacket struct {
*Header
}
type RIRspPacket struct {
*Header
RTMPData []byte
}
func (p *RIRspPacket) WriteTo(w io.Writer) (int64, error) {
a := acc(w)
a.writeTo(p.Header)
a.write(p.RTMPData)
return a.ret()
}
type RIAckPacket struct {
*Header
}
// ParsePacket parses the body of a UDP packet for a domain header, and then
// based on the packet type, an AURP-Tr header, an AURP routing header, and
// then a particular packet type.
@ -452,6 +473,22 @@ func ParsePacket(p []byte) (Packet, error) {
orsp.Header = h
return orsp, nil
case CmdCodeRIReq:
return &RIReqPacket{
Header: h,
}, nil
case CmdCodeRIRsp:
return &RIRspPacket{
Header: h,
RTMPData: p,
}, nil
case CmdCodeRIAck:
return &RIAckPacket{
Header: h,
}, nil
default:
return nil, fmt.Errorf("unknown routing packet command code %d", h.CommandCode)
}

View file

@ -31,6 +31,5 @@ func main() {
log.Printf("Failed to read packet: %v", readErr)
continue
}
}
}