Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Commit 4841b9d

Browse files
committed
✨ refactor(models.go): change peak calculation to sum for BPS and PPS
- update `GetPeakBPS` to return sum of BPS across signatures - update `GetPeakPPS` to return sum of PPS across signatures - replace peak calculations with summation for accuracy
1 parent 771835a commit 4841b9d

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

neoprotect/models.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,26 +127,22 @@ func (a *Attack) Duration() time.Duration {
127127
return endTime.Sub(*a.StartedAt)
128128
}
129129

130-
// GetPeakBPS returns the peak bits per second across all signatures
130+
// GetPeakBPS zwraca sumę bitów na sekundę ze wszystkich sygnatur
131131
func (a *Attack) GetPeakBPS() int64 {
132-
var peak int64
132+
var sum int64
133133
for _, sig := range a.Signatures {
134-
if sig.BPSPeak > peak {
135-
peak = sig.BPSPeak
136-
}
134+
sum += sig.BPSPeak
137135
}
138-
return peak
136+
return sum
139137
}
140138

141-
// GetPeakPPS returns the peak packets per second across all signatures
139+
// GetPeakPPS zwraca sumę pakietów na sekundę ze wszystkich sygnatur
142140
func (a *Attack) GetPeakPPS() int64 {
143-
var peak int64
141+
var sum int64
144142
for _, sig := range a.Signatures {
145-
if sig.PPSPeak > peak {
146-
peak = sig.PPSPeak
147-
}
143+
sum += sig.PPSPeak
148144
}
149-
return peak
145+
return sum
150146
}
151147

152148
// GetSignatureNames returns all unique signature names

0 commit comments

Comments
 (0)