1
0
mirror of https://github.com/netsampler/goflow2.git synced 2024-05-06 15:54:52 +00:00

23 lines
680 B
Go
Raw Normal View History

2023-08-09 19:47:20 -07:00
package netflow
import (
"encoding/json"
"fmt"
)
func (p *IPFIXPacket) MarshalJSON() ([]byte, error) {
return json.Marshal(*p) // this is a trick to avoid having the JSON marshaller defaults to MarshalText
}
func (p *NFv9Packet) MarshalJSON() ([]byte, error) {
return json.Marshal(*p) // this is a trick to avoid having the JSON marshaller defaults to MarshalText
}
func (p *IPFIXPacket) MarshalText() ([]byte, error) {
return []byte(fmt.Sprintf("IPFIX count:%d seq:%d", len(p.FlowSets), p.SequenceNumber)), nil
}
func (p *NFv9Packet) MarshalText() ([]byte, error) {
return []byte(fmt.Sprintf("NetFlowV%d count:%d seq:%d", p.Version, p.Count, p.SequenceNumber)), nil
}