console/frontend: add IPv4 vs IPv6

This commit is contained in:
Vincent Bernat
2022-04-23 14:53:41 +02:00
parent 19e5c4388f
commit 45a40f451c
2 changed files with 9 additions and 1 deletions

View File

@@ -39,9 +39,14 @@
title="Top countries"
:refresh="refreshOccasionally"
/>
<WidgetTop
what="etype"
title="IPv4/IPv6"
:refresh="refreshOccasionally"
/>
<WidgetGraph
:refresh="refreshInfrequently"
class="col-span-2 md:col-span-4"
class="col-span-2 md:col-span-3"
/>
</div>
</div>

View File

@@ -123,6 +123,9 @@ func (c *Component) widgetTopHandlerFunc(gc *gin.Context) {
case "protocol":
selector = `dictGetOrDefault('protocols', 'name', Proto, '???')`
groupby = `Proto`
case "etype":
selector = `if(equals(EType, 34525), 'IPv6', if(equals(EType, 2048), 'IPv4', '???'))`
groupby = `EType`
case "src-port":
selector = `concat(dictGetOrDefault('protocols', 'name', Proto, '???'), '/', toString(SrcPort))`
groupby = `Proto, SrcPort`