Documentation ¶
Index ¶
- func CreateIPFIXMsg(set entities.Set, obsDomainID uint32, seqNumber uint32, exportTime time.Time) ([]byte, error)
- func WriteIPFIXMsgToBuffer(set entities.Set, obsDomainID uint32, seqNumber uint32, exportTime time.Time, ...) (int, error)
- type ExporterInput
- type ExporterTLSClientConfig
- type ExportingProcess
- func (ep *ExportingProcess) CloseConnToCollector()
- func (ep *ExportingProcess) GetMsgSizeLimit() int
- func (ep *ExportingProcess) NewTemplateID() uint16
- func (ep *ExportingProcess) SendDataRecords(templateID uint16, records []entities.Record, buf *bytes.Buffer) (int, int, error)
- func (ep *ExportingProcess) SendSet(set entities.Set) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateIPFIXMsg ¶ added in v0.8.0
func WriteIPFIXMsgToBuffer ¶ added in v0.12.0
func WriteIPFIXMsgToBuffer(set entities.Set, obsDomainID uint32, seqNumber uint32, exportTime time.Time, buf *bytes.Buffer) (int, error)
WriteIPFIXMsgToBuffer serializes the set as an IPFIX message and writes it to the provided buffer. It returns the message length and an error if applicable.
Types ¶
type ExporterInput ¶ added in v0.4.0
type ExporterInput struct { // CollectorAddress needs to be provided in hostIP:port format. CollectorAddress string // CollectorProtocol needs to be provided in lower case format. // We support "tcp" and "udp" protocols. CollectorProtocol string ObservationDomainID uint32 TempRefTimeout uint32 // TLSClientConfig is set to use an encrypted connection to the collector. TLSClientConfig *ExporterTLSClientConfig IsIPv6 bool SendJSONRecord bool // JSONBufferLen is recommended for sending json records. If not given a // valid value, we use a default of 5000B JSONBufferLen int // For UDP, this should be set by taking into account the PMTU and // header sizes. MaxMsgSize int CheckConnInterval time.Duration }
type ExporterTLSClientConfig ¶ added in v0.5.14
type ExporterTLSClientConfig struct { // ServerName is passed to the server for SNI and is used in the client to check server // certificates against. If ServerName is empty, the hostname used to contact the // server is used. ServerName string // CAData holds PEM-encoded bytes for trusted root certificates for server. CAData []byte // CertData holds PEM-encoded bytes. CertData []byte // KeyData holds PEM-encoded bytes. KeyData []byte }
type ExportingProcess ¶
type ExportingProcess struct {
// contains filtered or unexported fields
}
- Tested one exportingProcess process per exporter. Can support multiple collector scenario by creating different instances of exporting process. Need to be tested
- Only one observation point per observation domain is supported, so observation point ID not defined.
- Supports only TCP and UDP; one session at a time. SCTP is not supported.
- UDP needs to send PMTU size packets as per RFC7011. In order to guarantee this, maxMsgSize should be set correctly. maxMsgSize is the maximum payload (IPFIX message) size, not the maximum packet size. You need to compute maxMsgSize based on the desired maximum packet size. If maxMsgSize is not set correctly, the message may be fragmented.
func InitExportingProcess ¶
func InitExportingProcess(input ExporterInput) (*ExportingProcess, error)
InitExportingProcess takes in collector address(net.Addr format), obsID(observation ID) and tempRefTimeout(template refresh timeout). tempRefTimeout is applicable only for collectors listening over UDP; unit is seconds. For TCP, you can pass any value and it will be ignored. For UDP, if 0 is passed, 600s is used as the default.
func (*ExportingProcess) CloseConnToCollector ¶
func (ep *ExportingProcess) CloseConnToCollector()
CloseConnToCollector closes the connection to the collector. It can safely be closed more than once, and subsequent calls will be no-ops.
func (*ExportingProcess) GetMsgSizeLimit ¶ added in v0.4.2
func (ep *ExportingProcess) GetMsgSizeLimit() int
GetMsgSizeLimit returns the maximum IPFIX message size that this exporter is allowed to write to the connection. If the exporter is configured to send marshalled JSON records instead, this function will return 0.
func (*ExportingProcess) NewTemplateID ¶
func (ep *ExportingProcess) NewTemplateID() uint16
NewTemplateID is called to get ID when creating new template record.
func (*ExportingProcess) SendDataRecords ¶ added in v0.12.0
func (ep *ExportingProcess) SendDataRecords(templateID uint16, records []entities.Record, buf *bytes.Buffer) (int, int, error)
SendDataRecords is a specialized version of SendSet which can send a list of data records more efficiently. All the data records must be for the same template ID. This function performs fewer sanity checks on the data records, compared to SendSet. This function can also take a reusable buffer as a parameter to avoid repeated memory allocations. You can use nil as the buffer if you want this function to be responsible for allocation. SendDataRecords returns the number of records successfully sent, the total number of bytes sent, and an error if applicable.