/
types.go
60 lines (54 loc) · 2.48 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2020 VMware, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package intermediate
import "github.com/vmware/go-ipfix/pkg/entities"
type FlowKey struct {
SourceAddress string
DestinationAddress string
Protocol uint8
SourcePort uint16
DestinationPort uint16
}
type AggregationFlowRecord struct {
Record entities.Record
// Flow record contains mapping to its reference in priority queue.
PriorityQueueItem *ItemToExpire
// ReadyToSend is an indicator that we received all required records for the
// given flow, i.e., records from source and destination nodes for the case
// inter-node flow and record from the node for the case of intra-node flow.
ReadyToSend bool
waitForReadyToSendRetries int
// areCorrelatedFieldsFilled is an indicator for IPFIX Mediator to check whether K8s
// metadata are filled for flow record. It is always true for Intra-Node
// and ToExternal flows and only applicable for Inter-Node flows that are
// not required to be correlated. (e.g. flows with Egress deny rule applied)
areCorrelatedFieldsFilled bool
// Some fields could be filled externally on aggregation records once before
// exporting them in IPFIX mediator, e.g., metadata of a flow.
// areExternalFieldsFilled is an indicator for IPFIX Mediator to check whether
// these fields has been filled or not before exporting. This field is set to
// false when creating new AggregationFlowRecord. Setting and utilizing this
// field is upto the user and not used in go-ipfix library code.
areExternalFieldsFilled bool
// isIPv4 indicates whether the source and destination addresses are IPv4 or
// IPv6 in the aggregated flow record.
isIPv4 bool
}
type AggregationElements struct {
NonStatsElements []string
StatsElements []string
AggregatedSourceStatsElements []string
AggregatedDestinationStatsElements []string
}
type FlowKeyRecordMapCallBack func(key FlowKey, record *AggregationFlowRecord) error