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
|
}, 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
|
// 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
|
// based on the packet type, an AURP-Tr header, an AURP routing header, and
|
||||||
// then a particular packet type.
|
// then a particular packet type.
|
||||||
|
@ -452,6 +473,22 @@ func ParsePacket(p []byte) (Packet, error) {
|
||||||
orsp.Header = h
|
orsp.Header = h
|
||||||
return orsp, nil
|
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:
|
default:
|
||||||
return nil, fmt.Errorf("unknown routing packet command code %d", h.CommandCode)
|
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)
|
log.Printf("Failed to read packet: %v", readErr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue