|
|
|
@ -4,21 +4,21 @@ import (
|
|
|
|
|
"encoding/hex"
|
|
|
|
|
"errors"
|
|
|
|
|
"fmt"
|
|
|
|
|
"github.com/subgraph/fw-daemon/Godeps/_workspace/src/github.com/op/go-logging"
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
"net"
|
|
|
|
|
"strconv"
|
|
|
|
|
"strings"
|
|
|
|
|
"github.com/subgraph/fw-daemon/Godeps/_workspace/src/github.com/op/go-logging"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var log = logging.MustGetLogger("proc")
|
|
|
|
|
|
|
|
|
|
func SetLogger(logger *logging.Logger) {
|
|
|
|
|
log = logger
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var pcache = &pidCache{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func LookupUDPSocketProcess(srcPort uint16) *ProcInfo {
|
|
|
|
|
ss := findUDPSocket(srcPort)
|
|
|
|
|
if ss == nil {
|
|
|
|
@ -63,7 +63,6 @@ func (sa *socketAddr) parse(s string) error {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func ParseIp(ip string) (net.IP, error) {
|
|
|
|
|
var result net.IP
|
|
|
|
|
dst, err := hex.DecodeString(ip)
|
|
|
|
@ -145,7 +144,7 @@ func readConntrack() ([]*ConnectionInfo, error) {
|
|
|
|
|
}
|
|
|
|
|
var result []*ConnectionInfo
|
|
|
|
|
lines := strings.Split(string(data), "\n")
|
|
|
|
|
for _,line := range(lines) {
|
|
|
|
|
for _, line := range lines {
|
|
|
|
|
ci, err := parseConntrackLine(line)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|