mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-11 22:14:02 +01:00
fakeexporter: use a gaussian distribution for sizes
This commit is contained in:
@@ -106,7 +106,7 @@ func generateFlows(flowConfigs []FlowConfiguration, seed int64, now time.Time) [
|
||||
if flowConfig.Size == 0 {
|
||||
flow.Octets = uint32(r.Int31n(1200) + 300)
|
||||
} else {
|
||||
flow.Octets = uint32(float64(flowConfig.Size) * (0.9 + r.Float64()/5))
|
||||
flow.Octets = uint32(float64(flowConfig.Size) * (r.NormFloat64()*0.3 + 1))
|
||||
if flow.Octets > 9000 {
|
||||
flow.Octets = 9000
|
||||
} else if flow.Octets > 1500 && flowConfig.Size <= 1500 {
|
||||
|
||||
@@ -153,7 +153,7 @@ func TestGenerateFlows(t *testing.T) {
|
||||
DstAddr: net.ParseIP("203.0.113.91"),
|
||||
EType: 0x800,
|
||||
IPFlow: IPFlow{
|
||||
Octets: 1500,
|
||||
Octets: 1365,
|
||||
Packets: 1,
|
||||
Proto: 6,
|
||||
SrcPort: 443,
|
||||
@@ -169,7 +169,7 @@ func TestGenerateFlows(t *testing.T) {
|
||||
DstAddr: net.ParseIP("203.0.113.220"),
|
||||
EType: 0x800,
|
||||
IPFlow: IPFlow{
|
||||
Octets: 1283,
|
||||
Octets: 1500,
|
||||
Packets: 1,
|
||||
Proto: 6,
|
||||
SrcPort: 443,
|
||||
@@ -203,7 +203,7 @@ func TestGenerateFlows(t *testing.T) {
|
||||
DstAddr: net.ParseIP("2001:db8:2:0:245b:11f7:351e:dc1a"),
|
||||
EType: 0x86dd,
|
||||
IPFlow: IPFlow{
|
||||
Octets: 1312,
|
||||
Octets: 1170,
|
||||
Packets: 1,
|
||||
Proto: 6,
|
||||
SrcPort: 34045,
|
||||
|
||||
Reference in New Issue
Block a user