diff --git a/vendor/github.com/google/gopacket/layers/gen.go b/vendor/github.com/google/gopacket/layers/gen.go
new file mode 100644
index 0000000..ab7a0c0
--- /dev/null
+++ b/vendor/github.com/google/gopacket/layers/gen.go
@@ -0,0 +1,109 @@
+// Copyright 2012 Google, Inc. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file in the root of the source
+// tree.
+
+// +build ignore
+
+// This binary pulls known ports from IANA, and uses them to populate
+// iana_ports.go's TCPPortNames and UDPPortNames maps.
+//
+//  go run gen.go | gofmt > iana_ports.go
+package main
+
+import (
+	"bytes"
+	"encoding/xml"
+	"flag"
+	"fmt"
+	"io/ioutil"
+	"net/http"
+	"os"
+	"strconv"
+	"time"
+)
+
+const fmtString = `// Copyright 2012 Google, Inc. All rights reserved.
+
+package layers
+
+// Created by gen.go, don't edit manually
+// Generated at %s
+// Fetched from %q
+
+// TCPPortNames contains the port names for all TCP ports.
+var TCPPortNames = tcpPortNames
+
+// UDPPortNames contains the port names for all UDP ports.
+var UDPPortNames = udpPortNames
+
+// SCTPPortNames contains the port names for all SCTP ports.
+var SCTPPortNames = sctpPortNames
+
+var tcpPortNames = map[TCPPort]string{
+%s}
+var udpPortNames = map[UDPPort]string{
+%s}
+var sctpPortNames = map[SCTPPort]string{
+%s}
+`
+
+var url = flag.String("url", "http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml", "URL to grab port numbers from")
+
+func main() {
+	fmt.Fprintf(os.Stderr, "Fetching ports from %q\n", *url)
+	resp, err := http.Get(*url)
+	if err != nil {
+		panic(err)
+	}
+	defer resp.Body.Close()
+	body, err := ioutil.ReadAll(resp.Body)
+	if err != nil {
+		panic(err)
+	}
+	fmt.Fprintln(os.Stderr, "Parsing XML")
+	var registry struct {
+		Records []struct {
+			Protocol string `xml:"protocol"`
+			Number   string `xml:"number"`
+			Name     string `xml:"name"`
+		} `xml:"record"`
+	}
+	xml.Unmarshal(body, &registry)
+	var tcpPorts bytes.Buffer
+	var udpPorts bytes.Buffer
+	var sctpPorts bytes.Buffer
+	done := map[string]map[int]bool{
+		"tcp":  map[int]bool{},
+		"udp":  map[int]bool{},
+		"sctp": map[int]bool{},
+	}
+	for _, r := range registry.Records {
+		port, err := strconv.Atoi(r.Number)
+		if err != nil {
+			continue
+		}
+		if r.Name == "" {
+			continue
+		}
+		var b *bytes.Buffer
+		switch r.Protocol {
+		case "tcp":
+			b = &tcpPorts
+		case "udp":
+			b = &udpPorts
+		case "sctp":
+			b = &sctpPorts
+		default:
+			continue
+		}
+		if done[r.Protocol][port] {
+			continue
+		}
+		done[r.Protocol][port] = true
+		fmt.Fprintf(b, "\t%d: %q,\n", port, r.Name)
+	}
+	fmt.Fprintln(os.Stderr, "Writing results to stdout")
+	fmt.Printf(fmtString, time.Now(), *url, tcpPorts.String(), udpPorts.String(), sctpPorts.String())
+}
diff --git a/vendor/github.com/google/gopacket/layers/gen2.go b/vendor/github.com/google/gopacket/layers/gen2.go
new file mode 100644
index 0000000..150cad7
--- /dev/null
+++ b/vendor/github.com/google/gopacket/layers/gen2.go
@@ -0,0 +1,104 @@
+// Copyright 2012 Google, Inc. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file in the root of the source
+// tree.
+
+// +build ignore
+
+// This binary handles creating string constants and function templates for enums.
+//
+//  go run gen.go | gofmt > enums_generated.go
+package main
+
+import (
+	"fmt"
+	"log"
+	"os"
+	"text/template"
+	"time"
+)
+
+const fmtString = `// Copyright 2012 Google, Inc. All rights reserved.
+
+package layers
+
+// Created by gen2.go, don't edit manually
+// Generated at %s
+
+import (
+  "fmt"
+
+  "github.com/google/gopacket"
+)
+
+`
+
+var funcsTmpl = template.Must(template.New("foo").Parse(`
+// Decoder calls {{.Name}}Metadata.DecodeWith's decoder.
+func (a {{.Name}}) Decode(data []byte, p gopacket.PacketBuilder) error {
+	return {{.Name}}Metadata[a].DecodeWith.Decode(data, p)
+}
+// String returns {{.Name}}Metadata.Name.
+func (a {{.Name}}) String() string {
+	return {{.Name}}Metadata[a].Name
+}
+// LayerType returns {{.Name}}Metadata.LayerType.
+func (a {{.Name}}) LayerType() gopacket.LayerType {
+	return {{.Name}}Metadata[a].LayerType
+}
+
+type errorDecoderFor{{.Name}} int
+func (a *errorDecoderFor{{.Name}}) Decode(data []byte, p gopacket.PacketBuilder) error {
+  return a
+}
+func (a *errorDecoderFor{{.Name}}) Error() string {
+  return fmt.Sprintf("Unable to decode {{.Name}} %d", int(*a))
+}
+
+var errorDecodersFor{{.Name}} [{{.Num}}]errorDecoderFor{{.Name}}
+var {{.Name}}Metadata [{{.Num}}]EnumMetadata
+
+func initUnknownTypesFor{{.Name}}() {
+  for i := 0; i < {{.Num}}; i++ {
+    errorDecodersFor{{.Name}}[i] = errorDecoderFor{{.Name}}(i)
+    {{.Name}}Metadata[i] = EnumMetadata{
+      DecodeWith: &errorDecodersFor{{.Name}}[i],
+      Name: "Unknown{{.Name}}",
+    }
+  }
+}
+`))
+
+func main() {
+	fmt.Fprintf(os.Stderr, "Writing results to stdout\n")
+	fmt.Printf(fmtString, time.Now())
+	types := []struct {
+		Name string
+		Num  int
+	}{
+		{"LinkType", 256},
+		{"EthernetType", 65536},
+		{"PPPType", 65536},
+		{"IPProtocol", 256},
+		{"SCTPChunkType", 256},
+		{"PPPoECode", 256},
+		{"FDDIFrameControl", 256},
+		{"EAPOLType", 256},
+		{"ProtocolFamily", 256},
+		{"Dot11Type", 256},
+		{"USBTransportType", 256},
+	}
+
+	fmt.Println("func init() {")
+	for _, t := range types {
+		fmt.Printf("initUnknownTypesFor%s()\n", t.Name)
+	}
+	fmt.Println("initActualTypeData()")
+	fmt.Println("}")
+	for _, t := range types {
+		if err := funcsTmpl.Execute(os.Stdout, t); err != nil {
+			log.Fatalf("Failed to execute template %s: %v", t.Name, err)
+		}
+	}
+}
diff --git a/vendor/github.com/google/gopacket/pcap/generate_defs.go b/vendor/github.com/google/gopacket/pcap/generate_defs.go
new file mode 100644
index 0000000..bcbf161
--- /dev/null
+++ b/vendor/github.com/google/gopacket/pcap/generate_defs.go
@@ -0,0 +1,157 @@
+// Copyright 2019 The GoPacket Authors. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file in the root of the source
+// tree.
+
+// +build ignore
+
+package main
+
+// This file generates the godefs needed for the windows version.
+// Rebuild is only necessary if additional libpcap functionality is implemented, or a new arch is implemented in golang.
+// Call with go run generate_windows.go [-I includepath]
+// Needs npcap sdk, go tool cgo, and gofmt to work. Location of npcap includes can be specified with -I
+
+import (
+	"bytes"
+	"flag"
+	"fmt"
+	"io/ioutil"
+	"log"
+	"os"
+	"os/exec"
+	"path/filepath"
+	"strings"
+)
+
+const header = `// Copyright 2019 The GoPacket Authors. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file in the root of the source
+// tree.
+
+// This file contains necessary structs/constants generated from libpcap headers with cgo -godefs
+// generated with: %s
+// DO NOT MODIFY
+
+`
+
+const source = `
+package pcap
+
+//#include <pcap.h>
+import "C"
+
+import "syscall" // needed for RawSockaddr
+
+const errorBufferSize = C.PCAP_ERRBUF_SIZE
+
+const (
+	pcapErrorNotActivated    = C.PCAP_ERROR_NOT_ACTIVATED
+	pcapErrorActivated       = C.PCAP_ERROR_ACTIVATED
+	pcapWarningPromisc       = C.PCAP_WARNING_PROMISC_NOTSUP
+	pcapErrorNoSuchDevice    = C.PCAP_ERROR_NO_SUCH_DEVICE
+	pcapErrorDenied          = C.PCAP_ERROR_PERM_DENIED
+	pcapErrorNotUp           = C.PCAP_ERROR_IFACE_NOT_UP
+	pcapError                = C.PCAP_ERROR
+	pcapWarning              = C.PCAP_WARNING
+	pcapDIN                  = C.PCAP_D_IN
+	pcapDOUT                 = C.PCAP_D_OUT
+	pcapDINOUT               = C.PCAP_D_INOUT
+	pcapNetmaskUnknown       = C.PCAP_NETMASK_UNKNOWN
+	pcapTstampPrecisionMicro = C.PCAP_TSTAMP_PRECISION_MICRO
+	pcapTstampPrecisionNano  = C.PCAP_TSTAMP_PRECISION_NANO
+)
+
+type timeval C.struct_timeval
+type pcapPkthdr C.struct_pcap_pkthdr
+type pcapTPtr uintptr
+type pcapBpfInstruction C.struct_bpf_insn
+type pcapBpfProgram C.struct_bpf_program
+type pcapStats C.struct_pcap_stat
+type pcapCint C.int
+type pcapIf C.struct_pcap_if
+// +godefs map struct_sockaddr syscall.RawSockaddr
+type pcapAddr C.struct_pcap_addr
+`
+
+var includes = flag.String("I", "C:\\npcap-sdk-1.01\\Include", "Include path containing libpcap headers")
+
+func main() {
+	flag.Parse()
+
+	infile, err := ioutil.TempFile(".", "defs.*.go")
+	if err != nil {
+		log.Fatal("Couldn't create temporary source file: ", err)
+	}
+	defer infile.Close()
+	defer os.Remove(infile.Name())
+
+	_, err = infile.WriteString(source)
+	if err != nil {
+		log.Fatalf("Couldn't write definitions to temporary file %s: %s", infile.Name(), err)
+	}
+	err = infile.Close()
+	if err != nil {
+		log.Fatalf("Couldn't close temporary source file %s: %s", infile.Name(), err)
+	}
+
+	archs := []string{"386", "amd64"}
+	for _, arch := range archs {
+		env := append(os.Environ(), "GOARCH="+arch)
+		cmd := exec.Command("go", "tool", "cgo", "-godefs", "--", "-I", *includes, infile.Name())
+		cmd.Env = env
+		cmd.Stderr = os.Stderr
+		var generated bytes.Buffer
+		cmd.Stdout = &generated
+		err := cmd.Run()
+		if err != nil {
+			log.Fatalf("Couldn't generated defs for %s: %s\n", arch, err)
+		}
+
+		cmd = exec.Command("gofmt")
+		cmd.Env = env
+		cmd.Stderr = os.Stderr
+		outName := fmt.Sprintf("defs_windows_%s.go", arch)
+		out, err := os.Create(outName)
+		if err != nil {
+			log.Fatalf("Couldn't open file %s: %s", outName, err)
+		}
+		cmd.Stdout = out
+		in, err := cmd.StdinPipe()
+		if err != nil {
+			log.Fatal("Couldn't create input pipe for gofmt: ", err)
+		}
+		err = cmd.Start()
+		if err != nil {
+			log.Fatal("Couldn't start gofmt: ", err)
+		}
+
+		_, err = fmt.Fprintf(in, header, strings.Join(append([]string{filepath.Base(os.Args[0])}, os.Args[1:]...), " "))
+		if err != nil {
+			log.Fatal("Couldn't write header to gofmt: ", err)
+		}
+
+		for {
+			line, err := generated.ReadBytes('\n')
+			if err != nil {
+				break
+			}
+			// remove godefs comments
+			if bytes.HasPrefix(line, []byte("//")) {
+				continue
+			}
+			_, err = in.Write(line)
+			if err != nil {
+				log.Fatal("Couldn't write line to gofmt: ", err)
+			}
+		}
+		in.Close()
+		err = cmd.Wait()
+		if err != nil {
+			log.Fatal("gofmt failed: ", err)
+		}
+		out.Close()
+	}
+}
diff --git a/vendor/github.com/google/gopacket/pcap/pcap_tester.go b/vendor/github.com/google/gopacket/pcap/pcap_tester.go
new file mode 100644
index 0000000..7873a96
--- /dev/null
+++ b/vendor/github.com/google/gopacket/pcap/pcap_tester.go
@@ -0,0 +1,108 @@
+// Copyright 2012 Google, Inc. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file in the root of the source
+// tree.
+
+// +build ignore
+
+// This binary tests that PCAP packet capture is working correctly by issuing
+// HTTP requests, then making sure we actually capture data off the wire.
+package main
+
+import (
+	"errors"
+	"flag"
+	"fmt"
+	"log"
+	"net/http"
+	"os"
+	"time"
+
+	"github.com/google/gopacket/pcap"
+)
+
+var mode = flag.String("mode", "basic", "One of: basic,filtered,timestamp")
+
+func generatePackets() {
+	if resp, err := http.Get("http://code.google.com"); err != nil {
+		log.Printf("Could not get HTTP: %v", err)
+	} else {
+		resp.Body.Close()
+	}
+}
+
+func main() {
+	flag.Parse()
+	ifaces, err := pcap.FindAllDevs()
+	if err != nil {
+		log.Fatal(err)
+	}
+	for _, iface := range ifaces {
+		log.Printf("Trying capture on %q", iface.Name)
+		if err := tryCapture(iface); err != nil {
+			log.Printf("Error capturing on %q: %v", iface.Name, err)
+		} else {
+			log.Printf("Successfully captured on %q", iface.Name)
+			return
+		}
+	}
+	os.Exit(1)
+}
+
+func tryCapture(iface pcap.Interface) error {
+	if iface.Name[:2] == "lo" {
+		return errors.New("skipping loopback")
+	}
+	var h *pcap.Handle
+	var err error
+	switch *mode {
+	case "basic":
+		h, err = pcap.OpenLive(iface.Name, 65536, false, time.Second*3)
+		if err != nil {
+			return fmt.Errorf("openlive: %v", err)
+		}
+		defer h.Close()
+	case "filtered":
+		h, err = pcap.OpenLive(iface.Name, 65536, false, time.Second*3)
+		if err != nil {
+			return fmt.Errorf("openlive: %v", err)
+		}
+		defer h.Close()
+		if err := h.SetBPFFilter("port 80 or port 443"); err != nil {
+			return fmt.Errorf("setbpf: %v", err)
+		}
+	case "timestamp":
+		u, err := pcap.NewInactiveHandle(iface.Name)
+		if err != nil {
+			return err
+		}
+		defer u.CleanUp()
+		if err = u.SetSnapLen(65536); err != nil {
+			return err
+		} else if err = u.SetPromisc(false); err != nil {
+			return err
+		} else if err = u.SetTimeout(time.Second * 3); err != nil {
+			return err
+		}
+		sources := u.SupportedTimestamps()
+		if len(sources) == 0 {
+			return errors.New("no supported timestamp sources")
+		} else if err := u.SetTimestampSource(sources[0]); err != nil {
+			return fmt.Errorf("settimestampsource(%v): %v", sources[0], err)
+		} else if h, err = u.Activate(); err != nil {
+			return fmt.Errorf("could not activate: %v", err)
+		}
+		defer h.Close()
+	default:
+		panic("Invalid --mode: " + *mode)
+	}
+	go generatePackets()
+	h.ReadPacketData() // Do one dummy read to clear any timeouts.
+	data, ci, err := h.ReadPacketData()
+	if err != nil {
+		return fmt.Errorf("readpacketdata: %v", err)
+	}
+	log.Printf("Read packet, %v bytes, CI: %+v", len(data), ci)
+	return nil
+}
