mirror of
https://github.com/openobserve/goflow2.git
synced 2025-11-02 13:03:18 +00:00
allow unknown record structures in sFlow (#153)
This commit is contained in:
@@ -60,7 +60,15 @@ type RecordHeader struct {
|
||||
|
||||
type FlowRecord struct {
|
||||
Header RecordHeader
|
||||
Data interface{}
|
||||
Data interface{} // replace by FlowRecordData
|
||||
}
|
||||
|
||||
type FlowRecordRaw struct {
|
||||
Data []byte
|
||||
}
|
||||
|
||||
type FlowRecordData interface {
|
||||
GetBytes(offset int, length int, dst []byte) error
|
||||
}
|
||||
|
||||
type CounterRecord struct {
|
||||
|
||||
@@ -247,7 +247,10 @@ func DecodeFlowRecord(header *RecordHeader, payload *bytes.Buffer) (FlowRecord,
|
||||
|
||||
flowRecord.Data = extendedGateway
|
||||
default:
|
||||
return flowRecord, errors.New(fmt.Sprintf("Unknown data format %v.", (*header).DataFormat))
|
||||
//return flowRecord, errors.New(fmt.Sprintf("Unknown data format %v.", (*header).DataFormat))
|
||||
flowRecord.Data = &FlowRecordRaw{
|
||||
Data: payload.Next(int(header.Length)),
|
||||
}
|
||||
}
|
||||
return flowRecord, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user