Verified Commit b14582aa authored by Christopher Hauser's avatar Christopher Hauser
Browse files

update to github repos and new goflow version

parent e53ccbcb
No related merge requests found
Pipeline #53830 passed with stages
in 4 minutes and 21 seconds
Showing with 17 additions and 12 deletions
+17 -12
......@@ -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.GetIPversion()),
SrcIP: net.IP(flow.GetSrcIP()).String(),
DstIP: net.IP(flow.GetDstIP()).String(),
IPVersion: flowh.IPVersionString(),
SrcIP: fmt.Sprintf("%v", net.IP(flow.GetSrcAddr())),
DstIP: fmt.Sprintf("%v", net.IP(flow.GetDstAddr())),
SrcPort: flow.GetSrcPort(),
DstPort: flow.GetDstPort(),
Proto: flow.GetProto(),
Peer: flow.GetPeer(),
Peer: flowh.Peer(),
Bytes: flow.GetBytes(),
Packets: flow.GetPackets(),
}
......
......@@ -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.GetSrcIP()) || isValidIP(flow.GetDstIP()) {
if !ipFilterSet || isValidIP(flow.GetSrcAddr()) || isValidIP(flow.GetDstAddr()) {
// peer filter
if len(validPeers) == 0 || isValidPeer(flow.GetPeer()) {
flowh := protobuf_helpers.NewFlowHelper(flow)
if len(validPeers) == 0 || isValidPeer(flowh.Peer()) {
return true
}
}
......
......@@ -4,7 +4,7 @@ import (
"log"
"runtime/debug"
flow "omi-gitlab.e-technik.uni-ulm.de/bwnetflow/bwnetflow_api/go"
flow "github.com/bwNetFlow/protobuf/go"
)
func runKafkaListener() {
......
......@@ -6,7 +6,7 @@ import (
"os/signal"
"syscall"
kafka "omi-gitlab.e-technik.uni-ulm.de/bwnetflow/kafka/kafkaconnector"
kafka "github.com/bwNetFlow/kafkaconnector"
"github.com/Shopify/sarama"
)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment