RI-Req, RI-Rsp, RI-Ack
This commit is contained in:
parent
78c19bd166
commit
caad2d1d4f
2 changed files with 37 additions and 1 deletions
37
aurp/aurp.go
37
aurp/aurp.go
|
@ -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)
|
||||
}
|
||||
|
|
1
main.go
1
main.go
|
@ -31,6 +31,5 @@ func main() {
|
|||
log.Printf("Failed to read packet: %v", readErr)
|
||||
continue
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue