Skip to content

Commit

Permalink
- keep a topology map in elasticsearch with all public IPs that each …
Browse files Browse the repository at this point in the history
…agent has

- at startup, each agent adds its IPs to the topology map (in elasticsearch under packetbeat-topology index)
- determine src_server and dst_server for each transaction
- ignore duplicated transactions
  • Loading branch information
monicasarbu committed Mar 16, 2014
1 parent d9485bc commit ed1df53
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions net.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package main

import (
"net"
)


func LocalAddrs() ([]string, error) {
var localAddrs = []string{}
addrs, err := net.InterfaceAddrs()
if err != nil {
return nil, err
}
for _, addr := range addrs {
// a bit wtf'ish.. Don't know how to do this otherwise
ip, _, err := net.ParseCIDR(addr.String())
if err == nil && ip != nil {
localAddrs = append(localAddrs, ip.String())
}
}
return localAddrs, nil
}

0 comments on commit ed1df53

Please sign in to comment.