mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-10-21 15:29:42 +00:00
* Use log in tap package instead of fmt. * Moved api/pkg/tap to root. * Added go.mod and go.sum for tap. * Added replace for shared. * api uses tap module instead of tap package. * Removed dependency of tap in shared by moving env var out of tap. * Fixed compilation bugs. * Fixed: Forgot to export struct field HostMode. * Removed unused flag. * Close har output channel when done. * Moved websocket out of mizu and into passive-tapper. * Send connection details over har output channel. * Fixed compilation errors. * Removed unused info from request response cache. * Renamed connection -> connectionID. * Fixed rename bug. * Export setters and getters for filter ips and ports. * Added tap dependency to Dockerfile. * Uncomment error messages. * Renamed `filterIpAddresses` -> `filterAuthorities`. * Renamed ConnectionID -> ConnectionInfo. * Fixed: Missed one replace.
36 lines
499 B
Go
36 lines
499 B
Go
package tap
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
type AppStats struct {
|
|
matchedMessages int
|
|
}
|
|
|
|
type StatsTracker struct {
|
|
stats AppStats
|
|
statsMutex sync.Mutex
|
|
}
|
|
|
|
func (st *StatsTracker) incMatchedMessages() {
|
|
st.statsMutex.Lock()
|
|
st.stats.matchedMessages++
|
|
st.statsMutex.Unlock()
|
|
}
|
|
|
|
func (st *StatsTracker) dumpStats() AppStats {
|
|
st.statsMutex.Lock()
|
|
|
|
stats := AppStats{
|
|
matchedMessages: st.stats.matchedMessages,
|
|
}
|
|
|
|
st.stats.matchedMessages = 0
|
|
|
|
st.statsMutex.Unlock()
|
|
|
|
return stats
|
|
}
|
|
|