Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
bwnetflow
kafka
consumer_dumper
Commits
b14582aa
Verified
Commit
b14582aa
authored
5 years ago
by
Christopher Hauser
Browse files
Options
Download
Patches
Plain Diff
update to github repos and new goflow version
parent
e53ccbcb
master
No related merge requests found
Pipeline
#53830
passed with stages
in 4 minutes and 21 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
dump.go
+9
-6
dump.go
flow-filters.go
+6
-4
flow-filters.go
kafka-listener.go
+1
-1
kafka-listener.go
main.go
+1
-1
main.go
with
17 additions
and
12 deletions
+17
-12
dump.go
+
9
−
6
View file @
b14582aa
...
...
@@ -5,12 +5,13 @@ import (
"fmt"
"net"
flow
"omi-gitlab.e-technik.uni-ulm.de/bwnetflow/bwnetflow_api/go"
flow
"github.com/bwNetFlow/protobuf/go"
"github.com/bwNetFlow/protobuf_helpers/go"
)
// JSONFlowMessage describes a JSON representation of a single flow
type
JSONFlowMessage
struct
{
IPVersion
int32
`json:"ipVersion"`
IPVersion
string
`json:"ipVersion"`
SrcIP
string
`json:"srcIP,omitempty"`
DstIP
string
`json:"dstIP,omitempty"`
SrcPort
uint32
`json:"srcPort"`
...
...
@@ -23,15 +24,17 @@ type JSONFlowMessage struct {
func
dumpFlow
(
flow
*
flow
.
FlowMessage
)
{
flowh
:=
protobuf_helpers
.
NewFlowHelper
(
flow
)
// translate message to JSONFlowMessage
jsonMsg
:=
JSONFlowMessage
{
IPVersion
:
int32
(
flow
.
Get
IP
v
ersion
(
)
),
SrcIP
:
net
.
IP
(
flow
.
GetSrc
IP
())
.
String
(
),
DstIP
:
net
.
IP
(
flow
.
GetDst
IP
())
.
String
(
),
IPVersion
:
flowh
.
IP
V
ersion
String
(),
SrcIP
:
fmt
.
Sprintf
(
"%v"
,
net
.
IP
(
flow
.
GetSrc
Addr
())
),
DstIP
:
fmt
.
Sprintf
(
"%v"
,
net
.
IP
(
flow
.
GetDst
Addr
())
),
SrcPort
:
flow
.
GetSrcPort
(),
DstPort
:
flow
.
GetDstPort
(),
Proto
:
flow
.
GetProto
(),
Peer
:
flow
.
Get
Peer
(),
Peer
:
flow
h
.
Peer
(),
Bytes
:
flow
.
GetBytes
(),
Packets
:
flow
.
GetPackets
(),
}
...
...
This diff is collapsed.
Click to expand it.
flow-filters.go
+
6
−
4
View file @
b14582aa
...
...
@@ -8,8 +8,9 @@ import (
"strconv"
"strings"
flow
"omi-gitlab.e-technik.uni-ulm.de/bwnetflow/bwnetflow_api/go"
"omi-gitlab.e-technik.uni-ulm.de/bwnetflow/ip_prefix_trie"
"github.com/bwNetFlow/ip_prefix_trie"
flow
"github.com/bwNetFlow/protobuf/go"
protobuf_helpers
"github.com/bwNetFlow/protobuf_helpers/go"
)
var
validCustomerIDs
[]
int
...
...
@@ -79,9 +80,10 @@ func filterApplies(flow *flow.FlowMessage) bool {
// customerID filter
if
len
(
validCustomerIDs
)
==
0
||
isValidCustomerID
(
int
(
flow
.
GetCid
()))
{
// IP subnet filter
if
!
ipFilterSet
||
isValidIP
(
flow
.
GetSrc
IP
())
||
isValidIP
(
flow
.
GetDst
IP
())
{
if
!
ipFilterSet
||
isValidIP
(
flow
.
GetSrc
Addr
())
||
isValidIP
(
flow
.
GetDst
Addr
())
{
// peer filter
if
len
(
validPeers
)
==
0
||
isValidPeer
(
flow
.
GetPeer
())
{
flowh
:=
protobuf_helpers
.
NewFlowHelper
(
flow
)
if
len
(
validPeers
)
==
0
||
isValidPeer
(
flowh
.
Peer
())
{
return
true
}
}
...
...
This diff is collapsed.
Click to expand it.
kafka-listener.go
+
1
−
1
View file @
b14582aa
...
...
@@ -4,7 +4,7 @@ import (
"log"
"runtime/debug"
flow
"
omi-gitlab.e-technik.uni-ulm.de
/bw
n
et
f
low/
bwnetflow_api
/go"
flow
"
github.com
/bw
N
et
F
low/
protobuf
/go"
)
func
runKafkaListener
()
{
...
...
This diff is collapsed.
Click to expand it.
main.go
+
1
−
1
View file @
b14582aa
...
...
@@ -6,7 +6,7 @@ import (
"os/signal"
"syscall"
kafka
"
omi-gitlab.e-technik.uni-ulm.de
/bw
n
et
f
low/
kafka/
kafkaconnector"
kafka
"
github.com
/bw
N
et
F
low/kafkaconnector"
"github.com/Shopify/sarama"
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets