func get_ips(packet *gopacket.Packet) (string, string) {
	src := ""
	tgt := ""
	if ipv4_layer := (*packet).Layer(layers.LayerTypeIPv4); ipv4_layer != nil {
		ipv4, _ := ipv4_layer.(*layers.IPv4)
		src = ipv4.SrcIP.String()
		tgt = ipv4.DstIP.String()
	} else  
	if ipv6_layer := (*packet).Layer(layers.LayerTypeIPv6); ipv6_layer != nil {
		ipv6, _ := ipv6_layer.(*layers.IPv6)
		src = ipv6.SrcIP.String()
		tgt = ipv6.DstIP.String()
	}
	return src, tgt
}
Gets source and target IPs from packet, if it is either IPv4 or IPv6
package main
import (
	"github.com/google/gopacket"
	"github.com/google/gopacket/layers"
	"github.com/google/gopacket/pcap"
	"encoding/json"
	"flag"
	"fmt"
	"io/ioutil"
	"net"
	"os"
	"runtime/pprof"
	"sync"
	"time"
)
var (
	dcache dns_cache
)
type dns_cache struct {
	mu             sync.Mutex
	resolved_names map[string]string
}
func (d *dns_cache) Put(key string, value string) {
	d.mu.Lock()
	d.resolved_names[key] = value
	d.mu.Unlock()
}
func (d *dns_cache) Get(key string) string {
	result := ""
	d.mu.Lock()
	if r, ok := d.resolved_names[key]; ok {
		result = r
	}
	d.mu.Unlock()
	return result
}
type Network struct {
	CIDR  string
	Name  string
	ipnet *net.IPNet
}
type Object struct {
	SourceIP   string
	SourceName string
	TargetIP   string
	TargetName string
	Service    string
	Protocol   string
	Packages   int
	Bytes      int
	Syns       int
	Fins       int
}
type Node struct {
	ID      string
	Label   string
	Network string
}
type Connection struct {
	SourceIP string
	TargetIP string
	Service  string
	Sequence uint32
	SynTime  time.Time
	FinTime  time.Time
}
func lookup_addr(addr string) string {
	result := dcache.Get(addr)
	if result == "" {
		addrs, _ := net.LookupAddr(addr)
		if addrs != nil && len(addrs) > 0 {
			result = addrs[0]
			dcache.Put(addr, addrs[0])
		}
	}
	if result == "" {
		result = addr
	}
	return result
}