Sun Dec 1 02:47:12 UTC 2024 I: starting to build gopacket/trixie/i386 on jenkins on '2024-12-01 02:46' Sun Dec 1 02:47:12 UTC 2024 I: The jenkins build log is/was available at https://jenkins.debian.net/userContent/reproducible/debian/build_service/i386_20/34783/console.log Sun Dec 1 02:47:12 UTC 2024 I: Downloading source for trixie/gopacket=1.1.19-6.2 --2024-12-01 02:47:12-- http://deb.debian.org/debian/pool/main/g/gopacket/gopacket_1.1.19-6.2.dsc Connecting to 46.16.76.132:3128... connected. Proxy request sent, awaiting response... 200 OK Length: 2163 (2.1K) [text/prs.lines.tag] Saving to: ‘gopacket_1.1.19-6.2.dsc’ 0K .. 100% 246M=0s 2024-12-01 02:47:12 (246 MB/s) - ‘gopacket_1.1.19-6.2.dsc’ saved [2163/2163] Sun Dec 1 02:47:12 UTC 2024 I: gopacket_1.1.19-6.2.dsc -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Format: 3.0 (quilt) Source: gopacket Binary: golang-github-google-gopacket-dev Architecture: all Version: 1.1.19-6.2 Maintainer: Debian Go Packaging Team Uploaders: Hilko Bengen Homepage: https://github.com/google/gopacket/ Standards-Version: 4.6.2 Vcs-Browser: https://salsa.debian.org/go-team/packages/gopacket Vcs-Git: https://salsa.debian.org/go-team/packages/gopacket.git Testsuite: autopkgtest-pkg-go Build-Depends: debhelper-compat (= 13), dh-sequence-golang, golang-go, golang-golang-x-net-dev, golang-golang-x-sys-dev, libpcap0.8-dev, linux-libc-dev Package-List: golang-github-google-gopacket-dev deb golang optional arch=all Checksums-Sha1: 333d45c443398baa9015a8be5f9d4bdd62defc48 950745 gopacket_1.1.19.orig.tar.gz 27d29fa886613e9a4e8aae79773dca60c1802fa5 4620 gopacket_1.1.19-6.2.debian.tar.xz Checksums-Sha256: 31efa87cc9d2b41e5e66c7daa8839d841d2a43cc477bf595c9e8c24ef6903830 950745 gopacket_1.1.19.orig.tar.gz ff83abb1bfd8257cf5372dcc3939f6e4aa067c382c4bbd68b9606bcb082202b6 4620 gopacket_1.1.19-6.2.debian.tar.xz Files: c7ca96771a70a3734df976df46e3498a 950745 gopacket_1.1.19.orig.tar.gz 14a7275efec23b8a89df17a4c64dbc32 4620 gopacket_1.1.19-6.2.debian.tar.xz Go-Import-Path: github.com/google/gopacket -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEUryGlb40+QrX1Ay4E4jA+JnoM2sFAmaa28UACgkQE4jA+Jno M2tRdQ//TC8t+e/vtO5Z36yYdQLfMP9sYGmvMsUpt9mMwElKEB9mJN3zbx/SrpMM 0wos+UREP8vRadAcoJVrdi9UK/myYRJeoq1f4JtaoLTV4zXLkS+C3g9PgICHbvg9 LUkPVKUVZ7ynI1MFofVuU1ffv4esGmZMCBCxixJyYJY1MRAO1apU5hgDrVzyLS11 TWPPQfsV+wwL4hfTCnqA2DAklT9pNN8bi9JbHfXRyXzUE+8X2xKMIndZKGdt5ETl DxGbXK8D9ndRMy+llHgCndqho0EhkFFdnPBYGqVo+8zSrCcUrxaO/wT2IVkJ9AII 3RTY4ICj7CTWH5clKzW3YQlOyvbblaJOduGSxPVDDGGT4yHLmEe9JkxLL0o5EfYG dnyCXGXVIEXk65cyll16z4W6FiKpyz9xx9KkMavXj0+TmAmzPSFYovK9tkm6coRQ KGZy1BAnLCGJngNqEGJLblpEc24yM3bvI4fLZFd9UydKWOGtfp+qnh/Q89LDQZBA sjxJqoj4iMcn4aBb6iUNngV35xlfUOiJ4wYxz8RNjFUm+A6Rgb9lNaeU//hGWEmB 5IUigTSii/inYIB0H7mqNkFAKVwvCwdiQrhTvJbJG6A03sp6cnsQbzbUxxle5HOV S7/bdc0m9NWkImmOVM5m8GwtVvYBIRRhR9ldU065I8Er/C3EOgA= =DmVl -----END PGP SIGNATURE----- Sun Dec 1 02:47:12 UTC 2024 I: Checking whether the package is not for us Sun Dec 1 02:47:12 UTC 2024 I: Starting 1st build on remote node infom08-i386.debian.net. Sun Dec 1 02:47:12 UTC 2024 I: Preparing to do remote build '1' on infom08-i386.debian.net. Sun Dec 1 02:48:38 UTC 2024 I: Deleting $TMPDIR on infom08-i386.debian.net. I: pbuilder: network access will be disabled during build I: Current time: Fri Jan 2 21:10:15 -12 2026 I: pbuilder-time-stamp: 1767431415 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/trixie-reproducible-base.tgz] I: copying local configuration W: --override-config is not set; not updating apt.conf Read the manpage for details. I: mounting /proc filesystem I: mounting /sys filesystem I: creating /{dev,run}/shm I: mounting /dev/pts filesystem I: redirecting /dev/ptmx to /dev/pts/ptmx I: policy-rc.d already exists I: using eatmydata during job I: Copying source file I: copying [gopacket_1.1.19-6.2.dsc] I: copying [./gopacket_1.1.19.orig.tar.gz] I: copying [./gopacket_1.1.19-6.2.debian.tar.xz] I: Extracting source gpgv: Signature made Fri Jul 19 21:33:57 2024 gpgv: using RSA key 52BC8695BE34F90AD7D40CB81388C0F899E8336B gpgv: Can't check signature: No public key dpkg-source: warning: cannot verify inline signature for ./gopacket_1.1.19-6.2.dsc: no acceptable signature found dpkg-source: info: extracting gopacket in gopacket-1.1.19 dpkg-source: info: unpacking gopacket_1.1.19.orig.tar.gz dpkg-source: info: unpacking gopacket_1.1.19-6.2.debian.tar.xz dpkg-source: info: using patch list from debian/patches/series dpkg-source: info: applying 0001-Skip-comparing-libpcap-output-in-TestBPFInstruction.patch dpkg-source: info: applying 0002-fix-time-type-with-__USE_TIME_BITS64.patch I: Not using root during the build. I: Installing the build-deps I: user script /srv/workspace/pbuilder/25777/tmp/hooks/D02_print_environment starting I: set BUILDDIR='/build/reproducible-path' BUILDUSERGECOS='first user,first room,first work-phone,first home-phone,first other' BUILDUSERNAME='pbuilder1' BUILD_ARCH='i386' DEBIAN_FRONTEND='noninteractive' DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=6 ' DISTRIBUTION='trixie' HOME='/root' HOST_ARCH='i386' IFS=' ' INVOCATION_ID='af84578d72764613b3aa7cc20cb90dd9' LANG='C' LANGUAGE='en_US:en' LC_ALL='C' LD_LIBRARY_PATH='/usr/lib/libeatmydata' LD_PRELOAD='libeatmydata.so' MAIL='/var/mail/root' OPTIND='1' PATH='/usr/sbin:/usr/bin:/sbin:/bin:/usr/games' PBCURRENTCOMMANDLINEOPERATION='build' PBUILDER_OPERATION='build' PBUILDER_PKGDATADIR='/usr/share/pbuilder' PBUILDER_PKGLIBDIR='/usr/lib/pbuilder' PBUILDER_SYSCONFDIR='/etc' PPID='25777' PS1='# ' PS2='> ' PS4='+ ' PWD='/' SHELL='/bin/bash' SHLVL='2' SUDO_COMMAND='/usr/bin/timeout -k 18.1h 18h /usr/bin/ionice -c 3 /usr/bin/nice /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.G5OdWz8x/pbuilderrc_8rPm --distribution trixie --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/trixie-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.G5OdWz8x/b1 --logfile b1/build.log gopacket_1.1.19-6.2.dsc' SUDO_GID='111' SUDO_UID='104' SUDO_USER='jenkins' TERM='unknown' TZ='/usr/share/zoneinfo/Etc/GMT+12' USER='root' _='/usr/bin/systemd-run' I: uname -a Linux infom08-i386 6.11.5+bpo-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.11.5-1~bpo12+1 (2024-11-11) x86_64 GNU/Linux I: ls -l /bin lrwxrwxrwx 1 root root 7 Nov 22 2024 /bin -> usr/bin I: user script /srv/workspace/pbuilder/25777/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy Version: 0.invalid.0 Architecture: i386 Maintainer: Debian Pbuilder Team Description: Dummy package to satisfy dependencies with aptitude - created by pbuilder This package was created automatically by pbuilder to satisfy the build-dependencies of the package being currently built. Depends: debhelper-compat (= 13), dh-sequence-golang, golang-go, golang-golang-x-net-dev, golang-golang-x-sys-dev, libpcap0.8-dev, linux-libc-dev dpkg-deb: building package 'pbuilder-satisfydepends-dummy' in '/tmp/satisfydepends-aptitude/pbuilder-satisfydepends-dummy.deb'. Selecting previously unselected package pbuilder-satisfydepends-dummy. (Reading database ... 19950 files and directories currently installed.) Preparing to unpack .../pbuilder-satisfydepends-dummy.deb ... Unpacking pbuilder-satisfydepends-dummy (0.invalid.0) ... dpkg: pbuilder-satisfydepends-dummy: dependency problems, but configuring anyway as you requested: pbuilder-satisfydepends-dummy depends on debhelper-compat (= 13); however: Package debhelper-compat is not installed. pbuilder-satisfydepends-dummy depends on dh-sequence-golang; however: Package dh-sequence-golang is not installed. pbuilder-satisfydepends-dummy depends on golang-go; however: Package golang-go is not installed. pbuilder-satisfydepends-dummy depends on golang-golang-x-net-dev; however: Package golang-golang-x-net-dev is not installed. pbuilder-satisfydepends-dummy depends on golang-golang-x-sys-dev; however: Package golang-golang-x-sys-dev is not installed. pbuilder-satisfydepends-dummy depends on libpcap0.8-dev; however: Package libpcap0.8-dev is not installed. Setting up pbuilder-satisfydepends-dummy (0.invalid.0) ... Reading package lists... Building dependency tree... Reading state information... Initializing package states... Writing extended state information... Building tag database... pbuilder-satisfydepends-dummy is already installed at the requested version (0.invalid.0) pbuilder-satisfydepends-dummy is already installed at the requested version (0.invalid.0) The following NEW packages will be installed: autoconf{a} automake{a} autopoint{a} autotools-dev{a} bsdextrautils{a} debhelper{a} dh-autoreconf{a} dh-golang{a} dh-strip-nondeterminism{a} dwz{a} file{a} gettext{a} gettext-base{a} golang-1.23-go{a} golang-1.23-src{a} golang-go{a} golang-golang-x-crypto-dev{a} golang-golang-x-net-dev{a} golang-golang-x-sys-dev{a} golang-golang-x-term-dev{a} golang-golang-x-text-dev{a} golang-src{a} groff-base{a} intltool-debian{a} libarchive-zip-perl{a} libdbus-1-3{a} libdbus-1-dev{a} libdebhelper-perl{a} libelf1t64{a} libfile-stripnondeterminism-perl{a} libicu72{a} libmagic-mgc{a} libmagic1t64{a} libpcap0.8-dev{a} libpcap0.8t64{a} libpipeline1{a} libpkgconf3{a} libtool{a} libuchardet0{a} libxml2{a} m4{a} man-db{a} pkgconf{a} pkgconf-bin{a} po-debconf{a} sensible-utils{a} sgml-base{a} xml-core{a} The following packages are RECOMMENDED but will NOT be installed: curl dbus libarchive-cpio-perl libltdl-dev libmail-sendmail-perl lynx wget 0 packages upgraded, 48 newly installed, 0 to remove and 0 not upgraded. Need to get 72.5 MB of archives. After unpacking 378 MB will be used. Writing extended state information... Get: 1 http://deb.debian.org/debian trixie/main i386 sgml-base all 1.31 [15.4 kB] Get: 2 http://deb.debian.org/debian trixie/main i386 sensible-utils all 0.0.24 [24.8 kB] Get: 3 http://deb.debian.org/debian trixie/main i386 libmagic-mgc i386 1:5.45-3+b1 [314 kB] Get: 4 http://deb.debian.org/debian trixie/main i386 libmagic1t64 i386 1:5.45-3+b1 [115 kB] Get: 5 http://deb.debian.org/debian trixie/main i386 file i386 1:5.45-3+b1 [43.2 kB] Get: 6 http://deb.debian.org/debian trixie/main i386 gettext-base i386 0.22.5-2 [201 kB] Get: 7 http://deb.debian.org/debian trixie/main i386 libuchardet0 i386 0.0.8-1+b2 [69.2 kB] Get: 8 http://deb.debian.org/debian trixie/main i386 groff-base i386 1.23.0-5 [1196 kB] Get: 9 http://deb.debian.org/debian trixie/main i386 bsdextrautils i386 2.40.2-11 [95.6 kB] Get: 10 http://deb.debian.org/debian trixie/main i386 libpipeline1 i386 1.5.8-1 [41.2 kB] Get: 11 http://deb.debian.org/debian trixie/main i386 man-db i386 2.13.0-1 [1428 kB] Get: 12 http://deb.debian.org/debian trixie/main i386 m4 i386 1.4.19-4 [293 kB] Get: 13 http://deb.debian.org/debian trixie/main i386 autoconf all 2.72-3 [493 kB] Get: 14 http://deb.debian.org/debian trixie/main i386 autotools-dev all 20220109.1 [51.6 kB] Get: 15 http://deb.debian.org/debian trixie/main i386 automake all 1:1.16.5-1.3 [823 kB] Get: 16 http://deb.debian.org/debian trixie/main i386 autopoint all 0.22.5-2 [723 kB] Get: 17 http://deb.debian.org/debian trixie/main i386 libdebhelper-perl all 13.20 [89.7 kB] Get: 18 http://deb.debian.org/debian trixie/main i386 libtool all 2.4.7-8 [517 kB] Get: 19 http://deb.debian.org/debian trixie/main i386 dh-autoreconf all 20 [17.1 kB] Get: 20 http://deb.debian.org/debian trixie/main i386 libarchive-zip-perl all 1.68-1 [104 kB] Get: 21 http://deb.debian.org/debian trixie/main i386 libfile-stripnondeterminism-perl all 1.14.0-1 [19.5 kB] Get: 22 http://deb.debian.org/debian trixie/main i386 dh-strip-nondeterminism all 1.14.0-1 [8448 B] Get: 23 http://deb.debian.org/debian trixie/main i386 libelf1t64 i386 0.192-4 [195 kB] Get: 24 http://deb.debian.org/debian trixie/main i386 dwz i386 0.15-1+b1 [116 kB] Get: 25 http://deb.debian.org/debian trixie/main i386 libicu72 i386 72.1-5+b1 [9583 kB] Get: 26 http://deb.debian.org/debian trixie/main i386 libxml2 i386 2.12.7+dfsg+really2.9.14-0.2+b1 [734 kB] Get: 27 http://deb.debian.org/debian trixie/main i386 gettext i386 0.22.5-2 [1631 kB] Get: 28 http://deb.debian.org/debian trixie/main i386 intltool-debian all 0.35.0+20060710.6 [22.9 kB] Get: 29 http://deb.debian.org/debian trixie/main i386 po-debconf all 1.0.21+nmu1 [248 kB] Get: 30 http://deb.debian.org/debian trixie/main i386 debhelper all 13.20 [915 kB] Get: 31 http://deb.debian.org/debian trixie/main i386 dh-golang all 1.62 [24.7 kB] Get: 32 http://deb.debian.org/debian trixie/main i386 golang-1.23-src all 1.23.3-2 [19.1 MB] Get: 33 http://deb.debian.org/debian trixie/main i386 golang-1.23-go i386 1.23.3-2 [25.1 MB] Get: 34 http://deb.debian.org/debian trixie/main i386 golang-src all 2:1.23~2 [5088 B] Get: 35 http://deb.debian.org/debian trixie/main i386 golang-go i386 2:1.23~2 [44.3 kB] Get: 36 http://deb.debian.org/debian trixie/main i386 golang-golang-x-sys-dev all 0.22.0-1 [431 kB] Get: 37 http://deb.debian.org/debian trixie/main i386 golang-golang-x-term-dev all 0.22.0-1 [14.8 kB] Get: 38 http://deb.debian.org/debian trixie/main i386 golang-golang-x-text-dev all 0.16.0-1 [4003 kB] Get: 39 http://deb.debian.org/debian trixie/main i386 golang-golang-x-crypto-dev all 1:0.25.0-1 [1682 kB] Get: 40 http://deb.debian.org/debian trixie/main i386 golang-golang-x-net-dev all 1:0.27.0-1 [898 kB] Get: 41 http://deb.debian.org/debian trixie/main i386 libdbus-1-3 i386 1.14.10-6 [217 kB] Get: 42 http://deb.debian.org/debian trixie/main i386 libpkgconf3 i386 1.8.1-4 [38.4 kB] Get: 43 http://deb.debian.org/debian trixie/main i386 pkgconf-bin i386 1.8.1-4 [30.6 kB] Get: 44 http://deb.debian.org/debian trixie/main i386 pkgconf i386 1.8.1-4 [26.2 kB] Get: 45 http://deb.debian.org/debian trixie/main i386 xml-core all 0.19 [20.1 kB] Get: 46 http://deb.debian.org/debian trixie/main i386 libdbus-1-dev i386 1.14.10-6 [260 kB] Get: 47 http://deb.debian.org/debian trixie/main i386 libpcap0.8t64 i386 1.10.5-1 [175 kB] Get: 48 http://deb.debian.org/debian trixie/main i386 libpcap0.8-dev i386 1.10.5-1 [293 kB] Fetched 72.5 MB in 2s (35.5 MB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package sgml-base. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 19950 files and directories currently installed.) Preparing to unpack .../00-sgml-base_1.31_all.deb ... Unpacking sgml-base (1.31) ... Selecting previously unselected package sensible-utils. Preparing to unpack .../01-sensible-utils_0.0.24_all.deb ... Unpacking sensible-utils (0.0.24) ... Selecting previously unselected package libmagic-mgc. Preparing to unpack .../02-libmagic-mgc_1%3a5.45-3+b1_i386.deb ... Unpacking libmagic-mgc (1:5.45-3+b1) ... Selecting previously unselected package libmagic1t64:i386. Preparing to unpack .../03-libmagic1t64_1%3a5.45-3+b1_i386.deb ... Unpacking libmagic1t64:i386 (1:5.45-3+b1) ... Selecting previously unselected package file. Preparing to unpack .../04-file_1%3a5.45-3+b1_i386.deb ... Unpacking file (1:5.45-3+b1) ... Selecting previously unselected package gettext-base. Preparing to unpack .../05-gettext-base_0.22.5-2_i386.deb ... Unpacking gettext-base (0.22.5-2) ... Selecting previously unselected package libuchardet0:i386. Preparing to unpack .../06-libuchardet0_0.0.8-1+b2_i386.deb ... Unpacking libuchardet0:i386 (0.0.8-1+b2) ... Selecting previously unselected package groff-base. Preparing to unpack .../07-groff-base_1.23.0-5_i386.deb ... Unpacking groff-base (1.23.0-5) ... Selecting previously unselected package bsdextrautils. Preparing to unpack .../08-bsdextrautils_2.40.2-11_i386.deb ... Unpacking bsdextrautils (2.40.2-11) ... Selecting previously unselected package libpipeline1:i386. Preparing to unpack .../09-libpipeline1_1.5.8-1_i386.deb ... Unpacking libpipeline1:i386 (1.5.8-1) ... Selecting previously unselected package man-db. Preparing to unpack .../10-man-db_2.13.0-1_i386.deb ... Unpacking man-db (2.13.0-1) ... Selecting previously unselected package m4. Preparing to unpack .../11-m4_1.4.19-4_i386.deb ... Unpacking m4 (1.4.19-4) ... Selecting previously unselected package autoconf. Preparing to unpack .../12-autoconf_2.72-3_all.deb ... Unpacking autoconf (2.72-3) ... Selecting previously unselected package autotools-dev. Preparing to unpack .../13-autotools-dev_20220109.1_all.deb ... Unpacking autotools-dev (20220109.1) ... Selecting previously unselected package automake. Preparing to unpack .../14-automake_1%3a1.16.5-1.3_all.deb ... Unpacking automake (1:1.16.5-1.3) ... Selecting previously unselected package autopoint. Preparing to unpack .../15-autopoint_0.22.5-2_all.deb ... Unpacking autopoint (0.22.5-2) ... Selecting previously unselected package libdebhelper-perl. Preparing to unpack .../16-libdebhelper-perl_13.20_all.deb ... Unpacking libdebhelper-perl (13.20) ... Selecting previously unselected package libtool. Preparing to unpack .../17-libtool_2.4.7-8_all.deb ... Unpacking libtool (2.4.7-8) ... Selecting previously unselected package dh-autoreconf. Preparing to unpack .../18-dh-autoreconf_20_all.deb ... Unpacking dh-autoreconf (20) ... Selecting previously unselected package libarchive-zip-perl. Preparing to unpack .../19-libarchive-zip-perl_1.68-1_all.deb ... Unpacking libarchive-zip-perl (1.68-1) ... Selecting previously unselected package libfile-stripnondeterminism-perl. Preparing to unpack .../20-libfile-stripnondeterminism-perl_1.14.0-1_all.deb ... Unpacking libfile-stripnondeterminism-perl (1.14.0-1) ... Selecting previously unselected package dh-strip-nondeterminism. Preparing to unpack .../21-dh-strip-nondeterminism_1.14.0-1_all.deb ... Unpacking dh-strip-nondeterminism (1.14.0-1) ... Selecting previously unselected package libelf1t64:i386. Preparing to unpack .../22-libelf1t64_0.192-4_i386.deb ... Unpacking libelf1t64:i386 (0.192-4) ... Selecting previously unselected package dwz. Preparing to unpack .../23-dwz_0.15-1+b1_i386.deb ... Unpacking dwz (0.15-1+b1) ... Selecting previously unselected package libicu72:i386. Preparing to unpack .../24-libicu72_72.1-5+b1_i386.deb ... Unpacking libicu72:i386 (72.1-5+b1) ... Selecting previously unselected package libxml2:i386. Preparing to unpack .../25-libxml2_2.12.7+dfsg+really2.9.14-0.2+b1_i386.deb ... Unpacking libxml2:i386 (2.12.7+dfsg+really2.9.14-0.2+b1) ... Selecting previously unselected package gettext. Preparing to unpack .../26-gettext_0.22.5-2_i386.deb ... Unpacking gettext (0.22.5-2) ... Selecting previously unselected package intltool-debian. Preparing to unpack .../27-intltool-debian_0.35.0+20060710.6_all.deb ... Unpacking intltool-debian (0.35.0+20060710.6) ... Selecting previously unselected package po-debconf. Preparing to unpack .../28-po-debconf_1.0.21+nmu1_all.deb ... Unpacking po-debconf (1.0.21+nmu1) ... Selecting previously unselected package debhelper. Preparing to unpack .../29-debhelper_13.20_all.deb ... Unpacking debhelper (13.20) ... Selecting previously unselected package dh-golang. Preparing to unpack .../30-dh-golang_1.62_all.deb ... Unpacking dh-golang (1.62) ... Selecting previously unselected package golang-1.23-src. Preparing to unpack .../31-golang-1.23-src_1.23.3-2_all.deb ... Unpacking golang-1.23-src (1.23.3-2) ... Selecting previously unselected package golang-1.23-go. Preparing to unpack .../32-golang-1.23-go_1.23.3-2_i386.deb ... Unpacking golang-1.23-go (1.23.3-2) ... Selecting previously unselected package golang-src. Preparing to unpack .../33-golang-src_2%3a1.23~2_all.deb ... Unpacking golang-src (2:1.23~2) ... Selecting previously unselected package golang-go:i386. Preparing to unpack .../34-golang-go_2%3a1.23~2_i386.deb ... Unpacking golang-go:i386 (2:1.23~2) ... Selecting previously unselected package golang-golang-x-sys-dev. Preparing to unpack .../35-golang-golang-x-sys-dev_0.22.0-1_all.deb ... Unpacking golang-golang-x-sys-dev (0.22.0-1) ... Selecting previously unselected package golang-golang-x-term-dev. Preparing to unpack .../36-golang-golang-x-term-dev_0.22.0-1_all.deb ... Unpacking golang-golang-x-term-dev (0.22.0-1) ... Selecting previously unselected package golang-golang-x-text-dev. Preparing to unpack .../37-golang-golang-x-text-dev_0.16.0-1_all.deb ... Unpacking golang-golang-x-text-dev (0.16.0-1) ... Selecting previously unselected package golang-golang-x-crypto-dev. Preparing to unpack .../38-golang-golang-x-crypto-dev_1%3a0.25.0-1_all.deb ... Unpacking golang-golang-x-crypto-dev (1:0.25.0-1) ... Selecting previously unselected package golang-golang-x-net-dev. Preparing to unpack .../39-golang-golang-x-net-dev_1%3a0.27.0-1_all.deb ... Unpacking golang-golang-x-net-dev (1:0.27.0-1) ... Selecting previously unselected package libdbus-1-3:i386. Preparing to unpack .../40-libdbus-1-3_1.14.10-6_i386.deb ... Unpacking libdbus-1-3:i386 (1.14.10-6) ... Selecting previously unselected package libpkgconf3:i386. Preparing to unpack .../41-libpkgconf3_1.8.1-4_i386.deb ... Unpacking libpkgconf3:i386 (1.8.1-4) ... Selecting previously unselected package pkgconf-bin. Preparing to unpack .../42-pkgconf-bin_1.8.1-4_i386.deb ... Unpacking pkgconf-bin (1.8.1-4) ... Selecting previously unselected package pkgconf:i386. Preparing to unpack .../43-pkgconf_1.8.1-4_i386.deb ... Unpacking pkgconf:i386 (1.8.1-4) ... Selecting previously unselected package xml-core. Preparing to unpack .../44-xml-core_0.19_all.deb ... Unpacking xml-core (0.19) ... Selecting previously unselected package libdbus-1-dev:i386. Preparing to unpack .../45-libdbus-1-dev_1.14.10-6_i386.deb ... Unpacking libdbus-1-dev:i386 (1.14.10-6) ... Selecting previously unselected package libpcap0.8t64:i386. Preparing to unpack .../46-libpcap0.8t64_1.10.5-1_i386.deb ... Unpacking libpcap0.8t64:i386 (1.10.5-1) ... Selecting previously unselected package libpcap0.8-dev:i386. Preparing to unpack .../47-libpcap0.8-dev_1.10.5-1_i386.deb ... Unpacking libpcap0.8-dev:i386 (1.10.5-1) ... Setting up libpipeline1:i386 (1.5.8-1) ... Setting up libicu72:i386 (72.1-5+b1) ... Setting up bsdextrautils (2.40.2-11) ... Setting up libmagic-mgc (1:5.45-3+b1) ... Setting up libarchive-zip-perl (1.68-1) ... Setting up libdebhelper-perl (13.20) ... Setting up golang-golang-x-sys-dev (0.22.0-1) ... Setting up libmagic1t64:i386 (1:5.45-3+b1) ... Setting up gettext-base (0.22.5-2) ... Setting up m4 (1.4.19-4) ... Setting up golang-golang-x-term-dev (0.22.0-1) ... Setting up file (1:5.45-3+b1) ... Setting up libelf1t64:i386 (0.192-4) ... Setting up autotools-dev (20220109.1) ... Setting up libpkgconf3:i386 (1.8.1-4) ... Setting up libdbus-1-3:i386 (1.14.10-6) ... Setting up golang-1.23-src (1.23.3-2) ... Setting up autopoint (0.22.5-2) ... Setting up pkgconf-bin (1.8.1-4) ... Setting up autoconf (2.72-3) ... Setting up dwz (0.15-1+b1) ... Setting up sensible-utils (0.0.24) ... Setting up golang-golang-x-text-dev (0.16.0-1) ... Setting up libuchardet0:i386 (0.0.8-1+b2) ... Setting up libpcap0.8t64:i386 (1.10.5-1) ... Setting up sgml-base (1.31) ... Setting up golang-golang-x-crypto-dev (1:0.25.0-1) ... Setting up golang-src (2:1.23~2) ... Setting up libxml2:i386 (2.12.7+dfsg+really2.9.14-0.2+b1) ... Setting up automake (1:1.16.5-1.3) ... update-alternatives: using /usr/bin/automake-1.16 to provide /usr/bin/automake (automake) in auto mode Setting up libfile-stripnondeterminism-perl (1.14.0-1) ... Setting up gettext (0.22.5-2) ... Setting up libtool (2.4.7-8) ... Setting up pkgconf:i386 (1.8.1-4) ... Setting up intltool-debian (0.35.0+20060710.6) ... Setting up dh-autoreconf (20) ... Setting up golang-1.23-go (1.23.3-2) ... Setting up golang-golang-x-net-dev (1:0.27.0-1) ... Setting up dh-strip-nondeterminism (1.14.0-1) ... Setting up groff-base (1.23.0-5) ... Setting up xml-core (0.19) ... Setting up golang-go:i386 (2:1.23~2) ... Setting up po-debconf (1.0.21+nmu1) ... Setting up man-db (2.13.0-1) ... Not building database; man-db/auto-update is not 'true'. Setting up debhelper (13.20) ... Setting up dh-golang (1.62) ... Processing triggers for libc-bin (2.40-3) ... Processing triggers for sgml-base (1.31) ... Setting up libdbus-1-dev:i386 (1.14.10-6) ... Setting up libpcap0.8-dev:i386 (1.10.5-1) ... Reading package lists... Building dependency tree... Reading state information... Reading extended state information... Initializing package states... Writing extended state information... Building tag database... -> Finished parsing the build-deps I: Building the package I: Running cd /build/reproducible-path/gopacket-1.1.19/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-genchanges -S > ../gopacket_1.1.19-6.2_source.changes dpkg-buildpackage: info: source package gopacket dpkg-buildpackage: info: source version 1.1.19-6.2 dpkg-buildpackage: info: source distribution unstable dpkg-buildpackage: info: source changed by Aurelien Jarno dpkg-source --before-build . dpkg-buildpackage: info: host architecture i386 debian/rules clean dh clean --buildsystem=golang dh_auto_clean -O--buildsystem=golang dh_autoreconf_clean -O--buildsystem=golang dh_clean -O--buildsystem=golang debian/rules binary dh binary --buildsystem=golang dh_update_autotools_config -O--buildsystem=golang dh_autoreconf -O--buildsystem=golang dh_auto_configure -O--buildsystem=golang dh_auto_build -O--buildsystem=golang cd obj-i686-linux-gnu && go install -trimpath -v -p 6 github.com/google/gopacket github.com/google/gopacket/afpacket github.com/google/gopacket/bytediff github.com/google/gopacket/defrag/lcmdefrag github.com/google/gopacket/dumpcommand github.com/google/gopacket/ip4defrag github.com/google/gopacket/layers github.com/google/gopacket/macs github.com/google/gopacket/pcap github.com/google/gopacket/pcapgo github.com/google/gopacket/reassembly github.com/google/gopacket/routing github.com/google/gopacket/tcpassembly github.com/google/gopacket/tcpassembly/tcpreader internal/unsafeheader internal/goarch internal/coverage/rtcov internal/byteorder internal/godebugs internal/goexperiment internal/goos internal/cpu internal/abi internal/profilerecord internal/runtime/atomic internal/runtime/syscall internal/chacha8rand runtime/internal/math runtime/internal/sys internal/race sync/atomic unicode unicode/utf8 internal/runtime/exithook internal/bytealg cmp internal/itoa math/bits internal/asan internal/msan internal/nettrace encoding internal/stringslite container/list log/internal math github.com/google/gopacket/macs runtime iter internal/reflectlite sync internal/weak slices internal/bisect internal/testlog internal/singleflight runtime/cgo errors sort internal/godebug io internal/oserror strconv path syscall vendor/golang.org/x/net/dns/dnsmessage bytes strings math/rand/v2 internal/concurrent hash reflect unique hash/crc32 net/netip bufio internal/syscall/unix internal/syscall/execenv time io/fs context internal/fmtsort internal/poll encoding/binary internal/filepathlite os golang.org/x/sys/unix fmt runtime/debug github.com/google/gopacket/bytediff golang.org/x/net/bpf encoding/hex flag log compress/flate compress/gzip net github.com/google/gopacket github.com/google/gopacket/routing github.com/google/gopacket/afpacket github.com/google/gopacket/layers github.com/google/gopacket/defrag/lcmdefrag github.com/google/gopacket/ip4defrag github.com/google/gopacket/pcap github.com/google/gopacket/pcapgo github.com/google/gopacket/reassembly github.com/google/gopacket/tcpassembly github.com/google/gopacket/dumpcommand github.com/google/gopacket/tcpassembly/tcpreader dh_auto_test -O--buildsystem=golang cd obj-i686-linux-gnu && go test -vet=off -v -p 6 github.com/google/gopacket github.com/google/gopacket/afpacket github.com/google/gopacket/bytediff github.com/google/gopacket/defrag/lcmdefrag github.com/google/gopacket/dumpcommand github.com/google/gopacket/ip4defrag github.com/google/gopacket/layers github.com/google/gopacket/macs github.com/google/gopacket/pcap github.com/google/gopacket/pcapgo github.com/google/gopacket/reassembly github.com/google/gopacket/routing github.com/google/gopacket/tcpassembly github.com/google/gopacket/tcpassembly/tcpreader === RUN TestDumpEmbedded --- PASS: TestDumpEmbedded (0.00s) === RUN TestConcatPacketSources --- PASS: TestConcatPacketSources (0.00s) === RUN TestToDuration --- PASS: TestToDuration (0.00s) === RUN TestExponentialSizeIncreasePrepend --- PASS: TestExponentialSizeIncreasePrepend (0.00s) === RUN TestExponentialSizeIncreaseAppend --- PASS: TestExponentialSizeIncreaseAppend (0.00s) === RUN ExampleSerializeBuffer --- PASS: ExampleSerializeBuffer (0.00s) PASS ok github.com/google/gopacket 0.017s === RUN TestParseOptions afpacket_test.go:32: got: afpacket.options{frameSize:4096, framesPerBlock:0, blockSize:2, numBlocks:128, addVLANHeader:false, blockTimeout:64000000, pollTimeout:-1000000, version:-1, socktype:3, iface:""} err: block size 2 must be divisible by page size 4096 afpacket_test.go:32: got: afpacket.options{frameSize:333, framesPerBlock:0, blockSize:524288, numBlocks:128, addVLANHeader:false, blockTimeout:64000000, pollTimeout:-1000000, version:-1, socktype:3, iface:""} err: block size 524288 must be divisible by frame size 333 afpacket_test.go:32: got: afpacket.options{frameSize:4096, framesPerBlock:0, blockSize:524288, numBlocks:128, addVLANHeader:false, blockTimeout:64000000, pollTimeout:-1000000, version:-3, socktype:3, iface:""} err: tpacket version InvalidVersion is invalid afpacket_test.go:32: got: afpacket.options{frameSize:4096, framesPerBlock:0, blockSize:524288, numBlocks:128, addVLANHeader:false, blockTimeout:64000000, pollTimeout:-1000000, version:5, socktype:3, iface:""} err: tpacket version InvalidVersion is invalid afpacket_test.go:32: got: afpacket.options{frameSize:1024, framesPerBlock:512, blockSize:524288, numBlocks:128, addVLANHeader:false, blockTimeout:64000000, pollTimeout:-1000000, version:-1, socktype:3, iface:""} err: --- PASS: TestParseOptions (0.00s) PASS ok github.com/google/gopacket/afpacket 0.016s === RUN TestLCS --- PASS: TestLCS (0.00s) === RUN TestDiff --- PASS: TestDiff (0.00s) PASS ok github.com/google/gopacket/bytediff 0.008s ? github.com/google/gopacket/dumpcommand [no test files] === RUN TestOrderedLCMDefrag --- PASS: TestOrderedLCMDefrag (0.00s) === RUN TestUnorderedLCMDefrag --- PASS: TestUnorderedLCMDefrag (0.00s) === RUN TestNonLCMDefrag --- PASS: TestNonLCMDefrag (0.00s) PASS ok github.com/google/gopacket/defrag/lcmdefrag 0.013s === RUN TestNotFrag --- PASS: TestNotFrag (0.00s) === RUN TestDefragPingMultipleFrags --- PASS: TestDefragPingMultipleFrags (0.00s) === RUN TestDefragPing1 --- PASS: TestDefragPing1 (0.00s) === RUN TestDefragPing1and2 --- PASS: TestDefragPing1and2 (0.00s) === RUN TestDefragTooSmall --- PASS: TestDefragTooSmall (0.00s) === RUN TestDefragFragmentOffset --- PASS: TestDefragFragmentOffset (0.00s) === RUN TestDefragDiscard --- PASS: TestDefragDiscard (0.00s) === RUN TestDefragMaxSize --- PASS: TestDefragMaxSize (0.00s) === RUN TestDefragIDField --- PASS: TestDefragIDField (0.00s) PASS ok github.com/google/gopacket/ip4defrag 0.018s ? github.com/google/gopacket/routing [no test files] === RUN TestASFPresencePongDecodeFromBytes --- PASS: TestASFPresencePongDecodeFromBytes (0.00s) === RUN TestASFPresencePongSupportsDCMI --- PASS: TestASFPresencePongSupportsDCMI (0.00s) === RUN TestASFPresencePongSerializeTo --- PASS: TestASFPresencePongSerializeTo (0.00s) === RUN TestASFDecodeFromBytes --- PASS: TestASFDecodeFromBytes (0.00s) === RUN TestASFSerializeTo --- PASS: TestASFSerializeTo (0.00s) === RUN TestBFDNoAuth base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP BFD] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 57 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 37 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 24 bytes base_test.go:21: Got layer BFD, 24 bytes, payload of 0 bytes base_test.go:24: PACKET: 71 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..57..] SrcMAC=00:10:94:00:00:02 DstMAC=00:00:01:00:00:01 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..37..] Version=4 IHL=5 TOS=0 Length=61 Id=0 Flags= FragOffset=0 TTL=10 Protocol=UDP Checksum=12120 SrcIP=192.85.1.2 DstIP=192.0.0.1 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..24..] SrcPort=49152 DstPort=3784(bfd-control) Length=32 Checksum=29233} - Layer 4 (24 bytes) = BFD {Contents=[..24..] Payload=[] Version=1 Diagnostic=None State=Down Poll=false Final=false ControlPlaneIndependent=false AuthPresent=false Demand=false Multipoint=false DetectMultiplier=5 MyDiscriminator=1 YourDiscriminator=0 DesiredMinTxInterval=1000000 RequiredMinRxInterval=1000000 RequiredMinEchoRxInterval=0 AuthHeader=nil} --- PASS: TestBFDNoAuth (0.00s) === RUN TestBFDAuthTypePassword base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP BFD] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 65 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 41 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 33 bytes base_test.go:21: Got layer BFD, 33 bytes, payload of 0 bytes base_test.go:24: PACKET: 79 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..65..] SrcMAC=00:10:94:00:00:02 DstMAC=00:00:01:00:00:01 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..41..] Version=4 IHL=5 TOS=0 Length=61 Id=0 Flags= FragOffset=0 TTL=10 Protocol=UDP Checksum=12120 SrcIP=192.85.1.2 DstIP=192.0.0.1 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..33..] SrcPort=49152 DstPort=3784(bfd-control) Length=41 Checksum=29233} - Layer 4 (33 bytes) = BFD {Contents=[..33..] Payload=[] Version=1 Diagnostic=None State=Down Poll=false Final=false ControlPlaneIndependent=false AuthPresent=true Demand=false Multipoint=false DetectMultiplier=5 MyDiscriminator=1 YourDiscriminator=0 DesiredMinTxInterval=1000000 RequiredMinRxInterval=1000000 RequiredMinEchoRxInterval=0 AuthHeader={ AuthType=Simple Password KeyID=2 SequenceNumber=0 Data=[..6..]}} --- PASS: TestBFDAuthTypePassword (0.00s) === RUN TestBFDAuthTypeKeyedMD5 base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP BFD] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 80 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 56 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 48 bytes base_test.go:21: Got layer BFD, 48 bytes, payload of 0 bytes base_test.go:24: PACKET: 94 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..80..] SrcMAC=00:10:94:00:00:02 DstMAC=00:00:01:00:00:01 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..56..] Version=4 IHL=5 TOS=0 Length=76 Id=1 Flags= FragOffset=0 TTL=10 Protocol=UDP Checksum=12104 SrcIP=192.85.1.2 DstIP=192.0.0.1 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..48..] SrcPort=1024 DstPort=3784(bfd-control) Length=56 Checksum=27340} - Layer 4 (48 bytes) = BFD {Contents=[..48..] Payload=[] Version=1 Diagnostic=None State=Down Poll=false Final=false ControlPlaneIndependent=false AuthPresent=true Demand=false Multipoint=false DetectMultiplier=5 MyDiscriminator=1 YourDiscriminator=0 DesiredMinTxInterval=1000000 RequiredMinRxInterval=1000000 RequiredMinEchoRxInterval=0 AuthHeader={ AuthType=Keyed MD5 KeyID=2 SequenceNumber=5 Data=[..16..]}} --- PASS: TestBFDAuthTypeKeyedMD5 (0.00s) === RUN TestBFDAuthTypeMeticulousKeyedSHA1 base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP BFD] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 60 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 52 bytes base_test.go:21: Got layer BFD, 52 bytes, payload of 0 bytes base_test.go:24: PACKET: 98 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..84..] SrcMAC=00:10:94:00:00:02 DstMAC=00:00:01:00:00:01 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..60..] Version=4 IHL=5 TOS=0 Length=80 Id=0 Flags= FragOffset=0 TTL=10 Protocol=UDP Checksum=12101 SrcIP=192.85.1.2 DstIP=192.0.0.1 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..52..] SrcPort=1024 DstPort=3784(bfd-control) Length=60 Checksum=14218} - Layer 4 (52 bytes) = BFD {Contents=[..52..] Payload=[] Version=1 Diagnostic=None State=Down Poll=false Final=false ControlPlaneIndependent=false AuthPresent=true Demand=false Multipoint=false DetectMultiplier=5 MyDiscriminator=1 YourDiscriminator=0 DesiredMinTxInterval=1000000 RequiredMinRxInterval=1000000 RequiredMinEchoRxInterval=0 AuthHeader={ AuthType=Meticulous Keyed SHA1 KeyID=2 SequenceNumber=5 Data=[..20..]}} --- PASS: TestBFDAuthTypeMeticulousKeyedSHA1 (0.00s) === RUN TestFlowMapKey --- PASS: TestFlowMapKey (0.00s) === RUN TestDecodeSimpleTCPPacket --- PASS: TestDecodeSimpleTCPPacket (0.00s) === RUN TestDecodeSmallTCPPacketHasEmptyPayload --- PASS: TestDecodeSmallTCPPacketHasEmptyPayload (0.00s) === RUN TestDecodeVLANPacket decode_test.go:568: Layer 0: &layers.Ethernet{BaseLayer:layers.BaseLayer{Contents:[]uint8{0x0, 0x10, 0xdb, 0xff, 0x10, 0x0, 0x0, 0x15, 0x2c, 0x9d, 0xcc, 0x0, 0x81, 0x0}, Payload:[]uint8{0x1, 0xf7, 0x8, 0x0, 0x45, 0x0, 0x0, 0x28, 0x29, 0x8d, 0x40, 0x0, 0x7d, 0x6, 0x83, 0xa0, 0xac, 0x1b, 0xca, 0x8e, 0x45, 0x16, 0x94, 0xe2, 0xd4, 0xa, 0x0, 0x50, 0xdf, 0xab, 0x9c, 0xc6, 0xcd, 0x1e, 0xe5, 0xd1, 0x50, 0x10, 0x1, 0x0, 0x5a, 0x74, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}, SrcMAC:net.HardwareAddr{0x0, 0x15, 0x2c, 0x9d, 0xcc, 0x0}, DstMAC:net.HardwareAddr{0x0, 0x10, 0xdb, 0xff, 0x10, 0x0}, EthernetType:0x8100, Length:0x0} decode_test.go:568: Layer 1: &layers.Dot1Q{BaseLayer:layers.BaseLayer{Contents:[]uint8{0x1, 0xf7, 0x8, 0x0}, Payload:[]uint8{0x45, 0x0, 0x0, 0x28, 0x29, 0x8d, 0x40, 0x0, 0x7d, 0x6, 0x83, 0xa0, 0xac, 0x1b, 0xca, 0x8e, 0x45, 0x16, 0x94, 0xe2, 0xd4, 0xa, 0x0, 0x50, 0xdf, 0xab, 0x9c, 0xc6, 0xcd, 0x1e, 0xe5, 0xd1, 0x50, 0x10, 0x1, 0x0, 0x5a, 0x74, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}, Priority:0x0, DropEligible:false, VLANIdentifier:0x1f7, Type:0x800} decode_test.go:568: Layer 2: &layers.IPv4{BaseLayer:layers.BaseLayer{Contents:[]uint8{0x45, 0x0, 0x0, 0x28, 0x29, 0x8d, 0x40, 0x0, 0x7d, 0x6, 0x83, 0xa0, 0xac, 0x1b, 0xca, 0x8e, 0x45, 0x16, 0x94, 0xe2}, Payload:[]uint8{0xd4, 0xa, 0x0, 0x50, 0xdf, 0xab, 0x9c, 0xc6, 0xcd, 0x1e, 0xe5, 0xd1, 0x50, 0x10, 0x1, 0x0, 0x5a, 0x74, 0x0, 0x0}}, Version:0x4, IHL:0x5, TOS:0x0, Length:0x28, Id:0x298d, Flags:0x2, FragOffset:0x0, TTL:0x7d, Protocol:0x6, Checksum:0x83a0, SrcIP:net.IP{0xac, 0x1b, 0xca, 0x8e}, DstIP:net.IP{0x45, 0x16, 0x94, 0xe2}, Options:[]layers.IPv4Option(nil), Padding:[]uint8(nil)} decode_test.go:568: Layer 3: &layers.TCP{BaseLayer:layers.BaseLayer{Contents:[]uint8{0xd4, 0xa, 0x0, 0x50, 0xdf, 0xab, 0x9c, 0xc6, 0xcd, 0x1e, 0xe5, 0xd1, 0x50, 0x10, 0x1, 0x0, 0x5a, 0x74, 0x0, 0x0}, Payload:[]uint8{}}, SrcPort:0xd40a, DstPort:0x50, Seq:0xdfab9cc6, Ack:0xcd1ee5d1, DataOffset:0x5, FIN:false, SYN:false, RST:false, PSH:false, ACK:true, URG:false, ECE:false, CWR:false, NS:false, Window:0x100, Checksum:0x5a74, Urgent:0x0, sPort:[]uint8{0xd4, 0xa}, dPort:[]uint8{0x0, 0x50}, Options:[]layers.TCPOption{}, Padding:[]uint8(nil), opts:[4]layers.TCPOption{layers.TCPOption{OptionType:0x0, OptionLength:0x0, OptionData:[]uint8(nil)}, layers.TCPOption{OptionType:0x0, OptionLength:0x0, OptionData:[]uint8(nil)}, layers.TCPOption{OptionType:0x0, OptionLength:0x0, OptionData:[]uint8(nil)}, layers.TCPOption{OptionType:0x0, OptionLength:0x0, OptionData:[]uint8(nil)}}, tcpipchecksum:layers.tcpipchecksum{pseudoheader:layers.tcpipPseudoHeader(nil)}} base_test.go:19: Checking packet layers, want [Ethernet Dot1Q IPv4 TCP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 50 bytes base_test.go:21: Got layer Dot1Q, 4 bytes, payload of 46 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 20 bytes base_test.go:21: Got layer TCP, 20 bytes, payload of 0 bytes base_test.go:24: PACKET: 64 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..50..] SrcMAC=00:15:2c:9d:cc:00 DstMAC=00:10:db:ff:10:00 EthernetType=Dot1Q Length=0} - Layer 2 (04 bytes) = Dot1Q {Contents=[1, 247, 8, 0] Payload=[..46..] Priority=0 DropEligible=false VLANIdentifier=503 Type=IPv4} - Layer 3 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..20..] Version=4 IHL=5 TOS=0 Length=40 Id=10637 Flags=DF FragOffset=0 TTL=125 Protocol=TCP Checksum=33696 SrcIP=172.27.202.142 DstIP=69.22.148.226 Options=[] Padding=[]} - Layer 4 (20 bytes) = TCP {Contents=[..20..] Payload=[] SrcPort=54282 DstPort=80(http) Seq=3752565958 Ack=3441354193 DataOffset=5 FIN=false SYN=false RST=false PSH=false ACK=true URG=false ECE=false CWR=false NS=false Window=256 Checksum=23156 Urgent=0 Options=[] Padding=[]} --- PASS: TestDecodeVLANPacket (0.00s) === RUN TestDecodeSCTPPackets --- PASS: TestDecodeSCTPPackets (0.00s) === RUN TestDecodeCiscoDiscovery base_test.go:19: Checking packet layers, want [Ethernet LLC SNAP CiscoDiscovery CiscoDiscoveryInfo] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 451 bytes base_test.go:21: Got layer LLC, 3 bytes, payload of 448 bytes base_test.go:21: Got layer SNAP, 5 bytes, payload of 443 bytes base_test.go:21: Got layer CiscoDiscovery, 4 bytes, payload of 439 bytes base_test.go:21: Got layer CiscoDiscoveryInfo, 439 bytes, payload of 0 bytes base_test.go:24: PACKET: 465 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..451..] SrcMAC=00:0b:be:18:9a:41 DstMAC=01:00:0c:cc:cc:cc EthernetType=LLC Length=451} - Layer 2 (03 bytes) = LLC {Contents=[170, 170, 3] Payload=[..448..] DSAP=170 IG=false SSAP=170 CR=false Control=3} - Layer 3 (05 bytes) = SNAP {Contents=[..5..] Payload=[..443..] OrganizationalCode=[0, 0, 12] Type=CiscoDiscovery} - Layer 4 (04 bytes) = CiscoDiscovery {Contents=[2, 180, 9, 160] Payload=[..439..] Version=2 TTL=180 Checksum=2464 Values=[..13..]} - Layer 5 (439 bytes) = CiscoDiscoveryInfo {Contents=[..439..] Payload=[] OUI=[0, 0, 12] ProtocolID=274 ClusterMaster=0.0.0.0 Unknown1=255.255.255.255 Version=1 SubVersion=2 Status=32 Unknown2=255 ClusterCommander=00:00:00:00:00:00 SwitchMAC=00:0b:be:18:9a:40 Unknown3=255 ManagementVLAN=0 DeviceID=myswitch Addresses=[192.168.0.253] PortID=FastEthernet0/1 Capabilities={ L3Router=false TBBridge=false SPBridge=false L2Switch=true IsHost=false IGMPFilter=true L1Repeater=false IsPhone=false RemotelyManaged=false} Version=Cisco Internetwork Operating System Software IOS (tm) C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA14, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by cisco Systems, Inc. Compiled Tue 26-Oct-10 10:35 by nburra Platform=cisco WS-C2950-12 IPPrefixes=[] VTPDomain=MYDOMAIN NativeVLAN=1 FullDuplex=true VLANReply={ ID=0 VLAN=0} VLANQuery={ ID=0 VLAN=0} PowerConsumption=0 MTU=0 ExtendedTrust=0 UntrustedCOS=0 SysName= SysOID= MgmtAddresses=[192.168.0.253] Location={ Type=0 Location=} PowerRequest={ ID=0 MgmtID=0 Values=[]} PowerAvailable={ ID=0 MgmtID=0 Values=[]} SparePairPoe={ PSEFourWire=false PDArchShared=false PDRequestOn=false PSEOn=false} EnergyWise={ EncryptedData=[] Unknown1=0 SequenceNumber=0 ModelNumber= Unknown2=0 HardwareID= SerialNum= Unknown3=[] Role= Domain= Name= ReplyUnknown1=[] ReplyPort=[] ReplyAddress=[] ReplyUnknown2=[] ReplyUnknown3=[]} Unknown=[]} --- PASS: TestDecodeCiscoDiscovery (0.00s) === RUN TestDecodeLinkLayerDiscovery base_test.go:19: Checking packet layers, want [Ethernet LinkLayerDiscovery LinkLayerDiscoveryInfo] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 249 bytes base_test.go:21: Got layer LinkLayerDiscovery, 249 bytes, payload of 0 bytes base_test.go:21: Got layer LinkLayerDiscoveryInfo, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 263 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..249..] SrcMAC=00:01:30:f9:ad:a0 DstMAC=01:80:c2:00:00:0e EthernetType=LinkLayerDiscovery Length=0} - Layer 2 (249 bytes) = LinkLayerDiscovery {Contents=[..249..] Payload=[] ChassisID={ Subtype=MAC Address ID=[..6..]} PortID={ Subtype=Interface Name ID=[49, 47, 49]} TTL=120 Values=[..13..]} - Layer 3 (00 bytes) = LinkLayerDiscoveryInfo {Contents=[] Payload=[] PortDescription=Summit300-48-Port 1001 SysName=Summit300-48 SysDescription=Summit300-48 - Version 7.4e.1 (Build 5) by Release_Master 05/27/05 04:53:11 SysCapabilities={ SystemCap={ Other=false Repeater=false Bridge=true WLANAP=false Router=true Phone=false DocSis=false StationOnly=false CVLAN=false SVLAN=false TMPR=false} EnabledCap={ Other=false Repeater=false Bridge=true WLANAP=false Router=true Phone=false DocSis=false StationOnly=false CVLAN=false SVLAN=false TMPR=false}} MgmtAddress={ Subtype=802 media plus Ethernet 'canonical format' Address=[..6..] InterfaceSubtype=IfIndex InterfaceNumber=1001 OID=} OrgTLVs=[..8..] Unknown=[]} base_test.go:19: Checking packet layers, want [Ethernet LinkLayerDiscovery LinkLayerDiscoveryInfo] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 254 bytes base_test.go:21: Got layer LinkLayerDiscovery, 254 bytes, payload of 0 bytes base_test.go:21: Got layer LinkLayerDiscoveryInfo, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 268 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..254..] SrcMAC=00:13:21:57:ca:7f DstMAC=01:80:c2:00:00:0e EthernetType=LinkLayerDiscovery Length=0} - Layer 2 (254 bytes) = LinkLayerDiscovery {Contents=[..254..] Payload=[] ChassisID={ Subtype=MAC Address ID=[..6..]} PortID={ Subtype=Local ID=[49]} TTL=120 Values=[..10..]} - Layer 3 (00 bytes) = LinkLayerDiscoveryInfo {Contents=[] Payload=[] PortDescription=1 SysName=ProCurve Switch 2600-8-PWR SysDescription=ProCurve J8762A Switch 2600-8-PWR, revision H.08.89, ROM H.08.5X (/sw/code/build/fish(ts_08_5)) SysCapabilities={ SystemCap={ Other=false Repeater=false Bridge=true WLANAP=false Router=true Phone=false DocSis=false StationOnly=false CVLAN=false SVLAN=false TMPR=false} EnabledCap={ Other=false Repeater=false Bridge=true WLANAP=false Router=false Phone=false DocSis=false StationOnly=false CVLAN=false SVLAN=false TMPR=false}} MgmtAddress={ Subtype=IPv4 Address=[15, 255, 122, 148] InterfaceSubtype=IfIndex InterfaceNumber=0 OID=} OrgTLVs=[..5..] Unknown=[]} --- PASS: TestDecodeLinkLayerDiscovery (0.00s) === RUN TestDecodeNortelDiscovery base_test.go:19: Checking packet layers, want [Ethernet LLC SNAP NortelDiscovery] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 19 bytes base_test.go:21: Got layer LLC, 3 bytes, payload of 16 bytes base_test.go:21: Got layer SNAP, 5 bytes, payload of 11 bytes base_test.go:21: Got layer NortelDiscovery, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 60 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..19..] SrcMAC=00:04:38:e0:cc:de DstMAC=01:00:81:00:01:00 EthernetType=LLC Length=19} - Layer 2 (03 bytes) = LLC {Contents=[170, 170, 3] Payload=[..16..] DSAP=170 IG=false SSAP=170 CR=false Control=3} - Layer 3 (05 bytes) = SNAP {Contents=[..5..] Payload=[..11..] OrganizationalCode=[0, 0, 129] Type=NortelDiscovery} - Layer 4 (00 bytes) = NortelDiscovery {Contents=[] Payload=[] IPAddress=172.19.88.3 SegmentID=[0, 4, 21] Chassis=BayStack 450 10/100/1000 Switches Backplane=Ethernet, Fast Ethernet and Gigabit Ethernet State=Heartbeat NumLinks=0} --- PASS: TestDecodeNortelDiscovery (0.00s) === RUN TestDecodeIPv6Jumbogram base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop TCP Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 70040 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 70000 bytes base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 69992 bytes base_test.go:21: Got layer TCP, 20 bytes, payload of 69972 bytes base_test.go:21: Got layer Payload, 69972 bytes, payload of 0 bytes base_test.go:24: PACKET: 70054 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..70040..] SrcMAC=24:be:05:27:0b:17 DstMAC=00:1f:ca:b3:76:40 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..70000..] Version=6 TrafficClass=0 FlowLabel=0 Length=0 NextHeader=IPv6HopByHop HopLimit=64 SrcIP=::1 DstIP=::2 HopByHop={ Contents=[..8..] Payload=[..69992..] NextHeader=TCP HeaderLength=0 ActualLength=8 Options=[{OptionType=194 OptionLength=4 ActualLength=6 OptionData=[0, 1, 17, 112] OptionAlignment=[0 0]}]}} - Layer 3 (08 bytes) = IPv6HopByHop {Contents=[..8..] Payload=[..69992..] NextHeader=TCP HeaderLength=0 ActualLength=8 Options=[{OptionType=194 OptionLength=4 ActualLength=6 OptionData=[0, 1, 17, 112] OptionAlignment=[0 0]}]} - Layer 4 (20 bytes) = TCP {Contents=[..20..] Payload=[..69972..] SrcPort=8888(ddi-tcp-1) DstPort=80(http) Seq=0 Ack=0 DataOffset=5 FIN=false SYN=true RST=false PSH=false ACK=false URG=false ECE=false CWR=false NS=false Window=8192 Checksum=27864 Urgent=0 Options=[] Padding=[]} - Layer 5 (69972 bytes) = Payload 69972 byte(s) base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop TCP Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 70039 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 69999 bytes base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 69991 bytes base_test.go:21: Got layer TCP, 20 bytes, payload of 69971 bytes base_test.go:21: Got layer Payload, 69971 bytes, payload of 0 bytes base_test.go:24: PACKET: 70053 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..70039..] SrcMAC=24:be:05:27:0b:17 DstMAC=00:1f:ca:b3:76:40 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..69999..] Version=6 TrafficClass=0 FlowLabel=0 Length=0 NextHeader=IPv6HopByHop HopLimit=64 SrcIP=::1 DstIP=::2 HopByHop={ Contents=[..8..] Payload=[..69991..] NextHeader=TCP HeaderLength=0 ActualLength=8 Options=[{OptionType=194 OptionLength=4 ActualLength=6 OptionData=[0, 1, 17, 112] OptionAlignment=[0 0]}]}} - Layer 3 (08 bytes) = IPv6HopByHop {Contents=[..8..] Payload=[..69991..] NextHeader=TCP HeaderLength=0 ActualLength=8 Options=[{OptionType=194 OptionLength=4 ActualLength=6 OptionData=[0, 1, 17, 112] OptionAlignment=[0 0]}]} - Layer 4 (20 bytes) = TCP {Contents=[..20..] Payload=[..69971..] SrcPort=8888(ddi-tcp-1) DstPort=80(http) Seq=0 Ack=0 DataOffset=5 FIN=false SYN=true RST=false PSH=false ACK=false URG=false ECE=false CWR=false NS=false Window=8192 Checksum=27864 Urgent=0 Options=[] Padding=[]} - Layer 5 (69971 bytes) = Payload 69971 byte(s) --- PASS: TestDecodeIPv6Jumbogram (0.00s) === RUN TestDecodeUDPPacketTooSmall base_test.go:19: Checking packet layers, want [Ethernet Dot1Q IPv4 UDP Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 56 bytes base_test.go:21: Got layer Dot1Q, 4 bytes, payload of 52 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 32 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 24 bytes base_test.go:21: Got layer Payload, 24 bytes, payload of 0 bytes base_test.go:24: PACKET: 70 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..56..] SrcMAC=00:10:db:ff:10:00 DstMAC=00:15:2c:9d:cc:00 EthernetType=Dot1Q Length=0} - Layer 2 (04 bytes) = Dot1Q {Contents=[1, 247, 8, 0] Payload=[..52..] Priority=0 DropEligible=false VLANIdentifier=503 Type=IPv4} - Layer 3 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..32..] Version=4 IHL=5 TOS=96 Length=60 Id=4009 Flags= FragOffset=0 TTL=110 Protocol=UDP Checksum=266 SrcIP=71.230.238.46 DstIP=172.22.89.115 Options=[] Padding=[]} - Layer 4 (08 bytes) = UDP {Contents=[..8..] Payload=[..24..] SrcPort=80(http) DstPort=80(http) Length=40 Checksum=19885} - Layer 5 (24 bytes) = Payload 24 byte(s) --- PASS: TestDecodeUDPPacketTooSmall (0.00s) === RUN TestDecodingLayerParserFullTCPPacket --- PASS: TestDecodingLayerParserFullTCPPacket (0.00s) === RUN TestDecodingLayerMap --- PASS: TestDecodingLayerMap (0.00s) === RUN TestDecodingLayerSparse --- PASS: TestDecodingLayerSparse (0.00s) === RUN TestDecodingLayerArray --- PASS: TestDecodingLayerArray (0.00s) === RUN TestICMP base_test.go:19: Checking packet layers, want [Ethernet IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 56 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 36 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 28 bytes base_test.go:21: Got layer Payload, 28 bytes, payload of 0 bytes base_test.go:24: PACKET: 70 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..56..] SrcMAC=00:1f:ca:b3:75:c0 DstMAC=24:be:05:27:0b:17 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..36..] Version=4 IHL=5 TOS=0 Length=56 Id=0 Flags= FragOffset=0 TTL=252 Protocol=ICMPv4 Checksum=55207 SrcIP=72.14.222.226 DstIP=172.29.20.15 Options=[] Padding=[]} - Layer 3 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..28..] TypeCode=DestinationUnreachable(CommAdminProhibited) Checksum=37998 Id=0 Seq=0} - Layer 4 (28 bytes) = Payload 28 byte(s) --- PASS: TestICMP (0.00s) === RUN TestICMP6 base_test.go:19: Checking packet layers, want [Ethernet IPv6 ICMPv6 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 72 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 32 bytes base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 28 bytes base_test.go:21: Got layer ICMPv6NeighborSolicitation, 28 bytes, payload of 0 bytes base_test.go:24: PACKET: 86 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..72..] SrcMAC=00:1f:ca:b3:75:c0 DstMAC=24:be:05:27:0b:17 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..32..] Version=6 TrafficClass=224 FlowLabel=0 Length=32 NextHeader=ICMPv6 HopLimit=255 SrcIP=fe80::21f:caff:feb3:75c0 DstIP=2620:0:1005:0:26be:5ff:fe27:b17 HopByHop=nil} - Layer 3 (04 bytes) = ICMPv6 {Contents=[135, 0, 30, 186] Payload=[..28..] TypeCode=NeighborSolicitation Checksum=7866 TypeBytes=[]} - Layer 4 (28 bytes) = ICMPv6NeighborSolicitation {Contents=[..28..] Payload=[] TargetAddress=2620:0:1005:0:26be:5ff:fe27:b17 Options=[ICMPv6Option(SourceAddress:00:1f:ca:b3:75:c0)]} --- PASS: TestICMP6 (0.00s) === RUN TestMPLS base_test.go:19: Checking packet layers, want [Ethernet MPLS IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 104 bytes base_test.go:21: Got layer MPLS, 4 bytes, payload of 100 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 80 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 72 bytes base_test.go:21: Got layer Payload, 72 bytes, payload of 0 bytes base_test.go:24: PACKET: 118 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..104..] SrcMAC=00:30:96:05:28:38 DstMAC=00:30:96:e6:fc:39 EthernetType=MPLSUnicast Length=0} - Layer 2 (04 bytes) = MPLS {Contents=[0, 1, 209, 255] Payload=[..100..] Label=29 TrafficClass=0 StackBottom=true TTL=255} - Layer 3 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..80..] Version=4 IHL=5 TOS=0 Length=100 Id=11 Flags= FragOffset=0 TTL=255 Protocol=ICMPv4 Checksum=42345 SrcIP=10.1.2.1 DstIP=10.34.0.1 Options=[] Padding=[]} - Layer 4 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..72..] TypeCode=EchoRequest Checksum=14966 Id=2618 Seq=1579} - Layer 5 (72 bytes) = Payload 72 byte(s) --- PASS: TestMPLS (0.00s) === RUN TestPPPGREIPv4IPv6VLAN base_test.go:19: Checking packet layers, want [Ethernet Dot1Q IPv6 IPv4 GRE PPP IPv4 UDP DNS] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 183 bytes base_test.go:21: Got layer Dot1Q, 4 bytes, payload of 179 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 139 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 119 bytes base_test.go:21: Got layer GRE, 16 bytes, payload of 103 bytes base_test.go:21: Got layer PPP, 2 bytes, payload of 99 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 79 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 71 bytes base_test.go:21: Got layer DNS, 71 bytes, payload of 0 bytes base_test.go:24: PACKET: 197 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..183..] SrcMAC=00:12:1e:f2:61:3d DstMAC=c5:00:00:00:82:c4 EthernetType=Dot1Q Length=0} - Layer 2 (04 bytes) = Dot1Q {Contents=[0, 100, 134, 221] Payload=[..179..] Priority=0 DropEligible=false VLANIdentifier=100 Type=IPv6} - Layer 3 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..139..] Version=6 TrafficClass=0 FlowLabel=0 Length=139 NextHeader=IPv4 HopLimit=246 SrcIP=2402:f000:1:8e01::5555 DstIP=2607:fcd0:100:2300::b108:2a6b HopByHop=nil} - Layer 4 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..119..] Version=4 IHL=5 TOS=0 Length=139 Id=36015 Flags= FragOffset=0 TTL=64 Protocol=GRE Checksum=30206 SrcIP=16.0.0.200 DstIP=192.52.166.154 Options=[] Padding=[]} - Layer 5 (16 bytes) = GRE {Contents=[..16..] Payload=[..103..] ChecksumPresent=false RoutingPresent=false KeyPresent=true SeqPresent=true StrictSourceRoute=false AckPresent=true RecursionControl=0 Flags=16 Version=1 Protocol=PPP Checksum=0 Offset=0 Key=6756224 Seq=430001 Ack=539254nil} - Layer 6 (02 bytes) = PPP {Contents=[0, 33] Payload=[..99..] PPPType=IPv4 HasPPTPHeader=true} - Layer 7 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..79..] Version=4 IHL=5 TOS=0 Length=99 Id=0 Flags=DF FragOffset=0 TTL=60 Protocol=UDP Checksum=22119 SrcIP=172.16.44.3 DstIP=8.8.8.8 Options=[] Padding=[]} - Layer 8 (08 bytes) = UDP {Contents=[..8..] Payload=[..71..] SrcPort=40768 DstPort=53(domain) Length=79 Checksum=64415} - Layer 9 (71 bytes) = DNS {Contents=[..71..] Payload=[] ID=42540 QR=false OpCode=Query AA=false TC=false RD=true RA=false Z=0 ResponseCode=No Error QDCount=1 ANCount=0 NSCount=0 ARCount=0 Questions=[{Name=[..53..] Type=AAAA Class=IN}] Answers=[] Authorities=[] Additionals=[]} --- PASS: TestPPPGREIPv4IPv6VLAN (0.00s) === RUN TestPPPoEICMPv6 base_test.go:19: Checking packet layers, want [Ethernet PPPoE PPP IPv6 ICMPv6 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 72 bytes base_test.go:21: Got layer PPPoE, 6 bytes, payload of 66 bytes base_test.go:21: Got layer PPP, 2 bytes, payload of 64 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes base_test.go:21: Got layer ICMPv6NeighborAdvertisement, 20 bytes, payload of 0 bytes base_test.go:24: PACKET: 86 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..72..] SrcMAC=ca:01:0e:88:00:06 DstMAC=cc:05:0e:88:00:00 EthernetType=PPPoESession Length=0} - Layer 2 (06 bytes) = PPPoE {Contents=[..6..] Payload=[..66..] Version=1 Type=1 Code=PPP SessionId=17 Length=66} - Layer 3 (02 bytes) = PPP {Contents=[0, 87] Payload=[..64..] PPPType=IPv6 HasPPTPHeader=false} - Layer 4 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..24..] Version=6 TrafficClass=224 FlowLabel=0 Length=24 NextHeader=ICMPv6 HopLimit=255 SrcIP=fe80::c801:eff:fe88:8 DstIP=ff02::1 HopByHop=nil} - Layer 5 (04 bytes) = ICMPv6 {Contents=[136, 0, 80, 131] Payload=[..20..] TypeCode=NeighborAdvertisement Checksum=20611 TypeBytes=[]} - Layer 6 (20 bytes) = ICMPv6NeighborAdvertisement {Contents=[..20..] Payload=[] Flags=128 TargetAddress=fe80::c801:eff:fe88:8 Options=[]} --- PASS: TestPPPoEICMPv6 (0.00s) === RUN TestPFLogUDP base_test.go:19: Checking packet layers, want [PFLog IPv4 UDP Payload] base_test.go:21: Got layer PFLog, 64 bytes, payload of 44 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 24 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 16 bytes base_test.go:21: Got layer Payload, 16 bytes, payload of 0 bytes base_test.go:24: PACKET: 108 bytes - Layer 1 (64 bytes) = PFLog {Contents=[..64..] Payload=[..44..] Length=61 Family=IPv4 Action=0 Reason=0 IFName=[..16..] Ruleset=[..16..] RuleNum=0 SubruleNum=174 UID=4294967167 PID=-1601830656 RuleUID=0 RulePID=-1061683200 Direction=2} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..24..] Version=4 IHL=5 TOS=0 Length=44 Id=534 Flags= FragOffset=0 TTL=64 Protocol=UDP Checksum=20144 SrcIP=172.23.232.204 DstIP=172.23.232.255 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..16..] SrcPort=61695 DstPort=8612(canon-bjnp2) Length=24 Checksum=10789} - Layer 4 (16 bytes) = Payload 16 byte(s) --- PASS: TestPFLogUDP (0.00s) === RUN TestRegressionDot1QPriority --- PASS: TestRegressionDot1QPriority (0.00s) === RUN TestPacketMPLSInMPLS base_test.go:19: Checking packet layers, want [Ethernet MPLS MPLS IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 108 bytes base_test.go:21: Got layer MPLS, 4 bytes, payload of 104 bytes base_test.go:21: Got layer MPLS, 4 bytes, payload of 100 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 80 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 72 bytes base_test.go:21: Got layer Payload, 72 bytes, payload of 0 bytes base_test.go:24: PACKET: 122 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..108..] SrcMAC=00:30:96:05:28:38 DstMAC=00:30:96:e6:fc:39 EthernetType=MPLSUnicast Length=0} - Layer 2 (04 bytes) = MPLS {Contents=[0, 1, 32, 255] Payload=[..104..] Label=18 TrafficClass=0 StackBottom=false TTL=255} - Layer 3 (04 bytes) = MPLS {Contents=[0, 1, 1, 255] Payload=[..100..] Label=16 TrafficClass=0 StackBottom=true TTL=255} - Layer 4 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..80..] Version=4 IHL=5 TOS=0 Length=100 Id=80 Flags= FragOffset=0 TTL=255 Protocol=ICMPv4 Checksum=42758 SrcIP=10.31.0.1 DstIP=10.34.0.1 Options=[] Padding=[]} - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..72..] TypeCode=EchoRequest Checksum=48401 Id=3941 Seq=4768} - Layer 6 (72 bytes) = Payload 72 byte(s) --- PASS: TestPacketMPLSInMPLS (0.00s) === RUN TestPacketIPv4Fragmented base_test.go:19: Checking packet layers, want [Ethernet IPv4 Fragment] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 56 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 36 bytes base_test.go:21: Got layer Fragment, 36 bytes, payload of 0 bytes base_test.go:24: PACKET: 70 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..56..] SrcMAC=00:40:33:d9:7c:fd DstMAC=00:00:39:cf:d9:cd EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..36..] Version=4 IHL=5 TOS=0 Length=56 Id=242 Flags=MF FragOffset=0 TTL=64 Protocol=UDP Checksum=44855 SrcIP=10.1.1.1 DstIP=129.111.30.27 Options=[] Padding=[]} - Layer 3 (36 bytes) = Fragment 36 byte(s) --- PASS: TestPacketIPv4Fragmented (0.00s) === RUN TestSCTPChunkBadLength --- PASS: TestSCTPChunkBadLength (0.00s) === RUN TestSTP base_test.go:19: Checking packet layers, want [Ethernet LLC STP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 38 bytes base_test.go:21: Got layer LLC, 3 bytes, payload of 35 bytes base_test.go:21: Got layer STP, 35 bytes, payload of 0 bytes base_test.go:24: PACKET: 60 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..38..] SrcMAC=00:1c:0e:87:85:04 DstMAC=01:80:c2:00:00:00 EthernetType=LLC Length=38} - Layer 2 (03 bytes) = LLC {Contents=[66, 66, 3] Payload=[..35..] DSAP=66 IG=false SSAP=66 CR=false Control=3} - Layer 3 (35 bytes) = STP {Contents=[..35..] Payload=[]} --- PASS: TestSTP (0.00s) === RUN TestDHCPv4EncodeRequest --- PASS: TestDHCPv4EncodeRequest (0.00s) === RUN TestDHCPv4EncodeResponse --- PASS: TestDHCPv4EncodeResponse (0.00s) === RUN TestDHCPv4DecodeOption --- PASS: TestDHCPv4DecodeOption (0.00s) === RUN TestDHCPv6EncodeRequest --- PASS: TestDHCPv6EncodeRequest (0.00s) === RUN TestDHCPv6EncodeReply --- PASS: TestDHCPv6EncodeReply (0.00s) === RUN TestPacketDNSRegression base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 68 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 48 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 40 bytes base_test.go:21: Got layer DNS, 40 bytes, payload of 0 bytes base_test.go:24: PACKET: 82 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..68..] SrcMAC=00:0f:35:bb:0b:40 DstMAC=00:22:19:b6:7e:22 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..48..] Version=4 IHL=5 TOS=0 Length=68 Id=35268 Flags= FragOffset=0 TTL=56 Protocol=UDP Checksum=12093 SrcIP=109.194.160.4 DstIP=95.211.92.14 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..40..] SrcPort=57766 DstPort=53(domain) Length=48 Checksum=42391} - Layer 4 (40 bytes) = DNS {Contents=[..40..] Payload=[] ID=63000 QR=false OpCode=Query AA=false TC=false RD=false RA=false Z=1 ResponseCode=No Error QDCount=1 ANCount=0 NSCount=0 ARCount=1 Questions=[{Name=[..11..] Type=A Class=IN}] Answers=[] Authorities=[] Additionals=[{Name=[] Type=OPT Class=Unknown TTL=32768 DataLength=0 Data=[] IP= NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}]} --- PASS: TestPacketDNSRegression (0.00s) === RUN TestParseDNSTypeTXT base_test.go:19: Checking packet layers, want [Loopback IPv4 UDP DNS] base_test.go:21: Got layer Loopback, 4 bytes, payload of 115 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 95 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 87 bytes base_test.go:21: Got layer DNS, 87 bytes, payload of 0 bytes base_test.go:24: PACKET: 119 bytes - Layer 1 (04 bytes) = Loopback {Contents=[2, 0, 0, 0] Payload=[..115..] Family=IPv4} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..95..] Version=4 IHL=5 TOS=0 Length=115 Id=0 Flags=DF FragOffset=0 TTL=57 Protocol=UDP Checksum=25752 SrcIP=208.67.222.222 DstIP=10.186.35.6 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..87..] SrcPort=53(domain) DstPort=33202 Length=95 Checksum=56501} - Layer 4 (87 bytes) = DNS {Contents=[..87..] Payload=[] ID=39025 QR=true OpCode=Query AA=false TC=false RD=true RA=true Z=0 ResponseCode=No Error QDCount=1 ANCount=1 NSCount=0 ARCount=1 Questions=[{Name=[..10..] Type=TXT Class=IN}] Answers=[{Name=[..10..] Type=TXT Class=IN TTL=3600 DataLength=36 Data=[..36..] IP= NS=[] CNAME=[] PTR=[] TXTs=[[..35..]] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[..36..]}] Authorities=[] Additionals=[{Name=[] Type=OPT Class=Unknown TTL=0 DataLength=0 Data=[] IP= NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}]} --- PASS: TestParseDNSTypeTXT (0.00s) === RUN TestParseDNSBadVers base_test.go:19: Checking packet layers, want [Loopback IPv4 UDP DNS] base_test.go:21: Got layer Loopback, 4 bytes, payload of 56 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 36 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 28 bytes base_test.go:21: Got layer DNS, 28 bytes, payload of 0 bytes base_test.go:24: PACKET: 60 bytes - Layer 1 (04 bytes) = Loopback {Contents=[2, 0, 0, 0] Payload=[..56..] Family=IPv4} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..36..] Version=4 IHL=5 TOS=0 Length=56 Id=42400 Flags=DF FragOffset=0 TTL=56 Protocol=UDP Checksum=189 SrcIP=192.5.5.241 DstIP=172.30.42.67 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..28..] SrcPort=53(domain) DstPort=64888 Length=36 Checksum=16577} - Layer 4 (28 bytes) = DNS {Contents=[..28..] Payload=[] ID=36787 QR=true OpCode=Query AA=false TC=false RD=true RA=false Z=0 ResponseCode=Bad OPT Version QDCount=1 ANCount=0 NSCount=0 ARCount=1 Questions=[{Name=[] Type=TXT Class=IN}] Answers=[] Authorities=[] Additionals=[{Name=[] Type=OPT Class=Unknown TTL=16777216 DataLength=0 Data=[] IP= NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}]} --- PASS: TestParseDNSBadVers (0.00s) === RUN TestParseDNSBadCookie base_test.go:19: Checking packet layers, want [Loopback IPv4 UDP DNS] base_test.go:21: Got layer Loopback, 4 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 56 bytes base_test.go:21: Got layer DNS, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 88 bytes - Layer 1 (04 bytes) = Loopback {Contents=[2, 0, 0, 0] Payload=[..84..] Family=IPv4} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=65194 Flags= FragOffset=0 TTL=64 Protocol=UDP Checksum=0 SrcIP=127.0.0.1 DstIP=127.0.0.1 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..56..] SrcPort=53(domain) DstPort=54954 Length=64 Checksum=65107} - Layer 4 (56 bytes) = DNS {Contents=[..56..] Payload=[] ID=63147 QR=true OpCode=Query AA=false TC=false RD=true RA=true Z=0 ResponseCode=Bad Cookie QDCount=1 ANCount=0 NSCount=0 ARCount=1 Questions=[{Name=[] Type=SOA Class=IN}] Answers=[] Authorities=[] Additionals=[{Name=[] Type=OPT Class=Unknown TTL=16777216 DataLength=28 Data=[..28..] IP= NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[Cookie=36bf111fef2e01097d8ffe065c636ffb142d767494407a73] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}]} --- PASS: TestParseDNSBadCookie (0.00s) === RUN TestParseDNSTypeURI base_test.go:19: Checking packet layers, want [Loopback IPv4 UDP DNS] base_test.go:21: Got layer Loopback, 4 bytes, payload of 111 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 91 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 83 bytes base_test.go:21: Got layer DNS, 83 bytes, payload of 0 bytes base_test.go:24: PACKET: 115 bytes - Layer 1 (04 bytes) = Loopback {Contents=[2, 0, 0, 0] Payload=[..111..] Family=IPv4} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..91..] Version=4 IHL=5 TOS=0 Length=111 Id=15973 Flags= FragOffset=0 TTL=64 Protocol=UDP Checksum=15895 SrcIP=127.0.0.1 DstIP=127.0.0.1 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..83..] SrcPort=53(domain) DstPort=59347 Length=91 Checksum=65134} - Layer 4 (83 bytes) = DNS {Contents=[..83..] Payload=[] ID=44845 QR=true OpCode=Query AA=true TC=false RD=true RA=true Z=0 ResponseCode=No Error QDCount=1 ANCount=1 NSCount=0 ARCount=1 Questions=[{Name=[..14..] Type=URI Class=IN}] Answers=[{Name=[..14..] Type=URI Class=IN TTL=10800 DataLength=28 Data=[..28..] IP= NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=10 Weight=5 Target=[..24..]} TXT=[]}] Authorities=[] Additionals=[{Name=[] Type=OPT Class=Unknown TTL=0 DataLength=0 Data=[] IP= NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}]} --- PASS: TestParseDNSTypeURI (0.00s) === RUN TestParseDNSTypeOPT base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 88 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 68 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 60 bytes base_test.go:21: Got layer DNS, 60 bytes, payload of 0 bytes base_test.go:24: PACKET: 102 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..88..] SrcMAC=00:1c:c0:93:33:fb DstMAC=00:90:0b:12:91:c1 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..68..] Version=4 IHL=5 TOS=0 Length=90 Id=52824 Flags= FragOffset=0 TTL=64 Protocol=UDP Checksum=26594 SrcIP=172.16.1.199 DstIP=75.75.75.75 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..60..] SrcPort=54784 DstPort=53(domain) Length=70 Checksum=17584} - Layer 4 (60 bytes) = DNS {Contents=[..60..] Payload=[] ID=20498 QR=false OpCode=Query AA=false TC=false RD=true RA=false Z=0 ResponseCode=No Error QDCount=1 ANCount=0 NSCount=0 ARCount=1 Questions=[{Name=[..12..] Type=A Class=IN}] Answers=[] Authorities=[] Additionals=[{Name=[] Type=OPT Class=Unknown TTL=32768 DataLength=19 Data=[..19..] IP= NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[DeviceID=4f70656e444e530123456789abcdef] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}]} --- PASS: TestParseDNSTypeOPT (0.00s) === RUN TestDNSEncodeQuery --- PASS: TestDNSEncodeQuery (0.00s) === RUN TestDNSEncodeQueryWithOPT --- PASS: TestDNSEncodeQueryWithOPT (0.00s) === RUN TestDNSEncodeResponse --- PASS: TestDNSEncodeResponse (0.00s) === RUN TestDNSMalformedPacket --- PASS: TestDNSMalformedPacket (0.00s) === RUN TestDNSMalformedPacket2 --- PASS: TestDNSMalformedPacket2 (0.00s) === RUN TestBlankNameRootQuery --- PASS: TestBlankNameRootQuery (0.00s) === RUN TestAnotherMalformedDNS --- PASS: TestAnotherMalformedDNS (0.00s) === RUN TestMalformedDNSAgain --- PASS: TestMalformedDNSAgain (0.00s) === RUN TestMalformedDNSOhGodMakeItStop --- PASS: TestMalformedDNSOhGodMakeItStop (0.00s) === RUN TestMalformedDNSOPT --- PASS: TestMalformedDNSOPT (0.00s) === RUN TestPacketDNSPanic7 --- PASS: TestPacketDNSPanic7 (0.00s) === RUN TestDNSPacketWriteAnswer dns_test.go:1126: DNS {Contents=[..86..] Payload=[] ID=4660 QR=true OpCode=Query AA=false TC=false RD=false RA=false Z=0 ResponseCode=No Error QDCount=0 ANCount=2 NSCount=0 ARCount=0 Questions=[] Answers=[{Name=[..15..] Type=A Class=IN TTL=0 DataLength=4 Data=[127, 0, 0, 1] IP=127.0.0.1 NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..15..] Type=AAAA Class=IN TTL=0 DataLength=16 Data=[..16..] IP=::1 NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}] Authorities=[] Additionals=[]} --- PASS: TestDNSPacketWriteAnswer (0.00s) === RUN TestPacketDot11CtrlCTS base_test.go:19: Checking packet layers, want [RadioTap Dot11] base_test.go:21: Got layer RadioTap, 25 bytes, payload of 14 bytes base_test.go:21: Got layer Dot11, 10 bytes, payload of 0 bytes base_test.go:24: PACKET: 39 bytes - Layer 1 (25 bytes) = RadioTap {Contents=[..25..] Payload=[..14..] Version=0 Length=25 Present=2159 TSFT=20604983 Flags=SHORT-PREAMBLE,FCS Rate=24 Mb/s ChannelFrequency=5240 MHz ChannelFlags=OFDM,Ghz5 FHSS=0 DBMAntennaSignal=-79 DBMAntennaNoise=-92 LockQuality=0 TxAttenuation=0 DBTxAttenuation=0 DBMTxPower=0 Antenna=1 DBAntennaSignal=0 DBAntennaNoise=0 RxFlags= TxFlags= RtsRetries=0 DataRetries=0 MCS= AMPDUStatus=ref#0 VHT=} - Layer 2 (10 bytes) = Dot11 {Contents=[..10..] Payload=[] Type=CtrlCTS Proto=0 Flags= DurationID=148 Address1=d8:a2:5e:97:61:c1 Address2= Address3= Address4= SequenceNumber=0 FragmentNumber=0 Checksum=2392150070 QOS=nil HTControl=nil DataLayer=nil} --- PASS: TestPacketDot11CtrlCTS (0.00s) === RUN TestPacketDot11MgmtBeacon base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11MgmtBeacon Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement] base_test.go:21: Got layer RadioTap, 18 bytes, payload of 221 bytes base_test.go:21: Got layer Dot11, 24 bytes, payload of 193 bytes base_test.go:21: Got layer Dot11MgmtBeacon, 193 bytes, payload of 181 bytes base_test.go:21: Got layer Dot11InformationElement, 5 bytes, payload of 176 bytes base_test.go:21: Got layer Dot11InformationElement, 10 bytes, payload of 166 bytes base_test.go:21: Got layer Dot11InformationElement, 3 bytes, payload of 163 bytes base_test.go:21: Got layer Dot11InformationElement, 6 bytes, payload of 157 bytes base_test.go:21: Got layer Dot11InformationElement, 3 bytes, payload of 154 bytes base_test.go:21: Got layer Dot11InformationElement, 26 bytes, payload of 128 bytes base_test.go:21: Got layer Dot11InformationElement, 32 bytes, payload of 96 bytes base_test.go:21: Got layer Dot11InformationElement, 28 bytes, payload of 68 bytes base_test.go:21: Got layer Dot11InformationElement, 28 bytes, payload of 40 bytes base_test.go:21: Got layer Dot11InformationElement, 24 bytes, payload of 16 bytes base_test.go:21: Got layer Dot11InformationElement, 6 bytes, payload of 10 bytes base_test.go:21: Got layer Dot11InformationElement, 10 bytes, payload of 0 bytes base_test.go:24: PACKET: 239 bytes - Layer 1 (18 bytes) = RadioTap {Contents=[..18..] Payload=[..221..] Version=0 Length=18 Present=18478 TSFT=0 Flags=FCS Rate=6 Mb/s ChannelFrequency=2412 MHz ChannelFlags=OFDM,Ghz2 FHSS=0 DBMAntennaSignal=-81 DBMAntennaNoise=0 LockQuality=0 TxAttenuation=0 DBTxAttenuation=0 DBMTxPower=0 Antenna=5 DBAntennaSignal=0 DBAntennaNoise=0 RxFlags= TxFlags= RtsRetries=0 DataRetries=0 MCS= AMPDUStatus=ref#0 VHT=} - Layer 2 (24 bytes) = Dot11 {Contents=[..24..] Payload=[..193..] Type=MgmtBeacon Proto=0 Flags= DurationID=0 Address1=ff:ff:ff:ff:ff:ff Address2=c0:8a:de:01:11:b8 Address3=c0:8a:de:01:11:b8 Address4= SequenceNumber=2431 FragmentNumber=0 Checksum=361761684 QOS=nil HTControl=nil DataLayer=nil} - Layer 3 (193 bytes) = Dot11MgmtBeacon {Contents=[..193..] Payload=[..181..] Timestamp=84761702784 Interval=100 Flags=1057} - Layer 4 (05 bytes) = Dot11InformationElement 802.11 Information Element (ID: SSID parameter set, Length: 3, SSID: Wi2) - Layer 5 (10 bytes) = Dot11InformationElement 802.11 Information Element (ID: Supported Rates, Length: 8, Rates: 6.0* 9.0 12.0* 18.0 24.0* 36.0 48.0 54.0 Mbit) - Layer 6 (03 bytes) = Dot11InformationElement 802.11 Information Element (ID: DS Parameter set, Length: 1, Info: 01) - Layer 7 (06 bytes) = Dot11InformationElement 802.11 Information Element (ID: Traffic Indication Map (TIM), Length: 4, Info: 00010000) - Layer 8 (03 bytes) = Dot11InformationElement 802.11 Information Element (ID: ERP Information, Length: 1, Info: 00) - Layer 9 (26 bytes) = Dot11InformationElement 802.11 Information Element (ID: Vendor, Length: 24, OUI: 0050F202, Info: 0101810007A4000023A4000042435E0062322F00) - Layer 10 (32 bytes) = Dot11InformationElement 802.11 Information Element (ID: Vendor, Length: 30, OUI: 00904C33, Info: 8C011BFFFF000000000000000000001000000000000000000000) - Layer 11 (28 bytes) = Dot11InformationElement 802.11 Information Element (ID: HT Capabilities (802.11n D1.10), Length: 26, Info: 8C011BFFFF000000000000000000001000000000000000000000) - Layer 12 (28 bytes) = Dot11InformationElement 802.11 Information Element (ID: Vendor, Length: 26, OUI: 00904C34, Info: 01000000000000000000000000000000000000000000) - Layer 13 (24 bytes) = Dot11InformationElement 802.11 Information Element (ID: HT Information (802.11n D1.10), Length: 22, Info: 01000000000000000000000000000000000000000000) - Layer 14 (06 bytes) = Dot11InformationElement 802.11 Information Element (ID: Extended Capabilities, Length: 4, Info: 00000000) - Layer 15 (10 bytes) = Dot11InformationElement 802.11 Information Element (ID: Vendor, Length: 8, OUI: 00139201, Info: 00018500) --- PASS: TestPacketDot11MgmtBeacon (0.00s) === RUN TestPacketDot11DataQOSData base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11DataQOSData Dot11Data LLC SNAP ARP] base_test.go:21: Got layer RadioTap, 32 bytes, payload of 66 bytes base_test.go:21: Got layer Dot11, 26 bytes, payload of 36 bytes base_test.go:21: Got layer Dot11DataQOSData, 0 bytes, payload of 36 bytes base_test.go:21: Got layer Dot11Data, 0 bytes, payload of 36 bytes base_test.go:21: Got layer LLC, 3 bytes, payload of 33 bytes base_test.go:21: Got layer SNAP, 5 bytes, payload of 28 bytes base_test.go:21: Got layer ARP, 28 bytes, payload of 0 bytes base_test.go:24: PACKET: 96 bytes - Layer 1 (32 bytes) = RadioTap {Contents=[..32..] Payload=[..66..] Version=0 Length=32 Present=264295 TSFT=638790765 Flags=SHORT-PREAMBLE,DATAPAD Rate=54 Mb/s ChannelFrequency=0 MHz ChannelFlags= FHSS=0 DBMAntennaSignal=-51 DBMAntennaNoise=-96 LockQuality=0 TxAttenuation=0 DBTxAttenuation=0 DBMTxPower=0 Antenna=2 DBAntennaSignal=0 DBAntennaNoise=0 RxFlags= TxFlags= RtsRetries=0 DataRetries=0 MCS= AMPDUStatus=ref#0 VHT=} - Layer 2 (26 bytes) = Dot11 {Contents=[..26..] Payload=[..36..] Type=DataQOSData Proto=0 Flags=TO-DS DurationID=44 Address1=06:03:7f:07:a0:16 Address2=00:19:e3:d3:53:52 Address3=ff:ff:ff:ff:ff:ff Address4= SequenceNumber=1605 FragmentNumber=0 Checksum=3879274892 QOS={ TID=0 EOSP=false AckPolicy=normal-ack TXOP=0} HTControl=nil DataLayer={ Contents=[] Payload=[..36..]}} - Layer 3 (00 bytes) = Dot11DataQOSData {Contents=[] Payload=[..36..]} - Layer 4 (00 bytes) = Dot11Data {Contents=[] Payload=[..36..]} - Layer 5 (03 bytes) = LLC {Contents=[170, 170, 3] Payload=[..33..] DSAP=170 IG=false SSAP=170 CR=false Control=3} - Layer 6 (05 bytes) = SNAP {Contents=[..5..] Payload=[..28..] OrganizationalCode=[0, 0, 0] Type=ARP} - Layer 7 (28 bytes) = ARP {Contents=[..28..] Payload=[] AddrType=Ethernet Protocol=IPv4 HwAddressSize=6 ProtAddressSize=4 Operation=1 SourceHwAddress=[..6..] SourceProtAddress=[169, 254, 247, 0] DstHwAddress=[..6..] DstProtAddress=[140, 180, 51, 68]} --- PASS: TestPacketDot11DataQOSData (0.00s) === RUN TestPacketDot11MgmtAction base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11MgmtAction] base_test.go:21: Got layer RadioTap, 18 bytes, payload of 35 bytes base_test.go:21: Got layer Dot11, 24 bytes, payload of 7 bytes base_test.go:21: Got layer Dot11MgmtAction, 7 bytes, payload of 0 bytes base_test.go:24: PACKET: 53 bytes - Layer 1 (18 bytes) = RadioTap {Contents=[..18..] Payload=[..35..] Version=0 Length=18 Present=18478 TSFT=0 Flags=FCS Rate=1 Mb/s ChannelFrequency=2412 MHz ChannelFlags=CCK,Ghz2 FHSS=0 DBMAntennaSignal=-67 DBMAntennaNoise=0 LockQuality=0 TxAttenuation=0 DBTxAttenuation=0 DBMTxPower=0 Antenna=5 DBAntennaSignal=0 DBAntennaNoise=0 RxFlags= TxFlags= RtsRetries=0 DataRetries=0 MCS= AMPDUStatus=ref#0 VHT=} - Layer 2 (24 bytes) = Dot11 {Contents=[..24..] Payload=[..7..] Type=MgmtAction Proto=0 Flags= DurationID=0 Address1=ff:ff:ff:ff:ff:ff Address2=8e:3a:e3:44:ac:c6 Address3=8e:3a:e3:44:ac:c6 Address4= SequenceNumber=432 FragmentNumber=0 Checksum=871381333 QOS=nil HTControl=nil DataLayer=nil} - Layer 3 (07 bytes) = Dot11MgmtAction {Contents=[..7..] Payload=[]} --- PASS: TestPacketDot11MgmtAction (0.00s) === RUN TestPacketDot11CtrlAck base_test.go:19: Checking packet layers, want [RadioTap Dot11] base_test.go:21: Got layer RadioTap, 32 bytes, payload of 14 bytes base_test.go:21: Got layer Dot11, 10 bytes, payload of 0 bytes base_test.go:24: PACKET: 46 bytes - Layer 1 (32 bytes) = RadioTap {Contents=[..32..] Payload=[..14..] Version=0 Length=32 Present=264295 TSFT=638758038 Flags=SHORT-PREAMBLE,FCS,DATAPAD Rate=24 Mb/s ChannelFrequency=0 MHz ChannelFlags= FHSS=0 DBMAntennaSignal=-39 DBMAntennaNoise=-96 LockQuality=0 TxAttenuation=0 DBTxAttenuation=0 DBMTxPower=0 Antenna=2 DBAntennaSignal=0 DBAntennaNoise=0 RxFlags= TxFlags= RtsRetries=0 DataRetries=0 MCS= AMPDUStatus=ref#0 VHT=} - Layer 2 (10 bytes) = Dot11 {Contents=[..10..] Payload=[] Type=CtrlAck Proto=0 Flags= DurationID=0 Address1=00:19:e3:d3:53:52 Address2= Address3= Address4= SequenceNumber=0 FragmentNumber=0 Checksum=2272717126 QOS=nil HTControl=nil DataLayer=nil} --- PASS: TestPacketDot11CtrlAck (0.00s) === RUN TestPacketDot11DataARP base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11Data LLC SNAP ARP] base_test.go:21: Got layer RadioTap, 32 bytes, payload of 64 bytes base_test.go:21: Got layer Dot11, 24 bytes, payload of 36 bytes base_test.go:21: Got layer Dot11Data, 0 bytes, payload of 36 bytes base_test.go:21: Got layer LLC, 3 bytes, payload of 33 bytes base_test.go:21: Got layer SNAP, 5 bytes, payload of 28 bytes base_test.go:21: Got layer ARP, 28 bytes, payload of 0 bytes base_test.go:24: PACKET: 92 bytes - Layer 1 (32 bytes) = RadioTap {Contents=[..32..] Payload=[..64..] Version=0 Length=32 Present=264295 TSFT=622463798 Flags=SHORT-PREAMBLE,DATAPAD Rate=6 Mb/s ChannelFrequency=0 MHz ChannelFlags= FHSS=0 DBMAntennaSignal=-39 DBMAntennaNoise=-96 LockQuality=0 TxAttenuation=0 DBTxAttenuation=0 DBMTxPower=0 Antenna=2 DBAntennaSignal=0 DBAntennaNoise=0 RxFlags= TxFlags= RtsRetries=0 DataRetries=0 MCS= AMPDUStatus=ref#0 VHT=} - Layer 2 (24 bytes) = Dot11 {Contents=[..24..] Payload=[..36..] Type=Data Proto=0 Flags=FROM-DS DurationID=0 Address1=ff:ff:ff:ff:ff:ff Address2=06:03:7f:07:a0:16 Address3=00:19:e3:d3:53:52 Address4= SequenceNumber=2046 FragmentNumber=0 Checksum=2997778574 QOS=nil HTControl=nil DataLayer={ Contents=[] Payload=[..36..]}} - Layer 3 (00 bytes) = Dot11Data {Contents=[] Payload=[..36..]} - Layer 4 (03 bytes) = LLC {Contents=[170, 170, 3] Payload=[..33..] DSAP=170 IG=false SSAP=170 CR=false Control=3} - Layer 5 (05 bytes) = SNAP {Contents=[..5..] Payload=[..28..] OrganizationalCode=[0, 0, 0] Type=ARP} - Layer 6 (28 bytes) = ARP {Contents=[..28..] Payload=[] AddrType=Ethernet Protocol=IPv4 HwAddressSize=6 ProtAddressSize=4 Operation=1 SourceHwAddress=[..6..] SourceProtAddress=[169, 254, 247, 0] DstHwAddress=[..6..] DstProtAddress=[67, 8, 14, 54]} --- PASS: TestPacketDot11DataARP (0.00s) === RUN TestPacketDot11DataIP base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11Data LLC SNAP IPv4 UDP DHCPv4] base_test.go:21: Got layer RadioTap, 32 bytes, payload of 364 bytes base_test.go:21: Got layer Dot11, 24 bytes, payload of 336 bytes base_test.go:21: Got layer Dot11Data, 0 bytes, payload of 336 bytes base_test.go:21: Got layer LLC, 3 bytes, payload of 333 bytes base_test.go:21: Got layer SNAP, 5 bytes, payload of 328 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 308 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 300 bytes base_test.go:21: Got layer DHCPv4, 300 bytes, payload of 0 bytes base_test.go:24: PACKET: 392 bytes - Layer 1 (32 bytes) = RadioTap {Contents=[..32..] Payload=[..364..] Version=0 Length=32 Present=264295 TSFT=632340487 Flags=SHORT-PREAMBLE,DATAPAD Rate=6 Mb/s ChannelFrequency=0 MHz ChannelFlags= FHSS=0 DBMAntennaSignal=-40 DBMAntennaNoise=-96 LockQuality=0 TxAttenuation=0 DBTxAttenuation=0 DBMTxPower=0 Antenna=1 DBAntennaSignal=0 DBAntennaNoise=0 RxFlags= TxFlags= RtsRetries=0 DataRetries=0 MCS= AMPDUStatus=ref#0 VHT=} - Layer 2 (24 bytes) = Dot11 {Contents=[..24..] Payload=[..336..] Type=Data Proto=0 Flags=FROM-DS DurationID=0 Address1=ff:ff:ff:ff:ff:ff Address2=06:03:7f:07:a0:16 Address3=00:19:e3:d3:53:52 Address4= SequenceNumber=2388 FragmentNumber=0 Checksum=206812417 QOS=nil HTControl=nil DataLayer={ Contents=[] Payload=[..336..]}} - Layer 3 (00 bytes) = Dot11Data {Contents=[] Payload=[..336..]} - Layer 4 (03 bytes) = LLC {Contents=[170, 170, 3] Payload=[..333..] DSAP=170 IG=false SSAP=170 CR=false Control=3} - Layer 5 (05 bytes) = SNAP {Contents=[..5..] Payload=[..328..] OrganizationalCode=[0, 0, 0] Type=IPv4} - Layer 6 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..308..] Version=4 IHL=5 TOS=0 Length=328 Id=50452 Flags= FragOffset=0 TTL=255 Protocol=UDP Checksum=62864 SrcIP=0.0.0.0 DstIP=255.255.255.255 Options=[] Padding=[]} - Layer 7 (08 bytes) = UDP {Contents=[..8..] Payload=[..300..] SrcPort=68(bootpc) DstPort=67(bootps) Length=308 Checksum=11065} - Layer 8 (300 bytes) = DHCPv4 {Contents=[..300..] Payload=[] Operation=Request HardwareType=Ethernet HardwareLen=6 HardwareOpts=0 Xid=320834627 Secs=60 Flags=0 ClientIP=0.0.0.0 YourClientIP=0.0.0.0 NextServerIP=0.0.0.0 RelayAgentIP=0.0.0.0 ClientHWAddr=00:19:e3:d3:53:52 ServerName=[..64..] File=[..128..] Options=[Option(MessageType:Discover), Option(ParamsRequest:SubnetMask,Router,DNS,DomainName,DomainSearch,Unknown,Unknown,NetBIOSOverTCPNS,NetBIOSOverTCPNodeType,NetBIOSOverTCPScope), Option(MaxDHCPSize:[5 220]), Option(ClientID:[1 0 25 227 211 83 82]), Option(LeaseTime:7776000), Option(Hostname:Macintosh-4)]} --- PASS: TestPacketDot11DataIP (0.00s) === RUN TestPacketP6196 base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11DataQOSData Dot11WEP] base_test.go:21: Got layer RadioTap, 48 bytes, payload of 143 bytes base_test.go:21: Got layer Dot11, 26 bytes, payload of 113 bytes base_test.go:21: Got layer Dot11DataQOSData, 0 bytes, payload of 113 bytes base_test.go:21: Got layer Dot11WEP, 113 bytes, payload of 0 bytes base_test.go:24: PACKET: 191 bytes - Layer 1 (48 bytes) = RadioTap {Contents=[..48..] Payload=[..143..] Version=0 Length=48 Present=1837163 TSFT=20605036 Flags=WEP,FCS Rate=0 Mb/s ChannelFrequency=5240 MHz ChannelFlags=OFDM,Ghz5 FHSS=0 DBMAntennaSignal=-69 DBMAntennaNoise=-92 LockQuality=0 TxAttenuation=0 DBTxAttenuation=0 DBMTxPower=0 Antenna=1 DBAntennaSignal=0 DBAntennaNoise=0 RxFlags= TxFlags= RtsRetries=0 DataRetries=0 MCS=STBC#0,num-of-ESS#0 AMPDUStatus=ref#40140,delimiter CRC error,delimiter-CRC=30 VHT=} - Layer 2 (26 bytes) = Dot11 {Contents=[..26..] Payload=[..113..] Type=DataQOSData Proto=0 Flags=TO-DS,WEP DurationID=44 Address1=00:25:9c:42:c2:62 Address2=d8:a2:5e:97:61:c1 Address3=00:25:9c:42:c2:5f Address4= SequenceNumber=3505 FragmentNumber=0 Checksum=3402204673 QOS={ TID=0 EOSP=false AckPolicy=normal-ack TXOP=0} HTControl=nil DataLayer={ Contents=[] Payload=[..113..]}} - Layer 3 (00 bytes) = Dot11DataQOSData {Contents=[] Payload=[..113..]} - Layer 4 (113 bytes) = Dot11WEP {Contents=[..113..] Payload=[]} --- PASS: TestPacketP6196 (0.00s) === RUN TestPacketDot11HTControl base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11DataQOSData Dot11WEP] base_test.go:21: Got layer RadioTap, 38 bytes, payload of 106 bytes base_test.go:21: Got layer Dot11, 30 bytes, payload of 72 bytes base_test.go:21: Got layer Dot11DataQOSData, 0 bytes, payload of 72 bytes base_test.go:21: Got layer Dot11WEP, 72 bytes, payload of 0 bytes base_test.go:24: PACKET: 140 bytes - Layer 1 (38 bytes) = RadioTap {Contents=[..38..] Payload=[..106..] Version=0 Length=38 Present=2115627 TSFT=33976511 Flags= Rate=0 Mb/s ChannelFrequency=5240 MHz ChannelFlags=OFDM,Ghz5 FHSS=0 DBMAntennaSignal=-72 DBMAntennaNoise=0 LockQuality=0 TxAttenuation=0 DBTxAttenuation=0 DBMTxPower=0 Antenna=0 DBAntennaSignal=0 DBAntennaNoise=0 RxFlags= TxFlags= RtsRetries=0 DataRetries=0 MCS= AMPDUStatus=ref#0 VHT=long GI,40,user0(NSS#3MCS#7,BCC)} - Layer 2 (30 bytes) = Dot11 {Contents=[..30..] Payload=[..72..] Type=DataQOSData Proto=0 Flags=TO-DS,Retry,WEP,Order DurationID=5168 Address1=01:02:03:04:05:06 Address2=11:12:13:14:15:16 Address3=21:22:23:24:25:26 Address4= SequenceNumber=3036 FragmentNumber=0 Checksum=2114147696 QOS={ TID=0 EOSP=false AckPolicy=normal-ack TXOP=20} HTControl={ ACConstraint=false RDGMorePPDU=true VHT=nil HT={ LinkAdapationControl={ TRQ=true MRQ=true MSI=1 MFSI=0 ASEL=nil MFB=20} CalibrationPosition=0 CalibrationSequence=0 CSISteering=0 NDPAnnouncement=false DEI=true}} DataLayer={ Contents=[] Payload=[..72..]}} - Layer 3 (00 bytes) = Dot11DataQOSData {Contents=[] Payload=[..72..]} - Layer 4 (72 bytes) = Dot11WEP {Contents=[..72..] Payload=[]} --- PASS: TestPacketDot11HTControl (0.00s) === RUN TestInformationElement --- PASS: TestInformationElement (0.00s) === RUN TestEncodeDecodeDot1Q --- PASS: TestEncodeDecodeDot1Q (0.00s) === RUN TestPacketEAPOLKey base_test.go:19: Checking packet layers, want [EAPOL EAPOLKey Dot11InformationElement] base_test.go:21: Got layer EAPOL, 4 bytes, payload of 117 bytes base_test.go:21: Got layer EAPOLKey, 95 bytes, payload of 22 bytes base_test.go:21: Got layer Dot11InformationElement, 22 bytes, payload of 0 bytes base_test.go:24: PACKET: 121 bytes - Layer 1 (04 bytes) = EAPOL {Contents=[2, 3, 0, 117] Payload=[..117..] Version=2 Type=EAPOLKey Length=117} - Layer 2 (95 bytes) = EAPOLKey {Contents=[..95..] Payload=[..22..] KeyDescriptorType=802.11 KeyDescriptorVersion=AES-HMAC-SHA1-128 KeyType=Pairwise KeyIndex=0 Install=false KeyACK=true KeyMIC=false Secure=false MICError=false Request=false HasEncryptedKeyData=false SMKMessage=false KeyLength=16 ReplayCounter=0 Nonce=[..32..] IV=[..16..] RSC=0 ID=0 MIC=[..16..] KeyDataLength=22 EncryptedKeyData=[]} - Layer 3 (22 bytes) = Dot11InformationElement 802.11 Information Element (ID: Vendor, Length: 20, OUI: 000FAC04, Info: 592DA88096C461DA246C69001E877F3D) --- PASS: TestPacketEAPOLKey (0.00s) === RUN TestNewIPEndpoint --- PASS: TestNewIPEndpoint (0.00s) === RUN TestDecodeAndEncode --- PASS: TestDecodeAndEncode (0.00s) === RUN TestDecodeGeneve1 base_test.go:19: Checking packet layers, want [Linux SLL IPv4 UDP Geneve Ethernet IPv4 ICMPv4 Payload] base_test.go:21: Got layer Linux SLL, 16 bytes, payload of 134 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 114 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 106 bytes base_test.go:21: Got layer Geneve, 8 bytes, payload of 98 bytes base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 150 bytes - Layer 1 (16 bytes) = Linux SLL {Contents=[..16..] Payload=[..134..] PacketType=outgoing AddrLen=6 Addr=fa:16:3e:23:d3:42 EthernetType=IPv4 AddrType=1} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..114..] Version=4 IHL=5 TOS=0 Length=134 Id=34617 Flags=DF FragOffset=0 TTL=64 Protocol=UDP Checksum=12597 SrcIP=192.168.0.83 DstIP=192.168.0.85 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..106..] SrcPort=12631 DstPort=6081(geneve) Length=114 Checksum=0} - Layer 4 (08 bytes) = Geneve {Contents=[..8..] Payload=[..98..] Version=0 OptionsLength=0 OAMPacket=false CriticalOption=false Protocol=TransparentEthernetBridging VNI=0 Options=[]} - Layer 5 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..84..] SrcMAC=a2:fe:54:48:88:51 DstMAC=ba:09:60:5f:a0:91 EthernetType=IPv4 Length=0} - Layer 6 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=502 Flags=DF FragOffset=0 TTL=64 Protocol=ICMPv4 Checksum=46943 SrcIP=192.168.0.1 DstIP=192.168.0.2 Options=[] Padding=[]} - Layer 7 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=31199 Id=3322 Seq=25540} - Layer 8 (56 bytes) = Payload 56 byte(s) --- PASS: TestDecodeGeneve1 (0.00s) === RUN TestDecodeGeneve2 base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP Geneve Ethernet IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 134 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 114 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 106 bytes base_test.go:21: Got layer Geneve, 8 bytes, payload of 98 bytes base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 148 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..134..] SrcMAC=02:88:0a:81:bd:6d DstMAC=12:be:4e:b6:a7:c7 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..114..] Version=4 IHL=5 TOS=0 Length=134 Id=8434 Flags= FragOffset=0 TTL=64 Protocol=UDP Checksum=338 SrcIP=172.16.0.1 DstIP=172.16.0.2 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..106..] SrcPort=16550 DstPort=6081(geneve) Length=114 Checksum=0} - Layer 4 (08 bytes) = Geneve {Contents=[..8..] Payload=[..98..] Version=0 OptionsLength=0 OAMPacket=false CriticalOption=false Protocol=TransparentEthernetBridging VNI=10 Options=[]} - Layer 5 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..84..] SrcMAC=8e:ab:a2:a5:02:f7 DstMAC=d2:8c:db:12:53:d5 EthernetType=IPv4 Length=0} - Layer 6 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=14362 Flags=DF FragOffset=0 TTL=64 Protocol=ICMPv4 Checksum=33083 SrcIP=192.168.0.1 DstIP=192.168.0.2 Options=[] Padding=[]} - Layer 7 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=56733 Id=32478 Seq=707} - Layer 8 (56 bytes) = Payload 56 byte(s) --- PASS: TestDecodeGeneve2 (0.00s) === RUN TestDecodeGeneve3 base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP Geneve Ethernet IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 142 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 122 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 114 bytes base_test.go:21: Got layer Geneve, 16 bytes, payload of 98 bytes base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 156 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..142..] SrcMAC=00:1b:21:3c:ab:64 DstMAC=00:1b:21:3c:ac:30 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..122..] Version=4 IHL=5 TOS=0 Length=142 Id=57261 Flags=DF FragOffset=0 TTL=64 Protocol=UDP Checksum=12975 SrcIP=20.0.0.1 DstIP=20.0.0.2 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..114..] SrcPort=12618 DstPort=6081(geneve) Length=122 Checksum=0} - Layer 4 (16 bytes) = Geneve {Contents=[..16..] Payload=[..98..] Version=0 OptionsLength=8 OAMPacket=false CriticalOption=true Protocol=TransparentEthernetBridging VNI=10 Options=[{Class=0 Type=128 Flags=0 Length=8 Data=[0, 0, 0, 12]}]} - Layer 5 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..84..] SrcMAC=b6:9e:d2:49:51:48 DstMAC=fe:71:d8:83:72:4f EthernetType=IPv4 Length=0} - Layer 6 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=48546 Flags=DF FragOffset=0 TTL=64 Protocol=ICMPv4 Checksum=16644 SrcIP=30.0.0.1 DstIP=30.0.0.2 Options=[] Padding=[]} - Layer 7 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=11348 Id=10578 Seq=23} - Layer 8 (56 bytes) = Payload 56 byte(s) --- PASS: TestDecodeGeneve3 (0.00s) === RUN TestPacketGRE base_test.go:19: Checking packet layers, want [Ethernet IPv4 GRE IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 108 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 88 bytes base_test.go:21: Got layer GRE, 4 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 122 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..108..] SrcMAC=8e:7a:12:c3:a9:71 DstMAC=3a:56:6b:69:59:5e EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..88..] Version=4 IHL=5 TOS=0 Length=108 Id=33852 Flags=DF FragOffset=0 TTL=64 Protocol=GRE Checksum=13011 SrcIP=192.168.1.1 DstIP=192.168.1.2 Options=[] Padding=[]} - Layer 3 (04 bytes) = GRE {Contents=[0, 0, 8, 0] Payload=[..84..] ChecksumPresent=false RoutingPresent=false KeyPresent=false SeqPresent=false StrictSourceRoute=false AckPresent=false RecursionControl=0 Flags=0 Version=0 Protocol=IPv4 Checksum=0 Offset=0 Key=0 Seq=0 Ack=0nil} - Layer 4 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=1160 Flags=DF FragOffset=0 TTL=64 Protocol=ICMPv4 Checksum=56062 SrcIP=172.16.1.1 DstIP=172.16.2.1 Options=[] Padding=[]} - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=33476 Id=4724 Seq=1} - Layer 6 (56 bytes) = Payload 56 byte(s) --- PASS: TestPacketGRE (0.00s) === RUN TestIPv4OverGREEncode base_test.go:19: Checking packet layers, want [Ethernet IPv4 GRE IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 108 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 88 bytes base_test.go:21: Got layer GRE, 4 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 122 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..108..] SrcMAC=8e:7a:12:c3:a9:71 DstMAC=3a:56:6b:69:59:5e EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..88..] Version=4 IHL=5 TOS=0 Length=108 Id=33852 Flags=DF FragOffset=0 TTL=64 Protocol=GRE Checksum=13011 SrcIP=192.168.1.1 DstIP=192.168.1.2 Options=[] Padding=[]} - Layer 3 (04 bytes) = GRE {Contents=[0, 0, 8, 0] Payload=[..84..] ChecksumPresent=false RoutingPresent=false KeyPresent=false SeqPresent=false StrictSourceRoute=false AckPresent=false RecursionControl=0 Flags=0 Version=0 Protocol=IPv4 Checksum=0 Offset=0 Key=0 Seq=0 Ack=0nil} - Layer 4 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=1160 Flags=DF FragOffset=0 TTL=64 Protocol=ICMPv4 Checksum=56062 SrcIP=172.16.1.1 DstIP=172.16.2.1 Options=[] Padding=[]} - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=33476 Id=4724 Seq=1} - Layer 6 (56 bytes) = Payload 56 byte(s) --- PASS: TestIPv4OverGREEncode (0.00s) === RUN TestPacketEthernetOverGRE base_test.go:19: Checking packet layers, want [Ethernet IPv4 GRE Ethernet IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 122 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 102 bytes base_test.go:21: Got layer GRE, 4 bytes, payload of 98 bytes base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 136 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..122..] SrcMAC=d6:b9:d8:80:56:ef DstMAC=ea:6b:4c:d3:55:13 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..102..] Version=4 IHL=5 TOS=0 Length=122 Id=2765 Flags=DF FragOffset=0 TTL=64 Protocol=GRE Checksum=44084 SrcIP=192.168.1.1 DstIP=192.168.1.2 Options=[] Padding=[]} - Layer 3 (04 bytes) = GRE {Contents=[0, 0, 101, 88] Payload=[..98..] ChecksumPresent=false RoutingPresent=false KeyPresent=false SeqPresent=false StrictSourceRoute=false AckPresent=false RecursionControl=0 Flags=0 Version=0 Protocol=TransparentEthernetBridging Checksum=0 Offset=0 Key=0 Seq=0 Ack=0nil} - Layer 4 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..84..] SrcMAC=6e:32:3e:c7:9d:ef DstMAC=aa:6a:36:e6:c6:30 EthernetType=IPv4 Length=0} - Layer 5 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=55664 Flags=DF FragOffset=0 TTL=64 Protocol=ICMPv4 Checksum=1813 SrcIP=172.16.1.1 DstIP=172.16.1.2 Options=[] Padding=[]} - Layer 6 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=16149 Id=3842 Seq=1} - Layer 7 (56 bytes) = Payload 56 byte(s) --- PASS: TestPacketEthernetOverGRE (0.00s) === RUN TestEthernetOverGREEncode base_test.go:19: Checking packet layers, want [Ethernet IPv4 GRE Ethernet IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 122 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 102 bytes base_test.go:21: Got layer GRE, 4 bytes, payload of 98 bytes base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 136 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..122..] SrcMAC=d6:b9:d8:80:56:ef DstMAC=ea:6b:4c:d3:55:13 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..102..] Version=4 IHL=5 TOS=0 Length=122 Id=2765 Flags=DF FragOffset=0 TTL=64 Protocol=GRE Checksum=44084 SrcIP=192.168.1.1 DstIP=192.168.1.2 Options=[] Padding=[]} - Layer 3 (04 bytes) = GRE {Contents=[0, 0, 101, 88] Payload=[..98..] ChecksumPresent=false RoutingPresent=false KeyPresent=false SeqPresent=false StrictSourceRoute=false AckPresent=false RecursionControl=0 Flags=0 Version=0 Protocol=TransparentEthernetBridging Checksum=0 Offset=0 Key=0 Seq=0 Ack=0nil} - Layer 4 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..84..] SrcMAC=6e:32:3e:c7:9d:ef DstMAC=aa:6a:36:e6:c6:30 EthernetType=IPv4 Length=0} - Layer 5 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=55664 Flags=DF FragOffset=0 TTL=64 Protocol=ICMPv4 Checksum=1813 SrcIP=172.16.1.1 DstIP=172.16.1.2 Options=[] Padding=[]} - Layer 6 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=16149 Id=3842 Seq=1} - Layer 7 (56 bytes) = Payload 56 byte(s) --- PASS: TestEthernetOverGREEncode (0.00s) === RUN TestGREChecksum gre_test.go:357: PACKET: 142 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..128..] SrcMAC=c2:00:57:75:00:00 DstMAC=c2:01:57:75:00:00 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..108..] Version=4 IHL=5 TOS=0 Length=128 Id=10 Flags= FragOffset=0 TTL=255 Protocol=GRE Checksum=42818 SrcIP=10.0.0.1 DstIP=10.0.0.2 Options=[] Padding=[]} - Layer 3 (08 bytes) = GRE {Contents=[..8..] Payload=[..100..] ChecksumPresent=true RoutingPresent=false KeyPresent=false SeqPresent=false StrictSourceRoute=false AckPresent=false RecursionControl=0 Flags=0 Version=0 Protocol=IPv4 Checksum=30719 Offset=0 Key=0 Seq=0 Ack=0nil} - Layer 4 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..80..] Version=4 IHL=5 TOS=0 Length=100 Id=10 Flags= FragOffset=0 TTL=255 Protocol=ICMPv4 Checksum=46473 SrcIP=1.1.1.1 DstIP=2.2.2.2 Options=[] Padding=[]} - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..72..] TypeCode=EchoRequest Checksum=49108 Id=2 Seq=0} - Layer 6 (72 bytes) = Payload 72 byte(s) gre_test.go:357: PACKET: 102 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..88..] SrcMAC=c2:00:57:75:00:00 DstMAC=c2:01:57:75:00:00 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..68..] Version=4 IHL=5 TOS=0 Length=88 Id=10 Flags= FragOffset=0 TTL=255 Protocol=GRE Checksum=42858 SrcIP=10.0.0.1 DstIP=10.0.0.2 Options=[] Padding=[]} - Layer 3 (08 bytes) = GRE {Contents=[..8..] Payload=[..60..] ChecksumPresent=true RoutingPresent=false KeyPresent=false SeqPresent=false StrictSourceRoute=false AckPresent=false RecursionControl=0 Flags=0 Version=0 Protocol=IPv4 Checksum=33909 Offset=0 Key=0 Seq=0 Ack=0nil} - Layer 4 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..40..] Version=4 IHL=5 TOS=0 Length=60 Id=964 Flags=DF FragOffset=0 TTL=1 Protocol=UDP Checksum=27057 SrcIP=2.3.4.5 DstIP=2.3.4.50 Options=[] Padding=[]} - Layer 5 (08 bytes) = UDP {Contents=[..8..] Payload=[..32..] SrcPort=41781 DstPort=33434(traceroute) Length=40 Checksum=55436} - Layer 6 (32 bytes) = Payload 32 byte(s) --- PASS: TestGREChecksum (0.00s) === RUN TestGTPPacket base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP GTPv1U IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 124 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 104 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 96 bytes base_test.go:21: Got layer GTPv1U, 12 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 138 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..124..] SrcMAC=00:0c:29:da:d1:de DstMAC=00:0c:29:e3:c6:4d EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..104..] Version=4 IHL=5 TOS=0 Length=124 Id=0 Flags=DF FragOffset=0 TTL=64 Protocol=UDP Checksum=26555 SrcIP=192.168.40.178 DstIP=192.168.40.179 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..96..] SrcPort=2152(gtp-user) DstPort=2152(gtp-user) Length=104 Checksum=49604} - Layer 4 (12 bytes) = GTPv1U {Contents=[..12..] Payload=[..84..] Version=1 ProtocolType=1 Reserved=0 ExtensionHeaderFlag=false SequenceNumberFlag=true NPDUFlag=false MessageType=255 MessageLength=88 TEID=1 SequenceNumber=9851 NPDU=0 GTPExtensionHeaders=[]} - Layer 5 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=1654 Flags= FragOffset=0 TTL=64 Protocol=ICMPv4 Checksum=38959 SrcIP=192.168.40.178 DstIP=202.11.40.158 Options=[] Padding=[]} - Layer 6 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoReply Checksum=14825 Id=0 Seq=10365} - Layer 7 (56 bytes) = Payload 56 byte(s) --- PASS: TestGTPPacket (0.00s) === RUN TestGTPPacketWithEH base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP GTPv1U IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 128 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 108 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 100 bytes base_test.go:21: Got layer GTPv1U, 16 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 142 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..128..] SrcMAC=00:0c:29:da:d1:de DstMAC=00:0c:29:e3:c6:4d EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..108..] Version=4 IHL=5 TOS=0 Length=128 Id=0 Flags=DF FragOffset=0 TTL=64 Protocol=UDP Checksum=26555 SrcIP=192.168.40.178 DstIP=192.168.40.179 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..100..] SrcPort=2152(gtp-user) DstPort=2152(gtp-user) Length=108 Checksum=49557} - Layer 4 (16 bytes) = GTPv1U {Contents=[..16..] Payload=[..84..] Version=1 ProtocolType=1 Reserved=0 ExtensionHeaderFlag=true SequenceNumberFlag=true NPDUFlag=false MessageType=255 MessageLength=88 TEID=1050199 SequenceNumber=5 NPDU=0 GTPExtensionHeaders=[{Type=192 Content=[9, 4]}]} - Layer 5 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=1701 Flags= FragOffset=0 TTL=64 Protocol=ICMPv4 Checksum=38912 SrcIP=192.168.40.178 DstIP=202.11.40.158 Options=[] Padding=[]} - Layer 6 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoReply Checksum=58294 Id=0 Seq=10412} - Layer 7 (56 bytes) = Payload 56 byte(s) --- PASS: TestGTPPacketWithEH (0.00s) === RUN TestPacketICMPv6NeighborAnnouncementFlags --- PASS: TestPacketICMPv6NeighborAnnouncementFlags (0.00s) === RUN TestPacketICMPv6RouterAnnouncementFlags --- PASS: TestPacketICMPv6RouterAnnouncementFlags (0.00s) === RUN TestPacketICMPv6 base_test.go:19: Checking packet layers, want [Ethernet IPv6 ICMPv6 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 64 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes base_test.go:21: Got layer ICMPv6NeighborAdvertisement, 20 bytes, payload of 0 bytes base_test.go:24: PACKET: 78 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..64..] SrcMAC=24:be:05:27:0b:17 DstMAC=00:1f:ca:b3:76:40 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..24..] Version=6 TrafficClass=0 FlowLabel=0 Length=24 NextHeader=ICMPv6 HopLimit=255 SrcIP=2620:0:1005:0:26be:5ff:fe27:b17 DstIP=fe80::21f:caff:feb3:7640 HopByHop=nil} - Layer 3 (04 bytes) = ICMPv6 {Contents=[136, 0, 30, 214] Payload=[..20..] TypeCode=NeighborAdvertisement Checksum=7894 TypeBytes=[]} - Layer 4 (20 bytes) = ICMPv6NeighborAdvertisement {Contents=[..20..] Payload=[] Flags=64 TargetAddress=2620:0:1005:0:26be:5ff:fe27:b17 Options=[]} --- PASS: TestPacketICMPv6 (0.00s) === RUN TestPacketICMPv6WithHopByHop base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 176 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 128 bytes base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 128 bytes base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 124 bytes base_test.go:21: Got layer MLDv2MulticastListenerReport, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 190 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..176..] SrcMAC=1e:c3:e3:b7:c4:d5 DstMAC=33:33:00:00:00:16 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..128..] Version=6 TrafficClass=0 FlowLabel=0 Length=136 NextHeader=IPv6HopByHop HopLimit=1 SrcIP=:: DstIP=ff02::16 HopByHop={ Contents=[..8..] Payload=[..128..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]}} - Layer 3 (08 bytes) = IPv6HopByHop {Contents=[..8..] Payload=[..128..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]} - Layer 4 (04 bytes) = ICMPv6 {Contents=[143, 0, 158, 237] Payload=[..124..] TypeCode=143(0) Checksum=40685 TypeBytes=[]} - Layer 5 (00 bytes) = MLDv2MulticastListenerReport Number of Mcast Addr Records: 6 (actual 6), Multicast Address Records: [{RecordType:CHANGE_TO_INCLUDE_MODE AuxDataLen:0 N:0 MulticastAddress:ff02::1:ffb7:c4d5 SourceAddresses:[] AuxiliaryData:[]} {RecordType:CHANGE_TO_INCLUDE_MODE AuxDataLen:0 N:0 MulticastAddress:ff02::1:ff00:0 SourceAddresses:[] AuxiliaryData:[]} {RecordType:CHANGE_TO_EXCLUDE_MODE AuxDataLen:0 N:0 MulticastAddress:ff02::1:ff11:79 SourceAddresses:[] AuxiliaryData:[]} {RecordType:CHANGE_TO_EXCLUDE_MODE AuxDataLen:0 N:0 MulticastAddress:ff02::1:ff00:1 SourceAddresses:[] AuxiliaryData:[]} {RecordType:CHANGE_TO_EXCLUDE_MODE AuxDataLen:0 N:0 MulticastAddress:ff05::2 SourceAddresses:[] AuxiliaryData:[]} {RecordType:CHANGE_TO_EXCLUDE_MODE AuxDataLen:0 N:0 MulticastAddress:ff02::2 SourceAddresses:[] AuxiliaryData:[]}] --- PASS: TestPacketICMPv6WithHopByHop (0.00s) === RUN TestPacketICMPv6RouterAdvertisement base_test.go:19: Checking packet layers, want [Ethernet IPv6 ICMPv6 ICMPv6RouterAdvertisement] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 104 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 60 bytes base_test.go:21: Got layer ICMPv6RouterAdvertisement, 60 bytes, payload of 0 bytes base_test.go:24: PACKET: 118 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..104..] SrcMAC=c2:00:54:f5:00:00 DstMAC=33:33:00:00:00:01 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..64..] Version=6 TrafficClass=224 FlowLabel=0 Length=64 NextHeader=ICMPv6 HopLimit=255 SrcIP=fe80::c000:54ff:fef5:0 DstIP=ff02::1 HopByHop=nil} - Layer 3 (04 bytes) = ICMPv6 {Contents=[134, 0, 196, 254] Payload=[..60..] TypeCode=RouterAdvertisement Checksum=50430 TypeBytes=[]} - Layer 4 (60 bytes) = ICMPv6RouterAdvertisement {Contents=[..60..] Payload=[] HopLimit=64 Flags=0 RouterLifetime=1800 ReachableTime=0 RetransTimer=0 Options=[ICMPv6Option(SourceAddress:c2:00:54:f5:00:00), ICMPv6Option(MTU:1500), ICMPv6Option(PrefixInfo:2001:db8:0:1::/64:true:true:720h0m0s:168h0m0s)]} --- PASS: TestPacketICMPv6RouterAdvertisement (0.00s) === RUN TestPacketICMPv6NeighborSolicitation base_test.go:19: Checking packet layers, want [Ethernet IPv6 ICMPv6 ICMPv6NeighborSolicitation] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 64 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes base_test.go:21: Got layer ICMPv6NeighborSolicitation, 20 bytes, payload of 0 bytes base_test.go:24: PACKET: 78 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..64..] SrcMAC=00:0c:29:0e:4c:67 DstMAC=33:33:ff:0e:4c:67 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..24..] Version=6 TrafficClass=0 FlowLabel=0 Length=24 NextHeader=ICMPv6 HopLimit=255 SrcIP=:: DstIP=ff02::1:ff0e:4c67 HopByHop=nil} - Layer 3 (04 bytes) = ICMPv6 {Contents=[135, 0, 185, 48] Payload=[..20..] TypeCode=NeighborSolicitation Checksum=47408 TypeBytes=[]} - Layer 4 (20 bytes) = ICMPv6NeighborSolicitation {Contents=[..20..] Payload=[] TargetAddress=fe80::20c:29ff:fe0e:4c67 Options=[]} --- PASS: TestPacketICMPv6NeighborSolicitation (0.00s) === RUN TestIGMPv1MembershipReportPacket base_test.go:19: Checking packet layers, want [Ethernet IPv4 IGMP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 46 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 8 bytes base_test.go:21: Got layer IGMP, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 60 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..46..] SrcMAC=00:30:c1:bf:57:55 DstMAC=01:00:5e:00:01:3c EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..8..] Version=4 IHL=5 TOS=0 Length=28 Id=27263 Flags= FragOffset=0 TTL=1 Protocol=IGMP Checksum=25445 SrcIP=10.60.0.132 DstIP=224.0.1.60 Options=[] Padding=[]} - Layer 3 (00 bytes) = IGMP {Contents=[] Payload=[] Type=IGMPv1 Membership Report MaxResponseTime=0s Checksum=3267 GroupAddress=224.0.1.60 Version=1} --- PASS: TestIGMPv1MembershipReportPacket (0.00s) === RUN TestIGMPv2MembershipQuery base_test.go:19: Checking packet layers, want [Ethernet IPv4 IGMP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 46 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 8 bytes base_test.go:21: Got layer IGMP, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 60 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..46..] SrcMAC=00:01:63:6f:c8:00 DstMAC=01:00:5e:00:00:01 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..8..] Version=4 IHL=5 TOS=192 Length=28 Id=339 Flags= FragOffset=0 TTL=1 Protocol=IGMP Checksum=52435 SrcIP=10.60.0.189 DstIP=224.0.0.1 Options=[] Padding=[]} - Layer 3 (00 bytes) = IGMP {Contents=[] Payload=[] Type=IGMP Membership Query MaxResponseTime=10s Checksum=61083 GroupAddress=0.0.0.0 Version=2} --- PASS: TestIGMPv2MembershipQuery (0.00s) === RUN TestIGMPv2MembershipReport base_test.go:19: Checking packet layers, want [Ethernet IPv4 IGMP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 46 bytes base_test.go:21: Got layer IPv4, 24 bytes, payload of 8 bytes base_test.go:21: Got layer IGMP, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 60 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..46..] SrcMAC=00:15:58:dc:d9:f6 DstMAC=01:00:5e:7f:ff:fd EthernetType=IPv4 Length=0} - Layer 2 (24 bytes) = IPv4 {Contents=[..24..] Payload=[..8..] Version=4 IHL=6 TOS=0 Length=32 Id=31216 Flags= FragOffset=0 TTL=1 Protocol=IGMP Checksum=43847 SrcIP=10.60.5.103 DstIP=239.255.255.253 Options=[IPv4Option(148:[0 0])] Padding=[]} - Layer 3 (00 bytes) = IGMP {Contents=[] Payload=[] Type=IGMPv2 Membership Report MaxResponseTime=0s Checksum=64001 GroupAddress=239.255.255.253 Version=2} --- PASS: TestIGMPv2MembershipReport (0.00s) === RUN TestIGMPv3MembershipQuery base_test.go:19: Checking packet layers, want [Ethernet IPv4 IGMP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 46 bytes base_test.go:21: Got layer IPv4, 24 bytes, payload of 12 bytes base_test.go:21: Got layer IGMP, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 60 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..46..] SrcMAC=00:26:44:6c:1e:da DstMAC=01:00:5e:00:00:01 EthernetType=IPv4 Length=0} - Layer 2 (24 bytes) = IPv4 {Contents=[..24..] Payload=[..12..] Version=4 IHL=6 TOS=192 Length=36 Id=6129 Flags=DF FragOffset=0 TTL=1 Protocol=IGMP Checksum=10619 SrcIP=192.168.1.254 DstIP=224.0.0.1 Options=[IPv4Option(148:[0 0])] Padding=[]} - Layer 3 (00 bytes) = IGMP {Contents=[] Payload=[] Type=IGMP Membership Query MaxResponseTime=2.4s Checksum=60627 GroupAddress=0.0.0.0 SupressRouterProcessing=false RobustnessValue=2 IntervalTime=2s SourceAddresses=[] NumberOfGroupRecords=0 NumberOfSources=0 GroupRecords=[] Version=3} --- PASS: TestIGMPv3MembershipQuery (0.00s) === RUN TestIGMPv3MembershipReport2Records base_test.go:19: Checking packet layers, want [Ethernet IPv4 IGMP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 48 bytes base_test.go:21: Got layer IPv4, 24 bytes, payload of 24 bytes base_test.go:21: Got layer IGMP, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 62 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..48..] SrcMAC=00:25:2e:51:c3:81 DstMAC=01:00:5e:00:00:16 EthernetType=IPv4 Length=0} - Layer 2 (24 bytes) = IPv4 {Contents=[..24..] Payload=[..24..] Version=4 IHL=6 TOS=88 Length=48 Id=316 Flags= FragOffset=0 TTL=1 Protocol=IGMP Checksum=33075 SrcIP=192.168.1.66 DstIP=224.0.0.22 Options=[IPv4Option(148:[0 0])] Padding=[]} - Layer 3 (00 bytes) = IGMP {Contents=[] Payload=[] Type=IGMPv3 Membership Report MaxResponseTime=0s Checksum=62268 GroupAddress= SupressRouterProcessing=false RobustnessValue=0 IntervalTime=0s SourceAddresses=[] NumberOfGroupRecords=2 NumberOfSources=0 GroupRecords=[{Type=MODE_IS_EXCLUDE AuxDataLen=0 NumberOfSources=0 MulticastAddress=239.195.7.2 SourceAddresses=[] AuxData=0}, {Type=MODE_IS_EXCLUDE AuxDataLen=0 NumberOfSources=0 MulticastAddress=239.255.255.250 SourceAddresses=[] AuxData=0}] Version=3} --- PASS: TestIGMPv3MembershipReport2Records (0.00s) === RUN TestGetIPOptLengthNoOpt --- PASS: TestGetIPOptLengthNoOpt (0.00s) === RUN TestGetIPOptLengthEndOfList --- PASS: TestGetIPOptLengthEndOfList (0.00s) === RUN TestGetIPOptLengthPaddingEndOfList --- PASS: TestGetIPOptLengthPaddingEndOfList (0.00s) === RUN TestGetIPOptLengthOptionEndOfList --- PASS: TestGetIPOptLengthOptionEndOfList (0.00s) === RUN TestIPOptResetDuringDecoding --- PASS: TestIPOptResetDuringDecoding (0.00s) === RUN TestChecksum --- PASS: TestChecksum (0.00s) === RUN TestIPv4InvalidOptionLength --- PASS: TestIPv4InvalidOptionLength (0.00s) === RUN TestIPv4Options --- PASS: TestIPv4Options (0.00s) === RUN TestSerializeIPv6HeaderTLVOptions --- PASS: TestSerializeIPv6HeaderTLVOptions (0.00s) === RUN TestPacketIPv6HopByHop0Serialize --- PASS: TestPacketIPv6HopByHop0Serialize (0.00s) === RUN TestPacketIPv6HopByHop0Decode base_test.go:19: Checking packet layers, want [IPv6 IPv6HopByHop] base_test.go:21: Got layer IPv6, 40 bytes, payload of 0 bytes base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 0 bytes base_test.go:24: PACKET: 48 bytes, truncated - Layer 1 (40 bytes) = IPv6 {Contents=[..40..] Payload=[] Version=6 TrafficClass=0 FlowLabel=0 Length=8 NextHeader=IPv6HopByHop HopLimit=64 SrcIP=2001:db8::1 DstIP=2001:db8::2 HopByHop={ Contents=[..8..] Payload=[] NextHeader=NoNextHeader HeaderLength=0 ActualLength=8 Options=[{OptionType=1 OptionLength=4 ActualLength=6 OptionData=[0, 0, 0, 0] OptionAlignment=[0 0]}]}} - Layer 2 (08 bytes) = IPv6HopByHop {Contents=[..8..] Payload=[] NextHeader=NoNextHeader HeaderLength=0 ActualLength=8 Options=[{OptionType=1 OptionLength=4 ActualLength=6 OptionData=[0, 0, 0, 0] OptionAlignment=[0 0]}]} --- PASS: TestPacketIPv6HopByHop0Decode (0.00s) === RUN TestPacketIPv6Destination0Serialize --- PASS: TestPacketIPv6Destination0Serialize (0.00s) === RUN TestPacketIPv6Destination0Decode base_test.go:19: Checking packet layers, want [IPv6 IPv6Destination] base_test.go:21: Got layer IPv6, 40 bytes, payload of 8 bytes base_test.go:21: Got layer IPv6Destination, 8 bytes, payload of 0 bytes base_test.go:24: PACKET: 48 bytes - Layer 1 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..8..] Version=6 TrafficClass=0 FlowLabel=0 Length=8 NextHeader=IPv6Destination HopLimit=64 SrcIP=2001:db8::1 DstIP=2001:db8::2 HopByHop=nil} - Layer 2 (08 bytes) = IPv6Destination {Contents=[..8..] Payload=[] NextHeader=NoNextHeader HeaderLength=0 ActualLength=8 Options=[{OptionType=1 OptionLength=4 ActualLength=6 OptionData=[0, 0, 0, 0] OptionAlignment=[0 0]}]} --- PASS: TestPacketIPv6Destination0Decode (0.00s) === RUN TestIPv6JumbogramSerialize --- PASS: TestIPv6JumbogramSerialize (0.00s) === RUN TestIPv6JumbogramDecode base_test.go:19: Checking packet layers, want [IPv6 IPv6HopByHop Payload] base_test.go:21: Got layer IPv6, 40 bytes, payload of 65544 bytes base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 65536 bytes base_test.go:21: Got layer Payload, 65536 bytes, payload of 0 bytes base_test.go:24: PACKET: 65584 bytes - Layer 1 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..65544..] Version=6 TrafficClass=0 FlowLabel=0 Length=0 NextHeader=IPv6HopByHop HopLimit=64 SrcIP=2001:db8::1 DstIP=2001:db8::2 HopByHop={ Contents=[..8..] Payload=[..65536..] NextHeader=NoNextHeader HeaderLength=0 ActualLength=8 Options=[{OptionType=194 OptionLength=4 ActualLength=6 OptionData=[0, 1, 0, 8] OptionAlignment=[0 0]}]}} - Layer 2 (08 bytes) = IPv6HopByHop {Contents=[..8..] Payload=[..65536..] NextHeader=NoNextHeader HeaderLength=0 ActualLength=8 Options=[{OptionType=194 OptionLength=4 ActualLength=6 OptionData=[0, 1, 0, 8] OptionAlignment=[0 0]}]} - Layer 3 (65536 bytes) = Payload 65536 byte(s) --- PASS: TestIPv6JumbogramDecode (0.00s) === RUN TestPacketIPSecAHTransport base_test.go:19: Checking packet layers, want [Ethernet IPv4 IPSecAH ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 108 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 88 bytes base_test.go:21: Got layer IPSecAH, 24 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 122 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..108..] SrcMAC=1a:0e:3c:4e:3b:3a DstMAC=7e:c0:ff:c6:48:f1 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..88..] Version=4 IHL=5 TOS=0 Length=108 Id=25866 Flags=DF FragOffset=0 TTL=64 Protocol=IPSecAH Checksum=20993 SrcIP=192.168.1.1 DstIP=192.168.1.2 Options=[] Padding=[]} - Layer 3 (24 bytes) = IPSecAH {Contents=[..24..] Payload=[..64..] NextHeader=ICMPv4 HeaderLength=4 ActualLength=24 Reserved=0 SPI=257 Seq=1 AuthenticationData=[..12..]} - Layer 4 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=64485 Id=1560 Seq=1} - Layer 5 (56 bytes) = Payload 56 byte(s) --- PASS: TestPacketIPSecAHTransport (0.00s) === RUN TestPacketIPSecAHTunnel base_test.go:19: Checking packet layers, want [Ethernet IPv4 IPSecAH IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 128 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 108 bytes base_test.go:21: Got layer IPSecAH, 24 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 142 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..128..] SrcMAC=56:6c:ed:2d:73:cd DstMAC=72:20:4d:91:63:c9 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..108..] Version=4 IHL=5 TOS=0 Length=128 Id=0 Flags=DF FragOffset=0 TTL=64 Protocol=IPSecAH Checksum=46839 SrcIP=192.168.1.1 DstIP=192.168.1.2 Options=[] Padding=[]} - Layer 3 (24 bytes) = IPSecAH {Contents=[..24..] Payload=[..84..] NextHeader=IPv4 HeaderLength=4 ActualLength=24 Reserved=0 SPI=257 Seq=1 AuthenticationData=[..12..]} - Layer 4 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=43375 Flags=DF FragOffset=0 TTL=64 Protocol=ICMPv4 Checksum=13847 SrcIP=172.16.1.1 DstIP=172.16.2.1 Options=[] Padding=[]} - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=55135 Id=31322 Seq=1} - Layer 6 (56 bytes) = Payload 56 byte(s) --- PASS: TestPacketIPSecAHTunnel (0.00s) === RUN TestPacketIPSecESP base_test.go:19: Checking packet layers, want [Ethernet IPv4 IPSecESP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 136 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 116 bytes base_test.go:21: Got layer IPSecESP, 116 bytes, payload of 0 bytes base_test.go:24: PACKET: 150 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..136..] SrcMAC=00:11:43:4a:d7:0a DstMAC=00:00:00:00:00:12 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..116..] Version=4 IHL=5 TOS=0 Length=136 Id=0 Flags=DF FragOffset=0 TTL=64 Protocol=IPSecESP Checksum=48704 SrcIP=190.0.0.1 DstIP=190.0.0.2 Options=[] Padding=[]} - Layer 3 (116 bytes) = IPSecESP {Contents=[..116..] Payload=[] SPI=110 Seq=19 Encrypted=[..108..]} --- PASS: TestPacketIPSecESP (0.00s) === RUN TestLCMDecode --- PASS: TestLCMDecode (0.00s) === RUN TestPacketLLDP base_test.go:19: Checking packet layers, want [Ethernet LinkLayerDiscovery LinkLayerDiscoveryInfo] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 222 bytes base_test.go:21: Got layer LinkLayerDiscovery, 222 bytes, payload of 0 bytes base_test.go:21: Got layer LinkLayerDiscoveryInfo, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 236 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..222..] SrcMAC=00:1b:1b:02:e6:1f DstMAC=01:80:c2:00:00:0e EthernetType=LinkLayerDiscovery Length=0} - Layer 2 (222 bytes) = LinkLayerDiscovery {Contents=[..222..] Payload=[] ChassisID={ Subtype=Local ID=[..7..]} PortID={ Subtype=Local ID=[..8..]} TTL=20 Values=[..8..]} - Layer 3 (00 bytes) = LinkLayerDiscoveryInfo {Contents=[] Payload=[] PortDescription=Siemens, SIMATIC NET, Ethernet Switch Port 01 SysName=Switch1 SysDescription=Siemens, SIMATIC NET, SCALANCE X212-2, 6GK5 212-2BB00-2AA3, HW: 7, FW: V4.02 SysCapabilities={ SystemCap={ Other=false Repeater=false Bridge=false WLANAP=false Router=false Phone=false DocSis=false StationOnly=true CVLAN=false SVLAN=false TMPR=false} EnabledCap={ Other=false Repeater=false Bridge=false WLANAP=false Router=false Phone=false DocSis=false StationOnly=true CVLAN=false SVLAN=false TMPR=false}} MgmtAddress={ Subtype=IPv4 Address=[141, 81, 0, 190] InterfaceSubtype=IfIndex InterfaceNumber=1 OID=+n} OrgTLVs=[{OUI=3791 SubType=2 Info=[0, 0, 0, 0]}, {OUI=3791 SubType=5 Info=[..6..]}, {OUI=4623 SubType=1 Info=[..5..]}] Unknown=[]} --- PASS: TestPacketLLDP (0.00s) === RUN TestPacketMulticastListenerQueryMessageV1 base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6 MLDv1MulticastListenerQuery] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 72 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 24 bytes base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes base_test.go:21: Got layer MLDv1MulticastListenerQuery, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 86 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..72..] SrcMAC=b0:a8:6e:0c:d4:e8 DstMAC=33:33:00:00:00:01 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..24..] Version=6 TrafficClass=0 FlowLabel=0 Length=36 NextHeader=IPv6HopByHop HopLimit=1 SrcIP=fe80::b2a8:6eff:fe0c:d4e8 DstIP=ff02::1 HopByHop={ Contents=[..8..] Payload=[..24..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]}} - Layer 3 (08 bytes) = IPv6HopByHop {Contents=[..8..] Payload=[..24..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]} - Layer 4 (04 bytes) = ICMPv6 {Contents=[130, 0, 98, 58] Payload=[..20..] TypeCode=130(0) Checksum=25146 TypeBytes=[]} - Layer 5 (00 bytes) = MLDv1MulticastListenerQuery Maximum Response Delay: 10000ms, Multicast Address: :: --- PASS: TestPacketMulticastListenerQueryMessageV1 (0.00s) === RUN TestPacketMulticastListenerReportMessageV1 base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6 MLDv1MulticastListenerReport] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 72 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 24 bytes base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes base_test.go:21: Got layer MLDv1MulticastListenerReport, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 86 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..72..] SrcMAC=b0:a8:6e:0c:d4:e8 DstMAC=33:33:00:00:00:01 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..24..] Version=6 TrafficClass=0 FlowLabel=0 Length=36 NextHeader=IPv6HopByHop HopLimit=1 SrcIP=fe80::b2a8:6eff:fe0c:d4e8 DstIP=ff02::1 HopByHop={ Contents=[..8..] Payload=[..24..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]}} - Layer 3 (08 bytes) = IPv6HopByHop {Contents=[..8..] Payload=[..24..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]} - Layer 4 (04 bytes) = ICMPv6 {Contents=[131, 0, 98, 58] Payload=[..20..] TypeCode=131(0) Checksum=25146 TypeBytes=[]} - Layer 5 (00 bytes) = MLDv1MulticastListenerReport Maximum Response Delay: 10000ms, Multicast Address: ff02::db8:1122:3344 --- PASS: TestPacketMulticastListenerReportMessageV1 (0.00s) === RUN TestPacketMulticastListenerDoneMessageV1 base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6 MLDv1MulticastListenerDone] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 72 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 24 bytes base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes base_test.go:21: Got layer MLDv1MulticastListenerDone, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 86 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..72..] SrcMAC=b0:a8:6e:0c:d4:e8 DstMAC=33:33:00:00:00:01 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..24..] Version=6 TrafficClass=0 FlowLabel=0 Length=36 NextHeader=IPv6HopByHop HopLimit=1 SrcIP=fe80::b2a8:6eff:fe0c:d4e8 DstIP=ff02::1 HopByHop={ Contents=[..8..] Payload=[..24..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]}} - Layer 3 (08 bytes) = IPv6HopByHop {Contents=[..8..] Payload=[..24..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]} - Layer 4 (04 bytes) = ICMPv6 {Contents=[132, 0, 98, 58] Payload=[..20..] TypeCode=132(0) Checksum=25146 TypeBytes=[]} - Layer 5 (00 bytes) = MLDv1MulticastListenerDone Maximum Response Delay: 10000ms, Multicast Address: ff02::db8:1122:3344 --- PASS: TestPacketMulticastListenerDoneMessageV1 (0.00s) === RUN TestPacketMulticastListenerQueryMessageV2 base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6 MLDv2MulticastListenerQuery] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 76 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 28 bytes base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 28 bytes base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 24 bytes base_test.go:21: Got layer MLDv2MulticastListenerQuery, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 90 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..76..] SrcMAC=b0:a8:6e:0c:d4:e8 DstMAC=33:33:00:00:00:01 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..28..] Version=6 TrafficClass=0 FlowLabel=0 Length=36 NextHeader=IPv6HopByHop HopLimit=1 SrcIP=fe80::b2a8:6eff:fe0c:d4e8 DstIP=ff02::1 HopByHop={ Contents=[..8..] Payload=[..28..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]}} - Layer 3 (08 bytes) = IPv6HopByHop {Contents=[..8..] Payload=[..28..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]} - Layer 4 (04 bytes) = ICMPv6 {Contents=[130, 0, 98, 58] Payload=[..24..] TypeCode=130(0) Checksum=25146 TypeBytes=[]} - Layer 5 (00 bytes) = MLDv2MulticastListenerQuery Maximum Response Code: 0x2710 (10000ms), Multicast Address: ::, Suppress Routerside Processing: false, QRV: 0x2, QQIC: 0x3c (60s), Number of Source Address: 0 (actual: 0), Source Addresses: [] --- PASS: TestPacketMulticastListenerQueryMessageV2 (0.00s) === RUN TestPacketMulticastListenerReportMessageV2 base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6 MLDv2MulticastListenerReport] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 136 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 88 bytes base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 88 bytes base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 84 bytes base_test.go:21: Got layer MLDv2MulticastListenerReport, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 150 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..136..] SrcMAC=00:15:17:cc:e5:46 DstMAC=33:33:00:00:00:16 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..88..] Version=6 TrafficClass=0 FlowLabel=0 Length=96 NextHeader=IPv6HopByHop HopLimit=1 SrcIP=fe80::215:17ff:fecc:e546 DstIP=ff02::16 HopByHop={ Contents=[..8..] Payload=[..88..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]}} - Layer 3 (08 bytes) = IPv6HopByHop {Contents=[..8..] Payload=[..88..] NextHeader=ICMPv6 HeaderLength=0 ActualLength=8 Options=[{OptionType=5 OptionLength=2 ActualLength=4 OptionData=[0, 0] OptionAlignment=[0 0]}, {OptionType=1 OptionLength=0 ActualLength=2 OptionData=[] OptionAlignment=[0 0]}]} - Layer 4 (04 bytes) = ICMPv6 {Contents=[143, 0, 42, 14] Payload=[..84..] TypeCode=143(0) Checksum=10766 TypeBytes=[]} - Layer 5 (00 bytes) = MLDv2MulticastListenerReport Number of Mcast Addr Records: 4 (actual 4), Multicast Address Records: [{RecordType:MODE_IS_EXCLUDE AuxDataLen:0 N:0 MulticastAddress:ff02::db8:1122:3344 SourceAddresses:[] AuxiliaryData:[]} {RecordType:MODE_IS_EXCLUDE AuxDataLen:0 N:0 MulticastAddress:ff02::1:ffcc:e546 SourceAddresses:[] AuxiliaryData:[]} {RecordType:MODE_IS_EXCLUDE AuxDataLen:0 N:0 MulticastAddress:ff02::1:ffa7:10ad SourceAddresses:[] AuxiliaryData:[]} {RecordType:MODE_IS_EXCLUDE AuxDataLen:0 N:0 MulticastAddress:ff02::1:ff00:2 SourceAddresses:[] AuxiliaryData:[]}] --- PASS: TestPacketMulticastListenerReportMessageV2 (0.00s) === RUN TestPacketMPLS base_test.go:19: Checking packet layers, want [Ethernet MPLS MPLS IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 108 bytes base_test.go:21: Got layer MPLS, 4 bytes, payload of 104 bytes base_test.go:21: Got layer MPLS, 4 bytes, payload of 100 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 80 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 72 bytes base_test.go:21: Got layer Payload, 72 bytes, payload of 0 bytes base_test.go:24: PACKET: 122 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..108..] SrcMAC=cc:15:14:64:00:00 DstMAC=cc:13:14:64:00:01 EthernetType=MPLSUnicast Length=0} - Layer 2 (04 bytes) = MPLS {Contents=[0, 1, 16, 254] Payload=[..104..] Label=17 TrafficClass=0 StackBottom=false TTL=254} - Layer 3 (04 bytes) = MPLS {Contents=[0, 1, 49, 254] Payload=[..100..] Label=19 TrafficClass=0 StackBottom=true TTL=254} - Layer 4 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..80..] Version=4 IHL=5 TOS=0 Length=100 Id=57 Flags= FragOffset=0 TTL=254 Protocol=ICMPv4 Checksum=44123 SrcIP=12.0.0.1 DstIP=2.2.2.2 Options=[] Padding=[]} - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..72..] TypeCode=EchoRequest Checksum=14955 Id=11 Seq=2} - Layer 6 (72 bytes) = Payload 72 byte(s) --- PASS: TestPacketMPLS (0.00s) === RUN TestNTPOne base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP NTP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 76 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 56 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 48 bytes base_test.go:21: Got layer NTP, 48 bytes, payload of 0 bytes base_test.go:24: PACKET: 90 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..76..] SrcMAC=00:d0:59:6c:40:4e DstMAC=00:0c:41:82:b2:53 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..56..] Version=4 IHL=5 TOS=0 Length=76 Id=2626 Flags= FragOffset=0 TTL=128 Protocol=UDP Checksum=46586 SrcIP=192.168.50.50 DstIP=67.129.68.9 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..48..] SrcPort=123(ntp) DstPort=123(ntp) Length=56 Checksum=63698} - Layer 4 (48 bytes) = NTP {Contents=[..48..] Payload=[] LeapIndicator=3 Version=3 Mode=1 Stratum=0 Poll=10 Precision=-6 RootDelay=0 RootDispersion=66192 ReferenceID=0 ReferenceTimestamp=0 OriginTimestamp=0 ReceiveTimestamp=0 TransmitTimestamp=14195914391047827090 ExtensionBytes=[]} --- PASS: TestNTPOne (0.00s) === RUN TestNTPTwo base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP NTP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 76 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 56 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 48 bytes base_test.go:21: Got layer NTP, 48 bytes, payload of 0 bytes base_test.go:24: PACKET: 90 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..76..] SrcMAC=00:0c:41:82:b2:53 DstMAC=00:d0:59:6c:40:4e EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..56..] Version=4 IHL=5 TOS=0 Length=76 Id=12870 Flags=DF FragOffset=0 TTL=47 Protocol=UDP Checksum=43032 SrcIP=69.44.57.60 DstIP=192.168.50.50 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..48..] SrcPort=123(ntp) DstPort=123(ntp) Length=56 Checksum=2392} - Layer 4 (48 bytes) = NTP {Contents=[..48..] Payload=[] LeapIndicator=0 Version=3 Mode=2 Stratum=3 Poll=10 Precision=-18 RootDelay=7159 RootDispersion=5356 ReferenceID=1370390711 ReferenceTimestamp=14195912602744153803 OriginTimestamp=14195914391047827090 ReceiveTimestamp=14195914386266741222 TransmitTimestamp=14195914386266943086 ExtensionBytes=[]} --- PASS: TestNTPTwo (0.00s) === RUN TestNTPThree base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP NTP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 76 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 56 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 48 bytes base_test.go:21: Got layer NTP, 48 bytes, payload of 0 bytes base_test.go:24: PACKET: 90 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..76..] SrcMAC=00:0c:41:82:b2:53 DstMAC=00:d0:59:6c:40:4e EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..56..] Version=4 IHL=5 TOS=0 Length=76 Id=0 Flags=DF FragOffset=0 TTL=48 Protocol=UDP Checksum=29797 SrcIP=24.123.202.230 DstIP=192.168.50.50 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..48..] SrcPort=123(ntp) DstPort=123(ntp) Length=56 Checksum=17413} - Layer 4 (48 bytes) = NTP {Contents=[..48..] Payload=[] LeapIndicator=0 Version=3 Mode=2 Stratum=2 Poll=10 Precision=-20 RootDelay=1987 RootDispersion=12160 ReferenceID=3323878402 ReferenceTimestamp=14195901919906529999 OriginTimestamp=14195914391047827090 ReceiveTimestamp=14195914386315751093 TransmitTimestamp=14195914386315794043 ExtensionBytes=[]} --- PASS: TestNTPThree (0.00s) === RUN TestNTPIsomorphism --- PASS: TestNTPIsomorphism (0.00s) === RUN TestPacketOSPF2Hello base_test.go:19: Checking packet layers, want [Ethernet IPv4 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 64 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 44 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 78 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..64..] SrcMAC=00:e0:18:b1:0c:ad DstMAC=01:00:5e:00:00:05 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..44..] Version=4 IHL=5 TOS=192 Length=64 Id=2066 Flags= FragOffset=0 TTL=1 Protocol=OSPF Checksum=26077 SrcIP=192.168.170.8 DstIP=224.0.0.5 Options=[] Padding=[]} - Layer 3 (00 bytes) = OSPF {Contents=[] Payload=[] Version=2 Type=Hello PacketLength=44 RouterID=3232279048 AreaID=1 Checksum=10043 Content={ InterfaceID=0 RtrPriority=1 Options=2 HelloInterval=10 RouterDeadInterval=40 DesignatedRouterID=3232279048 BackupDesignatedRouterID=0 NeighborID=[] NetworkMask=4294967040} AuType=0 Authentication=0} --- PASS: TestPacketOSPF2Hello (0.00s) === RUN TestPacketOSPF3Hello base_test.go:19: Checking packet layers, want [Ethernet IPv6 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 76 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 36 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 90 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..76..] SrcMAC=c2:00:1f:fa:00:01 DstMAC=33:33:00:00:00:05 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..36..] Version=6 TrafficClass=224 FlowLabel=0 Length=36 NextHeader=OSPF HopLimit=1 SrcIP=fe80::1 DstIP=ff02::5 HopByHop=nil} - Layer 3 (00 bytes) = OSPF {Contents=[] Payload=[] Version=3 Type=Hello PacketLength=36 RouterID=16843009 AreaID=1 Checksum=64390 Content={ InterfaceID=5 RtrPriority=1 Options=19 HelloInterval=10 RouterDeadInterval=40 DesignatedRouterID=0 BackupDesignatedRouterID=0 NeighborID=[]} Instance=0 Reserved=0} --- PASS: TestPacketOSPF3Hello (0.00s) === RUN TestPacketOSPF2DBDesc base_test.go:19: Checking packet layers, want [Ethernet IPv4 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 52 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 32 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 66 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..52..] SrcMAC=00:e0:18:b1:0c:ad DstMAC=00:60:08:81:7a:70 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..32..] Version=4 IHL=5 TOS=192 Length=52 Id=11237 Flags= FragOffset=0 TTL=1 Protocol=OSPF Checksum=46960 SrcIP=192.168.170.8 DstIP=192.168.170.2 Options=[] Padding=[]} - Layer 3 (00 bytes) = OSPF {Contents=[] Payload=[] Version=2 Type=Database Description PacketLength=32 RouterID=3232279048 AreaID=1 Checksum=41042 Content={ Options=2 InterfaceMTU=1500 Flags=7 DDSeqNumber=1098361214 LSAinfo=[]} AuType=0 Authentication=0} --- PASS: TestPacketOSPF2DBDesc (0.00s) === RUN TestPacketOSPF3DBDesc base_test.go:19: Checking packet layers, want [Ethernet IPv6 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 68 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 28 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 82 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..68..] SrcMAC=c2:01:1f:fa:00:01 DstMAC=c2:00:1f:fa:00:01 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..28..] Version=6 TrafficClass=224 FlowLabel=0 Length=28 NextHeader=OSPF HopLimit=1 SrcIP=fe80::2 DstIP=fe80::1 HopByHop=nil} - Layer 3 (00 bytes) = OSPF {Contents=[] Payload=[] Version=3 Type=Database Description PacketLength=28 RouterID=33686018 AreaID=1 Checksum=55334 Content={ Options=19 InterfaceMTU=1500 Flags=7 DDSeqNumber=7494 LSAinfo=[]} Instance=0 Reserved=0} --- PASS: TestPacketOSPF3DBDesc (0.00s) === RUN TestPacketOSPF2LSRequest base_test.go:19: Checking packet layers, want [Ethernet IPv4 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 56 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 36 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 70 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..56..] SrcMAC=00:60:08:81:7a:70 DstMAC=00:e0:18:b1:0c:ad EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..36..] Version=4 IHL=5 TOS=192 Length=56 Id=35014 Flags= FragOffset=0 TTL=1 Protocol=OSPF Checksum=23179 SrcIP=192.168.170.2 DstIP=192.168.170.8 Options=[] Padding=[]} - Layer 3 (00 bytes) = OSPF {Contents=[] Payload=[] Version=2 Type=Link State Request PacketLength=36 RouterID=3232279043 AreaID=1 Checksum=48583 Content=[{LSType=1 LSID=3232279048 AdvRouter=3232279048}] AuType=0 Authentication=0} --- PASS: TestPacketOSPF2LSRequest (0.00s) === RUN TestPacketOSPF3LSRequest base_test.go:19: Checking packet layers, want [Ethernet IPv6 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 140 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 100 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 154 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..140..] SrcMAC=c2:01:1f:fa:00:01 DstMAC=c2:00:1f:fa:00:01 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..100..] Version=6 TrafficClass=224 FlowLabel=0 Length=100 NextHeader=OSPF HopLimit=1 SrcIP=fe80::2 DstIP=fe80::1 HopByHop=nil} - Layer 3 (00 bytes) = OSPF {Contents=[] Payload=[] Version=3 Type=Link State Request PacketLength=100 RouterID=33686018 AreaID=1 Checksum=11418 Content=[..7..] Instance=0 Reserved=0} --- PASS: TestPacketOSPF3LSRequest (0.00s) === RUN TestPacketOSPF2LSUpdate base_test.go:19: Checking packet layers, want [Ethernet IPv4 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 312 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 292 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 326 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..312..] SrcMAC=00:60:08:81:7a:70 DstMAC=01:00:5e:00:00:06 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..292..] Version=4 IHL=5 TOS=192 Length=312 Id=12325 Flags= FragOffset=0 TTL=1 Protocol=OSPF Checksum=15575 SrcIP=192.168.170.2 DstIP=224.0.0.6 Options=[] Padding=[]} - Layer 3 (00 bytes) = OSPF {Contents=[] Payload=[] Version=2 Type=Link State Update PacketLength=292 RouterID=3232279043 AreaID=1 Checksum=13931 Content={ NumOfLSAs=7 LSAs=[..7..]} AuType=0 Authentication=0} --- PASS: TestPacketOSPF2LSUpdate (0.00s) === RUN TestPacketOSPF2LSUpdateLSA2 base_test.go:19: Checking packet layers, want [Ethernet Dot1Q IPv4 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 128 bytes base_test.go:21: Got layer Dot1Q, 4 bytes, payload of 124 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 104 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 142 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..128..] SrcMAC=d4:e8:80:c2:b1:c9 DstMAC=01:00:5e:00:00:05 EthernetType=Dot1Q Length=0} - Layer 2 (04 bytes) = Dot1Q {Contents=[1, 127, 8, 0] Payload=[..124..] Priority=0 DropEligible=false VLANIdentifier=383 Type=IPv4} - Layer 3 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..104..] Version=4 IHL=5 TOS=192 Length=140 Id=63460 Flags= FragOffset=0 TTL=1 Protocol=OSPF Checksum=6401 SrcIP=172.24.27.86 DstIP=224.0.0.5 Options=[] Padding=[]} - Layer 4 (00 bytes) = OSPF {Contents=[] Payload=[] Version=2 Type=Link State Update PacketLength=88 RouterID=2887255110 AreaID=12 Checksum=0 Content={ NumOfLSAs=2 LSAs=[{LSAge=1 LSType=1 LinkStateID=2887255110 AdvRouter=2887255110 LSSeqNumber=2147484698 LSChecksum=24613 Length=36 LSOptions=40 Content={ Flags=0 Links=1 Routers=[{Type=2 LinkID=2887261014 LinkData=2887261014 Metric=1}]}}, {LSAge=1 LSType=2 LinkStateID=2887261014 AdvRouter=2887255110 LSSeqNumber=2147484703 LSChecksum=14606 Length=40 LSOptions=40 Content={ NetworkMask=4294967288 AttachedRouter=[2887255110, 2887255109, 2887261011, 2887261012]}}]} AuType=0 Authentication=0} --- PASS: TestPacketOSPF2LSUpdateLSA2 (0.00s) === RUN TestPacketOSPF2LSUpdateLSA7 base_test.go:19: Checking packet layers, want [Ethernet Dot1Q IPv4 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 124 bytes base_test.go:21: Got layer Dot1Q, 4 bytes, payload of 120 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 100 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 138 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..124..] SrcMAC=00:1a:1e:02:81:a8 DstMAC=01:00:5e:00:00:06 EthernetType=Dot1Q Length=0} - Layer 2 (04 bytes) = Dot1Q {Contents=[1, 127, 8, 0] Payload=[..120..] Priority=0 DropEligible=false VLANIdentifier=383 Type=IPv4} - Layer 3 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..100..] Version=4 IHL=5 TOS=192 Length=136 Id=0 Flags=DF FragOffset=0 TTL=1 Protocol=OSPF Checksum=53482 SrcIP=172.24.27.84 DstIP=224.0.0.6 Options=[] Padding=[]} - Layer 4 (00 bytes) = OSPF {Contents=[] Payload=[] Version=2 Type=Link State Update PacketLength=84 RouterID=2887261012 AreaID=12 Checksum=0 Content={ NumOfLSAs=2 LSAs=[{LSAge=1 LSType=7 LinkStateID=180899680 AdvRouter=2887261012 LSSeqNumber=2147484582 LSChecksum=19720 Length=36 LSOptions=8 Content={ NetworkMask=4294967264 ExternalBit=128 Metric=256 ForwardingAddress=2887261012 ExternalRouteTag=0}}, {LSAge=1 LSType=7 LinkStateID=176198400 AdvRouter=2887261012 LSSeqNumber=2147484582 LSChecksum=17366 Length=36 LSOptions=8 Content={ NetworkMask=4294967168 ExternalBit=128 Metric=256 ForwardingAddress=2887261012 ExternalRouteTag=0}}]} AuType=0 Authentication=0} --- PASS: TestPacketOSPF2LSUpdateLSA7 (0.00s) === RUN TestPacketOSPF3LSUpdate base_test.go:19: Checking packet layers, want [Ethernet IPv6 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 328 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 288 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 342 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..328..] SrcMAC=c2:00:1f:fa:00:01 DstMAC=c2:01:1f:fa:00:01 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..288..] Version=6 TrafficClass=224 FlowLabel=0 Length=288 NextHeader=OSPF HopLimit=1 SrcIP=fe80::1 DstIP=fe80::2 HopByHop=nil} - Layer 3 (00 bytes) = OSPF {Contents=[] Payload=[] Version=3 Type=Link State Update PacketLength=288 RouterID=16843009 AreaID=1 Checksum=58710 Content={ NumOfLSAs=7 LSAs=[..7..]} Instance=0 Reserved=0} --- PASS: TestPacketOSPF3LSUpdate (0.00s) === RUN TestPacketOSPF2LSAck base_test.go:19: Checking packet layers, want [Ethernet IPv4 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 64 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 44 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 78 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..64..] SrcMAC=00:e0:18:b1:0c:ad DstMAC=00:60:08:81:7a:70 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..44..] Version=4 IHL=5 TOS=192 Length=64 Id=11242 Flags= FragOffset=0 TTL=1 Protocol=OSPF Checksum=46943 SrcIP=192.168.170.8 DstIP=192.168.170.2 Options=[] Padding=[]} - Layer 3 (00 bytes) = OSPF {Contents=[] Payload=[] Version=2 Type=Link State Acknowledgment PacketLength=44 RouterID=3232279048 AreaID=1 Checksum=58100 Content=[{LSAge=3600 LSType=1 LinkStateID=3232279042 AdvRouter=3232279042 LSSeqNumber=2147483649 LSChecksum=19086 Length=48 LSOptions=2}] AuType=0 Authentication=0} --- PASS: TestPacketOSPF2LSAck (0.00s) === RUN TestPacketOSPF3LSAck base_test.go:19: Checking packet layers, want [Ethernet IPv6 OSPF] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 176 bytes base_test.go:21: Got layer IPv6, 40 bytes, payload of 136 bytes base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 190 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..176..] SrcMAC=c2:00:1f:fa:00:01 DstMAC=33:33:00:00:00:05 EthernetType=IPv6 Length=0} - Layer 2 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..136..] Version=6 TrafficClass=224 FlowLabel=0 Length=136 NextHeader=OSPF HopLimit=1 SrcIP=fe80::1 DstIP=ff02::5 HopByHop=nil} - Layer 3 (00 bytes) = OSPF {Contents=[] Payload=[] Version=3 Type=Link State Acknowledgment PacketLength=136 RouterID=16843009 AreaID=1 Checksum=40236 Content=[..6..] Instance=0 Reserved=0} --- PASS: TestPacketOSPF3LSAck (0.00s) === RUN TestPacketOSPFInvalidLSA base_test.go:19: Checking packet layers, want [Ethernet IPv4 DecodeFailure] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 83 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 63 bytes base_test.go:21: Got layer DecodeFailure, 63 bytes, payload of 0 bytes base_test.go:24: PACKET: 97 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..83..] SrcMAC=bd:e4:19:72:1d:1f DstMAC=5c:fa:00:00:fa:6c EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..63..] Version=4 IHL=5 TOS=0 Length=173 Id=0 Flags=DF FragOffset=0 TTL=64 Protocol=OSPF Checksum=28399 SrcIP=107.150.97.17 DstIP=180.150.192.168 Options=[] Padding=[]} - Layer 3 (63 bytes) = DecodeFailure Packet decoding error: Cannot parse Link State Update packet: Could not extract Link State type. --- PASS: TestPacketOSPFInvalidLSA (0.00s) === RUN TestPacketPrism base_test.go:19: Checking packet layers, want [Prism monitor mode header Dot11 Dot11MgmtProbeReq] base_test.go:21: Got layer Prism monitor mode header, 144 bytes, payload of 126 bytes base_test.go:21: Got layer Dot11, 24 bytes, payload of 98 bytes base_test.go:21: Got layer Dot11MgmtProbeReq, 98 bytes, payload of 0 bytes base_test.go:24: PACKET: 270 bytes - Layer 1 (144 bytes) = Prism monitor mode header {Contents=[..144..] Payload=[..126..] Code=68 Length=144 DeviceName=ra0 Values=[..10..]} - Layer 2 (24 bytes) = Dot11 {Contents=[..24..] Payload=[..98..] Type=MgmtProbeReq Proto=0 Flags= DurationID=0 Address1=ff:ff:ff:ff:ff:ff Address2=cc:fa:00:ad:79:e8 Address3=ff:ff:ff:ff:ff:ff Address4= SequenceNumber=1050 FragmentNumber=0 Checksum=0 QOS=nil HTControl=nil DataLayer=nil} - Layer 3 (98 bytes) = Dot11MgmtProbeReq {Contents=[..98..] Payload=[]} --- PASS: TestPacketPrism (0.00s) === RUN TestPacketRadiotap0 base_test.go:19: Checking packet layers, want [RadioTap Dot11] base_test.go:21: Got layer RadioTap, 18 bytes, payload of 14 bytes base_test.go:21: Got layer Dot11, 10 bytes, payload of 0 bytes base_test.go:24: PACKET: 32 bytes - Layer 1 (18 bytes) = RadioTap {Contents=[..18..] Payload=[..14..] Version=0 Length=18 Present=18478 TSFT=0 Flags=FCS Rate=1 Mb/s ChannelFrequency=2412 MHz ChannelFlags=CCK,Ghz2 FHSS=0 DBMAntennaSignal=-58 DBMAntennaNoise=0 LockQuality=0 TxAttenuation=0 DBTxAttenuation=0 DBMTxPower=0 Antenna=7 DBAntennaSignal=0 DBAntennaNoise=0 RxFlags= TxFlags= RtsRetries=0 DataRetries=0 MCS= AMPDUStatus=ref#0 VHT=} - Layer 2 (10 bytes) = Dot11 {Contents=[..10..] Payload=[] Type=CtrlAck Proto=0 Flags= DurationID=0 Address1=88:1f:a1:ae:9d:cb Address2= Address3= Address4= SequenceNumber=0 FragmentNumber=0 Checksum=1263218886 QOS=nil HTControl=nil DataLayer=nil} --- PASS: TestPacketRadiotap0 (0.00s) === RUN TestPacketRadiotap1 base_test.go:19: Checking packet layers, want [RadioTap Dot11] base_test.go:21: Got layer RadioTap, 21 bytes, payload of 28 bytes base_test.go:21: Got layer Dot11, 24 bytes, payload of 0 bytes base_test.go:21: Got layer Dot11DataNull, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 49 bytes - Layer 1 (21 bytes) = RadioTap {Contents=[..21..] Payload=[..28..] Version=0 Length=21 Present=542762 TSFT=0 Flags=FCS Rate=0 Mb/s ChannelFrequency=2412 MHz ChannelFlags=Ghz2,Dynamic FHSS=0 DBMAntennaSignal=-36 DBMAntennaNoise=0 LockQuality=0 TxAttenuation=0 DBTxAttenuation=0 DBMTxPower=0 Antenna=5 DBAntennaSignal=0 DBAntennaNoise=0 RxFlags= TxFlags= RtsRetries=0 DataRetries=0 MCS=20,MCSIndex#7,longGI AMPDUStatus=ref#0 VHT=} - Layer 2 (24 bytes) = Dot11 {Contents=[..24..] Payload=[] Type=DataNull Proto=0 Flags=TO-DS,PowerManagement DurationID=44 Address1=00:3a:9d:aa:f0:19 Address2=1c:ab:a7:f2:13:9d Address3=00:3a:9d:aa:f0:19 Address4= SequenceNumber=2855 FragmentNumber=0 Checksum=384936430 QOS=nil HTControl=nil DataLayer={ Contents=[] Payload=[]}} - Layer 3 (00 bytes) = Dot11DataNull {Contents=[] Payload=[]} --- PASS: TestPacketRadiotap1 (0.00s) === RUN TestRADIUSCode === RUN TestRADIUSCode/Unknown(0) === RUN TestRADIUSCode/Access-Request === RUN TestRADIUSCode/Access-Accept === RUN TestRADIUSCode/Access-Reject === RUN TestRADIUSCode/Accounting-Request === RUN TestRADIUSCode/Accounting-Response === RUN TestRADIUSCode/Access-Challenge === RUN TestRADIUSCode/Status-Server === RUN TestRADIUSCode/Status-Client === RUN TestRADIUSCode/Reserved --- PASS: TestRADIUSCode (0.00s) --- PASS: TestRADIUSCode/Unknown(0) (0.00s) --- PASS: TestRADIUSCode/Access-Request (0.00s) --- PASS: TestRADIUSCode/Access-Accept (0.00s) --- PASS: TestRADIUSCode/Access-Reject (0.00s) --- PASS: TestRADIUSCode/Accounting-Request (0.00s) --- PASS: TestRADIUSCode/Accounting-Response (0.00s) --- PASS: TestRADIUSCode/Access-Challenge (0.00s) --- PASS: TestRADIUSCode/Status-Server (0.00s) --- PASS: TestRADIUSCode/Status-Client (0.00s) --- PASS: TestRADIUSCode/Reserved (0.00s) === RUN TestRADIUSAttributeType === RUN TestRADIUSAttributeType/Unknown(0) === RUN TestRADIUSAttributeType/User-Name === RUN TestRADIUSAttributeType/User-Password === RUN TestRADIUSAttributeType/CHAP-Password === RUN TestRADIUSAttributeType/NAS-IP-Address === RUN TestRADIUSAttributeType/NAS-Port === RUN TestRADIUSAttributeType/Service-Type === RUN TestRADIUSAttributeType/Framed-Protocol === RUN TestRADIUSAttributeType/Framed-IP-Address === RUN TestRADIUSAttributeType/Framed-IP-Netmask === RUN TestRADIUSAttributeType/Framed-Routing === RUN TestRADIUSAttributeType/Filter-Id === RUN TestRADIUSAttributeType/Framed-MTU === RUN TestRADIUSAttributeType/Framed-Compression === RUN TestRADIUSAttributeType/Login-IP-Host === RUN TestRADIUSAttributeType/Login-Service === RUN TestRADIUSAttributeType/Login-TCP-Port === RUN TestRADIUSAttributeType/Reply-Message === RUN TestRADIUSAttributeType/Callback-Number === RUN TestRADIUSAttributeType/Callback-Id === RUN TestRADIUSAttributeType/Framed-Route === RUN TestRADIUSAttributeType/Framed-IPX-Network === RUN TestRADIUSAttributeType/State === RUN TestRADIUSAttributeType/Class === RUN TestRADIUSAttributeType/Vendor-Specific === RUN TestRADIUSAttributeType/Session-Timeout === RUN TestRADIUSAttributeType/Idle-Timeout === RUN TestRADIUSAttributeType/Termination-Action === RUN TestRADIUSAttributeType/Called-Station-Id === RUN TestRADIUSAttributeType/Calling-Station-Id === RUN TestRADIUSAttributeType/NAS-Identifier === RUN TestRADIUSAttributeType/Proxy-State === RUN TestRADIUSAttributeType/Login-LAT-Service === RUN TestRADIUSAttributeType/Login-LAT-Node === RUN TestRADIUSAttributeType/Login-LAT-Group === RUN TestRADIUSAttributeType/Framed-AppleTalk-Link === RUN TestRADIUSAttributeType/Framed-AppleTalk-Network === RUN TestRADIUSAttributeType/Framed-AppleTalk-Zone === RUN TestRADIUSAttributeType/Acct-Status-Type === RUN TestRADIUSAttributeType/Acct-Delay-Time === RUN TestRADIUSAttributeType/Acct-Input-Octets === RUN TestRADIUSAttributeType/Acct-Output-Octets === RUN TestRADIUSAttributeType/Acct-Session-Id === RUN TestRADIUSAttributeType/Acct-Authentic === RUN TestRADIUSAttributeType/Acct-Session-Time === RUN TestRADIUSAttributeType/Acct-Input-Packets === RUN TestRADIUSAttributeType/Acct-Output-Packets === RUN TestRADIUSAttributeType/Acct-Terminate-Cause === RUN TestRADIUSAttributeType/Acct-Multi-Session-Id === RUN TestRADIUSAttributeType/Acct-Link-Count === RUN TestRADIUSAttributeType/Acct-Input-Gigawords === RUN TestRADIUSAttributeType/Acct-Output-Gigawords === RUN TestRADIUSAttributeType/Event-Timestamp === RUN TestRADIUSAttributeType/CHAP-Challenge === RUN TestRADIUSAttributeType/NAS-Port-Type === RUN TestRADIUSAttributeType/Port-Limit === RUN TestRADIUSAttributeType/Login-LAT-Port === RUN TestRADIUSAttributeType/Tunnel-Type === RUN TestRADIUSAttributeType/Tunnel-Medium-Type === RUN TestRADIUSAttributeType/Tunnel-Client-Endpoint === RUN TestRADIUSAttributeType/Tunnel-Server-Endpoint === RUN TestRADIUSAttributeType/Acct-Tunnel-Connection === RUN TestRADIUSAttributeType/Tunnel-Password === RUN TestRADIUSAttributeType/ARAP-Password === RUN TestRADIUSAttributeType/ARAP-Features === RUN TestRADIUSAttributeType/ARAP-Zone-Access === RUN TestRADIUSAttributeType/ARAP-Security === RUN TestRADIUSAttributeType/ARAP-Security-Data === RUN TestRADIUSAttributeType/Password-Retry === RUN TestRADIUSAttributeType/Prompt === RUN TestRADIUSAttributeType/Connect-Info === RUN TestRADIUSAttributeType/Configuration-Token === RUN TestRADIUSAttributeType/EAP-Message === RUN TestRADIUSAttributeType/Message-Authenticator === RUN TestRADIUSAttributeType/Tunnel-Private-Group-ID === RUN TestRADIUSAttributeType/Tunnel-Assignment-ID === RUN TestRADIUSAttributeType/Tunnel-Preference === RUN TestRADIUSAttributeType/ARAP-Challenge-Response === RUN TestRADIUSAttributeType/Acct-Interim-Interval === RUN TestRADIUSAttributeType/Acct-Tunnel-Packets-Lost === RUN TestRADIUSAttributeType/NAS-Port-Id === RUN TestRADIUSAttributeType/Framed-Pool === RUN TestRADIUSAttributeType/Tunnel-Client-Auth-ID === RUN TestRADIUSAttributeType/Tunnel-Server-Auth-ID --- PASS: TestRADIUSAttributeType (0.00s) --- PASS: TestRADIUSAttributeType/Unknown(0) (0.00s) --- PASS: TestRADIUSAttributeType/User-Name (0.00s) --- PASS: TestRADIUSAttributeType/User-Password (0.00s) --- PASS: TestRADIUSAttributeType/CHAP-Password (0.00s) --- PASS: TestRADIUSAttributeType/NAS-IP-Address (0.00s) --- PASS: TestRADIUSAttributeType/NAS-Port (0.00s) --- PASS: TestRADIUSAttributeType/Service-Type (0.00s) --- PASS: TestRADIUSAttributeType/Framed-Protocol (0.00s) --- PASS: TestRADIUSAttributeType/Framed-IP-Address (0.00s) --- PASS: TestRADIUSAttributeType/Framed-IP-Netmask (0.00s) --- PASS: TestRADIUSAttributeType/Framed-Routing (0.00s) --- PASS: TestRADIUSAttributeType/Filter-Id (0.00s) --- PASS: TestRADIUSAttributeType/Framed-MTU (0.00s) --- PASS: TestRADIUSAttributeType/Framed-Compression (0.00s) --- PASS: TestRADIUSAttributeType/Login-IP-Host (0.00s) --- PASS: TestRADIUSAttributeType/Login-Service (0.00s) --- PASS: TestRADIUSAttributeType/Login-TCP-Port (0.00s) --- PASS: TestRADIUSAttributeType/Reply-Message (0.00s) --- PASS: TestRADIUSAttributeType/Callback-Number (0.00s) --- PASS: TestRADIUSAttributeType/Callback-Id (0.00s) --- PASS: TestRADIUSAttributeType/Framed-Route (0.00s) --- PASS: TestRADIUSAttributeType/Framed-IPX-Network (0.00s) --- PASS: TestRADIUSAttributeType/State (0.00s) --- PASS: TestRADIUSAttributeType/Class (0.00s) --- PASS: TestRADIUSAttributeType/Vendor-Specific (0.00s) --- PASS: TestRADIUSAttributeType/Session-Timeout (0.00s) --- PASS: TestRADIUSAttributeType/Idle-Timeout (0.00s) --- PASS: TestRADIUSAttributeType/Termination-Action (0.00s) --- PASS: TestRADIUSAttributeType/Called-Station-Id (0.00s) --- PASS: TestRADIUSAttributeType/Calling-Station-Id (0.00s) --- PASS: TestRADIUSAttributeType/NAS-Identifier (0.00s) --- PASS: TestRADIUSAttributeType/Proxy-State (0.00s) --- PASS: TestRADIUSAttributeType/Login-LAT-Service (0.00s) --- PASS: TestRADIUSAttributeType/Login-LAT-Node (0.00s) --- PASS: TestRADIUSAttributeType/Login-LAT-Group (0.00s) --- PASS: TestRADIUSAttributeType/Framed-AppleTalk-Link (0.00s) --- PASS: TestRADIUSAttributeType/Framed-AppleTalk-Network (0.00s) --- PASS: TestRADIUSAttributeType/Framed-AppleTalk-Zone (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Status-Type (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Delay-Time (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Input-Octets (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Output-Octets (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Session-Id (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Authentic (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Session-Time (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Input-Packets (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Output-Packets (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Terminate-Cause (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Multi-Session-Id (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Link-Count (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Input-Gigawords (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Output-Gigawords (0.00s) --- PASS: TestRADIUSAttributeType/Event-Timestamp (0.00s) --- PASS: TestRADIUSAttributeType/CHAP-Challenge (0.00s) --- PASS: TestRADIUSAttributeType/NAS-Port-Type (0.00s) --- PASS: TestRADIUSAttributeType/Port-Limit (0.00s) --- PASS: TestRADIUSAttributeType/Login-LAT-Port (0.00s) --- PASS: TestRADIUSAttributeType/Tunnel-Type (0.00s) --- PASS: TestRADIUSAttributeType/Tunnel-Medium-Type (0.00s) --- PASS: TestRADIUSAttributeType/Tunnel-Client-Endpoint (0.00s) --- PASS: TestRADIUSAttributeType/Tunnel-Server-Endpoint (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Tunnel-Connection (0.00s) --- PASS: TestRADIUSAttributeType/Tunnel-Password (0.00s) --- PASS: TestRADIUSAttributeType/ARAP-Password (0.00s) --- PASS: TestRADIUSAttributeType/ARAP-Features (0.00s) --- PASS: TestRADIUSAttributeType/ARAP-Zone-Access (0.00s) --- PASS: TestRADIUSAttributeType/ARAP-Security (0.00s) --- PASS: TestRADIUSAttributeType/ARAP-Security-Data (0.00s) --- PASS: TestRADIUSAttributeType/Password-Retry (0.00s) --- PASS: TestRADIUSAttributeType/Prompt (0.00s) --- PASS: TestRADIUSAttributeType/Connect-Info (0.00s) --- PASS: TestRADIUSAttributeType/Configuration-Token (0.00s) --- PASS: TestRADIUSAttributeType/EAP-Message (0.00s) --- PASS: TestRADIUSAttributeType/Message-Authenticator (0.00s) --- PASS: TestRADIUSAttributeType/Tunnel-Private-Group-ID (0.00s) --- PASS: TestRADIUSAttributeType/Tunnel-Assignment-ID (0.00s) --- PASS: TestRADIUSAttributeType/Tunnel-Preference (0.00s) --- PASS: TestRADIUSAttributeType/ARAP-Challenge-Response (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Interim-Interval (0.00s) --- PASS: TestRADIUSAttributeType/Acct-Tunnel-Packets-Lost (0.00s) --- PASS: TestRADIUSAttributeType/NAS-Port-Id (0.00s) --- PASS: TestRADIUSAttributeType/Framed-Pool (0.00s) --- PASS: TestRADIUSAttributeType/Tunnel-Client-Auth-ID (0.00s) --- PASS: TestRADIUSAttributeType/Tunnel-Server-Auth-ID (0.00s) === RUN TestRADIUSRecordSize === RUN TestRADIUSRecordSize/Minimum-1 === RUN TestRADIUSRecordSize/Maximum+1 --- PASS: TestRADIUSRecordSize (0.01s) --- PASS: TestRADIUSRecordSize/Minimum-1 (0.00s) --- PASS: TestRADIUSRecordSize/Maximum+1 (0.01s) === RUN TestRADIUSLengthField === RUN TestRADIUSLengthField/Minimum-1 === RUN TestRADIUSLengthField/Minimum+1 === RUN TestRADIUSLengthField/Maximum-1 === RUN TestRADIUSLengthField/Maximum+1 --- PASS: TestRADIUSLengthField (0.00s) --- PASS: TestRADIUSLengthField/Minimum-1 (0.00s) --- PASS: TestRADIUSLengthField/Minimum+1 (0.00s) --- PASS: TestRADIUSLengthField/Maximum-1 (0.00s) --- PASS: TestRADIUSLengthField/Maximum+1 (0.00s) === RUN TestRADIUSAttributesLengthField === RUN TestRADIUSAttributesLengthField/Minimum-1 === RUN TestRADIUSAttributesLengthField/Minimum-1#01 === RUN TestRADIUSAttributesLengthField/Minimum+1 === RUN TestRADIUSAttributesLengthField/Minimum+1#01 --- PASS: TestRADIUSAttributesLengthField (0.00s) --- PASS: TestRADIUSAttributesLengthField/Minimum-1 (0.00s) --- PASS: TestRADIUSAttributesLengthField/Minimum-1#01 (0.00s) --- PASS: TestRADIUSAttributesLengthField/Minimum+1 (0.00s) --- PASS: TestRADIUSAttributesLengthField/Minimum+1#01 (0.00s) === RUN TestRADIUSAccessRequest base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP RADIUS] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 103 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 83 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 75 bytes base_test.go:21: Got layer RADIUS, 75 bytes, payload of 0 bytes base_test.go:24: PACKET: 117 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..103..] SrcMAC=02:42:06:4d:ad:bf DstMAC=02:42:ac:14:00:02 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..83..] Version=4 IHL=5 TOS=0 Length=103 Id=61162 Flags=DF FragOffset=0 TTL=64 Protocol=UDP Checksum=62319 SrcIP=172.20.0.1 DstIP=172.20.0.2 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..75..] SrcPort=55337 DstPort=1812(radius) Length=83 Checksum=22672} - Layer 4 (75 bytes) = RADIUS {Contents=[..75..] Payload=[] Code=Access-Request Identifier=141 Length=75 Authenticator=[59 189 34 82 180 200 216 68 27 70 121 191 74 43 134 1] Attributes=[..5..]} --- PASS: TestRADIUSAccessRequest (0.00s) === RUN TestRADIUSAccessAccept base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP RADIUS] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 48 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 28 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 20 bytes base_test.go:21: Got layer RADIUS, 20 bytes, payload of 0 bytes base_test.go:24: PACKET: 62 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..48..] SrcMAC=02:42:ac:14:00:02 DstMAC=02:42:06:4d:ad:bf EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..28..] Version=4 IHL=5 TOS=0 Length=48 Id=61181 Flags= FragOffset=0 TTL=64 Protocol=UDP Checksum=13204 SrcIP=172.20.0.2 DstIP=172.20.0.1 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..20..] SrcPort=1812(radius) DstPort=55337 Length=28 Checksum=22617} - Layer 4 (20 bytes) = RADIUS {Contents=[..20..] Payload=[] Code=Access-Accept Identifier=141 Length=20 Authenticator=[134 168 213 205 105 60 7 94 158 24 162 45 221 95 43 255] Attributes=[]} --- PASS: TestRADIUSAccessAccept (0.00s) === RUN TestRMCPDecodeFromBytes --- PASS: TestRMCPDecodeFromBytes (0.00s) === RUN TestRMCPTestSerializeTo --- PASS: TestRMCPTestSerializeTo (0.00s) === RUN TestDecodeUDPSFlow base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP SFlow] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 1468 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 1448 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 1440 bytes base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 1482 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..1468..] SrcMAC=f0:50:56:85:3a:fd DstMAC=84:2b:2b:16:8b:62 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..1448..] Version=4 IHL=5 TOS=0 Length=1468 Id=39940 Flags=DF FragOffset=0 TTL=255 Protocol=UDP Checksum=50944 SrcIP=10.1.255.14 DstIP=10.1.0.27 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..1440..] SrcPort=51031 DstPort=6343(sflow) Length=1448 Checksum=8763} - Layer 4 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=10.1.248.22 SubAgentID=17 SequenceNumber=40443 AgentUptime=1078576845 SampleCount=7 FlowSamples=[..6..] CounterSamples=[{EnterpriseID=Standard SFlow Format=Counter Sample SampleLength=168 SequenceNumber=8434 SourceIDClass=Single Interface SourceIDIndex=522 RecordCount=2 Records=[{EnterpriseID=Standard SFlow Format=Generic Interface Counters FlowDataLength=88 IfIndex=522 IfType=6 IfSpeed=10000000000 IfDirection=1 IfStatus=3 IfInOctets=327115139476491 IfInUcastPkts=3406683542 IfInMulticastPkts=436422 IfInBroadcastPkts=123 IfInDiscards=0 IfInErrors=0 IfInUnknownProtos=0 IfOutOctets=57184089570462 IfOutUcastPkts=1449403761 IfOutMulticastPkts=7363268 IfOutBroadcastPkts=592113 IfOutDiscards=0 IfOutErrors=0 IfPromiscuousMode=0}, {EnterpriseID=Standard SFlow Format=Ethernet Interface Counters FlowDataLength=52 AlignmentErrors=0 FCSErrors=0 SingleCollisionFrames=0 MultipleCollisionFrames=0 SQETestErrors=0 DeferredTransmissions=0 LateCollisions=0 ExcessiveCollisions=0 InternalMacTransmitErrors=0 CarrierSenseErrors=0 FrameTooLongs=0 InternalMacReceiveErrors=0 SymbolErrors=0}]}]} --- PASS: TestDecodeUDPSFlow (0.00s) === RUN TestDecodeSFlowDatagram base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP SFlow] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 1468 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 1448 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 1440 bytes base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 1482 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..1468..] SrcMAC=f0:50:56:85:3a:fd DstMAC=84:2b:2b:16:8b:62 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..1448..] Version=4 IHL=5 TOS=0 Length=1468 Id=39940 Flags=DF FragOffset=0 TTL=255 Protocol=UDP Checksum=50944 SrcIP=10.1.255.14 DstIP=10.1.0.27 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..1440..] SrcPort=51031 DstPort=6343(sflow) Length=1448 Checksum=8763} - Layer 4 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=10.1.248.22 SubAgentID=17 SequenceNumber=40443 AgentUptime=1078576845 SampleCount=7 FlowSamples=[..6..] CounterSamples=[{EnterpriseID=Standard SFlow Format=Counter Sample SampleLength=168 SequenceNumber=8434 SourceIDClass=Single Interface SourceIDIndex=522 RecordCount=2 Records=[{EnterpriseID=Standard SFlow Format=Generic Interface Counters FlowDataLength=88 IfIndex=522 IfType=6 IfSpeed=10000000000 IfDirection=1 IfStatus=3 IfInOctets=327115139476491 IfInUcastPkts=3406683542 IfInMulticastPkts=436422 IfInBroadcastPkts=123 IfInDiscards=0 IfInErrors=0 IfInUnknownProtos=0 IfOutOctets=57184089570462 IfOutUcastPkts=1449403761 IfOutMulticastPkts=7363268 IfOutBroadcastPkts=592113 IfOutDiscards=0 IfOutErrors=0 IfPromiscuousMode=0}, {EnterpriseID=Standard SFlow Format=Ethernet Interface Counters FlowDataLength=52 AlignmentErrors=0 FCSErrors=0 SingleCollisionFrames=0 MultipleCollisionFrames=0 SQETestErrors=0 DeferredTransmissions=0 LateCollisions=0 ExcessiveCollisions=0 InternalMacTransmitErrors=0 CarrierSenseErrors=0 FrameTooLongs=0 InternalMacReceiveErrors=0 SymbolErrors=0}]}]} --- PASS: TestDecodeSFlowDatagram (0.00s) === RUN TestPacketPacket0 base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP SFlow] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 1160 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 1140 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 1132 bytes base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 1174 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..1160..] SrcMAC=00:00:00:00:00:00 DstMAC=00:00:00:00:00:00 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..1140..] Version=4 IHL=5 TOS=0 Length=1160 Id=0 Flags=DF FragOffset=0 TTL=64 Protocol=UDP Checksum=14435 SrcIP=127.0.0.1 DstIP=127.0.0.1 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..1132..] SrcPort=56504 DstPort=6343(sflow) Length=1140 Checksum=648} - Layer 4 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=192.168.91.17 SubAgentID=0 SequenceNumber=46394 AgentUptime=52000 SampleCount=3 FlowSamples=[{EnterpriseID=Standard SFlow Format=Flow Sample SampleLength=340 SequenceNumber=139118 SourceIDClass=Single Interface SourceIDIndex=3 SamplingRate=1 SamplePool=139118 Dropped=0 InputInterfaceFormat=0 InputInterface=3 OutputInterfaceFormat=0 OutputInterface=1073741823 RecordCount=4 Records=[{EnterpriseID=Standard SFlow Format=Extended URL Flow Record FlowDataLength=48 Direction=Source address is the server URL=http://www.sflow.org Host=host1.sflow.org}, {EnterpriseID=Standard SFlow Format=Extended User Flow Record FlowDataLength=44 SourceCharSet=106 SourceUserID=source user DestinationCharSet=106 DestinationUserID=destination user}, {EnterpriseID=Standard SFlow Format=Extended Gateway Flow Record FlowDataLength=100 NextHop=13.12.11.10 AS=65001 SourceAS=123 PeerAS=999 ASPathCount=3 ASPath=[AS Sequence:[123 456 789], AS Set:[11111 22222 33333], AS Sequence:[777 888 999]] Communities=[12, 13] LocalPref=432}, {EnterpriseID=Standard SFlow Format=Raw Packet Flow Record FlowDataLength=84 HeaderProtocol=ETHERNET-ISO88023 FrameLength=70 PayloadRemoved=4 HeaderLength=66 Header=PACKET: 68 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..54..] SrcMAC=00:50:56:c0:00:09 DstMAC=00:0c:29:67:a0:e5 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..32..] Version=4 IHL=5 TOS=16 Length=52 Id=37571 Flags=DF FragOffset=0 TTL=64 Protocol=TCP Checksum=28813 SrcIP=192.168.91.1 DstIP=192.168.91.17 Options=[] Padding=[]} - Layer 3 (32 bytes) = TCP {Contents=[..32..] Payload=[] SrcPort=54237 DstPort=22(ssh) Seq=3811476599 Ack=325961043 DataOffset=8 FIN=false SYN=false RST=false PSH=false ACK=true URG=false ECE=false CWR=false NS=false Window=8183 Checksum=59261 Urgent=0 Options=[TCPOption(NOP:), TCPOption(NOP:), TCPOption(Timestamps:784756794/1016954 0x2ec6703a000f847a)] Padding=[]} }]}, {EnterpriseID=Standard SFlow Format=Flow Sample SampleLength=400 SequenceNumber=139119 SourceIDClass=Single Interface SourceIDIndex=3 SamplingRate=1 SamplePool=139119 Dropped=0 InputInterfaceFormat=0 InputInterface=1073741823 OutputInterfaceFormat=0 OutputInterface=3 RecordCount=4 Records=[{EnterpriseID=Standard SFlow Format=Extended URL Flow Record FlowDataLength=48 Direction=Source address is the server URL=http://www.sflow.org Host=host1.sflow.org}, {EnterpriseID=Standard SFlow Format=Extended User Flow Record FlowDataLength=44 SourceCharSet=106 SourceUserID=source user DestinationCharSet=106 DestinationUserID=destination user}, {EnterpriseID=Standard SFlow Format=Extended Gateway Flow Record FlowDataLength=100 NextHop=13.12.11.10 AS=65001 SourceAS=123 PeerAS=999 ASPathCount=3 ASPath=[AS Sequence:[123 456 789], AS Set:[11111 22222 33333], AS Sequence:[777 888 999]] Communities=[12, 13] LocalPref=432}, {EnterpriseID=Standard SFlow Format=Raw Packet Flow Record FlowDataLength=144 HeaderProtocol=ETHERNET-ISO88023 FrameLength=390 PayloadRemoved=4 HeaderLength=128 Header=PACKET: 128 bytes, truncated - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..114..] SrcMAC=00:0c:29:67:a0:e5 DstMAC=00:50:56:c0:00:09 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..94..] Version=4 IHL=5 TOS=16 Length=372 Id=48122 Flags=DF FragOffset=0 TTL=64 Protocol=TCP Checksum=17942 SrcIP=192.168.91.17 DstIP=192.168.91.1 Options=[] Padding=[]} - Layer 3 (32 bytes) = TCP {Contents=[..32..] Payload=[..62..] SrcPort=22(ssh) DstPort=54237 Seq=325961043 Ack=3811476599 DataOffset=8 FIN=false SYN=false RST=false PSH=true ACK=true URG=false ECE=false CWR=false NS=false Window=272 Checksum=14538 Urgent=0 Options=[TCPOption(NOP:), TCPOption(NOP:), TCPOption(Timestamps:1016957/784756794 0x000f847d2ec6703a)] Padding=[]} - Layer 4 (62 bytes) = Payload 62 byte(s) }]}, {EnterpriseID=Standard SFlow Format=Flow Sample SampleLength=340 SequenceNumber=139120 SourceIDClass=Single Interface SourceIDIndex=3 SamplingRate=1 SamplePool=139120 Dropped=0 InputInterfaceFormat=0 InputInterface=3 OutputInterfaceFormat=0 OutputInterface=1073741823 RecordCount=4 Records=[{EnterpriseID=Standard SFlow Format=Extended URL Flow Record FlowDataLength=48 Direction=Source address is the server URL=http://www.sflow.org Host=host1.sflow.org}, {EnterpriseID=Standard SFlow Format=Extended User Flow Record FlowDataLength=44 SourceCharSet=106 SourceUserID=source user DestinationCharSet=106 DestinationUserID=destination user}, {EnterpriseID=Standard SFlow Format=Extended Gateway Flow Record FlowDataLength=100 NextHop=13.12.11.10 AS=65001 SourceAS=123 PeerAS=999 ASPathCount=3 ASPath=[AS Sequence:[123 456 789], AS Set:[11111 22222 33333], AS Sequence:[777 888 999]] Communities=[12, 13] LocalPref=432}, {EnterpriseID=Standard SFlow Format=Raw Packet Flow Record FlowDataLength=84 HeaderProtocol=ETHERNET-ISO88023 FrameLength=70 PayloadRemoved=4 HeaderLength=66 Header=PACKET: 68 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..54..] SrcMAC=00:50:56:c0:00:09 DstMAC=00:0c:29:67:a0:e5 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..32..] Version=4 IHL=5 TOS=16 Length=52 Id=25981 Flags=DF FragOffset=0 TTL=64 Protocol=TCP Checksum=40403 SrcIP=192.168.91.1 DstIP=192.168.91.17 Options=[] Padding=[]} - Layer 3 (32 bytes) = TCP {Contents=[..32..] Payload=[] SrcPort=54237 DstPort=22(ssh) Seq=3811476599 Ack=325961363 DataOffset=8 FIN=false SYN=false RST=false PSH=false ACK=true URG=false ECE=false CWR=false NS=false Window=8172 Checksum=58947 Urgent=0 Options=[TCPOption(NOP:), TCPOption(NOP:), TCPOption(Timestamps:784756796/1016957 0x2ec6703c000f847d)] Padding=[]} }]}] CounterSamples=[]} --- PASS: TestPacketPacket0 (0.00s) === RUN TestDecodeProcessorCounter base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 88 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=10.20.4.0 SubAgentID=100 SequenceNumber=96480 AgentUptime=1929595000 SampleCount=1 FlowSamples=[] CounterSamples=[{EnterpriseID=Standard SFlow Format=Expanded Counter Sample SampleLength=52 SequenceNumber=96480 SourceIDClass=Single Interface SourceIDIndex=1 RecordCount=1 Records=[{EnterpriseID=Standard SFlow Format=Processor Counters FlowDataLength=28 FiveSecCpu=1450 OneMinCpu=1370 FiveMinCpu=1330 TotalMemory=3884806144 FreeMemory=1441230848}]}]} --- PASS: TestDecodeProcessorCounter (0.00s) === RUN TestDecodeExtendedSwitchFlow base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 92 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=192.168.1.7 SubAgentID=0 SequenceNumber=638 AgentUptime=853599356 SampleCount=1 FlowSamples=[{EnterpriseID=Standard SFlow Format=Flow Sample SampleLength=56 SequenceNumber=291 SourceIDClass=Single Interface SourceIDIndex=29 SamplingRate=256 SamplePool=823 Dropped=22051 InputInterfaceFormat=0 InputInterface=29 OutputInterfaceFormat=0 OutputInterface=4 RecordCount=1 Records=[{EnterpriseID=Standard SFlow Format=Extended Switch Flow Record FlowDataLength=16 IncomingVLAN=3 IncomingVLANPriority=2 OutgoingVLAN=5 OutgoingVLANPriority=4294967295}]}] CounterSamples=[]} --- PASS: TestDecodeExtendedSwitchFlow (0.00s) === RUN TestDecodeExtendedRouterFlow base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 92 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=192.168.1.18 SubAgentID=0 SequenceNumber=638 AgentUptime=853599356 SampleCount=1 FlowSamples=[{EnterpriseID=Standard SFlow Format=Flow Sample SampleLength=52 SequenceNumber=291 SourceIDClass=Single Interface SourceIDIndex=29 SamplingRate=256 SamplePool=820 Dropped=22018 InputInterfaceFormat=0 InputInterface=29 OutputInterfaceFormat=0 OutputInterface=4 RecordCount=1 Records=[{EnterpriseID=Standard SFlow Format=Extended Router Flow Record FlowDataLength=16 NextHop=192.168.1.33 NextHopSourceMask=4294967295 NextHopDestinationMask=4294967168}]}] CounterSamples=[]} --- PASS: TestDecodeExtendedRouterFlow (0.00s) === RUN TestDecodeExtendedRouterFlowIPv6 base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 104 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=192.168.1.18 SubAgentID=0 SequenceNumber=638 AgentUptime=853599356 SampleCount=1 FlowSamples=[{EnterpriseID=Standard SFlow Format=Flow Sample SampleLength=52 SequenceNumber=291 SourceIDClass=Single Interface SourceIDIndex=29 SamplingRate=256 SamplePool=820 Dropped=22018 InputInterfaceFormat=0 InputInterface=29 OutputInterfaceFormat=0 OutputInterface=4 RecordCount=1 Records=[{EnterpriseID=Standard SFlow Format=Extended Router Flow Record FlowDataLength=28 NextHop=2001:db8:: NextHopSourceMask=4294967295 NextHopDestinationMask=4294967168}]}] CounterSamples=[]} --- PASS: TestDecodeExtendedRouterFlowIPv6 (0.00s) === RUN TestDecodeExtendedIpv4TunnelIngressFlow base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 108 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=127.0.0.1 SubAgentID=0 SequenceNumber=114 AgentUptime=114000 SampleCount=1 FlowSamples=[{EnterpriseID=Standard SFlow Format=Flow Sample SampleLength=72 SequenceNumber=116 SourceIDClass=Single Interface SourceIDIndex=33555432 SamplingRate=1 SamplePool=116 Dropped=0 InputInterfaceFormat=0 InputInterface=0 OutputInterfaceFormat=0 OutputInterface=2147483649 RecordCount=1 Records=[{EnterpriseID=Standard SFlow Format=Extended IPv4 Tunnel Ingress Record FlowDataLength=32 SFlowIpv4Record={ Length=0 Protocol=47 IPSrc=192.168.0.84 IPDst=192.168.0.83 PortSrc=0 PortDst=0 TCPFlags=0 TOS=0}}]}] CounterSamples=[]} --- PASS: TestDecodeExtendedIpv4TunnelIngressFlow (0.00s) === RUN TestDecodeExtendedIpv4TunnelEgressFlow base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 108 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=127.0.0.1 SubAgentID=1 SequenceNumber=18 AgentUptime=17000 SampleCount=1 FlowSamples=[{EnterpriseID=Standard SFlow Format=Flow Sample SampleLength=72 SequenceNumber=18 SourceIDClass=Single Interface SourceIDIndex=33555433 SamplingRate=1 SamplePool=18 Dropped=0 InputInterfaceFormat=0 InputInterface=108 OutputInterfaceFormat=0 OutputInterface=2147483649 RecordCount=1 Records=[{EnterpriseID=Standard SFlow Format=Extended IPv4 Tunnel Egress Record FlowDataLength=32 SFlowIpv4Record={ Length=0 Protocol=0 IPSrc=0.0.0.0 IPDst=192.168.0.84 PortSrc=0 PortDst=0 TCPFlags=0 TOS=0}}]}] CounterSamples=[]} --- PASS: TestDecodeExtendedIpv4TunnelEgressFlow (0.00s) === RUN TestDecodeEthernetFrameFlow base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 532 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=185.120.22.246 SubAgentID=100000 SequenceNumber=11 AgentUptime=12951 SampleCount=7 FlowSamples=[..7..] CounterSamples=[]} --- PASS: TestDecodeEthernetFrameFlow (0.00s) === RUN TestDecodePortnameCounter base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 252 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=127.0.0.1 SubAgentID=0 SequenceNumber=111469 AgentUptime=235197000 SampleCount=1 FlowSamples=[] CounterSamples=[{EnterpriseID=Standard SFlow Format=Counter Sample SampleLength=216 SequenceNumber=23520 SourceIDClass=Single Interface SourceIDIndex=14 RecordCount=4 Records=[{EnterpriseID=Standard SFlow Format=Ethernet Interface Counters FlowDataLength=52 AlignmentErrors=0 FCSErrors=0 SingleCollisionFrames=4294967295 MultipleCollisionFrames=4294967295 SQETestErrors=4294967295 DeferredTransmissions=4294967295 LateCollisions=4294967295 ExcessiveCollisions=4294967295 InternalMacTransmitErrors=4294967295 CarrierSenseErrors=4294967295 FrameTooLongs=4294967295 InternalMacReceiveErrors=4294967295 SymbolErrors=4294967295}, {EnterpriseID=Standard SFlow Format=Openflow Port Counters FlowDataLength=12 DatapathID=108659399421513 PortNo=3}, {EnterpriseID=Standard SFlow Format=PORT NAME Counters FlowDataLength=20 Len=16 Str=tapd98154f2-00}, {EnterpriseID=Standard SFlow Format=Generic Interface Counters FlowDataLength=88 IfIndex=14 IfType=6 IfSpeed=10000000000 IfDirection=1 IfStatus=3 IfInOctets=18249 IfInUcastPkts=181 IfInMulticastPkts=0 IfInBroadcastPkts=4294967295 IfInDiscards=0 IfInErrors=0 IfInUnknownProtos=4294967295 IfOutOctets=35339 IfOutUcastPkts=466 IfOutMulticastPkts=4294967295 IfOutBroadcastPkts=4294967295 IfOutDiscards=0 IfOutErrors=0 IfPromiscuousMode=0}]}]} --- PASS: TestDecodePortnameCounter (0.00s) === RUN TestDecodeVLANCounter base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 88 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=10.20.4.0 SubAgentID=100 SequenceNumber=96480 AgentUptime=1929595000 SampleCount=1 FlowSamples=[] CounterSamples=[{EnterpriseID=Standard SFlow Format=Expanded Counter Sample SampleLength=52 SequenceNumber=96480 SourceIDClass=Single Interface SourceIDIndex=1 RecordCount=1 Records=[{EnterpriseID=Standard SFlow Format=VLAN Counters FlowDataLength=28 VlanID=10 Octets=25963724 UcastPkts=38531 MulticastPkts=167958 BroadcastPkts=128627 Discards=0}]}]} --- PASS: TestDecodeVLANCounter (0.00s) === RUN TestDecodeLACPCounter base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 112 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=127.0.0.1 SubAgentID=0 SequenceNumber=14565 AgentUptime=95295000 SampleCount=1 FlowSamples=[] CounterSamples=[{EnterpriseID=Standard SFlow Format=Counter Sample SampleLength=116 SequenceNumber=3376 SourceIDClass=Single Interface SourceIDIndex=1 RecordCount=1 Records=[{EnterpriseID=Standard SFlow Format=LACP Counters FlowDataLength=56 ActorSystemID=7e:60:69:73:8f:42 PartnerSystemID=00:00:00:00:00:00 AttachedAggID=1 LacpPortState={ PortStateAll=91553792} LACPDUsRx=0 MarkerPDUsRx=4294967295 MarkerResponsePDUsRx=4294967295 UnknownRx=4294967295 IllegalRx=0 LACPDUsTx=1173 MarkerPDUsTx=4294967295 MarkerResponsePDUsTx=4294967295}]}]} --- PASS: TestDecodeLACPCounter (0.00s) === RUN TestDecodeOpenflowCounter base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 244 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=127.0.0.1 SubAgentID=0 SequenceNumber=111450 AgentUptime=235148000 SampleCount=1 FlowSamples=[] CounterSamples=[{EnterpriseID=Standard SFlow Format=Counter Sample SampleLength=208 SequenceNumber=23515 SourceIDClass=Single Interface SourceIDIndex=11 RecordCount=4 Records=[{EnterpriseID=Standard SFlow Format=Ethernet Interface Counters FlowDataLength=52 AlignmentErrors=0 FCSErrors=0 SingleCollisionFrames=4294967295 MultipleCollisionFrames=4294967295 SQETestErrors=4294967295 DeferredTransmissions=4294967295 LateCollisions=4294967295 ExcessiveCollisions=4294967295 InternalMacTransmitErrors=4294967295 CarrierSenseErrors=4294967295 FrameTooLongs=4294967295 InternalMacReceiveErrors=4294967295 SymbolErrors=4294967295}, {EnterpriseID=Standard SFlow Format=Openflow Port Counters FlowDataLength=12 DatapathID=108659399421513 PortNo=65534}, {EnterpriseID=Standard SFlow Format=PORT NAME Counters FlowDataLength=12 Len=8 Str=br-int}, {EnterpriseID=Standard SFlow Format=Generic Interface Counters FlowDataLength=88 IfIndex=11 IfType=6 IfSpeed=100000000 IfDirection=0 IfStatus=0 IfInOctets=0 IfInUcastPkts=0 IfInMulticastPkts=0 IfInBroadcastPkts=4294967295 IfInDiscards=0 IfInErrors=0 IfInUnknownProtos=4294967295 IfOutOctets=0 IfOutUcastPkts=0 IfOutMulticastPkts=4294967295 IfOutBroadcastPkts=4294967295 IfOutDiscards=0 IfOutErrors=0 IfPromiscuousMode=0}]}]} --- PASS: TestDecodeOpenflowCounter (0.00s) === RUN TestDecodeAppResourcesOvsdbCounter base_test.go:19: Checking packet layers, want [SFlow] base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes base_test.go:24: PACKET: 128 bytes - Layer 1 (00 bytes) = SFlow {Contents=[] Payload=[] DatagramVersion=5 AgentAddress=127.0.0.1 SubAgentID=0 SequenceNumber=111455 AgentUptime=235164000 SampleCount=1 FlowSamples=[] CounterSamples=[{EnterpriseID=Standard SFlow Format=Counter Sample SampleLength=92 SequenceNumber=23517 SourceIDClass=Single Interface SourceIDIndex=33555432 RecordCount=2 Records=[{EnterpriseID=Standard SFlow Format=App Resources Counters FlowDataLength=40 UserTime=726317 SystemTime=669497 MemUsed=5812224 MemMax=0 FdOpen=0 FdMax=0 ConnOpen=0 ConnMax=0}, {EnterpriseID=Standard SFlow Format=OVSDP Counters FlowDataLength=24 NHit=1015 NMissed=328 NLost=0 NMaskHit=2619 NFlows=0 NMasks=0}]}]} --- PASS: TestDecodeAppResourcesOvsdbCounter (0.00s) === RUN TestSIPMain --- PASS: TestSIPMain (0.00s) === RUN TestTCPOptionKindString --- PASS: TestTCPOptionKindString (0.00s) === RUN TestTCPSerializePadding --- PASS: TestTCPSerializePadding (0.00s) === RUN TestPacketTCPOptionDecode --- PASS: TestPacketTCPOptionDecode (0.00s) === RUN TestIPv4UDPChecksum base_test.go:19: Checking packet layers, want [IPv4 UDP] base_test.go:21: Got layer IPv4, 20 bytes, payload of 8 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 0 bytes base_test.go:24: PACKET: 28 bytes - Layer 1 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..8..] Version=4 IHL=5 TOS=0 Length=28 Id=0 Flags= FragOffset=0 TTL=64 Protocol=UDP Checksum=36507 SrcIP=192.0.2.1 DstIP=198.51.100.1 Options=[] Padding=[]} - Layer 2 (08 bytes) = UDP {Contents=[..8..] Payload=[] SrcPort=12345(italk) DstPort=9999(distinct) Length=8 Checksum=48223} --- PASS: TestIPv4UDPChecksum (0.00s) === RUN TestIPv6UDPChecksumWithIPv6DstOpts base_test.go:19: Checking packet layers, want [IPv6 IPv6Destination UDP] base_test.go:21: Got layer IPv6, 40 bytes, payload of 16 bytes base_test.go:21: Got layer IPv6Destination, 8 bytes, payload of 8 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 0 bytes base_test.go:24: PACKET: 56 bytes - Layer 1 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..16..] Version=6 TrafficClass=0 FlowLabel=0 Length=16 NextHeader=IPv6Destination HopLimit=64 SrcIP=2001:db8::1 DstIP=2001:db8::2 HopByHop=nil} - Layer 2 (08 bytes) = IPv6Destination {Contents=[..8..] Payload=[..8..] NextHeader=UDP HeaderLength=0 ActualLength=8 Options=[{OptionType=1 OptionLength=4 ActualLength=6 OptionData=[0, 0, 0, 0] OptionAlignment=[0 0]}]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[] SrcPort=12345(italk) DstPort=9999(distinct) Length=8 Checksum=19745} --- PASS: TestIPv6UDPChecksumWithIPv6DstOpts (0.00s) === RUN TestIPv6JumbogramUDPChecksum base_test.go:19: Checking packet layers, want [IPv6 IPv6HopByHop UDP Payload] base_test.go:21: Got layer IPv6, 40 bytes, payload of 65552 bytes base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 65544 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 65536 bytes base_test.go:21: Got layer Payload, 65536 bytes, payload of 0 bytes base_test.go:24: PACKET: 65592 bytes - Layer 1 (40 bytes) = IPv6 {Contents=[..40..] Payload=[..65552..] Version=6 TrafficClass=0 FlowLabel=0 Length=0 NextHeader=IPv6HopByHop HopLimit=64 SrcIP=2001:db8::1 DstIP=2001:db8::2 HopByHop={ Contents=[..8..] Payload=[..65544..] NextHeader=UDP HeaderLength=0 ActualLength=8 Options=[{OptionType=194 OptionLength=4 ActualLength=6 OptionData=[0, 1, 0, 16] OptionAlignment=[0 0]}]}} - Layer 2 (08 bytes) = IPv6HopByHop {Contents=[..8..] Payload=[..65544..] NextHeader=UDP HeaderLength=0 ActualLength=8 Options=[{OptionType=194 OptionLength=4 ActualLength=6 OptionData=[0, 1, 0, 16] OptionAlignment=[0 0]}]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..65536..] SrcPort=12345(italk) DstPort=9999(distinct) Length=0 Checksum=52648} - Layer 4 (65536 bytes) = Payload 65536 byte(s) --- PASS: TestIPv6JumbogramUDPChecksum (0.00s) === RUN TestParseTLSClientHello base_test.go:19: Checking packet layers, want [Ethernet IPv4 TCP TLS] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 254 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 234 bytes base_test.go:21: Got layer TCP, 20 bytes, payload of 214 bytes base_test.go:21: Got layer TLS, 214 bytes, payload of 0 bytes base_test.go:24: PACKET: 268 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..254..] SrcMAC=00:50:56:c0:00:08 DstMAC=00:0c:29:1f:ab:17 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..234..] Version=4 IHL=5 TOS=0 Length=254 Id=28994 Flags=DF FragOffset=0 TTL=128 Protocol=TCP Checksum=20193 SrcIP=192.168.220.1 DstIP=192.168.220.131 Options=[] Padding=[]} - Layer 3 (20 bytes) = TCP {Contents=[..20..] Payload=[..214..] SrcPort=12046 DstPort=443(https) Seq=627883325 Ack=3436110327 DataOffset=5 FIN=false SYN=false RST=false PSH=true ACK=true URG=false ECE=false CWR=false NS=false Window=65535 Checksum=31919 Urgent=0 Options=[] Padding=[]} - Layer 4 (214 bytes) = TLS {Contents=[..214..] Payload=[] ChangeCipherSpec=[] Handshake=[{ContentType=Handshake Version=TLS 1.0 Length=209}] AppData=[] Alert=[]} --- PASS: TestParseTLSClientHello (0.00s) === RUN TestTLSClientHelloDecodeFromBytes --- PASS: TestTLSClientHelloDecodeFromBytes (0.00s) === RUN TestParseTLSChangeCipherSpec base_test.go:19: Checking packet layers, want [TLS] base_test.go:21: Got layer TLS, 53 bytes, payload of 0 bytes base_test.go:24: PACKET: 134 bytes - Layer 1 (53 bytes) = TLS {Contents=[..53..] Payload=[] ChangeCipherSpec=[{ContentType=Change Cipher Spec Version=TLS 1.0 Length=1 Message=Change Cipher Spec Message}] Handshake=[{ContentType=Handshake Version=TLS 1.0 Length=70}, {ContentType=Handshake Version=TLS 1.0 Length=48}] AppData=[] Alert=[]} --- PASS: TestParseTLSChangeCipherSpec (0.00s) === RUN TestParseTLSAppData base_test.go:19: Checking packet layers, want [TLS] base_test.go:21: Got layer TLS, 37 bytes, payload of 0 bytes base_test.go:24: PACKET: 74 bytes - Layer 1 (37 bytes) = TLS {Contents=[..37..] Payload=[] ChangeCipherSpec=[] Handshake=[] AppData=[{ContentType=Application Data Version=TLS 1.0 Length=32 Payload=[..32..]}, {ContentType=Application Data Version=TLS 1.0 Length=32 Payload=[..32..]}] Alert=[]} --- PASS: TestParseTLSAppData (0.00s) === RUN TestSerializeTLSAppData base_test.go:19: Checking packet layers, want [TLS] base_test.go:21: Got layer TLS, 37 bytes, payload of 0 bytes base_test.go:24: PACKET: 74 bytes - Layer 1 (37 bytes) = TLS {Contents=[..37..] Payload=[] ChangeCipherSpec=[] Handshake=[] AppData=[{ContentType=Application Data Version=TLS 1.0 Length=32 Payload=[..32..]}, {ContentType=Application Data Version=TLS 1.0 Length=32 Payload=[..32..]}] Alert=[]} --- PASS: TestSerializeTLSAppData (0.00s) === RUN TestParseTLSMalformed --- PASS: TestParseTLSMalformed (0.00s) === RUN TestParseTLSTooShort --- PASS: TestParseTLSTooShort (0.00s) === RUN TestParseTLSLengthMismatch --- PASS: TestParseTLSLengthMismatch (0.00s) === RUN TestParseTLSAlertEncrypted base_test.go:19: Checking packet layers, want [TLS] base_test.go:21: Got layer TLS, 37 bytes, payload of 0 bytes base_test.go:24: PACKET: 37 bytes - Layer 1 (37 bytes) = TLS {Contents=[..37..] Payload=[] ChangeCipherSpec=[] Handshake=[] AppData=[] Alert=[{ContentType=Alert Version=TLS 1.2 Length=32 Level=Unknown(255) Description=Unknown EncryptedMsg=[..32..]}]} --- PASS: TestParseTLSAlertEncrypted (0.00s) === RUN TestSerializeTLSAlertEncrypted base_test.go:19: Checking packet layers, want [TLS] base_test.go:21: Got layer TLS, 37 bytes, payload of 0 bytes base_test.go:24: PACKET: 37 bytes - Layer 1 (37 bytes) = TLS {Contents=[..37..] Payload=[] ChangeCipherSpec=[] Handshake=[] AppData=[] Alert=[{ContentType=Alert Version=TLS 1.2 Length=32 Level=Unknown(255) Description=Unknown EncryptedMsg=[..32..]}]} --- PASS: TestSerializeTLSAlertEncrypted (0.00s) === RUN TestUDPPacketDNS base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 230 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 210 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 202 bytes base_test.go:21: Got layer DNS, 202 bytes, payload of 0 bytes base_test.go:24: PACKET: 244 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..230..] SrcMAC=00:1f:ca:b3:75:c0 DstMAC=24:be:05:27:0b:17 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..210..] Version=4 IHL=5 TOS=0 Length=230 Id=26831 Flags= FragOffset=0 TTL=63 Protocol=UDP Checksum=42745 SrcIP=172.16.255.1 DstIP=172.29.20.15 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..202..] SrcPort=53(domain) DstPort=35181 Length=210 Checksum=30026} - Layer 4 (202 bytes) = DNS {Contents=[..202..] Payload=[] ID=47320 QR=true OpCode=Query AA=false TC=false RD=true RA=true Z=0 ResponseCode=No Error QDCount=1 ANCount=7 NSCount=0 ARCount=0 Questions=[{Name=[..8..] Type=MX Class=IN}] Answers=[..7..] Authorities=[] Additionals=[]} --- PASS: TestUDPPacketDNS (0.00s) === RUN TestDNSQueryA base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 60 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 40 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 32 bytes base_test.go:21: Got layer DNS, 32 bytes, payload of 0 bytes base_test.go:24: PACKET: 74 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..60..] SrcMAC=52:54:00:bd:1c:70 DstMAC=fe:54:00:3e:00:96 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..40..] Version=4 IHL=5 TOS=0 Length=60 Id=8928 Flags= FragOffset=0 TTL=64 Protocol=UDP Checksum=57912 SrcIP=192.168.122.70 DstIP=192.168.122.1 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..32..] SrcPort=49973 DstPort=53(domain) Length=40 Checksum=30162} - Layer 4 (32 bytes) = DNS {Contents=[..32..] Payload=[] ID=21057 QR=false OpCode=Query AA=false TC=false RD=true RA=false Z=0 ResponseCode=No Error QDCount=1 ANCount=0 NSCount=0 ARCount=0 Questions=[{Name=[..14..] Type=A Class=IN}] Answers=[] Authorities=[] Additionals=[]} --- PASS: TestDNSQueryA (0.00s) === RUN TestDNSRRA base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 292 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 272 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 264 bytes base_test.go:21: Got layer DNS, 264 bytes, payload of 0 bytes base_test.go:24: PACKET: 306 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..292..] SrcMAC=fe:54:00:3e:00:96 DstMAC=52:54:00:bd:1c:70 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..272..] Version=4 IHL=5 TOS=0 Length=292 Id=0 Flags=DF FragOffset=0 TTL=64 Protocol=UDP Checksum=50224 SrcIP=192.168.122.1 DstIP=192.168.122.70 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..264..] SrcPort=53(domain) DstPort=49973 Length=272 Checksum=30394} - Layer 4 (264 bytes) = DNS {Contents=[..264..] Payload=[] ID=21057 QR=true OpCode=Query AA=false TC=false RD=true RA=true Z=0 ResponseCode=No Error QDCount=1 ANCount=6 NSCount=4 ARCount=4 Questions=[{Name=[..14..] Type=A Class=IN}] Answers=[..6..] Authorities=[{Name=[..10..] Type=NS Class=IN TTL=172800 DataLength=6 Data=[..6..] IP= NS=[..14..] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..10..] Type=NS Class=IN TTL=172800 DataLength=6 Data=[..6..] IP= NS=[..14..] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..10..] Type=NS Class=IN TTL=172800 DataLength=6 Data=[..6..] IP= NS=[..14..] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..10..] Type=NS Class=IN TTL=172800 DataLength=6 Data=[..6..] IP= NS=[..14..] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}] Additionals=[{Name=[..14..] Type=A Class=IN TTL=172800 DataLength=4 Data=[216, 239, 32, 10] IP=216.239.32.10 NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..14..] Type=A Class=IN TTL=172800 DataLength=4 Data=[216, 239, 34, 10] IP=216.239.34.10 NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..14..] Type=A Class=IN TTL=172800 DataLength=4 Data=[216, 239, 36, 10] IP=216.239.36.10 NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..14..] Type=A Class=IN TTL=172800 DataLength=4 Data=[216, 239, 38, 10] IP=216.239.38.10 NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}]} --- PASS: TestDNSRRA (0.00s) === RUN TestDNSAAAA base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 224 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 204 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 196 bytes base_test.go:21: Got layer DNS, 196 bytes, payload of 0 bytes base_test.go:24: PACKET: 238 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..224..] SrcMAC=fe:54:00:3e:00:96 DstMAC=52:54:00:bd:1c:70 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..204..] Version=4 IHL=5 TOS=0 Length=224 Id=0 Flags=DF FragOffset=0 TTL=64 Protocol=UDP Checksum=50292 SrcIP=192.168.122.1 DstIP=192.168.122.70 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..196..] SrcPort=53(domain) DstPort=56083 Length=204 Checksum=30326} - Layer 4 (196 bytes) = DNS {Contents=[..196..] Payload=[] ID=62211 QR=true OpCode=Query AA=false TC=false RD=true RA=true Z=0 ResponseCode=No Error QDCount=1 ANCount=1 NSCount=4 ARCount=4 Questions=[{Name=[..14..] Type=AAAA Class=IN}] Answers=[{Name=[..14..] Type=AAAA Class=IN TTL=300 DataLength=16 Data=[..16..] IP=2a00:1450:400c:c01::69 NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}] Authorities=[{Name=[..10..] Type=NS Class=IN TTL=172800 DataLength=6 Data=[..6..] IP= NS=[..14..] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..10..] Type=NS Class=IN TTL=172800 DataLength=6 Data=[..6..] IP= NS=[..14..] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..10..] Type=NS Class=IN TTL=172800 DataLength=6 Data=[..6..] IP= NS=[..14..] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..10..] Type=NS Class=IN TTL=172800 DataLength=6 Data=[..6..] IP= NS=[..14..] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}] Additionals=[{Name=[..14..] Type=A Class=IN TTL=172800 DataLength=4 Data=[216, 239, 32, 10] IP=216.239.32.10 NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..14..] Type=A Class=IN TTL=172800 DataLength=4 Data=[216, 239, 34, 10] IP=216.239.34.10 NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..14..] Type=A Class=IN TTL=172800 DataLength=4 Data=[216, 239, 36, 10] IP=216.239.36.10 NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}, {Name=[..14..] Type=A Class=IN TTL=172800 DataLength=4 Data=[216, 239, 38, 10] IP=216.239.38.10 NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[] RName=[] Serial=0 Refresh=0 Retry=0 Expire=0 Minimum=0} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}]} --- PASS: TestDNSAAAA (0.00s) === RUN TestDNSMXSOA base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 110 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 90 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 82 bytes base_test.go:21: Got layer DNS, 82 bytes, payload of 0 bytes base_test.go:24: PACKET: 124 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..110..] SrcMAC=fe:54:00:3e:00:96 DstMAC=52:54:00:bd:1c:70 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..90..] Version=4 IHL=5 TOS=0 Length=110 Id=0 Flags=DF FragOffset=0 TTL=64 Protocol=UDP Checksum=50406 SrcIP=192.168.122.1 DstIP=192.168.122.70 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..82..] SrcPort=53(domain) DstPort=40032 Length=90 Checksum=30212} - Layer 4 (82 bytes) = DNS {Contents=[..82..] Payload=[] ID=64634 QR=true OpCode=Query AA=false TC=false RD=true RA=true Z=0 ResponseCode=No Error QDCount=1 ANCount=0 NSCount=1 ARCount=0 Questions=[{Name=[..14..] Type=MX Class=IN}] Answers=[] Authorities=[{Name=[..10..] Type=SOA Class=IN TTL=60 DataLength=38 Data=[..38..] IP= NS=[] CNAME=[] PTR=[] TXTs=[] SOA={ MName=[..14..] RName=[..20..] Serial=1548132 Refresh=7200 Retry=1800 Expire=1209600 Minimum=300} SRV={ Priority=0 Weight=0 Port=0 Name=[]} MX={ Preference=0 Name=[]} OPT=[] URI={ Priority=0 Weight=0 Target=[]} TXT=[]}] Additionals=[]} --- PASS: TestDNSMXSOA (0.00s) === RUN TestDNSDoesNotMalloc --- PASS: TestDNSDoesNotMalloc (0.01s) === RUN TestPacketUSB0 base_test.go:19: Checking packet layers, want [USB USBInterrupt] base_test.go:21: Got layer USB, 40 bytes, payload of 1 bytes base_test.go:21: Got layer USBInterrupt, 1 bytes, payload of 0 bytes base_test.go:24: PACKET: 65 bytes - Layer 1 (40 bytes) = USB {Contents=[..40..] Payload=[4] ID=18446612133308938240 EventType=COMPLETE TransferType=Interrupt Direction=In EndpointNumber=1 DeviceAddress=1 BusID=2 TimestampSec=1348195264 TimestampUsec=689546 Setup=false Data=true Status=0 UrbLength=1 UrbDataLength=1 UrbInterval=0 UrbStartFrame=0 UrbCopyOfTransferFlags=0 IsoNumDesc=0} - Layer 2 (01 bytes) = USBInterrupt {Contents=[4] Payload=[]} --- PASS: TestPacketUSB0 (0.00s) === RUN TestVRRPPacketPacket0 base_test.go:19: Checking packet layers, want [Ethernet IPv4 VRRP] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 46 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 20 bytes base_test.go:21: Got layer VRRP, 20 bytes, payload of 0 bytes base_test.go:24: PACKET: 60 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..46..] SrcMAC=00:00:5e:00:01:01 DstMAC=01:00:5e:00:00:12 EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..20..] Version=4 IHL=5 TOS=192 Length=40 Id=0 Flags= FragOffset=0 TTL=255 Protocol=VRRP Checksum=6605 SrcIP=192.168.0.30 DstIP=224.0.0.18 Options=[] Padding=[]} - Layer 3 (20 bytes) = VRRP {Contents=[..20..] Payload=[] Version=2 Type=VRRPv2 Advertisement VirtualRtrID=1 Priority=100 CountIPAddr=1 AuthType=No Authentication AdverInt=1 Checksum=47698 IPAddress=[192.168.0.1]} --- PASS: TestVRRPPacketPacket0 (0.00s) === RUN TestPacketVXLAN base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP VXLAN Ethernet IPv4 ICMPv4 Payload] base_test.go:21: Got layer Ethernet, 14 bytes, payload of 134 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 114 bytes base_test.go:21: Got layer UDP, 8 bytes, payload of 106 bytes base_test.go:21: Got layer VXLAN, 8 bytes, payload of 98 bytes base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes base_test.go:24: PACKET: 148 bytes - Layer 1 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..134..] SrcMAC=36:dc:85:1e:b3:40 DstMAC=00:16:3e:08:71:cf EthernetType=IPv4 Length=0} - Layer 2 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..114..] Version=4 IHL=5 TOS=0 Length=134 Id=53952 Flags=DF FragOffset=0 TTL=64 Protocol=UDP Checksum=20818 SrcIP=192.168.203.1 DstIP=192.168.202.1 Options=[] Padding=[]} - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..106..] SrcPort=45149 DstPort=4789(vxlan) Length=114 Checksum=0} - Layer 4 (08 bytes) = VXLAN {Contents=[..8..] Payload=[..98..] ValidIDFlag=true VNI=255 GBPExtension=false GBPDontLearn=false GBPApplied=false GBPGroupPolicyID=0} - Layer 5 (14 bytes) = Ethernet {Contents=[..14..] Payload=[..84..] SrcMAC=00:16:3e:37:f6:04 DstMAC=00:30:88:01:00:02 EthernetType=IPv4 Length=0} - Layer 6 (20 bytes) = IPv4 {Contents=[..20..] Payload=[..64..] Version=4 IHL=5 TOS=0 Length=84 Id=0 Flags=DF FragOffset=0 TTL=64 Protocol=ICMPv4 Checksum=9039 SrcIP=192.168.203.3 DstIP=192.168.203.5 Options=[] Padding=[]} - Layer 7 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=63218 Id=1292 Seq=1} - Layer 8 (56 bytes) = Payload 56 byte(s) --- PASS: TestPacketVXLAN (0.00s) === RUN TestIsomorphicPacketVXLAN --- PASS: TestIsomorphicPacketVXLAN (0.00s) PASS ok github.com/google/gopacket/layers 0.075s testing: warning: no tests to run PASS ok github.com/google/gopacket/macs 0.009s [no tests to run] === RUN TestPcapNonexistentFile pcap_test.go:26: Error returned for nonexistent file: /path/to/nonexistent/file: No such file or directory --- PASS: TestPcapNonexistentFile (0.00s) === RUN TestPcapFileRead pcap_test.go:86: Processing file test_loopback.pcap pcap_test.go:110: -- FULL PACKET DATA (560 bytes) ------------------------------------ 00000000 1e 00 00 00 60 00 00 00 02 04 06 40 00 00 00 00 |....`......@....| 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 01 e5 af 1f 90 |................| 00000030 08 97 16 66 0a 65 66 ef 80 18 28 e9 02 0c 00 00 |...f.ef...(.....| 00000040 01 01 08 0a 05 c0 8c fc 05 c0 38 8c 47 45 54 20 |..........8.GET | 00000050 2f 70 6b 67 2f 67 69 74 68 75 62 2e 63 6f 6d 2f |/pkg/github.com/| 00000060 67 63 6f 6e 6e 65 6c 6c 2f 67 6f 70 61 63 6b 65 |gconnell/gopacke| 00000070 74 2f 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 |t/ HTTP/1.1..Hos| 00000080 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 3a 38 30 38 |t: localhost:808| 00000090 30 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b |0..Connection: k| 000000a0 65 65 70 2d 61 6c 69 76 65 0d 0a 43 61 63 68 65 |eep-alive..Cache| 000000b0 2d 43 6f 6e 74 72 6f 6c 3a 20 6d 61 78 2d 61 67 |-Control: max-ag| 000000c0 65 3d 30 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a |e=0..User-Agent:| 000000d0 20 4d 6f 7a 69 6c 6c 61 2f 35 2e 30 20 28 4d 61 | Mozilla/5.0 (Ma| 000000e0 63 69 6e 74 6f 73 68 3b 20 49 6e 74 65 6c 20 4d |cintosh; Intel M| 000000f0 61 63 20 4f 53 20 58 20 31 30 5f 38 5f 32 29 20 |ac OS X 10_8_2) | 00000100 41 70 70 6c 65 57 65 62 4b 69 74 2f 35 33 37 2e |AppleWebKit/537.| 00000110 31 31 20 28 4b 48 54 4d 4c 2c 20 6c 69 6b 65 20 |11 (KHTML, like | 00000120 47 65 63 6b 6f 29 20 43 68 72 6f 6d 65 2f 32 33 |Gecko) Chrome/23| 00000130 2e 30 2e 31 32 37 31 2e 31 30 31 20 53 61 66 61 |.0.1271.101 Safa| 00000140 72 69 2f 35 33 37 2e 31 31 0d 0a 41 63 63 65 70 |ri/537.11..Accep| 00000150 74 3a 20 74 65 78 74 2f 68 74 6d 6c 2c 61 70 70 |t: text/html,app| 00000160 6c 69 63 61 74 69 6f 6e 2f 78 68 74 6d 6c 2b 78 |lication/xhtml+x| 00000170 6d 6c 2c 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 |ml,application/x| 00000180 6d 6c 3b 71 3d 30 2e 39 2c 2a 2f 2a 3b 71 3d 30 |ml;q=0.9,*/*;q=0| 00000190 2e 38 0d 0a 52 65 66 65 72 65 72 3a 20 68 74 74 |.8..Referer: htt| 000001a0 70 3a 2f 2f 6c 6f 63 61 6c 68 6f 73 74 3a 38 30 |p://localhost:80| 000001b0 38 30 2f 70 6b 67 2f 0d 0a 41 63 63 65 70 74 2d |80/pkg/..Accept-| 000001c0 45 6e 63 6f 64 69 6e 67 3a 20 67 7a 69 70 2c 64 |Encoding: gzip,d| 000001d0 65 66 6c 61 74 65 2c 73 64 63 68 0d 0a 41 63 63 |eflate,sdch..Acc| 000001e0 65 70 74 2d 4c 61 6e 67 75 61 67 65 3a 20 65 6e |ept-Language: en| 000001f0 2d 55 53 2c 65 6e 3b 71 3d 30 2e 38 0d 0a 41 63 |-US,en;q=0.8..Ac| 00000200 63 65 70 74 2d 43 68 61 72 73 65 74 3a 20 49 53 |cept-Charset: IS| 00000210 4f 2d 38 38 35 39 2d 31 2c 75 74 66 2d 38 3b 71 |O-8859-1,utf-8;q| 00000220 3d 30 2e 37 2c 2a 3b 71 3d 30 2e 33 0d 0a 0d 0a |=0.7,*;q=0.3....| --- Layer 1 --- Loopback {Contents=[30, 0, 0, 0] Payload=[..556..] Family=IPv6} 00000000 1e 00 00 00 |....| --- Layer 2 --- IPv6 {Contents=[..40..] Payload=[..516..] Version=6 TrafficClass=0 FlowLabel=0 Length=516 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 00000000 60 00 00 00 02 04 06 40 00 00 00 00 00 00 00 00 |`......@........| 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 01 |........| --- Layer 3 --- TCP {Contents=[..32..] Payload=[..484..] SrcPort=58799 DstPort=8080(http-alt) Seq=144119398 Ack=174417647 DataOffset=8 FIN=false SYN=false RST=false PSH=true ACK=true URG=false ECE=false CWR=false NS=false Window=10473 Checksum=524 Urgent=0 Options=[TCPOption(NOP:), TCPOption(NOP:), TCPOption(Timestamps:96505084/96483468 0x05c08cfc05c0388c)] Padding=[]} 00000000 e5 af 1f 90 08 97 16 66 0a 65 66 ef 80 18 28 e9 |.......f.ef...(.| 00000010 02 0c 00 00 01 01 08 0a 05 c0 8c fc 05 c0 38 8c |..............8.| --- Layer 4 --- Payload 484 byte(s) 00000000 47 45 54 20 2f 70 6b 67 2f 67 69 74 68 75 62 2e |GET /pkg/github.| 00000010 63 6f 6d 2f 67 63 6f 6e 6e 65 6c 6c 2f 67 6f 70 |com/gconnell/gop| 00000020 61 63 6b 65 74 2f 20 48 54 54 50 2f 31 2e 31 0d |acket/ HTTP/1.1.| 00000030 0a 48 6f 73 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 |.Host: localhost| 00000040 3a 38 30 38 30 0d 0a 43 6f 6e 6e 65 63 74 69 6f |:8080..Connectio| 00000050 6e 3a 20 6b 65 65 70 2d 61 6c 69 76 65 0d 0a 43 |n: keep-alive..C| 00000060 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 6d 61 |ache-Control: ma| 00000070 78 2d 61 67 65 3d 30 0d 0a 55 73 65 72 2d 41 67 |x-age=0..User-Ag| 00000080 65 6e 74 3a 20 4d 6f 7a 69 6c 6c 61 2f 35 2e 30 |ent: Mozilla/5.0| 00000090 20 28 4d 61 63 69 6e 74 6f 73 68 3b 20 49 6e 74 | (Macintosh; Int| 000000a0 65 6c 20 4d 61 63 20 4f 53 20 58 20 31 30 5f 38 |el Mac OS X 10_8| 000000b0 5f 32 29 20 41 70 70 6c 65 57 65 62 4b 69 74 2f |_2) AppleWebKit/| 000000c0 35 33 37 2e 31 31 20 28 4b 48 54 4d 4c 2c 20 6c |537.11 (KHTML, l| 000000d0 69 6b 65 20 47 65 63 6b 6f 29 20 43 68 72 6f 6d |ike Gecko) Chrom| 000000e0 65 2f 32 33 2e 30 2e 31 32 37 31 2e 31 30 31 20 |e/23.0.1271.101 | 000000f0 53 61 66 61 72 69 2f 35 33 37 2e 31 31 0d 0a 41 |Safari/537.11..A| 00000100 63 63 65 70 74 3a 20 74 65 78 74 2f 68 74 6d 6c |ccept: text/html| 00000110 2c 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 68 74 |,application/xht| 00000120 6d 6c 2b 78 6d 6c 2c 61 70 70 6c 69 63 61 74 69 |ml+xml,applicati| 00000130 6f 6e 2f 78 6d 6c 3b 71 3d 30 2e 39 2c 2a 2f 2a |on/xml;q=0.9,*/*| 00000140 3b 71 3d 30 2e 38 0d 0a 52 65 66 65 72 65 72 3a |;q=0.8..Referer:| 00000150 20 68 74 74 70 3a 2f 2f 6c 6f 63 61 6c 68 6f 73 | http://localhos| 00000160 74 3a 38 30 38 30 2f 70 6b 67 2f 0d 0a 41 63 63 |t:8080/pkg/..Acc| 00000170 65 70 74 2d 45 6e 63 6f 64 69 6e 67 3a 20 67 7a |ept-Encoding: gz| 00000180 69 70 2c 64 65 66 6c 61 74 65 2c 73 64 63 68 0d |ip,deflate,sdch.| 00000190 0a 41 63 63 65 70 74 2d 4c 61 6e 67 75 61 67 65 |.Accept-Language| 000001a0 3a 20 65 6e 2d 55 53 2c 65 6e 3b 71 3d 30 2e 38 |: en-US,en;q=0.8| 000001b0 0d 0a 41 63 63 65 70 74 2d 43 68 61 72 73 65 74 |..Accept-Charset| 000001c0 3a 20 49 53 4f 2d 38 38 35 39 2d 31 2c 75 74 66 |: ISO-8859-1,utf| 000001d0 2d 38 3b 71 3d 30 2e 37 2c 2a 3b 71 3d 30 2e 33 |-8;q=0.7,*;q=0.3| 000001e0 0d 0a 0d 0a |....| pcap_test.go:110: -- FULL PACKET DATA (76 bytes) ------------------------------------ 00000000 1e 00 00 00 60 01 88 91 00 20 06 40 00 00 00 00 |....`.... .@....| 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 01 1f 90 e5 af |................| 00000030 0a 65 66 ef 08 97 18 4a 80 10 23 02 00 28 00 00 |.ef....J..#..(..| 00000040 01 01 08 0a 05 c0 8c fc 05 c0 8c fc |............| --- Layer 1 --- Loopback {Contents=[30, 0, 0, 0] Payload=[..72..] Family=IPv6} 00000000 1e 00 00 00 |....| --- Layer 2 --- IPv6 {Contents=[..40..] Payload=[..32..] Version=6 TrafficClass=0 FlowLabel=100497 Length=32 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 00000000 60 01 88 91 00 20 06 40 00 00 00 00 00 00 00 00 |`.... .@........| 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 01 |........| --- Layer 3 --- TCP {Contents=[..32..] Payload=[] SrcPort=8080(http-alt) DstPort=58799 Seq=174417647 Ack=144119882 DataOffset=8 FIN=false SYN=false RST=false PSH=false ACK=true URG=false ECE=false CWR=false NS=false Window=8962 Checksum=40 Urgent=0 Options=[TCPOption(NOP:), TCPOption(NOP:), TCPOption(Timestamps:96505084/96505084 0x05c08cfc05c08cfc)] Padding=[]} 00000000 1f 90 e5 af 0a 65 66 ef 08 97 18 4a 80 10 23 02 |.....ef....J..#.| 00000010 00 28 00 00 01 01 08 0a 05 c0 8c fc 05 c0 8c fc |.(..............| pcap_test.go:110: -- FULL PACKET DATA (4172 bytes) ------------------------------------ 00000000 1e 00 00 00 60 01 88 91 10 20 06 40 00 00 00 00 |....`.... .@....| 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 01 1f 90 e5 af |................| 00000030 0a 65 66 ef 08 97 18 4a 80 18 23 02 10 28 00 00 |.ef....J..#..(..| 00000040 01 01 08 0a 05 c0 8d b6 05 c0 8c fc 48 54 54 50 |............HTTP| 00000050 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 44 61 74 |/1.1 200 OK..Dat| 00000060 65 3a 20 53 75 6e 2c 20 30 36 20 4a 61 6e 20 32 |e: Sun, 06 Jan 2| 00000070 30 31 33 20 31 37 3a 32 32 3a 33 32 20 47 4d 54 |013 17:22:32 GMT| 00000080 0d 0a 54 72 61 6e 73 66 65 72 2d 45 6e 63 6f 64 |..Transfer-Encod| 00000090 69 6e 67 3a 20 63 68 75 6e 6b 65 64 0d 0a 43 6f |ing: chunked..Co| 000000a0 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 |ntent-Type: text| 000000b0 2f 68 74 6d 6c 3b 20 63 68 61 72 73 65 74 3d 75 |/html; charset=u| 000000c0 74 66 2d 38 0d 0a 0d 0a 32 30 30 0d 0a 3c 21 44 |tf-8....200.......| 00000130 20 20 3c 74 69 74 6c 65 3e 67 6f 70 61 63 6b 65 | gopacke| 00000140 74 20 2d 20 54 68 65 20 47 6f 20 50 72 6f 67 72 |t - The Go Progr| 00000150 61 6d 6d 69 6e 67 20 4c 61 6e 67 75 61 67 65 3c |amming Language<| 00000160 2f 74 69 74 6c 65 3e 0a 0a 3c 6c 69 6e 6b 20 74 |/title>..<link t| 00000170 79 70 65 3d 22 74 65 78 74 2f 63 73 73 22 20 72 |ype="text/css" r| 00000180 65 6c 3d 22 73 74 79 6c 65 73 68 65 65 74 22 20 |el="stylesheet" | 00000190 68 72 65 66 3d 22 2f 64 6f 63 2f 73 74 79 6c 65 |href="/doc/style| 000001a0 2e 63 73 73 22 3e 0a 3c 73 63 72 69 70 74 20 74 |.css">.<script t| 000001b0 79 70 65 3d 22 74 65 78 74 2f 6a 61 76 61 73 63 |ype="text/javasc| 000001c0 72 69 70 74 22 20 73 72 63 3d 22 2f 64 6f 63 2f |ript" src="/doc/| 000001d0 67 6f 64 6f 63 73 2e 6a 73 22 3e 3c 2f 73 63 72 |godocs.js"></scr| 000001e0 69 70 74 3e 0a 0a 3c 2f 68 65 61 64 3e 0a 3c 62 |ipt>..</head>.<b| 000001f0 6f 64 79 3e 0a 0a 3c 64 69 76 20 69 64 3d 22 74 |ody>..<div id="t| 00000200 6f 70 62 61 72 22 3e 3c 64 69 76 20 63 6c 61 73 |opbar"><div clas| 00000210 73 3d 22 63 6f 6e 74 61 69 6e 65 72 20 77 69 64 |s="container wid| 00000220 65 22 3e 0a 0a 3c 66 6f 72 6d 20 6d 65 74 68 6f |e">..<form metho| 00000230 64 3d 22 47 45 54 22 20 61 63 74 69 6f 6e 3d 22 |d="GET" action="| 00000240 2f 73 65 61 72 63 68 22 3e 0a 3c 64 69 76 20 69 |/search">.<div i| 00000250 64 3d 22 6d 65 6e 75 22 3e 0a 3c 61 20 68 72 65 |d="menu">.<a hre| 00000260 66 3d 22 2f 64 6f 63 2f 22 3e 44 6f 63 75 6d 65 |f="/doc/">Docume| 00000270 6e 74 73 3c 2f 61 3e 0a 3c 61 20 68 72 65 66 3d |nts</a>.<a href=| 00000280 22 2f 72 65 66 2f 22 3e 52 65 66 65 72 65 6e 63 |"/ref/">Referenc| 00000290 65 73 3c 2f 61 3e 0a 3c 61 20 68 72 65 66 3d 22 |es</a>.<a href="| 000002a0 2f 70 6b 67 2f 22 3e 50 61 63 6b 61 67 65 73 3c |/pkg/">Packages<| 000002b0 2f 61 3e 0a 3c 61 20 68 72 65 66 3d 22 2f 70 72 |/a>.<a href="/pr| 000002c0 6f 6a 65 63 74 2f 22 3e 54 68 65 20 50 0d 0a 64 |oject/">The P..d| 000002d0 65 0d 0a 72 6f 6a 65 63 74 3c 2f 61 3e 0a 3c 61 |e..roject</a>.<a| 000002e0 20 68 72 65 66 3d 22 2f 68 65 6c 70 2f 22 3e 48 | href="/help/">H| 000002f0 65 6c 70 3c 2f 61 3e 0a 3c 69 6e 70 75 74 20 74 |elp</a>.<input t| 00000300 79 70 65 3d 22 74 65 78 74 22 20 69 64 3d 22 73 |ype="text" id="s| 00000310 65 61 72 63 68 22 20 6e 61 6d 65 3d 22 71 22 20 |earch" name="q" | 00000320 63 6c 61 73 73 3d 22 69 6e 61 63 74 69 76 65 22 |class="inactive"| 00000330 20 76 61 6c 75 65 3d 22 53 65 61 72 63 68 22 3e | value="Search">| 00000340 0a 3c 2f 64 69 76 3e 0a 3c 64 69 76 20 69 64 3d |.</div>.<div id=| 00000350 22 68 65 61 64 69 6e 67 22 3e 3c 61 20 68 72 65 |"heading"><a hre| 00000360 66 3d 22 2f 22 3e 54 68 65 20 47 6f 20 50 72 6f |f="/">The Go Pro| 00000370 67 72 61 6d 6d 69 6e 67 20 4c 61 6e 67 75 61 67 |gramming Languag| 00000380 65 3c 2f 61 3e 3c 2f 64 69 76 3e 0a 3c 2f 66 6f |e</a></div>.</fo| 00000390 72 6d 3e 0a 0a 3c 2f 64 69 76 3e 3c 2f 64 69 76 |rm>..</div></div| 000003a0 3e 0a 0a 3c 64 69 76 20 69 64 3d 22 70 61 67 65 |>..<div id="page| 000003b0 22 0d 0a 64 0d 0a 20 63 6c 61 73 73 3d 22 77 69 |"..d.. class="wi| 000003c0 64 65 22 0d 0a 33 0d 0a 3e 0a 0a 0d 0a 35 38 0d |de"..3..>....58.| 000003d0 0a 0a 20 20 3c 64 69 76 20 69 64 3d 22 70 6c 75 |.. <div id="plu| 000003e0 73 6f 6e 65 22 3e 3c 67 3a 70 6c 75 73 6f 6e 65 |sone"><g:plusone| 000003f0 20 73 69 7a 65 3d 22 73 6d 61 6c 6c 22 20 61 6e | size="small" an| 00000400 6e 6f 74 61 74 69 6f 6e 3d 22 6e 6f 6e 65 22 3e |notation="none">| 00000410 3c 2f 67 3a 70 6c 75 73 6f 6e 65 3e 3c 2f 64 69 |</g:plusone></di| 00000420 76 3e 0a 20 20 3c 68 31 3e 0d 0a 31 30 0d 0a 50 |v>. <h1>..10..P| 00000430 61 63 6b 61 67 65 20 67 6f 70 61 63 6b 65 74 0d |ackage gopacket.| 00000440 0a 36 0d 0a 3c 2f 68 31 3e 0a 0d 0a 31 0d 0a 0a |.6..</h1>...1...| 00000450 0d 0a 32 0d 0a 0a 0a 0d 0a 31 37 0d 0a 0a 3c 64 |..2......17...<d| 00000460 69 76 20 69 64 3d 22 6e 61 76 22 3e 3c 2f 64 69 |iv id="nav"></di| 00000470 76 3e 0a 0a 0d 0a 31 0d 0a 0a 0d 0a 63 65 39 34 |v>....1.....ce94| 00000480 0d 0a 3c 21 2d 2d 0a 09 43 6f 70 79 72 69 67 68 |..<!--..Copyrigh| 00000490 74 20 32 30 30 39 20 54 68 65 20 47 6f 20 41 75 |t 2009 The Go Au| 000004a0 74 68 6f 72 73 2e 20 41 6c 6c 20 72 69 67 68 74 |thors. All right| 000004b0 73 20 72 65 73 65 72 76 65 64 2e 0a 09 55 73 65 |s reserved...Use| 000004c0 20 6f 66 20 74 68 69 73 20 73 6f 75 72 63 65 20 | of this source | 000004d0 63 6f 64 65 20 69 73 20 67 6f 76 65 72 6e 65 64 |code is governed| 000004e0 20 62 79 20 61 20 42 53 44 2d 73 74 79 6c 65 0a | by a BSD-style.| 000004f0 09 6c 69 63 65 6e 73 65 20 74 68 61 74 20 63 61 |.license that ca| 00000500 6e 20 62 65 20 66 6f 75 6e 64 20 69 6e 20 74 68 |n be found in th| 00000510 65 20 4c 49 43 45 4e 53 45 20 66 69 6c 65 2e 0a |e LICENSE file..| 00000520 2d 2d 3e 0a 3c 21 2d 2d 0a 09 4e 6f 74 65 3a 20 |-->.<!--..Note: | 00000530 53 74 61 74 69 63 20 28 69 2e 65 2e 2c 20 6e 6f |Static (i.e., no| 00000540 74 20 74 65 6d 70 6c 61 74 65 2d 67 65 6e 65 72 |t template-gener| 00000550 61 74 65 64 29 20 68 72 65 66 20 61 6e 64 20 69 |ated) href and i| 00000560 64 0a 09 61 74 74 72 69 62 75 74 65 73 20 73 74 |d..attributes st| 00000570 61 72 74 20 77 69 74 68 20 22 70 6b 67 2d 22 20 |art with "pkg-" | 00000580 74 6f 20 6d 61 6b 65 20 69 74 20 69 6d 70 6f 73 |to make it impos| 00000590 73 69 62 6c 65 20 66 6f 72 0a 09 74 68 65 6d 20 |sible for..them | 000005a0 74 6f 20 63 6f 6e 66 6c 69 63 74 20 77 69 74 68 |to conflict with| 000005b0 20 67 65 6e 65 72 61 74 65 64 20 61 74 74 72 69 | generated attri| 000005c0 62 75 74 65 73 20 28 73 6f 6d 65 20 6f 66 20 77 |butes (some of w| 000005d0 68 69 63 68 0a 09 63 6f 72 72 65 73 70 6f 6e 64 |hich..correspond| 000005e0 20 74 6f 20 47 6f 20 69 64 65 6e 74 69 66 69 65 | to Go identifie| 000005f0 72 73 29 2e 0a 2d 2d 3e 0a 0a 09 0a 09 09 3c 64 |rs)..-->......<d| 00000600 69 76 20 69 64 3d 22 73 68 6f 72 74 2d 6e 61 76 |iv id="short-nav| 00000610 22 3e 0a 09 09 09 3c 64 6c 3e 0a 09 09 09 3c 64 |">....<dl>....<d| 00000620 64 3e 3c 63 6f 64 65 3e 69 6d 70 6f 72 74 20 22 |d><code>import "| 00000630 67 69 74 68 75 62 2e 63 6f 6d 2f 67 63 6f 6e 6e |github.com/gconn| 00000640 65 6c 6c 2f 67 6f 70 61 63 6b 65 74 22 3c 2f 63 |ell/gopacket"</c| 00000650 6f 64 65 3e 3c 2f 64 64 3e 0a 09 09 09 3c 2f 64 |ode></dd>....</d| 00000660 6c 3e 0a 09 09 09 3c 64 6c 3e 0a 09 09 09 3c 64 |l>....<dl>....<d| 00000670 64 3e 3c 61 20 68 72 65 66 3d 22 23 70 6b 67 2d |d><a href="#pkg-| 00000680 6f 76 65 72 76 69 65 77 22 20 63 6c 61 73 73 3d |overview" class=| 00000690 22 6f 76 65 72 76 69 65 77 4c 69 6e 6b 22 3e 4f |"overviewLink">O| 000006a0 76 65 72 76 69 65 77 3c 2f 61 3e 3c 2f 64 64 3e |verview</a></dd>| 000006b0 0a 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d |....<dd><a href=| 000006c0 22 23 70 6b 67 2d 69 6e 64 65 78 22 3e 49 6e 64 |"#pkg-index">Ind| 000006d0 65 78 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 0a |ex</a></dd>.....| 000006e0 09 09 09 0a 09 09 09 0a 09 09 09 09 3c 64 64 3e |............<dd>| 000006f0 3c 61 20 68 72 65 66 3d 22 23 70 6b 67 2d 73 75 |<a href="#pkg-su| 00000700 62 64 69 72 65 63 74 6f 72 69 65 73 22 3e 53 75 |bdirectories">Su| 00000710 62 64 69 72 65 63 74 6f 72 69 65 73 3c 2f 61 3e |bdirectories</a>| 00000720 3c 2f 64 64 3e 0a 09 09 09 0a 09 09 09 3c 2f 64 |</dd>........</d| 00000730 6c 3e 0a 09 09 3c 2f 64 69 76 3e 0a 09 09 3c 21 |l>...</div>...<!| 00000740 2d 2d 20 54 68 65 20 70 61 63 6b 61 67 65 27 73 |-- The package's| 00000750 20 4e 61 6d 65 20 69 73 20 70 72 69 6e 74 65 64 | Name is printed| 00000760 20 61 73 20 74 69 74 6c 65 20 62 79 20 74 68 65 | as title by the| 00000770 20 74 6f 70 2d 6c 65 76 65 6c 20 74 65 6d 70 6c | top-level templ| 00000780 61 74 65 20 2d 2d 3e 0a 09 09 3c 64 69 76 20 69 |ate -->...<div i| 00000790 64 3d 22 70 6b 67 2d 6f 76 65 72 76 69 65 77 22 |d="pkg-overview"| 000007a0 20 63 6c 61 73 73 3d 22 74 6f 67 67 6c 65 56 69 | class="toggleVi| 000007b0 73 69 62 6c 65 22 3e 0a 09 09 09 3c 64 69 76 20 |sible">....<div | 000007c0 63 6c 61 73 73 3d 22 63 6f 6c 6c 61 70 73 65 64 |class="collapsed| 000007d0 22 3e 0a 09 09 09 09 3c 68 32 20 63 6c 61 73 73 |">.....<h2 class| 000007e0 3d 22 74 6f 67 67 6c 65 42 75 74 74 6f 6e 22 20 |="toggleButton" | 000007f0 74 69 74 6c 65 3d 22 43 6c 69 63 6b 20 74 6f 20 |title="Click to | 00000800 73 68 6f 77 20 4f 76 65 72 76 69 65 77 20 73 65 |show Overview se| 00000810 63 74 69 6f 6e 22 3e 4f 76 65 72 76 69 65 77 20 |ction">Overview | 00000820 e2 96 b9 3c 2f 68 32 3e 0a 09 09 09 3c 2f 64 69 |...</h2>....</di| 00000830 76 3e 0a 09 09 09 3c 64 69 76 20 63 6c 61 73 73 |v>....<div class| 00000840 3d 22 65 78 70 61 6e 64 65 64 22 3e 0a 09 09 09 |="expanded">....| 00000850 09 3c 68 32 20 63 6c 61 73 73 3d 22 74 6f 67 67 |.<h2 class="togg| 00000860 6c 65 42 75 74 74 6f 6e 22 20 74 69 74 6c 65 3d |leButton" title=| 00000870 22 43 6c 69 63 6b 20 74 6f 20 68 69 64 65 20 4f |"Click to hide O| 00000880 76 65 72 76 69 65 77 20 73 65 63 74 69 6f 6e 22 |verview section"| 00000890 3e 4f 76 65 72 76 69 65 77 20 e2 96 be 3c 2f 68 |>Overview ...</h| 000008a0 32 3e 0a 09 09 09 09 3c 70 3e 0a 50 61 63 6b 61 |2>.....<p>.Packa| 000008b0 67 65 20 67 6f 70 61 63 6b 65 74 20 70 72 6f 76 |ge gopacket prov| 000008c0 69 64 65 73 20 70 61 63 6b 65 74 20 64 65 63 6f |ides packet deco| 000008d0 64 69 6e 67 20 66 6f 72 20 74 68 65 20 47 6f 20 |ding for the Go | 000008e0 6c 61 6e 67 75 61 67 65 2e 0a 3c 2f 70 3e 0a 3c |language..</p>.<| 000008f0 70 3e 0a 67 6f 70 61 63 6b 65 74 20 63 6f 6e 74 |p>.gopacket cont| 00000900 61 69 6e 73 20 33 20 73 75 62 2d 70 61 63 6b 61 |ains 3 sub-packa| 00000910 67 65 73 20 77 69 74 68 20 61 64 64 69 74 69 6f |ges with additio| 00000920 6e 61 6c 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 |nal functionalit| 00000930 79 20 79 6f 75 20 6d 61 79 20 66 69 6e 64 0a 75 |y you may find.u| 00000940 73 65 66 75 6c 3a 0a 3c 2f 70 3e 0a 3c 70 72 65 |seful:.</p>.<pre| 00000950 3e 2a 20 6c 61 79 65 72 73 3a 20 59 6f 75 26 23 |>* layers: You&#| 00000960 33 39 3b 6c 6c 20 70 72 6f 62 61 62 6c 79 20 75 |39;ll probably u| 00000970 73 65 20 74 68 69 73 20 65 76 65 72 79 20 74 69 |se this every ti| 00000980 6d 65 2e 20 20 54 68 69 73 20 63 6f 6e 74 61 69 |me. This contai| 00000990 6e 73 20 6f 66 20 74 68 65 20 6c 6f 67 69 63 0a |ns of the logic.| 000009a0 20 20 20 20 62 75 69 6c 74 20 69 6e 74 6f 20 67 | built into g| 000009b0 6f 70 61 63 6b 65 74 20 66 6f 72 20 64 65 63 6f |opacket for deco| 000009c0 64 69 6e 67 20 70 61 63 6b 65 74 20 70 72 6f 74 |ding packet prot| 000009d0 6f 63 6f 6c 73 2e 20 20 4e 6f 74 65 20 74 68 61 |ocols. Note tha| 000009e0 74 20 61 6c 6c 20 65 78 61 6d 70 6c 65 0a 20 20 |t all example. | 000009f0 20 20 63 6f 64 65 20 62 65 6c 6f 77 20 61 73 73 | code below ass| 00000a00 75 6d 65 73 20 74 68 61 74 20 79 6f 75 20 68 61 |umes that you ha| 00000a10 76 65 20 69 6d 70 6f 72 74 65 64 20 62 6f 74 68 |ve imported both| 00000a20 20 67 6f 70 61 63 6b 65 74 20 61 6e 64 0a 20 20 | gopacket and. | 00000a30 20 20 67 6f 70 61 63 6b 65 74 2f 6c 61 79 65 72 | gopacket/layer| 00000a40 73 2e 0a 2a 20 70 63 61 70 3a 20 43 20 62 69 6e |s..* pcap: C bin| 00000a50 64 69 6e 67 73 20 74 6f 20 75 73 65 20 6c 69 62 |dings to use lib| 00000a60 70 63 61 70 20 74 6f 20 70 75 6c 6c 20 70 61 63 |pcap to pull pac| 00000a70 6b 65 74 73 20 6f 66 66 20 74 68 65 20 77 69 72 |kets off the wir| 00000a80 65 2e 0a 2a 20 70 66 72 69 6e 67 3a 20 43 20 62 |e..* pfring: C b| 00000a90 69 6e 64 69 6e 67 73 20 74 6f 20 75 73 65 20 50 |indings to use P| 00000aa0 46 5f 52 49 4e 47 20 74 6f 20 70 75 6c 6c 20 70 |F_RING to pull p| 00000ab0 61 63 6b 65 74 73 20 6f 66 66 20 74 68 65 20 77 |ackets off the w| 00000ac0 69 72 65 2e 0a 3c 2f 70 72 65 3e 0a 3c 68 33 20 |ire..</pre>.<h3 | 00000ad0 69 64 3d 22 42 61 73 69 63 5f 55 73 61 67 65 22 |id="Basic_Usage"| 00000ae0 3e 42 61 73 69 63 20 55 73 61 67 65 3c 2f 68 33 |>Basic Usage</h3| 00000af0 3e 0a 3c 70 3e 0a 67 6f 70 61 63 6b 65 74 20 74 |>.<p>.gopacket t| 00000b00 61 6b 65 73 20 69 6e 20 70 61 63 6b 65 74 20 64 |akes in packet d| 00000b10 61 74 61 20 61 73 20 61 20 5b 5d 62 79 74 65 20 |ata as a []byte | 00000b20 61 6e 64 20 64 65 63 6f 64 65 73 20 69 74 20 69 |and decodes it i| 00000b30 6e 74 6f 20 61 20 70 61 63 6b 65 74 20 77 69 74 |nto a packet wit| 00000b40 68 0a 61 20 6e 6f 6e 2d 7a 65 72 6f 20 6e 75 6d |h.a non-zero num| 00000b50 62 65 72 20 6f 66 20 26 23 33 34 3b 6c 61 79 65 |ber of "laye| 00000b60 72 73 26 23 33 34 3b 2e 20 20 45 61 63 68 20 6c |rs". Each l| 00000b70 61 79 65 72 20 63 6f 72 72 65 73 70 6f 6e 64 73 |ayer corresponds| 00000b80 20 74 6f 20 61 20 70 72 6f 74 6f 63 6f 6c 0a 77 | to a protocol.w| 00000b90 69 74 68 69 6e 20 74 68 65 20 62 79 74 65 73 2e |ithin the bytes.| 00000ba0 20 20 4f 6e 63 65 20 61 20 70 61 63 6b 65 74 20 | Once a packet | 00000bb0 68 61 73 20 62 65 65 6e 20 64 65 63 6f 64 65 64 |has been decoded| 00000bc0 2c 20 74 68 65 20 6c 61 79 65 72 73 20 6f 66 20 |, the layers of | 00000bd0 74 68 65 20 70 61 63 6b 65 74 0a 63 61 6e 20 62 |the packet.can b| 00000be0 65 20 72 65 71 75 65 73 74 65 64 20 66 72 6f 6d |e requested from| 00000bf0 20 74 68 65 20 70 61 63 6b 65 74 2e 0a 3c 2f 70 | the packet..</p| 00000c00 3e 0a 3c 70 72 65 3e 2f 2f 20 44 65 63 6f 64 65 |>.<pre>// Decode| 00000c10 20 61 20 70 61 63 6b 65 74 0a 70 61 63 6b 65 74 | a packet.packet| 00000c20 20 3a 3d 20 67 6f 70 61 63 6b 65 74 2e 4e 65 77 | := gopacket.New| 00000c30 50 61 63 6b 65 74 28 6d 79 50 61 63 6b 65 74 44 |Packet(myPacketD| 00000c40 61 74 61 2c 20 6c 61 79 65 72 73 2e 4c 61 79 65 |ata, layers.Laye| 00000c50 72 54 79 70 65 45 74 68 65 72 6e 65 74 2c 20 67 |rTypeEthernet, g| 00000c60 6f 70 61 63 6b 65 74 2e 44 65 66 61 75 6c 74 29 |opacket.Default)| 00000c70 0a 2f 2f 20 47 65 74 20 74 68 65 20 54 43 50 20 |.// Get the TCP | 00000c80 6c 61 79 65 72 20 66 72 6f 6d 20 74 68 69 73 20 |layer from this | 00000c90 70 61 63 6b 65 74 0a 69 66 20 74 63 70 4c 61 79 |packet.if tcpLay| 00000ca0 65 72 20 3a 3d 20 70 61 63 6b 65 74 2e 4c 61 79 |er := packet.Lay| 00000cb0 65 72 28 6c 61 79 65 72 73 2e 4c 61 79 65 72 54 |er(layers.LayerT| 00000cc0 79 70 65 54 43 50 29 3b 20 74 63 70 4c 61 79 65 |ypeTCP); tcpLaye| 00000cd0 72 20 21 3d 20 6e 69 6c 20 7b 0a 20 20 66 6d 74 |r != nil {. fmt| 00000ce0 2e 50 72 69 6e 74 6c 6e 28 26 23 33 34 3b 54 68 |.Println("Th| 00000cf0 69 73 20 69 73 20 61 20 54 43 50 20 70 61 63 6b |is is a TCP pack| 00000d00 65 74 21 26 23 33 34 3b 29 0a 20 20 2f 2f 20 47 |et!"). // G| 00000d10 65 74 20 61 63 74 75 61 6c 20 54 43 50 20 64 61 |et actual TCP da| 00000d20 74 61 20 66 72 6f 6d 20 74 68 69 73 20 6c 61 79 |ta from this lay| 00000d30 65 72 0a 20 20 74 63 70 2c 20 5f 20 3a 3d 20 74 |er. tcp, _ := t| 00000d40 63 70 4c 61 79 65 72 2e 28 2a 6c 61 79 65 72 73 |cpLayer.(*layers| 00000d50 2e 54 43 50 29 0a 20 20 66 6d 74 2e 50 72 69 6e |.TCP). fmt.Prin| 00000d60 74 66 28 26 23 33 34 3b 46 72 6f 6d 20 73 72 63 |tf("From src| 00000d70 20 70 6f 72 74 20 25 64 20 74 6f 20 64 73 74 20 | port %d to dst | 00000d80 70 6f 72 74 20 25 64 5c 6e 26 23 33 34 3b 2c 20 |port %d\n", | 00000d90 74 63 70 2e 53 72 63 50 6f 72 74 2c 20 74 63 70 |tcp.SrcPort, tcp| 00000da0 2e 44 73 74 50 6f 72 74 29 0a 7d 0a 2f 2f 20 49 |.DstPort).}.// I| 00000db0 74 65 72 61 74 65 20 6f 76 65 72 20 61 6c 6c 20 |terate over all | 00000dc0 6c 61 79 65 72 73 2c 20 70 72 69 6e 74 69 6e 67 |layers, printing| 00000dd0 20 6f 75 74 20 65 61 63 68 20 6c 61 79 65 72 20 | out each layer | 00000de0 74 79 70 65 0a 66 6f 72 20 6c 61 79 65 72 20 3a |type.for layer :| 00000df0 3d 20 72 61 6e 67 65 20 70 61 63 6b 65 74 2e 4c |= range packet.L| 00000e00 61 79 65 72 73 28 29 20 7b 0a 20 20 66 6d 74 2e |ayers() {. fmt.| 00000e10 50 72 69 6e 74 6c 6e 28 26 23 33 34 3b 50 41 43 |Println("PAC| 00000e20 4b 45 54 20 4c 41 59 45 52 3a 26 23 33 34 3b 2c |KET LAYER:",| 00000e30 20 6c 61 79 65 72 2e 4c 61 79 65 72 54 79 70 65 | layer.LayerType| 00000e40 28 29 29 0a 7d 0a 3c 2f 70 72 65 3e 0a 3c 70 3e |()).}.</pre>.<p>| 00000e50 0a 50 61 63 6b 65 74 73 20 63 61 6e 20 62 65 20 |.Packets can be | 00000e60 64 65 63 6f 64 65 64 20 66 72 6f 6d 20 61 20 6e |decoded from a n| 00000e70 75 6d 62 65 72 20 6f 66 20 73 74 61 72 74 69 6e |umber of startin| 00000e80 67 20 70 6f 69 6e 74 73 2e 20 20 4d 61 6e 79 20 |g points. Many | 00000e90 6f 66 20 6f 75 72 20 62 61 73 65 0a 74 79 70 65 |of our base.type| 00000ea0 73 20 69 6d 70 6c 65 6d 65 6e 74 20 44 65 63 6f |s implement Deco| 00000eb0 64 65 72 2c 20 77 68 69 63 68 20 61 6c 6c 6f 77 |der, which allow| 00000ec0 20 75 73 20 74 6f 20 64 65 63 6f 64 65 20 70 61 | us to decode pa| 00000ed0 63 6b 65 74 73 20 66 6f 72 20 77 68 69 63 68 0a |ckets for which.| 00000ee0 77 65 20 64 6f 6e 26 23 33 39 3b 74 20 68 61 76 |we don't hav| 00000ef0 65 20 66 75 6c 6c 20 64 61 74 61 2e 0a 3c 2f 70 |e full data..</p| 00000f00 3e 0a 3c 70 72 65 3e 2f 2f 20 44 65 63 6f 64 65 |>.<pre>// Decode| 00000f10 20 61 6e 20 65 74 68 65 72 6e 65 74 20 70 61 63 | an ethernet pac| 00000f20 6b 65 74 0a 65 74 68 50 20 3a 3d 20 67 6f 70 61 |ket.ethP := gopa| 00000f30 63 6b 65 74 2e 4e 65 77 50 61 63 6b 65 74 28 70 |cket.NewPacket(p| 00000f40 31 2c 20 6c 61 79 65 72 73 2e 4c 61 79 65 72 54 |1, layers.LayerT| 00000f50 79 70 65 45 74 68 65 72 6e 65 74 2c 20 67 6f 70 |ypeEthernet, gop| 00000f60 61 63 6b 65 74 2e 44 65 66 61 75 6c 74 29 0a 2f |acket.Default)./| 00000f70 2f 20 44 65 63 6f 64 65 20 61 6e 20 49 50 76 36 |/ Decode an IPv6| 00000f80 20 68 65 61 64 65 72 20 61 6e 64 20 65 76 65 72 | header and ever| 00000f90 79 74 68 69 6e 67 20 69 74 20 63 6f 6e 74 61 69 |ything it contai| 00000fa0 6e 73 0a 69 70 50 20 3a 3d 20 67 6f 70 61 63 6b |ns.ipP := gopack| 00000fb0 65 74 2e 4e 65 77 50 61 63 6b 65 74 28 70 32 2c |et.NewPacket(p2,| 00000fc0 20 6c 61 79 65 72 73 2e 4c 61 79 65 72 54 79 70 | layers.LayerTyp| 00000fd0 65 49 50 76 36 2c 20 67 6f 70 61 63 6b 65 74 2e |eIPv6, gopacket.| 00000fe0 44 65 66 61 75 6c 74 29 0a 2f 2f 20 44 65 63 6f |Default).// Deco| 00000ff0 64 65 20 61 20 54 43 50 20 68 65 61 64 65 72 20 |de a TCP header | 00001000 61 6e 64 20 69 74 73 20 70 61 79 6c 6f 61 64 0a |and its payload.| 00001010 74 63 70 50 20 3a 3d 20 67 6f 70 61 63 6b 65 74 |tcpP := gopacket| 00001020 2e 4e 65 77 50 61 63 6b 65 74 28 70 33 2c 20 6c |.NewPacket(p3, l| 00001030 61 79 65 72 73 2e 4c 61 79 65 72 54 79 70 65 54 |ayers.LayerTypeT| 00001040 43 50 2c 20 67 6f 70 61 63 6b 65 74 |CP, gopacket| --- Layer 1 --- Loopback {Contents=[30, 0, 0, 0] Payload=[..4168..] Family=IPv6} 00000000 1e 00 00 00 |....| --- Layer 2 --- IPv6 {Contents=[..40..] Payload=[..4128..] Version=6 TrafficClass=0 FlowLabel=100497 Length=4128 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 00000000 60 01 88 91 10 20 06 40 00 00 00 00 00 00 00 00 |`.... .@........| 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 01 |........| --- Layer 3 --- TCP {Contents=[..32..] Payload=[..4096..] SrcPort=8080(http-alt) DstPort=58799 Seq=174417647 Ack=144119882 DataOffset=8 FIN=false SYN=false RST=false PSH=true ACK=true URG=false ECE=false CWR=false NS=false Window=8962 Checksum=4136 Urgent=0 Options=[TCPOption(NOP:), TCPOption(NOP:), TCPOption(Timestamps:96505270/96505084 0x05c08db605c08cfc)] Padding=[]} 00000000 1f 90 e5 af 0a 65 66 ef 08 97 18 4a 80 18 23 02 |.....ef....J..#.| 00000010 10 28 00 00 01 01 08 0a 05 c0 8d b6 05 c0 8c fc |.(..............| --- Layer 4 --- Payload 4096 byte(s) 00000000 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d |HTTP/1.1 200 OK.| 00000010 0a 44 61 74 65 3a 20 53 75 6e 2c 20 30 36 20 4a |.Date: Sun, 06 J| 00000020 61 6e 20 32 30 31 33 20 31 37 3a 32 32 3a 33 32 |an 2013 17:22:32| 00000030 20 47 4d 54 0d 0a 54 72 61 6e 73 66 65 72 2d 45 | GMT..Transfer-E| 00000040 6e 63 6f 64 69 6e 67 3a 20 63 68 75 6e 6b 65 64 |ncoding: chunked| 00000050 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 |..Content-Type: | 00000060 74 65 78 74 2f 68 74 6d 6c 3b 20 63 68 61 72 73 |text/html; chars| 00000070 65 74 3d 75 74 66 2d 38 0d 0a 0d 0a 32 30 30 0d |et=utf-8....200.| 00000080 0a 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e |.<!DOCTYPE html>| 00000090 0a 3c 68 74 6d 6c 3e 0a 3c 68 65 61 64 3e 0a 3c |.<html>.<head>.<| 000000a0 6d 65 74 61 20 68 74 74 70 2d 65 71 75 69 76 3d |meta http-equiv=| 000000b0 22 43 6f 6e 74 65 6e 74 2d 54 79 70 65 22 20 63 |"Content-Type" c| 000000c0 6f 6e 74 65 6e 74 3d 22 74 65 78 74 2f 68 74 6d |ontent="text/htm| 000000d0 6c 3b 20 63 68 61 72 73 65 74 3d 75 74 66 2d 38 |l; charset=utf-8| 000000e0 22 3e 0a 0a 20 20 3c 74 69 74 6c 65 3e 67 6f 70 |">.. <title>gop| 000000f0 61 63 6b 65 74 20 2d 20 54 68 65 20 47 6f 20 50 |acket - The Go P| 00000100 72 6f 67 72 61 6d 6d 69 6e 67 20 4c 61 6e 67 75 |rogramming Langu| 00000110 61 67 65 3c 2f 74 69 74 6c 65 3e 0a 0a 3c 6c 69 |age...<| 00000190 2f 73 63 72 69 70 74 3e 0a 0a 3c 2f 68 65 61 64 |/script>.....
.The Go| 00000320 20 50 72 6f 67 72 61 6d 6d 69 6e 67 20 4c 61 6e | Programming Lan| 00000330 67 75 61 67 65 3c 2f 61 3e 3c 2f 64 69 76 3e 0a |guage
.| 00000340 3c 2f 66 6f 72 6d 3e 0a 0a 3c 2f 64 69 76 3e 3c |..<| 00000350 2f 64 69 76 3e 0a 0a 3c 64 69 76 20 69 64 3d 22 |/div>..
...| 00000380 0a 35 38 0d 0a 0a 20 20 3c 64 69 76 20 69 64 3d |.58...
| 000003d0 3c 2f 64 69 76 3e 0a 20 20 3c 68 31 3e 0d 0a 31 |
.

..1| 000003e0 30 0d 0a 50 61 63 6b 61 67 65 20 67 6f 70 61 63 |0..Package gopac| 000003f0 6b 65 74 0d 0a 36 0d 0a 3c 2f 68 31 3e 0a 0d 0a |ket..6..

...| 00000400 31 0d 0a 0a 0d 0a 32 0d 0a 0a 0a 0d 0a 31 37 0d |1.....2......17.| 00000410 0a 0a 3c 64 69 76 20 69 64 3d 22 6e 61 76 22 3e |......1.....| 00000430 63 65 39 34 0d 0a 3c 21 2d 2d 0a 09 43 6f 70 79 |ce94.......| 000005b0 09 09 3c 64 69 76 20 69 64 3d 22 73 68 6f 72 74 |..
....
..| 000005d0 09 09 3c 64 64 3e 3c 63 6f 64 65 3e 69 6d 70 6f |..
impo| 000005e0 72 74 20 22 67 69 74 68 75 62 2e 63 6f 6d 2f 67 |rt "github.com/g| 000005f0 63 6f 6e 6e 65 6c 6c 2f 67 6f 70 61 63 6b 65 74 |connell/gopacket| 00000600 22 3c 2f 63 6f 64 65 3e 3c 2f 64 64 3e 0a 09 09 |"
...| 00000610 09 3c 2f 64 6c 3e 0a 09 09 09 3c 64 6c 3e 0a 09 |.
....
..| 00000620 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 |..
Overview<| 00000660 2f 64 64 3e 0a 09 09 09 3c 64 64 3e 3c 61 20 68 |/dd>....
Index
.| 00000690 09 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 09 |................| 000006a0 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 70 6b |
Subdirectories| 000006d0 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 0a 09 09 |
.......| 000006e0 09 3c 2f 64 6c 3e 0a 09 09 3c 2f 64 69 76 3e 0a |.
...
.| 000006f0 09 09 3c 21 2d 2d 20 54 68 65 20 70 61 63 6b 61 |.........<| 00000770 64 69 76 20 63 6c 61 73 73 3d 22 63 6f 6c 6c 61 |div class="colla| 00000780 70 73 65 64 22 3e 0a 09 09 09 09 3c 68 32 20 63 |psed">.....

Overv| 000007d0 69 65 77 20 e2 96 b9 3c 2f 68 32 3e 0a 09 09 09 |iew ...

....| 000007e0 3c 2f 64 69 76 3e 0a 09 09 09 3c 64 69 76 20 63 |
....
| 00000800 0a 09 09 09 09 3c 68 32 20 63 6c 61 73 73 3d 22 |.....

Overview ..| 00000850 be 3c 2f 68 32 3e 0a 09 09 09 09 3c 70 3e 0a 50 |.

.....

.P| 00000860 61 63 6b 61 67 65 20 67 6f 70 61 63 6b 65 74 20 |ackage gopacket | 00000870 70 72 6f 76 69 64 65 73 20 70 61 63 6b 65 74 20 |provides packet | 00000880 64 65 63 6f 64 69 6e 67 20 66 6f 72 20 74 68 65 |decoding for the| 00000890 20 47 6f 20 6c 61 6e 67 75 61 67 65 2e 0a 3c 2f | Go language...

.gopacket | 000008b0 63 6f 6e 74 61 69 6e 73 20 33 20 73 75 62 2d 70 |contains 3 sub-p| 000008c0 61 63 6b 61 67 65 73 20 77 69 74 68 20 61 64 64 |ackages with add| 000008d0 69 74 69 6f 6e 61 6c 20 66 75 6e 63 74 69 6f 6e |itional function| 000008e0 61 6c 69 74 79 20 79 6f 75 20 6d 61 79 20 66 69 |ality you may fi| 000008f0 6e 64 0a 75 73 65 66 75 6c 3a 0a 3c 2f 70 3e 0a |nd.useful:.

.| 00000900 3c 70 72 65 3e 2a 20 6c 61 79 65 72 73 3a 20 59 |
* layers: Y|
        00000910  6f 75 26 23 33 39 3b 6c  6c 20 70 72 6f 62 61 62  |ou'll probab|
        00000920  6c 79 20 75 73 65 20 74  68 69 73 20 65 76 65 72  |ly use this ever|
        00000930  79 20 74 69 6d 65 2e 20  20 54 68 69 73 20 63 6f  |y time.  This co|
        00000940  6e 74 61 69 6e 73 20 6f  66 20 74 68 65 20 6c 6f  |ntains of the lo|
        00000950  67 69 63 0a 20 20 20 20  62 75 69 6c 74 20 69 6e  |gic.    built in|
        00000960  74 6f 20 67 6f 70 61 63  6b 65 74 20 66 6f 72 20  |to gopacket for |
        00000970  64 65 63 6f 64 69 6e 67  20 70 61 63 6b 65 74 20  |decoding packet |
        00000980  70 72 6f 74 6f 63 6f 6c  73 2e 20 20 4e 6f 74 65  |protocols.  Note|
        00000990  20 74 68 61 74 20 61 6c  6c 20 65 78 61 6d 70 6c  | that all exampl|
        000009a0  65 0a 20 20 20 20 63 6f  64 65 20 62 65 6c 6f 77  |e.    code below|
        000009b0  20 61 73 73 75 6d 65 73  20 74 68 61 74 20 79 6f  | assumes that yo|
        000009c0  75 20 68 61 76 65 20 69  6d 70 6f 72 74 65 64 20  |u have imported |
        000009d0  62 6f 74 68 20 67 6f 70  61 63 6b 65 74 20 61 6e  |both gopacket an|
        000009e0  64 0a 20 20 20 20 67 6f  70 61 63 6b 65 74 2f 6c  |d.    gopacket/l|
        000009f0  61 79 65 72 73 2e 0a 2a  20 70 63 61 70 3a 20 43  |ayers..* pcap: C|
        00000a00  20 62 69 6e 64 69 6e 67  73 20 74 6f 20 75 73 65  | bindings to use|
        00000a10  20 6c 69 62 70 63 61 70  20 74 6f 20 70 75 6c 6c  | libpcap to pull|
        00000a20  20 70 61 63 6b 65 74 73  20 6f 66 66 20 74 68 65  | packets off the|
        00000a30  20 77 69 72 65 2e 0a 2a  20 70 66 72 69 6e 67 3a  | wire..* pfring:|
        00000a40  20 43 20 62 69 6e 64 69  6e 67 73 20 74 6f 20 75  | C bindings to u|
        00000a50  73 65 20 50 46 5f 52 49  4e 47 20 74 6f 20 70 75  |se PF_RING to pu|
        00000a60  6c 6c 20 70 61 63 6b 65  74 73 20 6f 66 66 20 74  |ll packets off t|
        00000a70  68 65 20 77 69 72 65 2e  0a 3c 2f 70 72 65 3e 0a  |he wire..
.| 00000a80 3c 68 33 20 69 64 3d 22 42 61 73 69 63 5f 55 73 |

Basic Usage| 00000aa0 3c 2f 68 33 3e 0a 3c 70 3e 0a 67 6f 70 61 63 6b |

.

.gopack| 00000ab0 65 74 20 74 61 6b 65 73 20 69 6e 20 70 61 63 6b |et takes in pack| 00000ac0 65 74 20 64 61 74 61 20 61 73 20 61 20 5b 5d 62 |et data as a []b| 00000ad0 79 74 65 20 61 6e 64 20 64 65 63 6f 64 65 73 20 |yte and decodes | 00000ae0 69 74 20 69 6e 74 6f 20 61 20 70 61 63 6b 65 74 |it into a packet| 00000af0 20 77 69 74 68 0a 61 20 6e 6f 6e 2d 7a 65 72 6f | with.a non-zero| 00000b00 20 6e 75 6d 62 65 72 20 6f 66 20 26 23 33 34 3b | number of "| 00000b10 6c 61 79 65 72 73 26 23 33 34 3b 2e 20 20 45 61 |layers". Ea| 00000b20 63 68 20 6c 61 79 65 72 20 63 6f 72 72 65 73 70 |ch layer corresp| 00000b30 6f 6e 64 73 20 74 6f 20 61 20 70 72 6f 74 6f 63 |onds to a protoc| 00000b40 6f 6c 0a 77 69 74 68 69 6e 20 74 68 65 20 62 79 |ol.within the by| 00000b50 74 65 73 2e 20 20 4f 6e 63 65 20 61 20 70 61 63 |tes. Once a pac| 00000b60 6b 65 74 20 68 61 73 20 62 65 65 6e 20 64 65 63 |ket has been dec| 00000b70 6f 64 65 64 2c 20 74 68 65 20 6c 61 79 65 72 73 |oded, the layers| 00000b80 20 6f 66 20 74 68 65 20 70 61 63 6b 65 74 0a 63 | of the packet.c| 00000b90 61 6e 20 62 65 20 72 65 71 75 65 73 74 65 64 20 |an be requested | 00000ba0 66 72 6f 6d 20 74 68 65 20 70 61 63 6b 65 74 2e |from the packet.| 00000bb0 0a 3c 2f 70 3e 0a 3c 70 72 65 3e 2f 2f 20 44 65 |.

.
// De|
        00000bc0  63 6f 64 65 20 61 20 70  61 63 6b 65 74 0a 70 61  |code a packet.pa|
        00000bd0  63 6b 65 74 20 3a 3d 20  67 6f 70 61 63 6b 65 74  |cket := gopacket|
        00000be0  2e 4e 65 77 50 61 63 6b  65 74 28 6d 79 50 61 63  |.NewPacket(myPac|
        00000bf0  6b 65 74 44 61 74 61 2c  20 6c 61 79 65 72 73 2e  |ketData, layers.|
        00000c00  4c 61 79 65 72 54 79 70  65 45 74 68 65 72 6e 65  |LayerTypeEtherne|
        00000c10  74 2c 20 67 6f 70 61 63  6b 65 74 2e 44 65 66 61  |t, gopacket.Defa|
        00000c20  75 6c 74 29 0a 2f 2f 20  47 65 74 20 74 68 65 20  |ult).// Get the |
        00000c30  54 43 50 20 6c 61 79 65  72 20 66 72 6f 6d 20 74  |TCP layer from t|
        00000c40  68 69 73 20 70 61 63 6b  65 74 0a 69 66 20 74 63  |his packet.if tc|
        00000c50  70 4c 61 79 65 72 20 3a  3d 20 70 61 63 6b 65 74  |pLayer := packet|
        00000c60  2e 4c 61 79 65 72 28 6c  61 79 65 72 73 2e 4c 61  |.Layer(layers.La|
        00000c70  79 65 72 54 79 70 65 54  43 50 29 3b 20 74 63 70  |yerTypeTCP); tcp|
        00000c80  4c 61 79 65 72 20 21 3d  20 6e 69 6c 20 7b 0a 20  |Layer != nil {. |
        00000c90  20 66 6d 74 2e 50 72 69  6e 74 6c 6e 28 26 23 33  | fmt.Println(|
        00000ca0  34 3b 54 68 69 73 20 69  73 20 61 20 54 43 50 20  |4;This is a TCP |
        00000cb0  70 61 63 6b 65 74 21 26  23 33 34 3b 29 0a 20 20  |packet!").  |
        00000cc0  2f 2f 20 47 65 74 20 61  63 74 75 61 6c 20 54 43  |// Get actual TC|
        00000cd0  50 20 64 61 74 61 20 66  72 6f 6d 20 74 68 69 73  |P data from this|
        00000ce0  20 6c 61 79 65 72 0a 20  20 74 63 70 2c 20 5f 20  | layer.  tcp, _ |
        00000cf0  3a 3d 20 74 63 70 4c 61  79 65 72 2e 28 2a 6c 61  |:= tcpLayer.(*la|
        00000d00  79 65 72 73 2e 54 43 50  29 0a 20 20 66 6d 74 2e  |yers.TCP).  fmt.|
        00000d10  50 72 69 6e 74 66 28 26  23 33 34 3b 46 72 6f 6d  |Printf("From|
        00000d20  20 73 72 63 20 70 6f 72  74 20 25 64 20 74 6f 20  | src port %d to |
        00000d30  64 73 74 20 70 6f 72 74  20 25 64 5c 6e 26 23 33  |dst port %d\n|
        00000d40  34 3b 2c 20 74 63 70 2e  53 72 63 50 6f 72 74 2c  |4;, tcp.SrcPort,|
        00000d50  20 74 63 70 2e 44 73 74  50 6f 72 74 29 0a 7d 0a  | tcp.DstPort).}.|
        00000d60  2f 2f 20 49 74 65 72 61  74 65 20 6f 76 65 72 20  |// Iterate over |
        00000d70  61 6c 6c 20 6c 61 79 65  72 73 2c 20 70 72 69 6e  |all layers, prin|
        00000d80  74 69 6e 67 20 6f 75 74  20 65 61 63 68 20 6c 61  |ting out each la|
        00000d90  79 65 72 20 74 79 70 65  0a 66 6f 72 20 6c 61 79  |yer type.for lay|
        00000da0  65 72 20 3a 3d 20 72 61  6e 67 65 20 70 61 63 6b  |er := range pack|
        00000db0  65 74 2e 4c 61 79 65 72  73 28 29 20 7b 0a 20 20  |et.Layers() {.  |
        00000dc0  66 6d 74 2e 50 72 69 6e  74 6c 6e 28 26 23 33 34  |fmt.Println("|
        00000dd0  3b 50 41 43 4b 45 54 20  4c 41 59 45 52 3a 26 23  |;PACKET LAYER:&#|
        00000de0  33 34 3b 2c 20 6c 61 79  65 72 2e 4c 61 79 65 72  |34;, layer.Layer|
        00000df0  54 79 70 65 28 29 29 0a  7d 0a 3c 2f 70 72 65 3e  |Type()).}.
| 00000e00 0a 3c 70 3e 0a 50 61 63 6b 65 74 73 20 63 61 6e |.

.Packets can| 00000e10 20 62 65 20 64 65 63 6f 64 65 64 20 66 72 6f 6d | be decoded from| 00000e20 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 73 74 61 | a number of sta| 00000e30 72 74 69 6e 67 20 70 6f 69 6e 74 73 2e 20 20 4d |rting points. M| 00000e40 61 6e 79 20 6f 66 20 6f 75 72 20 62 61 73 65 0a |any of our base.| 00000e50 74 79 70 65 73 20 69 6d 70 6c 65 6d 65 6e 74 20 |types implement | 00000e60 44 65 63 6f 64 65 72 2c 20 77 68 69 63 68 20 61 |Decoder, which a| 00000e70 6c 6c 6f 77 20 75 73 20 74 6f 20 64 65 63 6f 64 |llow us to decod| 00000e80 65 20 70 61 63 6b 65 74 73 20 66 6f 72 20 77 68 |e packets for wh| 00000e90 69 63 68 0a 77 65 20 64 6f 6e 26 23 33 39 3b 74 |ich.we don't| 00000ea0 20 68 61 76 65 20 66 75 6c 6c 20 64 61 74 61 2e | have full data.| 00000eb0 0a 3c 2f 70 3e 0a 3c 70 72 65 3e 2f 2f 20 44 65 |.

.
// De|
        00000ec0  63 6f 64 65 20 61 6e 20  65 74 68 65 72 6e 65 74  |code an ethernet|
        00000ed0  20 70 61 63 6b 65 74 0a  65 74 68 50 20 3a 3d 20  | packet.ethP := |
        00000ee0  67 6f 70 61 63 6b 65 74  2e 4e 65 77 50 61 63 6b  |gopacket.NewPack|
        00000ef0  65 74 28 70 31 2c 20 6c  61 79 65 72 73 2e 4c 61  |et(p1, layers.La|
        00000f00  79 65 72 54 79 70 65 45  74 68 65 72 6e 65 74 2c  |yerTypeEthernet,|
        00000f10  20 67 6f 70 61 63 6b 65  74 2e 44 65 66 61 75 6c  | gopacket.Defaul|
        00000f20  74 29 0a 2f 2f 20 44 65  63 6f 64 65 20 61 6e 20  |t).// Decode an |
        00000f30  49 50 76 36 20 68 65 61  64 65 72 20 61 6e 64 20  |IPv6 header and |
        00000f40  65 76 65 72 79 74 68 69  6e 67 20 69 74 20 63 6f  |everything it co|
        00000f50  6e 74 61 69 6e 73 0a 69  70 50 20 3a 3d 20 67 6f  |ntains.ipP := go|
        00000f60  70 61 63 6b 65 74 2e 4e  65 77 50 61 63 6b 65 74  |packet.NewPacket|
        00000f70  28 70 32 2c 20 6c 61 79  65 72 73 2e 4c 61 79 65  |(p2, layers.Laye|
        00000f80  72 54 79 70 65 49 50 76  36 2c 20 67 6f 70 61 63  |rTypeIPv6, gopac|
        00000f90  6b 65 74 2e 44 65 66 61  75 6c 74 29 0a 2f 2f 20  |ket.Default).// |
        00000fa0  44 65 63 6f 64 65 20 61  20 54 43 50 20 68 65 61  |Decode a TCP hea|
        00000fb0  64 65 72 20 61 6e 64 20  69 74 73 20 70 61 79 6c  |der and its payl|
        00000fc0  6f 61 64 0a 74 63 70 50  20 3a 3d 20 67 6f 70 61  |oad.tcpP := gopa|
        00000fd0  63 6b 65 74 2e 4e 65 77  50 61 63 6b 65 74 28 70  |cket.NewPacket(p|
        00000fe0  33 2c 20 6c 61 79 65 72  73 2e 4c 61 79 65 72 54  |3, layers.LayerT|
        00000ff0  79 70 65 54 43 50 2c 20  67 6f 70 61 63 6b 65 74  |ypeTCP, gopacket|
        
    pcap_test.go:110: -- FULL PACKET DATA (16388 bytes) ------------------------------------
        00000000  1e 00 00 00 60 01 88 91  3f d8 06 40 00 00 00 00  |....`...?..@....|
        00000010  00 00 00 00 00 00 00 00  00 00 00 01 00 00 00 00  |................|
        00000020  00 00 00 00 00 00 00 00  00 00 00 01 1f 90 e5 af  |................|
        00000030  0a 65 76 ef 08 97 18 4a  80 10 23 02 3f e0 00 00  |.ev....J..#.?...|
        00000040  01 01 08 0a 05 c0 8d b6  05 c0 8c fc 2e 44 65 66  |.............Def|
        00000050  61 75 6c 74 29 0a 3c 2f  70 72 65 3e 0a 3c 68 33  |ault).
.Reading Pack| 00000090 65 74 73 20 46 72 6f 6d 20 41 20 53 6f 75 72 63 |ets From A Sourc| 000000a0 65 3c 2f 68 33 3e 0a 3c 70 3e 0a 4d 6f 73 74 20 |e.

.Most | 000000b0 6f 66 20 74 68 65 20 74 69 6d 65 2c 20 79 6f 75 |of the time, you| 000000c0 20 77 6f 6e 26 23 33 39 3b 74 20 6a 75 73 74 20 | won't just | 000000d0 68 61 76 65 20 61 20 5b 5d 62 79 74 65 20 6f 66 |have a []byte of| 000000e0 20 70 61 63 6b 65 74 20 64 61 74 61 20 6c 79 69 | packet data lyi| 000000f0 6e 67 20 61 72 6f 75 6e 64 2e 0a 49 6e 73 74 65 |ng around..Inste| 00000100 61 64 2c 20 79 6f 75 26 23 33 39 3b 6c 6c 20 77 |ad, you'll w| 00000110 61 6e 74 20 74 6f 20 72 65 61 64 20 70 61 63 6b |ant to read pack| 00000120 65 74 73 20 69 6e 20 66 72 6f 6d 20 73 6f 6d 65 |ets in from some| 00000130 77 68 65 72 65 20 28 66 69 6c 65 2c 20 69 6e 74 |where (file, int| 00000140 65 72 66 61 63 65 2c 20 65 74 63 29 0a 61 6e 64 |erface, etc).and| 00000150 20 70 72 6f 63 65 73 73 20 74 68 65 6d 2e 20 20 | process them. | 00000160 54 6f 20 64 6f 20 74 68 61 74 2c 20 79 6f 75 26 |To do that, you&| 00000170 23 33 39 3b 6c 6c 20 77 61 6e 74 20 74 6f 20 62 |#39;ll want to b| 00000180 75 69 6c 64 20 61 20 50 61 63 6b 65 74 53 6f 75 |uild a PacketSou| 00000190 72 63 65 2e 0a 3c 2f 70 3e 0a 3c 70 3e 0a 46 69 |rce..

.

.Fi| 000001a0 72 73 74 2c 20 79 6f 75 26 23 33 39 3b 6c 6c 20 |rst, you'll | 000001b0 6e 65 65 64 20 74 6f 20 63 6f 6e 73 74 72 75 63 |need to construc| 000001c0 74 20 61 6e 20 6f 62 6a 65 63 74 20 74 68 61 74 |t an object that| 000001d0 20 69 6d 70 6c 65 6d 65 6e 74 73 20 74 68 65 20 | implements the | 000001e0 50 61 63 6b 65 74 44 61 74 61 53 6f 75 72 63 65 |PacketDataSource| 000001f0 0a 69 6e 74 65 72 66 61 63 65 2e 20 20 54 68 65 |.interface. The| 00000200 72 65 20 61 72 65 20 69 6d 70 6c 65 6d 65 6e 74 |re are implement| 00000210 61 74 69 6f 6e 73 20 6f 66 20 74 68 69 73 20 69 |ations of this i| 00000220 6e 74 65 72 66 61 63 65 20 62 75 6e 64 6c 65 64 |nterface bundled| 00000230 20 77 69 74 68 20 67 6f 70 61 63 6b 65 74 0a 69 | with gopacket.i| 00000240 6e 20 74 68 65 20 67 6f 70 61 63 6b 65 74 2f 70 |n the gopacket/p| 00000250 63 61 70 20 61 6e 64 20 67 6f 70 61 63 6b 65 74 |cap and gopacket| 00000260 2f 70 66 72 69 6e 67 20 73 75 62 70 61 63 6b 61 |/pfring subpacka| 00000270 67 65 73 2e 2e 2e 20 73 65 65 20 74 68 65 69 72 |ges... see their| 00000280 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 0a 66 | documentation.f| 00000290 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 |or more informat| 000002a0 69 6f 6e 20 6f 6e 20 74 68 65 69 72 20 75 73 61 |ion on their usa| 000002b0 67 65 2e 20 20 4f 6e 63 65 20 79 6f 75 20 68 61 |ge. Once you ha| 000002c0 76 65 20 61 20 50 61 63 6b 65 74 44 61 74 61 53 |ve a PacketDataS| 000002d0 6f 75 72 63 65 2c 20 79 6f 75 20 63 61 6e 0a 70 |ource, you can.p| 000002e0 61 73 73 20 69 74 20 69 6e 74 6f 20 4e 65 77 50 |ass it into NewP| 000002f0 61 63 6b 65 74 53 6f 75 72 63 65 2c 20 61 6c 6f |acketSource, alo| 00000300 6e 67 20 77 69 74 68 20 61 20 44 65 63 6f 64 65 |ng with a Decode| 00000310 72 20 6f 66 20 79 6f 75 72 20 63 68 6f 69 63 65 |r of your choice| 00000320 2c 20 74 6f 20 63 72 65 61 74 65 0a 61 20 50 61 |, to create.a Pa| 00000330 63 6b 65 74 53 6f 75 72 63 65 2e 0a 3c 2f 70 3e |cketSource..

| 00000340 0a 3c 70 3e 0a 4f 6e 63 65 20 79 6f 75 20 68 61 |.

.Once you ha| 00000350 76 65 20 61 20 50 61 63 6b 65 74 53 6f 75 72 63 |ve a PacketSourc| 00000360 65 2c 20 79 6f 75 20 63 61 6e 20 72 65 61 64 20 |e, you can read | 00000370 70 61 63 6b 65 74 73 20 66 72 6f 6d 20 69 74 20 |packets from it | 00000380 69 6e 20 6d 75 6c 74 69 70 6c 65 20 77 61 79 73 |in multiple ways| 00000390 2e 0a 53 65 65 20 74 68 65 20 64 6f 63 73 20 66 |..See the docs f| 000003a0 6f 72 20 50 61 63 6b 65 74 53 6f 75 72 63 65 20 |or PacketSource | 000003b0 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 |for more details| 000003c0 2e 20 20 54 68 65 20 65 61 73 69 65 73 74 20 6d |. The easiest m| 000003d0 65 74 68 6f 64 20 69 73 20 74 68 65 0a 50 61 63 |ethod is the.Pac| 000003e0 6b 65 74 73 20 66 75 6e 63 74 69 6f 6e 2c 20 77 |kets function, w| 000003f0 68 69 63 68 20 72 65 74 75 72 6e 73 20 61 20 63 |hich returns a c| 00000400 68 61 6e 6e 65 6c 2c 20 74 68 65 6e 20 61 73 79 |hannel, then asy| 00000410 6e 63 68 72 6f 6e 6f 75 73 6c 79 20 77 72 69 74 |nchronously writ| 00000420 65 73 20 6e 65 77 0a 70 61 63 6b 65 74 73 20 69 |es new.packets i| 00000430 6e 74 6f 20 74 68 61 74 20 63 68 61 6e 6e 65 6c |nto that channel| 00000440 2c 20 63 6c 6f 73 69 6e 67 20 74 68 65 20 63 68 |, closing the ch| 00000450 61 6e 6e 65 6c 20 69 66 20 74 68 65 20 70 61 63 |annel if the pac| 00000460 6b 65 74 53 6f 75 72 63 65 20 68 69 74 73 20 61 |ketSource hits a| 00000470 6e 0a 65 6e 64 2d 6f 66 2d 66 69 6c 65 2e 0a 3c |n.end-of-file..<| 00000480 2f 70 3e 0a 3c 70 72 65 3e 70 61 63 6b 65 74 53 |/p>.

packetS|
        00000490  6f 75 72 63 65 20 3a 3d  20 2e 2e 2e 20 20 2f 2f  |ource := ...  //|
        000004a0  20 63 6f 6e 73 74 72 75  63 74 20 75 73 69 6e 67  | construct using|
        000004b0  20 70 63 61 70 20 6f 72  20 70 66 72 69 6e 67 0a  | pcap or pfring.|
        000004c0  66 6f 72 20 70 61 63 6b  65 74 20 3a 3d 20 72 61  |for packet := ra|
        000004d0  6e 67 65 20 70 61 63 6b  65 74 53 6f 75 72 63 65  |nge packetSource|
        000004e0  2e 50 61 63 6b 65 74 73  28 29 20 7b 0a 20 20 68  |.Packets() {.  h|
        000004f0  61 6e 64 6c 65 50 61 63  6b 65 74 28 70 61 63 6b  |andlePacket(pack|
        00000500  65 74 29 20 20 2f 2f 20  64 6f 20 73 6f 6d 65 74  |et)  // do somet|
        00000510  68 69 6e 67 20 77 69 74  68 20 65 61 63 68 20 70  |hing with each p|
        00000520  61 63 6b 65 74 0a 7d 0a  3c 2f 70 72 65 3e 0a 3c  |acket.}.
.<| 00000530 70 3e 0a 59 6f 75 20 63 61 6e 20 63 68 61 6e 67 |p>.You can chang| 00000540 65 20 74 68 65 20 64 65 63 6f 64 69 6e 67 20 6f |e the decoding o| 00000550 70 74 69 6f 6e 73 20 6f 66 20 74 68 65 20 70 61 |ptions of the pa| 00000560 63 6b 65 74 53 6f 75 72 63 65 20 62 79 20 73 65 |cketSource by se| 00000570 74 74 69 6e 67 20 66 69 65 6c 64 73 20 69 6e 0a |tting fields in.| 00000580 70 61 63 6b 65 74 53 6f 75 72 63 65 2e 44 65 63 |packetSource.Dec| 00000590 6f 64 65 4f 70 74 69 6f 6e 73 2e 2e 2e 20 73 65 |odeOptions... se| 000005a0 65 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 |e the following | 000005b0 73 65 63 74 69 6f 6e 73 20 66 6f 72 20 6d 6f 72 |sections for mor| 000005c0 65 20 64 65 74 61 69 6c 73 2e 0a 3c 2f 70 3e 0a |e details..

.| 000005d0 3c 68 33 20 69 64 3d 22 4c 61 7a 79 5f 44 65 63 |

Lazy Deco| 000005f0 64 69 6e 67 3c 2f 68 33 3e 0a 3c 70 3e 0a 67 6f |ding

.

.go| 00000600 70 61 63 6b 65 74 20 6f 70 74 69 6f 6e 61 6c 6c |packet optionall| 00000610 79 20 64 65 63 6f 64 65 73 20 70 61 63 6b 65 74 |y decodes packet| 00000620 20 64 61 74 61 20 6c 61 7a 69 6c 79 2c 20 6d 65 | data lazily, me| 00000630 61 6e 69 6e 67 20 69 74 0a 6f 6e 6c 79 20 64 65 |aning it.only de| 00000640 63 6f 64 65 73 20 61 20 70 61 63 6b 65 74 20 6c |codes a packet l| 00000650 61 79 65 72 20 77 68 65 6e 20 69 74 20 6e 65 65 |ayer when it nee| 00000660 64 73 20 74 6f 20 74 6f 20 68 61 6e 64 6c 65 20 |ds to to handle | 00000670 61 20 66 75 6e 63 74 69 6f 6e 20 63 61 6c 6c 2e |a function call.| 00000680 0a 3c 2f 70 3e 0a 3c 70 72 65 3e 2f 2f 20 43 72 |.

.
// Cr|
        00000690  65 61 74 65 20 61 20 70  61 63 6b 65 74 2c 20 62  |eate a packet, b|
        000006a0  75 74 20 64 6f 6e 26 23  33 39 3b 74 20 61 63 74  |ut don't act|
        000006b0  75 61 6c 6c 79 20 64 65  63 6f 64 65 20 61 6e 79  |ually decode any|
        000006c0  74 68 69 6e 67 20 79 65  74 0a 70 61 63 6b 65 74  |thing yet.packet|
        000006d0  20 3a 3d 20 67 6f 70 61  63 6b 65 74 2e 4e 65 77  | := gopacket.New|
        000006e0  50 61 63 6b 65 74 28 6d  79 50 61 63 6b 65 74 44  |Packet(myPacketD|
        000006f0  61 74 61 2c 20 6c 61 79  65 72 73 2e 4c 61 79 65  |ata, layers.Laye|
        00000700  72 54 79 70 65 45 74 68  65 72 6e 65 74 2c 20 67  |rTypeEthernet, g|
        00000710  6f 70 61 63 6b 65 74 2e  4c 61 7a 79 29 0a 2f 2f  |opacket.Lazy).//|
        00000720  20 4e 6f 77 2c 20 64 65  63 6f 64 65 20 74 68 65  | Now, decode the|
        00000730  20 70 61 63 6b 65 74 20  75 70 20 74 6f 20 74 68  | packet up to th|
        00000740  65 20 66 69 72 73 74 20  49 50 76 34 20 6c 61 79  |e first IPv4 lay|
        00000750  65 72 20 66 6f 75 6e 64  20 62 75 74 20 6e 6f 20  |er found but no |
        00000760  66 75 72 74 68 65 72 2e  0a 2f 2f 20 49 66 20 6e  |further..// If n|
        00000770  6f 20 49 50 76 34 20 6c  61 79 65 72 20 77 61 73  |o IPv4 layer was|
        00000780  20 66 6f 75 6e 64 2c 20  74 68 65 20 77 68 6f 6c  | found, the whol|
        00000790  65 20 70 61 63 6b 65 74  20 77 69 6c 6c 20 62 65  |e packet will be|
        000007a0  20 64 65 63 6f 64 65 64  20 6c 6f 6f 6b 69 6e 67  | decoded looking|
        000007b0  20 66 6f 72 0a 2f 2f 20  69 74 2e 0a 69 70 34 20  | for.// it..ip4 |
        000007c0  3a 3d 20 70 61 63 6b 65  74 2e 4c 61 79 65 72 28  |:= packet.Layer(|
        000007d0  6c 61 79 65 72 73 2e 4c  61 79 65 72 54 79 70 65  |layers.LayerType|
        000007e0  49 50 76 34 29 0a 2f 2f  20 44 65 63 6f 64 65 20  |IPv4).// Decode |
        000007f0  61 6c 6c 20 6c 61 79 65  72 73 20 61 6e 64 20 72  |all layers and r|
        00000800  65 74 75 72 6e 20 74 68  65 6d 2e 20 20 54 68 65  |eturn them.  The|
        00000810  20 6c 61 79 65 72 73 20  75 70 20 74 6f 20 74 68  | layers up to th|
        00000820  65 20 66 69 72 73 74 20  49 50 76 34 20 6c 61 79  |e first IPv4 lay|
        00000830  65 72 0a 2f 2f 20 61 72  65 20 61 6c 72 65 61 64  |er.// are alread|
        00000840  79 20 64 65 63 6f 64 65  64 2c 20 61 6e 64 20 77  |y decoded, and w|
        00000850  69 6c 6c 20 6e 6f 74 20  72 65 71 75 69 72 65 20  |ill not require |
        00000860  64 65 63 6f 64 69 6e 67  20 61 20 73 65 63 6f 6e  |decoding a secon|
        00000870  64 20 74 69 6d 65 2e 0a  6c 61 79 65 72 73 20 3a  |d time..layers :|
        00000880  3d 20 70 61 63 6b 65 74  2e 4c 61 79 65 72 73 28  |= packet.Layers(|
        00000890  29 0a 3c 2f 70 72 65 3e  0a 3c 70 3e 0a 4c 61 7a  |).
.

.Laz| 000008a0 69 6c 79 2d 64 65 63 6f 64 65 64 20 70 61 63 6b |ily-decoded pack| 000008b0 65 74 73 20 61 72 65 20 6e 6f 74 20 63 6f 6e 63 |ets are not conc| 000008c0 75 72 72 65 6e 63 79 2d 73 61 66 65 2e 20 20 53 |urrency-safe. S| 000008d0 69 6e 63 65 20 6c 61 79 65 72 73 20 68 61 76 65 |ince layers have| 000008e0 20 6e 6f 74 20 61 6c 6c 20 62 65 65 6e 0a 64 65 | not all been.de| 000008f0 63 6f 64 65 64 2c 20 65 61 63 68 20 63 61 6c 6c |coded, each call| 00000900 20 74 6f 20 4c 61 79 65 72 28 29 20 6f 72 20 4c | to Layer() or L| 00000910 61 79 65 72 73 28 29 20 68 61 73 20 74 68 65 20 |ayers() has the | 00000920 70 6f 74 65 6e 74 69 61 6c 20 74 6f 20 6d 75 74 |potential to mut| 00000930 61 74 65 20 74 68 65 20 70 61 63 6b 65 74 0a 69 |ate the packet.i| 00000940 6e 20 6f 72 64 65 72 20 74 6f 20 64 65 63 6f 64 |n order to decod| 00000950 65 20 74 68 65 20 6e 65 78 74 20 6c 61 79 65 72 |e the next layer| 00000960 2e 20 20 49 66 20 61 20 70 61 63 6b 65 74 20 69 |. If a packet i| 00000970 73 20 75 73 65 64 0a 69 6e 20 6d 75 6c 74 69 70 |s used.in multip| 00000980 6c 65 20 67 6f 72 6f 75 74 69 6e 65 73 20 63 6f |le goroutines co| 00000990 6e 63 75 72 72 65 6e 74 6c 79 2c 20 64 6f 6e 26 |ncurrently, don&| 000009a0 23 33 39 3b 74 20 75 73 65 20 67 6f 70 61 63 6b |#39;t use gopack| 000009b0 65 74 2e 4c 61 7a 79 2e 20 20 54 68 65 6e 20 67 |et.Lazy. Then g| 000009c0 6f 70 61 63 6b 65 74 0a 77 69 6c 6c 20 64 65 63 |opacket.will dec| 000009d0 6f 64 65 20 74 68 65 20 70 61 63 6b 65 74 20 66 |ode the packet f| 000009e0 75 6c 6c 79 2c 20 61 6e 64 20 61 6c 6c 20 66 75 |ully, and all fu| 000009f0 74 75 72 65 20 66 75 6e 63 74 69 6f 6e 20 63 61 |ture function ca| 00000a00 6c 6c 73 20 77 6f 6e 26 23 33 39 3b 74 20 6d 75 |lls won't mu| 00000a10 74 61 74 65 20 74 68 65 0a 6f 62 6a 65 63 74 2e |tate the.object.| 00000a20 0a 3c 2f 70 3e 0a 3c 68 33 20 69 64 3d 22 4e 6f |.

.

N| 00000a40 6f 43 6f 70 79 20 44 65 63 6f 64 69 6e 67 3c 2f |oCopy Decoding.

.By defau| 00000a60 6c 74 2c 20 67 6f 70 61 63 6b 65 74 20 77 69 6c |lt, gopacket wil| 00000a70 6c 20 63 6f 70 79 20 74 68 65 20 73 6c 69 63 65 |l copy the slice| 00000a80 20 70 61 73 73 65 64 20 74 6f 20 4e 65 77 50 61 | passed to NewPa| 00000a90 63 6b 65 74 20 61 6e 64 20 73 74 6f 72 65 20 74 |cket and store t| 00000aa0 68 65 0a 63 6f 70 79 20 77 69 74 68 69 6e 20 74 |he.copy within t| 00000ab0 68 65 20 70 61 63 6b 65 74 2c 20 73 6f 20 66 75 |he packet, so fu| 00000ac0 74 75 72 65 20 6d 75 74 61 74 69 6f 6e 73 20 74 |ture mutations t| 00000ad0 6f 20 74 68 65 20 62 79 74 65 73 20 75 6e 64 65 |o the bytes unde| 00000ae0 72 6c 79 69 6e 67 20 74 68 65 20 73 6c 69 63 65 |rlying the slice| 00000af0 0a 64 6f 6e 26 23 33 39 3b 74 20 61 66 66 65 63 |.don't affec| 00000b00 74 20 74 68 65 20 70 61 63 6b 65 74 20 61 6e 64 |t the packet and| 00000b10 20 69 74 73 20 6c 61 79 65 72 73 2e 20 20 49 66 | its layers. If| 00000b20 20 79 6f 75 20 63 61 6e 20 67 75 61 72 61 6e 74 | you can guarant| 00000b30 65 65 20 74 68 61 74 20 74 68 65 0a 75 6e 64 65 |ee that the.unde| 00000b40 72 6c 79 69 6e 67 20 73 6c 69 63 65 20 62 79 74 |rlying slice byt| 00000b50 65 73 20 77 6f 6e 26 23 33 39 3b 74 20 62 65 20 |es won't be | 00000b60 63 68 61 6e 67 65 64 2c 20 79 6f 75 20 63 61 6e |changed, you can| 00000b70 20 75 73 65 20 4e 6f 43 6f 70 79 20 74 6f 20 74 | use NoCopy to t| 00000b80 65 6c 6c 0a 67 6f 70 61 63 6b 65 74 2e 4e 65 77 |ell.gopacket.New| 00000b90 50 61 63 6b 65 74 2c 20 61 6e 64 20 69 74 26 23 |Packet, and it&#| 00000ba0 33 39 3b 6c 6c 20 75 73 65 20 74 68 65 20 70 61 |39;ll use the pa| 00000bb0 73 73 65 64 2d 69 6e 20 73 6c 69 63 65 20 69 74 |ssed-in slice it| 00000bc0 73 65 6c 66 2e 0a 3c 2f 70 3e 0a 3c 70 72 65 3e |self..

.
|
        00000bd0  2f 2f 20 54 68 69 73 20  63 68 61 6e 6e 65 6c 20  |// This channel |
        00000be0  72 65 74 75 72 6e 73 20  6e 65 77 20 62 79 74 65  |returns new byte|
        00000bf0  20 73 6c 69 63 65 73 2c  20 65 61 63 68 20 6f 66  | slices, each of|
        00000c00  20 77 68 69 63 68 20 70  6f 69 6e 74 73 20 74 6f  | which points to|
        00000c10  20 61 20 6e 65 77 0a 2f  2f 20 6d 65 6d 6f 72 79  | a new.// memory|
        00000c20  20 6c 6f 63 61 74 69 6f  6e 20 74 68 61 74 26 23  | location that&#|
        00000c30  33 39 3b 73 20 67 75 61  72 61 6e 74 65 65 64 20  |39;s guaranteed |
        00000c40  69 6d 6d 75 74 61 62 6c  65 20 66 6f 72 20 74 68  |immutable for th|
        00000c50  65 20 64 75 72 61 74 69  6f 6e 20 6f 66 20 74 68  |e duration of th|
        00000c60  65 0a 2f 2f 20 70 61 63  6b 65 74 2e 0a 66 6f 72  |e.// packet..for|
        00000c70  20 64 61 74 61 20 3a 3d  20 72 61 6e 67 65 20 6d  | data := range m|
        00000c80  79 42 79 74 65 53 6c 69  63 65 43 68 61 6e 6e 65  |yByteSliceChanne|
        00000c90  6c 20 7b 0a 20 20 70 20  3a 3d 20 67 6f 70 61 63  |l {.  p := gopac|
        00000ca0  6b 65 74 2e 4e 65 77 50  61 63 6b 65 74 28 64 61  |ket.NewPacket(da|
        00000cb0  74 61 2c 20 6c 61 79 65  72 73 2e 4c 61 79 65 72  |ta, layers.Layer|
        00000cc0  54 79 70 65 45 74 68 65  72 6e 65 74 2c 20 67 6f  |TypeEthernet, go|
        00000cd0  70 61 63 6b 65 74 2e 4e  6f 43 6f 70 79 29 0a 20  |packet.NoCopy). |
        00000ce0  20 64 6f 53 6f 6d 65 74  68 69 6e 67 57 69 74 68  | doSomethingWith|
        00000cf0  50 61 63 6b 65 74 28 70  29 0a 7d 0a 3c 2f 70 72  |Packet(p).}..

.The faste| 00000d10 73 74 20 6d 65 74 68 6f 64 20 6f 66 20 64 65 63 |st method of dec| 00000d20 6f 64 69 6e 67 20 69 73 20 74 6f 20 75 73 65 20 |oding is to use | 00000d30 62 6f 74 68 20 4c 61 7a 79 20 61 6e 64 20 4e 6f |both Lazy and No| 00000d40 43 6f 70 79 2c 20 62 75 74 20 6e 6f 74 65 20 66 |Copy, but note f| 00000d50 72 6f 6d 0a 74 68 65 20 6d 61 6e 79 20 63 61 76 |rom.the many cav| 00000d60 65 61 74 73 20 61 62 6f 76 65 20 74 68 61 74 20 |eats above that | 00000d70 66 6f 72 20 73 6f 6d 65 20 69 6d 70 6c 65 6d 65 |for some impleme| 00000d80 6e 74 61 74 69 6f 6e 73 20 74 68 65 79 20 6d 61 |ntations they ma| 00000d90 79 20 62 65 20 64 61 6e 67 65 72 6f 75 73 0a 65 |y be dangerous.e| 00000da0 69 74 68 65 72 20 6f 72 20 62 6f 74 68 20 6d 61 |ither or both ma| 00000db0 79 20 62 65 20 64 61 6e 67 65 72 6f 75 73 2e 0a |y be dangerous..| 00000dc0 3c 2f 70 3e 0a 3c 68 33 20 69 64 3d 22 50 6f 69 |

.

Pointers | 00000df0 54 6f 20 4b 6e 6f 77 6e 20 4c 61 79 65 72 73 3c |To Known Layers<| 00000e00 2f 68 33 3e 0a 3c 70 3e 0a 44 75 72 69 6e 67 20 |/h3>.

.During | 00000e10 64 65 63 6f 64 69 6e 67 2c 20 63 65 72 74 61 69 |decoding, certai| 00000e20 6e 20 6c 61 79 65 72 73 20 61 72 65 20 73 74 6f |n layers are sto| 00000e30 72 65 64 20 69 6e 20 74 68 65 20 70 61 63 6b 65 |red in the packe| 00000e40 74 20 61 73 20 77 65 6c 6c 2d 6b 6e 6f 77 6e 0a |t as well-known.| 00000e50 6c 61 79 65 72 20 74 79 70 65 73 2e 20 20 46 6f |layer types. Fo| 00000e60 72 20 65 78 61 6d 70 6c 65 2c 20 49 50 76 34 20 |r example, IPv4 | 00000e70 61 6e 64 20 49 50 76 36 20 61 72 65 20 62 6f 74 |and IPv6 are bot| 00000e80 68 20 63 6f 6e 73 69 64 65 72 65 64 20 4e 65 74 |h considered Net| 00000e90 77 6f 72 6b 4c 61 79 65 72 0a 6c 61 79 65 72 73 |workLayer.layers| 00000ea0 2c 20 77 68 69 6c 65 20 54 43 50 20 61 6e 64 20 |, while TCP and | 00000eb0 55 44 50 20 61 72 65 20 62 6f 74 68 20 54 72 61 |UDP are both Tra| 00000ec0 6e 73 70 6f 72 74 4c 61 79 65 72 20 6c 61 79 65 |nsportLayer laye| 00000ed0 72 73 2e 20 20 57 65 20 73 75 70 70 6f 72 74 20 |rs. We support | 00000ee0 34 0a 6c 61 79 65 72 73 2c 20 63 6f 72 72 65 73 |4.layers, corres| 00000ef0 70 6f 6e 64 69 6e 67 20 74 6f 20 74 68 65 20 34 |ponding to the 4| 00000f00 20 6c 61 79 65 72 73 20 6f 66 20 74 68 65 20 54 | layers of the T| 00000f10 43 50 2f 49 50 20 6c 61 79 65 72 69 6e 67 20 73 |CP/IP layering s| 00000f20 63 68 65 6d 65 20 28 72 6f 75 67 68 6c 79 0a 61 |cheme (roughly.a| 00000f30 6e 61 67 61 6c 6f 75 73 20 74 6f 20 6c 61 79 65 |nagalous to laye| 00000f40 72 73 20 32 2c 20 33 2c 20 34 2c 20 61 6e 64 20 |rs 2, 3, 4, and | 00000f50 37 20 6f 66 20 74 68 65 20 4f 53 49 20 6d 6f 64 |7 of the OSI mod| 00000f60 65 6c 29 2e 20 20 54 6f 20 61 63 63 65 73 73 20 |el). To access | 00000f70 74 68 65 73 65 2c 0a 79 6f 75 20 63 61 6e 20 75 |these,.you can u| 00000f80 73 65 20 74 68 65 20 70 61 63 6b 65 74 2e 4c 69 |se the packet.Li| 00000f90 6e 6b 4c 61 79 65 72 2c 20 70 61 63 6b 65 74 2e |nkLayer, packet.| 00000fa0 4e 65 74 77 6f 72 6b 4c 61 79 65 72 2c 0a 70 61 |NetworkLayer,.pa| 00000fb0 63 6b 65 74 2e 54 72 61 6e 73 70 6f 72 74 4c 61 |cket.TransportLa| 00000fc0 79 65 72 2c 20 61 6e 64 20 70 61 63 6b 65 74 2e |yer, and packet.| 00000fd0 41 70 70 6c 69 63 61 74 69 6f 6e 4c 61 79 65 72 |ApplicationLayer| 00000fe0 20 66 75 6e 63 74 69 6f 6e 73 2e 20 20 45 61 63 | functions. Eac| 00000ff0 68 20 6f 66 0a 74 68 65 73 65 20 66 75 6e 63 74 |h of.these funct| 00001000 69 6f 6e 73 20 72 65 74 75 72 6e 73 20 61 20 63 |ions returns a c| 00001010 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 69 6e 74 |orresponding int| 00001020 65 72 66 61 63 65 0a 28 67 6f 70 61 63 6b 65 74 |erface.(gopacket| 00001030 2e 7b 4c 69 6e 6b 2c 4e 65 74 77 6f 72 6b 2c 54 |.{Link,Network,T| 00001040 72 61 6e 73 70 6f 72 74 2c 41 70 70 6c 69 63 61 |ransport,Applica| 00001050 74 69 6f 6e 7d 4c 61 79 65 72 29 2e 20 20 54 68 |tion}Layer). Th| 00001060 65 20 66 69 72 73 74 20 74 68 72 65 65 0a 70 72 |e first three.pr| 00001070 6f 76 69 64 65 20 6d 65 74 68 6f 64 73 20 66 6f |ovide methods fo| 00001080 72 20 67 65 74 74 69 6e 67 20 73 72 63 2f 64 73 |r getting src/ds| 00001090 74 20 61 64 64 72 65 73 73 65 73 20 66 6f 72 20 |t addresses for | 000010a0 74 68 61 74 20 70 61 72 74 69 63 75 6c 61 72 20 |that particular | 000010b0 6c 61 79 65 72 2c 0a 77 68 69 6c 65 20 74 68 65 |layer,.while the| 000010c0 20 66 69 6e 61 6c 20 6c 61 79 65 72 20 70 72 6f | final layer pro| 000010d0 76 69 64 65 73 20 61 20 50 61 79 6c 6f 61 64 20 |vides a Payload | 000010e0 66 75 6e 63 74 69 6f 6e 20 74 6f 20 67 65 74 20 |function to get | 000010f0 70 61 79 6c 6f 61 64 20 64 61 74 61 2e 0a 54 68 |payload data..Th| 00001100 69 73 20 69 73 20 68 65 6c 70 66 75 6c 2c 20 66 |is is helpful, f| 00001110 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 6f 20 67 |or example, to g| 00001120 65 74 20 70 61 79 6c 6f 61 64 73 20 66 6f 72 20 |et payloads for | 00001130 61 6c 6c 20 70 61 63 6b 65 74 73 20 72 65 67 61 |all packets rega| 00001140 72 64 6c 65 73 73 0a 6f 66 20 74 68 65 69 72 20 |rdless.of their | 00001150 75 6e 64 65 72 6c 79 69 6e 67 20 64 61 74 61 20 |underlying data | 00001160 74 79 70 65 3a 0a 3c 2f 70 3e 0a 3c 70 72 65 3e |type:.

.
|
        00001170  2f 2f 20 47 65 74 20 70  61 63 6b 65 74 73 20 66  |// Get packets f|
        00001180  72 6f 6d 20 73 6f 6d 65  20 73 6f 75 72 63 65 0a  |rom some source.|
        00001190  66 6f 72 20 70 61 63 6b  65 74 20 3a 3d 20 72 61  |for packet := ra|
        000011a0  6e 67 65 20 73 6f 6d 65  53 6f 75 72 63 65 20 7b  |nge someSource {|
        000011b0  0a 20 20 69 66 20 61 70  70 20 3a 3d 20 70 61 63  |.  if app := pac|
        000011c0  6b 65 74 2e 41 70 70 6c  69 63 61 74 69 6f 6e 4c  |ket.ApplicationL|
        000011d0  61 79 65 72 28 29 3b 20  61 70 70 20 21 3d 20 6e  |ayer(); app != n|
        000011e0  69 6c 20 7b 0a 20 20 20  20 69 66 20 73 74 72 69  |il {.    if stri|
        000011f0  6e 67 73 2e 43 6f 6e 74  61 69 6e 73 28 73 74 72  |ngs.Contains(str|
        00001200  69 6e 67 28 61 70 70 2e  50 61 79 6c 6f 61 64 28  |ing(app.Payload(|
        00001210  29 29 2c 20 26 23 33 34  3b 6d 61 67 69 63 20 73  |)), "magic s|
        00001220  74 72 69 6e 67 26 23 33  34 3b 29 20 7b 0a 20 20  |tring") {.  |
        00001230  20 20 20 20 66 6d 74 2e  50 72 69 6e 74 6c 6e 28  |    fmt.Println(|
        00001240  26 23 33 34 3b 46 6f 75  6e 64 20 6d 61 67 69 63  |"Found magic|
        00001250  20 73 74 72 69 6e 67 20  69 6e 20 61 20 70 61 63  | string in a pac|
        00001260  6b 65 74 21 26 23 33 34  3b 29 0a 20 20 20 20 7d  |ket!").    }|
        00001270  0a 20 20 7d 0a 7d 0a 3c  2f 70 72 65 3e 0a 3c 70  |.  }.}.
..A particularly| 00001290 20 75 73 65 66 75 6c 20 6c 61 79 65 72 20 69 73 | useful layer is| 000012a0 20 45 72 72 6f 72 4c 61 79 65 72 2c 20 77 68 69 | ErrorLayer, whi| 000012b0 63 68 20 69 73 20 73 65 74 20 77 68 65 6e 65 76 |ch is set whenev| 000012c0 65 72 20 74 68 65 72 65 26 23 33 39 3b 73 0a 61 |er there's.a| 000012d0 6e 20 65 72 72 6f 72 20 70 61 72 73 69 6e 67 20 |n error parsing | 000012e0 70 61 72 74 20 6f 66 20 74 68 65 20 70 61 63 6b |part of the pack| 000012f0 65 74 2e 0a 3c 2f 70 3e 0a 3c 70 72 65 3e 70 61 |et..

.
pa|
        00001300  63 6b 65 74 20 3a 3d 20  67 6f 70 61 63 6b 65 74  |cket := gopacket|
        00001310  2e 4e 65 77 50 61 63 6b  65 74 28 6d 79 50 61 63  |.NewPacket(myPac|
        00001320  6b 65 74 44 61 74 61 2c  20 6c 61 79 65 72 73 2e  |ketData, layers.|
        00001330  4c 61 79 65 72 54 79 70  65 45 74 68 65 72 6e 65  |LayerTypeEtherne|
        00001340  74 2c 20 67 6f 70 61 63  6b 65 74 2e 44 65 66 61  |t, gopacket.Defa|
        00001350  75 6c 74 29 0a 69 66 20  65 72 72 20 3a 3d 20 70  |ult).if err := p|
        00001360  61 63 6b 65 74 2e 45 72  72 6f 72 4c 61 79 65 72  |acket.ErrorLayer|
        00001370  28 29 3b 20 65 72 72 20  21 3d 20 6e 69 6c 20 7b  |(); err != nil {|
        00001380  0a 20 20 66 6d 74 2e 50  72 69 6e 74 6c 6e 28 26  |.  fmt.Println(&|
        00001390  23 33 34 3b 45 72 72 6f  72 20 64 65 63 6f 64 69  |#34;Error decodi|
        000013a0  6e 67 20 73 6f 6d 65 20  70 61 72 74 20 6f 66 20  |ng some part of |
        000013b0  74 68 65 20 70 61 63 6b  65 74 3a 26 23 33 34 3b  |the packet:"|
        000013c0  2c 20 65 72 72 29 0a 7d  0a 3c 2f 70 72 65 3e 0a  |, err).}.
.| 000013d0 3c 70 3e 0a 4e 6f 74 65 20 74 68 61 74 20 77 65 |

.Note that we| 000013e0 20 64 6f 6e 26 23 33 39 3b 74 20 72 65 74 75 72 | don't retur| 000013f0 6e 20 61 6e 20 65 72 72 6f 72 20 66 72 6f 6d 20 |n an error from | 00001400 4e 65 77 50 61 63 6b 65 74 20 62 65 63 61 75 73 |NewPacket becaus| 00001410 65 20 77 65 20 6d 61 79 20 68 61 76 65 20 64 65 |e we may have de| 00001420 63 6f 64 65 64 0a 61 20 6e 75 6d 62 65 72 20 6f |coded.a number o| 00001430 66 20 6c 61 79 65 72 73 20 73 75 63 63 65 73 73 |f layers success| 00001440 66 75 6c 6c 79 20 62 65 66 6f 72 65 20 72 75 6e |fully before run| 00001450 6e 69 6e 67 20 69 6e 74 6f 20 6f 75 72 20 65 72 |ning into our er| 00001460 72 6f 6e 65 6f 75 73 20 6c 61 79 65 72 2e 20 20 |roneous layer. | 00001470 59 6f 75 0a 6d 61 79 20 73 74 69 6c 6c 20 62 65 |You.may still be| 00001480 20 61 62 6c 65 20 74 6f 20 67 65 74 20 79 6f 75 | able to get you| 00001490 72 20 45 74 68 65 72 6e 65 74 20 61 6e 64 20 49 |r Ethernet and I| 000014a0 50 76 34 20 6c 61 79 65 72 73 20 63 6f 72 72 65 |Pv4 layers corre| 000014b0 63 74 6c 79 2c 20 65 76 65 6e 20 69 66 0a 79 6f |ctly, even if.yo| 000014c0 75 72 20 54 43 50 20 6c 61 79 65 72 20 69 73 20 |ur TCP layer is | 000014d0 6d 61 6c 66 6f 72 6d 65 64 2e 0a 3c 2f 70 3e 0a |malformed..

.| 000014e0 3c 68 33 20 69 64 3d 22 46 6c 6f 77 5f 41 6e 64 |

Flow | 00001500 41 6e 64 20 45 6e 64 70 6f 69 6e 74 3c 2f 68 33 |And Endpoint.

.gopacket h| 00001520 61 73 20 74 77 6f 20 75 73 65 66 75 6c 20 6f 62 |as two useful ob| 00001530 6a 65 63 74 73 2c 20 46 6c 6f 77 20 61 6e 64 20 |jects, Flow and | 00001540 45 6e 64 70 6f 69 6e 74 2c 20 66 6f 72 20 63 6f |Endpoint, for co| 00001550 6d 6d 75 6e 69 63 61 74 69 6e 67 20 69 6e 20 61 |mmunicating in a| 00001560 20 70 72 6f 74 6f 63 6f 6c 0a 69 6e 64 65 70 65 | protocol.indepe| 00001570 6e 64 65 6e 74 20 6d 61 6e 6e 65 72 20 74 68 65 |ndent manner the| 00001580 20 66 61 63 74 20 74 68 61 74 20 61 20 70 61 63 | fact that a pac| 00001590 6b 65 74 20 69 73 20 63 6f 6d 69 6e 67 20 66 72 |ket is coming fr| 000015a0 6f 6d 20 41 20 61 6e 64 20 67 6f 69 6e 67 20 74 |om A and going t| 000015b0 6f 20 42 2e 0a 54 68 65 20 67 65 6e 65 72 61 6c |o B..The general| 000015c0 20 6c 61 79 65 72 20 74 79 70 65 73 20 4c 69 6e | layer types Lin| 000015d0 6b 4c 61 79 65 72 2c 20 4e 65 74 77 6f 72 6b 4c |kLayer, NetworkL| 000015e0 61 79 65 72 2c 20 61 6e 64 20 54 72 61 6e 73 70 |ayer, and Transp| 000015f0 6f 72 74 4c 61 79 65 72 20 61 6c 6c 20 70 72 6f |ortLayer all pro| 00001600 76 69 64 65 0a 6d 65 74 68 6f 64 73 20 66 6f 72 |vide.methods for| 00001610 20 65 78 74 72 61 63 74 69 6e 67 20 74 68 65 69 | extracting thei| 00001620 72 20 66 6c 6f 77 20 69 6e 66 6f 72 6d 61 74 69 |r flow informati| 00001630 6f 6e 2c 20 77 69 74 68 6f 75 74 20 77 6f 72 72 |on, without worr| 00001640 79 69 6e 67 20 61 62 6f 75 74 20 74 68 65 20 74 |ying about the t| 00001650 79 70 65 0a 6f 66 20 74 68 65 20 75 6e 64 65 72 |ype.of the under| 00001660 6c 79 69 6e 67 20 4c 61 79 65 72 2e 0a 3c 2f 70 |lying Layer...

.A Flow is | 00001680 61 20 73 69 6d 70 6c 65 20 6f 62 6a 65 63 74 20 |a simple object | 00001690 6d 61 64 65 20 75 70 20 6f 66 20 61 20 73 65 74 |made up of a set| 000016a0 20 6f 66 20 74 77 6f 20 45 6e 64 70 6f 69 6e 74 | of two Endpoint| 000016b0 73 2c 20 6f 6e 65 20 73 6f 75 72 63 65 20 61 6e |s, one source an| 000016c0 64 20 6f 6e 65 0a 64 65 73 74 69 6e 61 74 69 6f |d one.destinatio| 000016d0 6e 2e 20 20 49 74 20 64 65 74 61 69 6c 73 20 74 |n. It details t| 000016e0 68 65 20 73 65 6e 64 65 72 20 61 6e 64 20 72 65 |he sender and re| 000016f0 63 65 69 76 65 72 20 6f 66 20 74 68 65 20 4c 61 |ceiver of the La| 00001700 79 65 72 20 6f 66 20 74 68 65 20 50 61 63 6b 65 |yer of the Packe| 00001710 74 2e 0a 3c 2f 70 3e 0a 3c 70 3e 0a 41 6e 20 45 |t..

.

.An E| 00001720 6e 64 70 6f 69 6e 74 20 69 73 20 61 20 68 61 73 |ndpoint is a has| 00001730 68 61 62 6c 65 20 72 65 70 72 65 73 65 6e 74 61 |hable representa| 00001740 74 69 6f 6e 20 6f 66 20 61 20 73 6f 75 72 63 65 |tion of a source| 00001750 20 6f 72 20 64 65 73 74 69 6e 61 74 69 6f 6e 2e | or destination.| 00001760 20 20 46 6f 72 0a 65 78 61 6d 70 6c 65 2c 20 66 | For.example, f| 00001770 6f 72 20 4c 61 79 65 72 54 79 70 65 49 50 76 34 |or LayerTypeIPv4| 00001780 2c 20 61 6e 20 45 6e 64 70 6f 69 6e 74 20 63 6f |, an Endpoint co| 00001790 6e 74 61 69 6e 73 20 74 68 65 20 49 50 20 61 64 |ntains the IP ad| 000017a0 64 72 65 73 73 20 62 79 74 65 73 20 66 6f 72 20 |dress bytes for | 000017b0 61 20 76 34 0a 49 50 20 70 61 63 6b 65 74 2e 20 |a v4.IP packet. | 000017c0 20 41 20 46 6c 6f 77 20 63 61 6e 20 62 65 20 62 | A Flow can be b| 000017d0 72 6f 6b 65 6e 20 69 6e 74 6f 20 45 6e 64 70 6f |roken into Endpo| 000017e0 69 6e 74 73 2c 20 61 6e 64 20 45 6e 64 70 6f 69 |ints, and Endpoi| 000017f0 6e 74 73 20 63 61 6e 20 62 65 20 63 6f 6d 62 69 |nts can be combi| 00001800 6e 65 64 0a 69 6e 74 6f 20 46 6c 6f 77 73 3a 0a |ned.into Flows:.| 00001810 3c 2f 70 3e 0a 3c 70 72 65 3e 70 61 63 6b 65 74 |

.
packet|
        00001820  20 3a 3d 20 67 6f 70 61  63 6b 65 74 2e 4e 65 77  | := gopacket.New|
        00001830  50 61 63 6b 65 74 28 6d  79 50 61 63 6b 65 74 44  |Packet(myPacketD|
        00001840  61 74 61 2c 20 6c 61 79  65 72 73 2e 4c 61 79 65  |ata, layers.Laye|
        00001850  72 54 79 70 65 45 74 68  65 72 6e 65 74 2c 20 67  |rTypeEthernet, g|
        00001860  6f 70 61 63 6b 65 74 2e  4c 61 7a 79 29 0a 6e 65  |opacket.Lazy).ne|
        00001870  74 46 6c 6f 77 20 3a 3d  20 70 61 63 6b 65 74 2e  |tFlow := packet.|
        00001880  4e 65 74 77 6f 72 6b 4c  61 79 65 72 28 29 2e 4e  |NetworkLayer().N|
        00001890  65 74 77 6f 72 6b 46 6c  6f 77 28 29 0a 73 72 63  |etworkFlow().src|
        000018a0  2c 20 64 73 74 20 3a 3d  20 6e 65 74 46 6c 6f 77  |, dst := netFlow|
        000018b0  2e 45 6e 64 70 6f 69 6e  74 73 28 29 0a 72 65 76  |.Endpoints().rev|
        000018c0  65 72 73 65 46 6c 6f 77  20 3a 3d 20 67 6f 70 61  |erseFlow := gopa|
        000018d0  63 6b 65 74 2e 4e 65 77  46 6c 6f 77 28 64 73 74  |cket.NewFlow(dst|
        000018e0  2c 20 73 72 63 29 0a 3c  2f 70 72 65 3e 0a 3c 70  |, src).
..Both Endpoint | 00001900 61 6e 64 20 46 6c 6f 77 20 6f 62 6a 65 63 74 73 |and Flow objects| 00001910 20 63 61 6e 20 62 65 20 75 73 65 64 20 61 73 20 | can be used as | 00001920 6d 61 70 20 6b 65 79 73 2c 20 61 6e 64 20 74 68 |map keys, and th| 00001930 65 20 65 71 75 61 6c 69 74 79 0a 6f 70 65 72 61 |e equality.opera| 00001940 74 6f 72 20 63 61 6e 20 63 6f 6d 70 61 72 65 20 |tor can compare | 00001950 74 68 65 6d 2c 20 73 6f 20 79 6f 75 20 63 61 6e |them, so you can| 00001960 20 65 61 73 69 6c 79 20 67 72 6f 75 70 20 74 6f | easily group to| 00001970 67 65 74 68 65 72 20 61 6c 6c 20 70 61 63 6b 65 |gether all packe| 00001980 74 73 0a 62 61 73 65 64 20 6f 6e 20 65 6e 64 70 |ts.based on endp| 00001990 6f 69 6e 74 20 63 72 69 74 65 72 69 61 3a 0a 3c |oint criteria:.<| 000019a0 2f 70 3e 0a 3c 70 72 65 3e 66 6c 6f 77 73 20 3a |/p>.
flows :|
        000019b0  3d 20 6d 61 70 5b 67 6f  70 61 63 6b 65 74 2e 45  |= map[gopacket.E|
        000019c0  6e 64 70 6f 69 6e 74 5d  63 68 61 6e 20 67 6f 70  |ndpoint]chan gop|
        000019d0  61 63 6b 65 74 2e 50 61  63 6b 65 74 0a 70 61 63  |acket.Packet.pac|
        000019e0  6b 65 74 20 3a 3d 20 67  6f 70 61 63 6b 65 74 2e  |ket := gopacket.|
        000019f0  4e 65 77 50 61 63 6b 65  74 28 6d 79 50 61 63 6b  |NewPacket(myPack|
        00001a00  65 74 44 61 74 61 2c 20  6c 61 79 65 72 73 2e 4c  |etData, layers.L|
        00001a10  61 79 65 72 54 79 70 65  45 74 68 65 72 6e 65 74  |ayerTypeEthernet|
        00001a20  2c 20 67 6f 70 61 63 6b  65 74 2e 4c 61 7a 79 29  |, gopacket.Lazy)|
        00001a30  0a 2f 2f 20 53 65 6e 64  20 61 6c 6c 20 54 43 50  |.// Send all TCP|
        00001a40  20 70 61 63 6b 65 74 73  20 74 6f 20 63 68 61 6e  | packets to chan|
        00001a50  6e 65 6c 73 20 62 61 73  65 64 20 6f 6e 20 74 68  |nels based on th|
        00001a60  65 69 72 20 64 65 73 74  69 6e 61 74 69 6f 6e 20  |eir destination |
        00001a70  70 6f 72 74 2e 0a 69 66  20 74 63 70 20 3a 3d 20  |port..if tcp := |
        00001a80  70 61 63 6b 65 74 2e 4c  61 79 65 72 28 6c 61 79  |packet.Layer(lay|
        00001a90  65 72 73 2e 4c 61 79 65  72 54 79 70 65 54 43 50  |ers.LayerTypeTCP|
        00001aa0  29 3b 20 74 63 70 20 21  3d 20 6e 69 6c 20 7b 0a  |); tcp != nil {.|
        00001ab0  20 20 66 6c 6f 77 73 5b  74 63 70 2e 54 72 61 6e  |  flows[tcp.Tran|
        00001ac0  73 70 6f 72 74 46 6c 6f  77 28 29 2e 44 73 74 28  |sportFlow().Dst(|
        00001ad0  29 5d 20 26 6c 74 3b 2d  20 70 61 63 6b 65 74 0a  |)] <- packet.|
        00001ae0  7d 0a 2f 2f 20 4c 6f 6f  6b 20 66 6f 72 20 61 6c  |}.// Look for al|
        00001af0  6c 20 70 61 63 6b 65 74  73 20 77 69 74 68 20 74  |l packets with t|
        00001b00  68 65 20 73 61 6d 65 20  73 6f 75 72 63 65 20 61  |he same source a|
        00001b10  6e 64 20 64 65 73 74 69  6e 61 74 69 6f 6e 20 6e  |nd destination n|
        00001b20  65 74 77 6f 72 6b 20 61  64 64 72 65 73 73 0a 69  |etwork address.i|
        00001b30  66 20 6e 65 74 20 3a 3d  20 70 61 63 6b 65 74 2e  |f net := packet.|
        00001b40  4e 65 74 77 6f 72 6b 4c  61 79 65 72 28 29 3b 20  |NetworkLayer(); |
        00001b50  6e 65 74 20 21 3d 20 6e  69 6c 20 7b 0a 20 20 73  |net != nil {.  s|
        00001b60  72 63 2c 20 64 73 74 20  3a 3d 20 6e 65 74 2e 4e  |rc, dst := net.N|
        00001b70  65 74 77 6f 72 6b 46 6c  6f 77 28 29 2e 45 6e 64  |etworkFlow().End|
        00001b80  70 6f 69 6e 74 73 28 29  0a 20 20 69 66 20 73 72  |points().  if sr|
        00001b90  63 20 3d 3d 20 64 73 74  20 7b 0a 20 20 20 20 66  |c == dst {.    f|
        00001ba0  6d 74 2e 50 72 69 6e 74  6c 6e 28 26 23 33 34 3b  |mt.Println("|
        00001bb0  46 69 73 68 79 20 70 61  63 6b 65 74 20 68 61 73  |Fishy packet has|
        00001bc0  20 73 61 6d 65 20 6e 65  74 77 6f 72 6b 20 73 6f  | same network so|
        00001bd0  75 72 63 65 20 61 6e 64  20 64 73 74 3a 20 25 73  |urce and dst: %s|
        00001be0  26 23 33 34 3b 2c 20 73  72 63 29 0a 20 20 7d 0a  |", src).  }.|
        00001bf0  7d 0a 2f 2f 20 46 69 6e  64 20 61 6c 6c 20 70 61  |}.// Find all pa|
        00001c00  63 6b 65 74 73 20 63 6f  6d 69 6e 67 20 66 72 6f  |ckets coming fro|
        00001c10  6d 20 55 44 50 20 70 6f  72 74 20 31 30 30 30 20  |m UDP port 1000 |
        00001c20  74 6f 20 55 44 50 20 70  6f 72 74 20 35 30 30 0a  |to UDP port 500.|
        00001c30  69 6e 74 65 72 65 73 74  69 6e 67 46 6c 6f 77 20  |interestingFlow |
        00001c40  3a 3d 20 67 6f 70 61 63  6b 65 74 2e 4e 65 77 46  |:= gopacket.NewF|
        00001c50  6c 6f 77 28 6c 61 79 65  72 73 2e 4e 65 77 55 44  |low(layers.NewUD|
        00001c60  50 50 6f 72 74 45 6e 64  70 6f 69 6e 74 28 31 30  |PPortEndpoint(10|
        00001c70  30 30 29 2c 20 6c 61 79  65 72 73 2e 4e 65 77 55  |00), layers.NewU|
        00001c80  44 50 50 6f 72 74 45 6e  64 70 6f 69 6e 74 28 35  |DPPortEndpoint(5|
        00001c90  30 30 29 29 0a 69 66 20  74 20 3a 3d 20 70 61 63  |00)).if t := pac|
        00001ca0  6b 65 74 2e 4e 65 74 77  6f 72 6b 4c 61 79 65 72  |ket.NetworkLayer|
        00001cb0  28 29 3b 20 74 20 21 3d  20 6e 69 6c 20 26 61 6d  |(); t != nil &am|
        00001cc0  70 3b 26 61 6d 70 3b 20  74 2e 54 72 61 6e 73 70  |p;& t.Transp|
        00001cd0  6f 72 74 46 6c 6f 77 28  29 20 3d 3d 20 69 6e 74  |ortFlow() == int|
        00001ce0  65 72 65 73 74 69 6e 67  46 6c 6f 77 20 7b 0a 20  |erestingFlow {. |
        00001cf0  20 66 6d 74 2e 50 72 69  6e 74 6c 6e 28 26 23 33  | fmt.Println(|
        00001d00  34 3b 46 6f 75 6e 64 20  74 68 61 74 20 55 44 50  |4;Found that UDP|
        00001d10  20 66 6c 6f 77 20 49 20  77 61 73 20 6c 6f 6f 6b  | flow I was look|
        00001d20  69 6e 67 20 66 6f 72 21  26 23 33 34 3b 29 0a 7d  |ing for!").}|
        00001d30  0a 3c 2f 70 72 65 3e 0a  3c 68 33 20 69 64 3d 22  |.
.

I| 00001d60 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 59 6f 75 72 |mplementing Your| 00001d70 20 4f 77 6e 20 44 65 63 6f 64 65 72 3c 2f 68 33 | Own Decoder.

.If your ne| 00001d90 74 77 6f 72 6b 20 68 61 73 20 73 6f 6d 65 20 73 |twork has some s| 00001da0 74 72 61 6e 67 65 20 65 6e 63 61 70 73 75 6c 61 |trange encapsula| 00001db0 74 69 6f 6e 2c 20 79 6f 75 20 63 61 6e 20 69 6d |tion, you can im| 00001dc0 70 6c 65 6d 65 6e 74 20 79 6f 75 72 20 6f 77 6e |plement your own| 00001dd0 0a 64 65 63 6f 64 65 72 2e 20 20 49 6e 20 74 68 |.decoder. In th| 00001de0 69 73 20 65 78 61 6d 70 6c 65 2c 20 77 65 20 68 |is example, we h| 00001df0 61 6e 64 6c 65 20 45 74 68 65 72 6e 65 74 20 70 |andle Ethernet p| 00001e00 61 63 6b 65 74 73 20 77 68 69 63 68 20 61 72 65 |ackets which are| 00001e10 20 65 6e 63 61 70 73 75 6c 61 74 65 64 0a 69 6e | encapsulated.in| 00001e20 20 61 20 34 2d 62 79 74 65 20 68 65 61 64 65 72 | a 4-byte header| 00001e30 2e 0a 3c 2f 70 3e 0a 3c 70 72 65 3e 2f 2f 20 43 |..

.
// C|
        00001e40  72 65 61 74 65 20 61 20  6c 61 79 65 72 20 74 79  |reate a layer ty|
        00001e50  70 65 2c 20 73 68 6f 75  6c 64 20 62 65 20 75 6e  |pe, should be un|
        00001e60  69 71 75 65 20 61 6e 64  20 68 69 67 68 2c 20 73  |ique and high, s|
        00001e70  6f 20 69 74 20 64 6f 65  73 6e 26 23 33 39 3b 74  |o it doesn't|
        00001e80  20 63 6f 6e 66 6c 69 63  74 2c 0a 2f 2f 20 67 69  | conflict,.// gi|
        00001e90  76 69 6e 67 20 69 74 20  61 20 6e 61 6d 65 20 61  |ving it a name a|
        00001ea0  6e 64 20 61 20 64 65 63  6f 64 65 72 20 74 6f 20  |nd a decoder to |
        00001eb0  75 73 65 2e 0a 76 61 72  20 4d 79 4c 61 79 65 72  |use..var MyLayer|
        00001ec0  54 79 70 65 20 3d 20 67  6f 70 61 63 6b 65 74 2e  |Type = gopacket.|
        00001ed0  52 65 67 69 73 74 65 72  4c 61 79 65 72 54 79 70  |RegisterLayerTyp|
        00001ee0  65 28 31 32 33 34 35 2c  20 26 23 33 34 3b 4d 79  |e(12345, "My|
        00001ef0  4c 61 79 65 72 54 79 70  65 26 23 33 34 3b 2c 20  |LayerType", |
        00001f00  67 6f 70 61 63 6b 65 74  2e 44 65 63 6f 64 65 46  |gopacket.DecodeF|
        00001f10  75 6e 63 28 64 65 63 6f  64 65 4d 79 4c 61 79 65  |unc(decodeMyLaye|
        00001f20  72 29 29 0a 0a 2f 2f 20  49 6d 70 6c 65 6d 65 6e  |r))..// Implemen|
        00001f30  74 20 6d 79 20 6c 61 79  65 72 0a 74 79 70 65 20  |t my layer.type |
        00001f40  4d 79 4c 61 79 65 72 20  73 74 72 75 63 74 20 7b  |MyLayer struct {|
        00001f50  0a 20 20 53 74 72 61 6e  67 65 48 65 61 64 65 72  |.  StrangeHeader|
        00001f60  20 5b 5d 62 79 74 65 0a  20 20 70 61 79 6c 6f 61  | []byte.  payloa|
        00001f70  64 20 5b 5d 62 79 74 65  0a 7d 0a 66 75 6e 63 20  |d []byte.}.func |
        00001f80  28 6d 20 4d 79 4c 61 79  65 72 29 20 4c 61 79 65  |(m MyLayer) Laye|
        00001f90  72 54 79 70 65 28 29 20  4c 61 79 65 72 54 79 70  |rType() LayerTyp|
        00001fa0  65 20 7b 20 72 65 74 75  72 6e 20 4d 79 4c 61 79  |e { return MyLay|
        00001fb0  65 72 54 79 70 65 20 7d  0a 66 75 6e 63 20 28 6d  |erType }.func (m|
        00001fc0  20 4d 79 4c 61 79 65 72  29 20 4c 61 79 65 72 43  | MyLayer) LayerC|
        00001fd0  6f 6e 74 65 6e 74 73 28  29 20 5b 5d 62 79 74 65  |ontents() []byte|
        00001fe0  20 7b 20 72 65 74 75 72  6e 20 6d 2e 53 74 72 61  | { return m.Stra|
        00001ff0  6e 67 65 48 65 61 64 65  72 20 7d 0a 66 75 6e 63  |ngeHeader }.func|
        00002000  20 28 6d 20 4d 79 4c 61  79 65 72 29 20 4c 61 79  | (m MyLayer) Lay|
        00002010  65 72 50 61 79 6c 6f 61  64 28 29 20 5b 5d 62 79  |erPayload() []by|
        00002020  74 65 20 7b 20 72 65 74  75 72 6e 20 6d 2e 70 61  |te { return m.pa|
        00002030  79 6c 6f 61 64 20 7d 0a  0a 2f 2f 20 4e 6f 77 20  |yload }..// Now |
        00002040  69 6d 70 6c 65 6d 65 6e  74 20 61 20 64 65 63 6f  |implement a deco|
        00002050  64 65 72 2e 2e 2e 20 74  68 69 73 20 6f 6e 65 20  |der... this one |
        00002060  73 74 72 69 70 73 20 6f  66 66 20 74 68 65 20 66  |strips off the f|
        00002070  69 72 73 74 20 34 20 62  79 74 65 73 20 6f 66 20  |irst 4 bytes of |
        00002080  74 68 65 0a 2f 2f 20 70  61 63 6b 65 74 2e 0a 66  |the.// packet..f|
        00002090  75 6e 63 20 64 65 63 6f  64 65 4d 79 4c 61 79 65  |unc decodeMyLaye|
        000020a0  72 28 64 61 74 61 20 5b  5d 62 79 74 65 2c 20 70  |r(data []byte, p|
        000020b0  20 67 6f 70 61 63 6b 65  74 2e 50 61 63 6b 65 74  | gopacket.Packet|
        000020c0  42 75 69 6c 64 65 72 29  20 65 72 72 6f 72 20 7b  |Builder) error {|
        000020d0  0a 20 20 2f 2f 20 43 72  65 61 74 65 20 6d 79 20  |.  // Create my |
        000020e0  6c 61 79 65 72 0a 20 20  70 2e 41 64 64 4c 61 79  |layer.  p.AddLay|
        000020f0  65 72 28 26 61 6d 70 3b  4d 79 4c 61 79 65 72 7b  |er(&MyLayer{|
        00002100  64 61 74 61 5b 3a 34 5d  2c 20 64 61 74 61 5b 34  |data[:4], data[4|
        00002110  3a 5d 7d 29 0a 20 20 2f  2f 20 44 65 74 65 72 6d  |:]}).  // Determ|
        00002120  69 6e 65 20 68 6f 77 20  74 6f 20 68 61 6e 64 6c  |ine how to handl|
        00002130  65 20 74 68 65 20 72 65  73 74 20 6f 66 20 74 68  |e the rest of th|
        00002140  65 20 70 61 63 6b 65 74  0a 20 20 72 65 74 75 72  |e packet.  retur|
        00002150  6e 20 70 2e 4e 65 78 74  44 65 63 6f 64 65 72 28  |n p.NextDecoder(|
        00002160  6c 61 79 65 72 73 2e 4c  61 79 65 72 54 79 70 65  |layers.LayerType|
        00002170  45 74 68 65 72 6e 65 74  29 0a 7d 0a 0a 2f 2f 20  |Ethernet).}..// |
        00002180  46 69 6e 61 6c 6c 79 2c  20 64 65 63 6f 64 65 20  |Finally, decode |
        00002190  79 6f 75 72 20 70 61 63  6b 65 74 73 3a 0a 70 20  |your packets:.p |
        000021a0  3a 3d 20 67 6f 70 61 63  6b 65 74 2e 4e 65 77 50  |:= gopacket.NewP|
        000021b0  61 63 6b 65 74 28 64 61  74 61 2c 20 4d 79 4c 61  |acket(data, MyLa|
        000021c0  79 65 72 54 79 70 65 2c  20 67 6f 70 61 63 6b 65  |yerType, gopacke|
        000021d0  74 2e 4c 61 7a 79 29 0a  3c 2f 70 72 65 3e 0a 3c  |t.Lazy).
.<| 000021e0 70 3e 0a 53 65 65 20 74 68 65 20 64 6f 63 73 20 |p>.See the docs | 000021f0 66 6f 72 20 44 65 63 6f 64 65 72 20 61 6e 64 20 |for Decoder and | 00002200 50 61 63 6b 65 74 42 75 69 6c 64 65 72 20 66 6f |PacketBuilder fo| 00002210 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 20 6f |r more details o| 00002220 6e 20 68 6f 77 20 63 6f 64 69 6e 67 0a 64 65 63 |n how coding.dec| 00002230 6f 64 65 72 73 20 77 6f 72 6b 73 2c 20 6f 72 20 |oders works, or | 00002240 6c 6f 6f 6b 20 61 74 20 52 65 67 69 73 74 65 72 |look at Register| 00002250 4c 61 79 65 72 54 79 70 65 20 61 6e 64 20 52 65 |LayerType and Re| 00002260 67 69 73 74 65 72 45 6e 64 70 6f 69 6e 74 54 79 |gisterEndpointTy| 00002270 70 65 20 74 6f 20 73 65 65 20 68 6f 77 0a 74 6f |pe to see how.to| 00002280 20 61 64 64 20 6c 61 79 65 72 2f 65 6e 64 70 6f | add layer/endpo| 00002290 69 6e 74 20 74 79 70 65 73 20 74 6f 20 67 6f 70 |int types to gop| 000022a0 61 63 6b 65 74 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 |acket..

.....| 000022b0 3c 2f 64 69 76 3e 0a 09 09 3c 2f 64 69 76 3e 0a |

....| 000022c0 09 09 0a 09 0a 09 09 3c 68 32 20 69 64 3d 22 70 |.......

Index<| 000022e0 2f 68 32 3e 0a 09 09 3c 21 2d 2d 20 54 61 62 6c |/h2>..........
.......| 00002360 09 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 |......
Variables| 00002390 3c 2f 64 64 3e 0a 09 09 09 0a 09 09 09 0a 09 09 |
...........| 000023a0 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 3e 3c |...........
<| 000023b0 61 20 68 72 65 66 3d 22 23 41 70 70 6c 69 63 61 |a href="#Applica| 000023c0 74 69 6f 6e 4c 61 79 65 72 22 3e 74 79 70 65 20 |tionLayer">type | 000023d0 41 70 70 6c 69 63 61 74 69 6f 6e 4c 61 79 65 72 |ApplicationLayer| 000023e0 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 |
.......| 000023f0 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00002400 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 43 |.
type| 00002420 20 43 61 70 74 75 72 65 49 6e 66 6f 3c 2f 61 3e | CaptureInfo| 00002430 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 09 0a |
...........| 00002440 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 |.............type D| 00002470 65 63 6f 64 65 46 61 69 6c 75 72 65 3c 2f 61 3e |ecodeFailure| 00002480 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 09 0a |...........| 00002490 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 |...........
&| 000024a0 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 |nbsp;   func| 000024d0 20 28 64 20 2a 44 65 63 6f 64 65 46 61 69 6c 75 | (d *DecodeFailu| 000024e0 72 65 29 20 45 72 72 6f 72 28 29 20 65 72 72 6f |re) Error() erro| 000024f0 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a |r
......| 00002500 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 |...........
&| 00002510 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 |nbsp;   func (d *Dec| 00002550 6f 64 65 46 61 69 6c 75 72 65 29 20 4c 61 79 65 |odeFailure) Laye| 00002560 72 43 6f 6e 74 65 6e 74 73 28 29 20 5b 5d 62 79 |rContents() []by| 00002570 74 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 |te
.....| 00002580 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e |............
| 00002590 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 |    func (d *Dec| 000025d0 6f 64 65 46 61 69 6c 75 72 65 29 20 4c 61 79 65 |odeFailure) Laye| 000025e0 72 50 61 79 6c 6f 61 64 28 29 20 5b 5d 62 79 74 |rPayload() []byt| 000025f0 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a |e
......| 00002600 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 |...........
&| 00002610 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 |nbsp;   | 00002640 66 75 6e 63 20 28 64 20 2a 44 65 63 6f 64 65 46 |func (d *DecodeF| 00002650 61 69 6c 75 72 65 29 20 4c 61 79 65 72 54 79 70 |ailure) LayerTyp| 00002660 65 28 29 20 4c 61 79 65 72 54 79 70 65 3c 2f 61 |e() LayerType
..........| 00002680 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e 62 73 70 |.......
 | 00002690 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 72 65 66 |;   func (d| 000026c0 20 2a 44 65 63 6f 64 65 46 61 69 6c 75 72 65 29 | *DecodeFailure)| 000026d0 20 53 74 72 69 6e 67 28 29 20 73 74 72 69 6e 67 | String() string| 000026e0 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 |
.......| 000026f0 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 3e |............
| 00002700 3c 61 20 68 72 65 66 3d 22 23 44 65 63 6f 64 65 |type Decod| 00002720 65 46 75 6e 63 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |eFunc
..| 00002730 09 09 09 0a 09 09 09 09 0a 09 09 09 09 09 0a 09 |................| 00002740 09 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 |....
  &| 00002750 6e 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 |nbsp; func (d Decod| 00002780 65 46 75 6e 63 29 20 44 65 63 6f 64 65 28 64 61 |eFunc) Decode(da| 00002790 74 61 20 5b 5d 62 79 74 65 2c 20 70 20 50 61 63 |ta []byte, p Pac| 000027a0 6b 65 74 42 75 69 6c 64 65 72 29 20 65 72 72 6f |ketBuilder) erro| 000027b0 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a |r
......| 000027c0 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 |.............type D| 000027f0 65 63 6f 64 65 4f 70 74 69 6f 6e 73 3c 2f 61 3e |ecodeOptions| 00002800 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 09 0a |...........| 00002810 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 |.............type Decoder| 00002840 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 |.......| 00002850 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00002860 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 45 |.
type En| 00002880 64 70 6f 69 6e 74 3c 2f 61 3e 3c 2f 64 64 3e 0a |dpoint
.| 00002890 09 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 |................| 000028a0 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 |
   | 000028b0 3b 20 3c 61 20 68 72 65 66 3d 22 23 4e 65 77 45 |; func Ne| 000028d0 77 45 6e 64 70 6f 69 6e 74 28 74 79 70 20 45 6e |wEndpoint(typ En| 000028e0 64 70 6f 69 6e 74 54 79 70 65 2c 20 72 61 77 20 |dpointType, raw | 000028f0 5b 5d 62 79 74 65 29 20 45 6e 64 70 6f 69 6e 74 |[]byte) Endpoint| 00002900 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 |
.......| 00002910 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00002920 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00002930 20 3c 61 20 68 72 65 66 3d 22 23 45 6e 64 70 6f | func (e Endpoi| 00002960 6e 74 29 20 45 6e 64 70 6f 69 6e 74 54 79 70 65 |nt) EndpointType| 00002970 28 29 20 45 6e 64 70 6f 69 6e 74 54 79 70 65 3c |() EndpointType<| 00002980 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 09 |/a>........| 00002990 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e 62 |.........
&nb| 000029a0 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 72 |sp;   func (a | 000029d0 45 6e 64 70 6f 69 6e 74 29 20 4c 65 73 73 54 68 |Endpoint) LessTh| 000029e0 61 6e 28 62 20 45 6e 64 70 6f 69 6e 74 29 20 62 |an(b Endpoint) b| 000029f0 6f 6f 6c 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 |ool
....| 00002a00 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 |.............    <| 00002a20 61 20 68 72 65 66 3d 22 23 45 6e 64 70 6f 69 6e |a href="#Endpoin| 00002a30 74 2e 52 61 77 22 3e 66 75 6e 63 20 28 65 20 45 |t.Raw">func (e E| 00002a40 6e 64 70 6f 69 6e 74 29 20 52 61 77 28 29 20 5b |ndpoint) Raw() [| 00002a50 5d 62 79 74 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |]byte..| 00002a60 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00002a70 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00002a80 20 3c 61 20 68 72 65 66 3d 22 23 45 6e 64 70 6f | func| 00002aa0 20 28 65 20 45 6e 64 70 6f 69 6e 74 29 20 53 74 | (e Endpoint) St| 00002ab0 72 69 6e 67 28 29 20 73 74 72 69 6e 67 3c 2f 61 |ring() string..........| 00002ad0 09 09 09 09 0a 09 09 09 09 3c 64 64 3e 3c 61 20 |.........
type Endpoi| 00002b00 6e 74 54 79 70 65 3c 2f 61 3e 3c 2f 64 64 3e 0a |ntType
.| 00002b10 09 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 |................| 00002b20 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 |
   | 00002b30 3b 20 3c 61 20 68 72 65 66 3d 22 23 52 65 67 69 |; func RegisterE| 00002b60 6e 64 70 6f 69 6e 74 54 79 70 65 28 6e 75 6d 20 |ndpointType(num | 00002b70 69 6e 74 2c 20 6d 65 74 61 20 45 6e 64 70 6f 69 |int, meta Endpoi| 00002b80 6e 74 54 79 70 65 4d 65 74 61 64 61 74 61 29 20 |ntTypeMetadata) | 00002b90 45 6e 64 70 6f 69 6e 74 54 79 70 65 3c 2f 61 3e |EndpointType| 00002ba0 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 09 0a |
...........| 00002bb0 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 |...........
&| 00002bc0 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 |nbsp;   func| 00002bf0 20 28 65 20 45 6e 64 70 6f 69 6e 74 54 79 70 65 | (e EndpointType| 00002c00 29 20 53 74 72 69 6e 67 28 29 20 73 74 72 69 6e |) String() strin| 00002c10 67 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a |g
......| 00002c20 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 |.............type EndpointTy| 00002c60 70 65 4d 65 74 61 64 61 74 61 3c 2f 61 3e 3c 2f |peMetadata.............| 00002c80 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 3e 3c |...........
<| 00002c90 61 20 68 72 65 66 3d 22 23 45 72 72 6f 72 4c 61 |a href="#ErrorLa| 00002ca0 79 65 72 22 3e 74 79 70 65 20 45 72 72 6f 72 4c |yer">type ErrorL| 00002cb0 61 79 65 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 |ayer
...| 00002cc0 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 |................| 00002cd0 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 |.....
type Fl| 00002cf0 6f 77 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 |ow
.....| 00002d00 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e |............
| 00002d10 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 |    func | 00002d40 46 6c 6f 77 46 72 6f 6d 45 6e 64 70 6f 69 6e 74 |FlowFromEndpoint| 00002d50 73 28 73 72 63 2c 20 64 73 74 20 45 6e 64 70 6f |s(src, dst Endpo| 00002d60 69 6e 74 29 20 28 5f 20 46 6c 6f 77 2c 20 65 72 |int) (_ Flow, er| 00002d70 72 20 65 72 72 6f 72 29 3c 2f 61 3e 3c 2f 64 64 |r error)...............| 00002d90 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 |..
  &nb| 00002da0 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 4e 65 |sp; func NewF| 00002dc0 6c 6f 77 28 74 20 45 6e 64 70 6f 69 6e 74 54 79 |low(t EndpointTy| 00002dd0 70 65 2c 20 73 72 63 2c 20 64 73 74 20 5b 5d 62 |pe, src, dst []b| 00002de0 79 74 65 29 20 46 6c 6f 77 3c 2f 61 3e 3c 2f 64 |yte) Flow..............| 00002e00 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e 62 73 |........
&nbs| 00002e10 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 72 65 |p;   fu| 00002e30 6e 63 20 28 66 20 46 6c 6f 77 29 20 44 73 74 28 |nc (f Flow) Dst(| 00002e40 29 20 28 64 73 74 20 45 6e 64 70 6f 69 6e 74 29 |) (dst Endpoint)| 00002e50 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 |
.......| 00002e60 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e |..........
&n| 00002e70 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 |bsp;   func (f| 00002ea0 20 46 6c 6f 77 29 20 45 6e 64 70 6f 69 6e 74 54 | Flow) EndpointT| 00002eb0 79 70 65 28 29 20 45 6e 64 70 6f 69 6e 74 54 79 |ype() EndpointTy| 00002ec0 70 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 |pe
.....| 00002ed0 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e |............
| 00002ee0 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 |    func (f | 00002f10 46 6c 6f 77 29 20 45 6e 64 70 6f 69 6e 74 73 28 |Flow) Endpoints(| 00002f20 29 20 28 73 72 63 2c 20 64 73 74 20 45 6e 64 70 |) (src, dst Endp| 00002f30 6f 69 6e 74 29 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |oint)
..| 00002f40 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00002f50 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00002f60 20 3c 61 20 68 72 65 66 3d 22 23 46 6c 6f 77 2e | func (f| 00002f80 20 46 6c 6f 77 29 20 52 65 76 65 72 73 65 28 29 | Flow) Reverse()| 00002f90 20 46 6c 6f 77 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 | Flow..| 00002fa0 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00002fb0 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00002fc0 20 3c 61 20 68 72 65 66 3d 22 23 46 6c 6f 77 2e | func (f Flo| 00002fe0 77 29 20 53 72 63 28 29 20 28 73 72 63 20 45 6e |w) Src() (src En| 00002ff0 64 70 6f 69 6e 74 29 3c 2f 61 3e 3c 2f 64 64 3e |dpoint)| 00003000 0a 09 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 |................| 00003010 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 |.
  &nbs| 00003020 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 46 6c 6f |p; func (| 00003040 66 20 46 6c 6f 77 29 20 53 74 72 69 6e 67 28 29 |f Flow) String()| 00003050 20 73 74 72 69 6e 67 3c 2f 61 3e 3c 2f 64 64 3e | string
| 00003060 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 |................| 00003070 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 |...
type Lay| 00003090 65 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 |er
.....| 000030a0 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 |................| 000030b0 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 |...
typ| 000030d0 65 20 4c 61 79 65 72 43 6c 61 73 73 3c 2f 61 3e |e LayerClass| 000030e0 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 09 09 |
...........| 000030f0 0a 09 09 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b |......
 | 00003100 20 26 6e 62 73 70 3b 20 3c 61 20 68 72 65 66 3d |   func NewLayerCl| 00003130 61 73 73 28 74 79 70 65 73 20 5b 5d 4c 61 79 65 |ass(types []Laye| 00003140 72 54 79 70 65 29 20 4c 61 79 65 72 43 6c 61 73 |rType) LayerClas| 00003150 73 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a |s
......| 00003160 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 |................| 00003170 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 |..
t| 00003190 79 70 65 20 4c 61 79 65 72 43 6c 61 73 73 4d 61 |ype LayerClassMa| 000031a0 70 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a |p
......| 000031b0 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 |...........
&| 000031c0 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 |nbsp;   func Ne| 000031f0 77 4c 61 79 65 72 43 6c 61 73 73 4d 61 70 28 74 |wLayerClassMap(t| 00003200 79 70 65 73 20 5b 5d 4c 61 79 65 72 54 79 70 65 |ypes []LayerType| 00003210 29 20 4c 61 79 65 72 43 6c 61 73 73 4d 61 70 3c |) LayerClassMap<| 00003220 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 09 |/a>
........| 00003230 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 |..............    | 00003250 3c 61 20 68 72 65 66 3d 22 23 4c 61 79 65 72 43 |func (m LayerC| 00003280 6c 61 73 73 4d 61 70 29 20 43 6f 6e 74 61 69 6e |lassMap) Contain| 00003290 73 28 74 20 4c 61 79 65 72 54 79 70 65 29 20 62 |s(t LayerType) b| 000032a0 6f 6f 6c 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 |ool....| 000032b0 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c |...............<| 000032c0 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 4c 61 79 |dd>ty| 000032e0 70 65 20 4c 61 79 65 72 43 6c 61 73 73 53 6c 69 |pe LayerClassSli| 000032f0 63 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 |ce.....| 00003300 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e |............
| 00003310 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 |    func| 00003340 20 4e 65 77 4c 61 79 65 72 43 6c 61 73 73 53 6c | NewLayerClassSl| 00003350 69 63 65 28 74 79 70 65 73 20 5b 5d 4c 61 79 65 |ice(types []Laye| 00003360 72 54 79 70 65 29 20 4c 61 79 65 72 43 6c 61 73 |rType) LayerClas| 00003370 73 53 6c 69 63 65 3c 2f 61 3e 3c 2f 64 64 3e 0a |sSlice
.| 00003380 09 09 09 09 0a 09 09 09 09 0a 09 09 09 09 09 0a |................| 00003390 09 09 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 |.....
  | 000033a0 26 6e 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 |  func | 000033d0 28 73 20 4c 61 79 65 72 43 6c 61 73 73 53 6c 69 |(s LayerClassSli| 000033e0 63 65 29 20 43 6f 6e 74 61 69 6e 73 28 74 20 4c |ce) Contains(t L| 000033f0 61 79 65 72 54 79 70 65 29 20 62 6f 6f 6c 3c 2f |ayerType) bool
.........| 00003410 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 3e 3c 61 |..........
type LayerTyp| 00003440 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a |e
......| 00003450 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 |...........
&| 00003460 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 |nbsp;   func R| 00003490 65 67 69 73 74 65 72 4c 61 79 65 72 54 79 70 65 |egisterLayerType| 000034a0 28 6e 75 6d 20 69 6e 74 2c 20 6d 65 74 61 20 4c |(num int, meta L| 000034b0 61 79 65 72 54 79 70 65 4d 65 74 61 64 61 74 61 |ayerTypeMetadata| 000034c0 29 20 4c 61 79 65 72 54 79 70 65 3c 2f 61 3e 3c |) LayerType<| 000034d0 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 09 0a 09 |/dd>............| 000034e0 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e |..........
&n| 000034f0 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 |bsp;   func (t | 00003520 4c 61 79 65 72 54 79 70 65 29 20 44 65 63 6f 64 |LayerType) Decod| 00003530 65 28 64 61 74 61 20 5b 5d 62 79 74 65 2c 20 63 |e(data []byte, c| 00003540 20 50 61 63 6b 65 74 42 75 69 6c 64 65 72 29 20 | PacketBuilder) | 00003550 65 72 72 6f 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |error
..| 00003560 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00003570 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00003580 20 3c 61 20 68 72 65 66 3d 22 23 4c 61 79 65 72 | fun| 000035a0 63 20 28 74 20 4c 61 79 65 72 54 79 70 65 29 20 |c (t LayerType) | 000035b0 53 74 72 69 6e 67 28 29 20 28 73 20 73 74 72 69 |String() (s stri| 000035c0 6e 67 29 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 |ng)....| 000035d0 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c |...............<| 000035e0 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 4c 61 79 |dd>| 00003600 74 79 70 65 20 4c 61 79 65 72 54 79 70 65 4d 65 |type LayerTypeMe| 00003610 74 61 64 61 74 61 3c 2f 61 3e 3c 2f 64 64 3e 0a |tadata.| 00003620 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 |................| 00003630 09 09 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 |.......
| 00003650 74 79 70 65 20 4c 69 6e 6b 4c 61 79 65 72 3c 2f |type LinkLayer
.........| 00003670 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c |...............<| 00003680 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 4e 65 74 |dd>type | 000036a0 4e 65 74 77 6f 72 6b 4c 61 79 65 72 3c 2f 61 3e |NetworkLayer| 000036b0 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 09 0a |...........| 000036c0 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 |.............type Packet.........| 00003700 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e 62 73 |........
&nbs| 00003710 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 72 65 |p;   f| 00003730 75 6e 63 20 4e 65 77 50 61 63 6b 65 74 28 64 61 |unc NewPacket(da| 00003740 74 61 20 5b 5d 62 79 74 65 2c 20 66 69 72 73 74 |ta []byte, first| 00003750 4c 61 79 65 72 44 65 63 6f 64 65 72 20 44 65 63 |LayerDecoder Dec| 00003760 6f 64 65 72 2c 20 6f 70 74 69 6f 6e 73 20 44 65 |oder, options De| 00003770 63 6f 64 65 4f 70 74 69 6f 6e 73 29 20 50 61 63 |codeOptions) Pac| 00003780 6b 65 74 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 |ket
....| 00003790 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a |................| 000037a0 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d |....
type PacketBuil| 000037d0 64 65 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 |der
....| 000037e0 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a |................| 000037f0 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d |....
type PacketD| 00003820 61 74 61 53 6f 75 72 63 65 3c 2f 61 3e 3c 2f 64 |ataSource..............| 00003840 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 3e 3c 61 |..........
type Packe| 00003870 74 53 6f 75 72 63 65 3c 2f 61 3e 3c 2f 64 64 3e |tSource
| 00003880 0a 09 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 |................| 00003890 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 |.
  &nbs| 000038a0 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 4e 65 77 |p; fu| 000038c0 6e 63 20 4e 65 77 50 61 63 6b 65 74 53 6f 75 72 |nc NewPacketSour| 000038d0 63 65 28 73 6f 75 72 63 65 20 50 61 63 6b 65 74 |ce(source Packet| 000038e0 44 61 74 61 53 6f 75 72 63 65 2c 20 64 65 63 6f |DataSource, deco| 000038f0 64 65 72 20 44 65 63 6f 64 65 72 29 20 2a 50 61 |der Decoder) *Pa| 00003900 63 6b 65 74 53 6f 75 72 63 65 3c 2f 61 3e 3c 2f |cketSource.............| 00003920 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e 62 |.........
&nb| 00003930 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 72 |sp;   fu| 00003960 6e 63 20 28 70 20 2a 50 61 63 6b 65 74 53 6f 75 |nc (p *PacketSou| 00003970 72 63 65 29 20 4e 65 78 74 50 61 63 6b 65 74 28 |rce) NextPacket(| 00003980 29 20 28 50 61 63 6b 65 74 2c 20 65 72 72 6f 72 |) (Packet, error| 00003990 29 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a |)
......| 000039a0 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 |...........
&| 000039b0 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 |nbsp;   fun| 000039e0 63 20 28 70 20 2a 50 61 63 6b 65 74 53 6f 75 72 |c (p *PacketSour| 000039f0 63 65 29 20 50 61 63 6b 65 74 73 28 29 20 63 68 |ce) Packets() ch| 00003a00 61 6e 20 50 61 63 6b 65 74 3c 2f 61 3e 3c 2f 64 |an Packet..............| 00003a20 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 |.....
type| 00003a40 20 50 61 79 6c 6f 61 64 3c 2f 61 3e 3c 2f 64 64 | Payload...............| 00003a60 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e 62 73 70 |.......
 | 00003a70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 72 65 66 |;   func (| 00003aa0 70 20 2a 50 61 79 6c 6f 61 64 29 20 4c 61 79 65 |p *Payload) Laye| 00003ab0 72 43 6f 6e 74 65 6e 74 73 28 29 20 5b 5d 62 79 |rContents() []by| 00003ac0 74 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 |te
.....| 00003ad0 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e |............
| 00003ae0 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 |    fu| 00003b10 6e 63 20 28 70 20 2a 50 61 79 6c 6f 61 64 29 20 |nc (p *Payload) | 00003b20 4c 61 79 65 72 50 61 79 6c 6f 61 64 28 29 20 5b |LayerPayload() [| 00003b30 5d 62 79 74 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |]byte
..| 00003b40 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00003b50 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00003b60 20 3c 61 20 68 72 65 66 3d 22 23 50 61 79 6c 6f | fu| 00003b80 6e 63 20 28 70 20 2a 50 61 79 6c 6f 61 64 29 20 |nc (p *Payload) | 00003b90 4c 61 79 65 72 54 79 70 65 28 29 20 4c 61 79 65 |LayerType() Laye| 00003ba0 72 54 79 70 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |rType..| 00003bb0 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00003bc0 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00003bd0 20 3c 61 20 68 72 65 66 3d 22 23 50 61 79 6c 6f | func| 00003bf0 20 28 70 20 2a 50 61 79 6c 6f 61 64 29 20 50 61 | (p *Payload) Pa| 00003c00 79 6c 6f 61 64 28 29 20 5b 5d 62 79 74 65 3c 2f |yload() []byte.........| 00003c20 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e 62 73 |........
&nbs| 00003c30 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 72 65 |p;   func (p *Pay| 00003c60 6c 6f 61 64 29 20 53 74 72 69 6e 67 28 29 20 73 |load) String() s| 00003c70 74 72 69 6e 67 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |tring
..| 00003c80 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00003c90 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 54 |.
t| 00003cb0 79 70 65 20 54 72 61 6e 73 70 6f 72 74 4c 61 79 |ype TransportLay| 00003cc0 65 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 |er
.....| 00003cd0 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 |................| 00003ce0 3c 2f 64 6c 3e 0a 0a 09 09 0a 0a 09 09 0a 09 09 |
...........| 00003cf0 09 3c 68 34 3e 50 61 63 6b 61 67 65 20 66 69 6c |.

Package fil| 00003d00 65 73 3c 2f 68 34 3e 0a 09 09 09 3c 70 3e 0a 09 |es

....

..| 00003d10 09 09 3c 73 70 61 6e 20 73 74 79 6c 65 3d 22 66 |....| 00003d30 09 09 0a 09 09 09 09 3c 61 20 68 72 65 66 3d 22 |.......b| 00003d70 61 73 65 2e 67 6f 3c 2f 61 3e 0a 09 09 09 0a 09 |ase.go......| 00003d80 09 09 09 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |...dec| 00003dc0 6f 64 65 2e 67 6f 3c 2f 61 3e 0a 09 09 09 0a 09 |ode.go......| 00003dd0 09 09 09 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |...doc.go| 00003e10 3c 2f 61 3e 0a 09 09 09 0a 09 09 09 09 3c 61 20 |.........flows.go.........layercl| 00003eb0 61 73 73 2e 67 6f 3c 2f 61 3e 0a 09 09 09 0a 09 |ass.go......| 00003ec0 09 09 09 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |...| 00003f00 6c 61 79 65 72 74 79 70 65 2e 67 6f 3c 2f 61 3e |layertype.go| 00003f10 0a 09 09 09 0a 09 09 09 09 3c 61 20 68 72 65 66 |.........packet.go| 00003f60 0a 09 09 09 0a 09 09 09 09 3c 61 20 68 72 65 66 |.........v| 00003fb0 61 6c 69 64 5f 6d 61 63 5f 70 72 65 66 69 78 65 |alid_mac_prefixe| 00003fc0 73 2e 67 6f 3c 2f 61 3e 0a 09 09 09 0a 09 09 09 |s.go........| 00003fd0 3c 2f 73 70 61 6e 3e 0a 09 09 09 3c 2f 70 3e 0a |....

.| 00003fe0 09 09 0a 09 0a 09 09 0a 09 09 0a 09 09 09 3c 68 |..............| 00000010 0a 3c 68 33 20 69 64 3d 22 52 65 61 64 69 6e 67 |.

Reading | 00000040 50 61 63 6b 65 74 73 20 46 72 6f 6d 20 41 20 53 |Packets From A S| 00000050 6f 75 72 63 65 3c 2f 68 33 3e 0a 3c 70 3e 0a 4d |ource

.

.M| 00000060 6f 73 74 20 6f 66 20 74 68 65 20 74 69 6d 65 2c |ost of the time,| 00000070 20 79 6f 75 20 77 6f 6e 26 23 33 39 3b 74 20 6a | you won't j| 00000080 75 73 74 20 68 61 76 65 20 61 20 5b 5d 62 79 74 |ust have a []byt| 00000090 65 20 6f 66 20 70 61 63 6b 65 74 20 64 61 74 61 |e of packet data| 000000a0 20 6c 79 69 6e 67 20 61 72 6f 75 6e 64 2e 0a 49 | lying around..I| 000000b0 6e 73 74 65 61 64 2c 20 79 6f 75 26 23 33 39 3b |nstead, you'| 000000c0 6c 6c 20 77 61 6e 74 20 74 6f 20 72 65 61 64 20 |ll want to read | 000000d0 70 61 63 6b 65 74 73 20 69 6e 20 66 72 6f 6d 20 |packets in from | 000000e0 73 6f 6d 65 77 68 65 72 65 20 28 66 69 6c 65 2c |somewhere (file,| 000000f0 20 69 6e 74 65 72 66 61 63 65 2c 20 65 74 63 29 | interface, etc)| 00000100 0a 61 6e 64 20 70 72 6f 63 65 73 73 20 74 68 65 |.and process the| 00000110 6d 2e 20 20 54 6f 20 64 6f 20 74 68 61 74 2c 20 |m. To do that, | 00000120 79 6f 75 26 23 33 39 3b 6c 6c 20 77 61 6e 74 20 |you'll want | 00000130 74 6f 20 62 75 69 6c 64 20 61 20 50 61 63 6b 65 |to build a Packe| 00000140 74 53 6f 75 72 63 65 2e 0a 3c 2f 70 3e 0a 3c 70 |tSource..

..First, you'| 00000160 3b 6c 6c 20 6e 65 65 64 20 74 6f 20 63 6f 6e 73 |;ll need to cons| 00000170 74 72 75 63 74 20 61 6e 20 6f 62 6a 65 63 74 20 |truct an object | 00000180 74 68 61 74 20 69 6d 70 6c 65 6d 65 6e 74 73 20 |that implements | 00000190 74 68 65 20 50 61 63 6b 65 74 44 61 74 61 53 6f |the PacketDataSo| 000001a0 75 72 63 65 0a 69 6e 74 65 72 66 61 63 65 2e 20 |urce.interface. | 000001b0 20 54 68 65 72 65 20 61 72 65 20 69 6d 70 6c 65 | There are imple| 000001c0 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 74 68 |mentations of th| 000001d0 69 73 20 69 6e 74 65 72 66 61 63 65 20 62 75 6e |is interface bun| 000001e0 64 6c 65 64 20 77 69 74 68 20 67 6f 70 61 63 6b |dled with gopack| 000001f0 65 74 0a 69 6e 20 74 68 65 20 67 6f 70 61 63 6b |et.in the gopack| 00000200 65 74 2f 70 63 61 70 20 61 6e 64 20 67 6f 70 61 |et/pcap and gopa| 00000210 63 6b 65 74 2f 70 66 72 69 6e 67 20 73 75 62 70 |cket/pfring subp| 00000220 61 63 6b 61 67 65 73 2e 2e 2e 20 73 65 65 20 74 |ackages... see t| 00000230 68 65 69 72 20 64 6f 63 75 6d 65 6e 74 61 74 69 |heir documentati| 00000240 6f 6e 0a 66 6f 72 20 6d 6f 72 65 20 69 6e 66 6f |on.for more info| 00000250 72 6d 61 74 69 6f 6e 20 6f 6e 20 74 68 65 69 72 |rmation on their| 00000260 20 75 73 61 67 65 2e 20 20 4f 6e 63 65 20 79 6f | usage. Once yo| 00000270 75 20 68 61 76 65 20 61 20 50 61 63 6b 65 74 44 |u have a PacketD| 00000280 61 74 61 53 6f 75 72 63 65 2c 20 79 6f 75 20 63 |ataSource, you c| 00000290 61 6e 0a 70 61 73 73 20 69 74 20 69 6e 74 6f 20 |an.pass it into | 000002a0 4e 65 77 50 61 63 6b 65 74 53 6f 75 72 63 65 2c |NewPacketSource,| 000002b0 20 61 6c 6f 6e 67 20 77 69 74 68 20 61 20 44 65 | along with a De| 000002c0 63 6f 64 65 72 20 6f 66 20 79 6f 75 72 20 63 68 |coder of your ch| 000002d0 6f 69 63 65 2c 20 74 6f 20 63 72 65 61 74 65 0a |oice, to create.| 000002e0 61 20 50 61 63 6b 65 74 53 6f 75 72 63 65 2e 0a |a PacketSource..| 000002f0 3c 2f 70 3e 0a 3c 70 3e 0a 4f 6e 63 65 20 79 6f |

.

.Once yo| 00000300 75 20 68 61 76 65 20 61 20 50 61 63 6b 65 74 53 |u have a PacketS| 00000310 6f 75 72 63 65 2c 20 79 6f 75 20 63 61 6e 20 72 |ource, you can r| 00000320 65 61 64 20 70 61 63 6b 65 74 73 20 66 72 6f 6d |ead packets from| 00000330 20 69 74 20 69 6e 20 6d 75 6c 74 69 70 6c 65 20 | it in multiple | 00000340 77 61 79 73 2e 0a 53 65 65 20 74 68 65 20 64 6f |ways..See the do| 00000350 63 73 20 66 6f 72 20 50 61 63 6b 65 74 53 6f 75 |cs for PacketSou| 00000360 72 63 65 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 |rce for more det| 00000370 61 69 6c 73 2e 20 20 54 68 65 20 65 61 73 69 65 |ails. The easie| 00000380 73 74 20 6d 65 74 68 6f 64 20 69 73 20 74 68 65 |st method is the| 00000390 0a 50 61 63 6b 65 74 73 20 66 75 6e 63 74 69 6f |.Packets functio| 000003a0 6e 2c 20 77 68 69 63 68 20 72 65 74 75 72 6e 73 |n, which returns| 000003b0 20 61 20 63 68 61 6e 6e 65 6c 2c 20 74 68 65 6e | a channel, then| 000003c0 20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 6c 79 20 | asynchronously | 000003d0 77 72 69 74 65 73 20 6e 65 77 0a 70 61 63 6b 65 |writes new.packe| 000003e0 74 73 20 69 6e 74 6f 20 74 68 61 74 20 63 68 61 |ts into that cha| 000003f0 6e 6e 65 6c 2c 20 63 6c 6f 73 69 6e 67 20 74 68 |nnel, closing th| 00000400 65 20 63 68 61 6e 6e 65 6c 20 69 66 20 74 68 65 |e channel if the| 00000410 20 70 61 63 6b 65 74 53 6f 75 72 63 65 20 68 69 | packetSource hi| 00000420 74 73 20 61 6e 0a 65 6e 64 2d 6f 66 2d 66 69 6c |ts an.end-of-fil| 00000430 65 2e 0a 3c 2f 70 3e 0a 3c 70 72 65 3e 70 61 63 |e..

.
pac|
        00000440  6b 65 74 53 6f 75 72 63  65 20 3a 3d 20 2e 2e 2e  |ketSource := ...|
        00000450  20 20 2f 2f 20 63 6f 6e  73 74 72 75 63 74 20 75  |  // construct u|
        00000460  73 69 6e 67 20 70 63 61  70 20 6f 72 20 70 66 72  |sing pcap or pfr|
        00000470  69 6e 67 0a 66 6f 72 20  70 61 63 6b 65 74 20 3a  |ing.for packet :|
        00000480  3d 20 72 61 6e 67 65 20  70 61 63 6b 65 74 53 6f  |= range packetSo|
        00000490  75 72 63 65 2e 50 61 63  6b 65 74 73 28 29 20 7b  |urce.Packets() {|
        000004a0  0a 20 20 68 61 6e 64 6c  65 50 61 63 6b 65 74 28  |.  handlePacket(|
        000004b0  70 61 63 6b 65 74 29 20  20 2f 2f 20 64 6f 20 73  |packet)  // do s|
        000004c0  6f 6d 65 74 68 69 6e 67  20 77 69 74 68 20 65 61  |omething with ea|
        000004d0  63 68 20 70 61 63 6b 65  74 0a 7d 0a 3c 2f 70 72  |ch packet.}..

.You can c| 000004f0 68 61 6e 67 65 20 74 68 65 20 64 65 63 6f 64 69 |hange the decodi| 00000500 6e 67 20 6f 70 74 69 6f 6e 73 20 6f 66 20 74 68 |ng options of th| 00000510 65 20 70 61 63 6b 65 74 53 6f 75 72 63 65 20 62 |e packetSource b| 00000520 79 20 73 65 74 74 69 6e 67 20 66 69 65 6c 64 73 |y setting fields| 00000530 20 69 6e 0a 70 61 63 6b 65 74 53 6f 75 72 63 65 | in.packetSource| 00000540 2e 44 65 63 6f 64 65 4f 70 74 69 6f 6e 73 2e 2e |.DecodeOptions..| 00000550 2e 20 73 65 65 20 74 68 65 20 66 6f 6c 6c 6f 77 |. see the follow| 00000560 69 6e 67 20 73 65 63 74 69 6f 6e 73 20 66 6f 72 |ing sections for| 00000570 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a 3c | more details..<| 00000580 2f 70 3e 0a 3c 68 33 20 69 64 3d 22 4c 61 7a 79 |/p>.

Lazy | 000005a0 44 65 63 6f 64 69 6e 67 3c 2f 68 33 3e 0a 3c 70 |Decoding

..gopacket optio| 000005c0 6e 61 6c 6c 79 20 64 65 63 6f 64 65 73 20 70 61 |nally decodes pa| 000005d0 63 6b 65 74 20 64 61 74 61 20 6c 61 7a 69 6c 79 |cket data lazily| 000005e0 2c 20 6d 65 61 6e 69 6e 67 20 69 74 0a 6f 6e 6c |, meaning it.onl| 000005f0 79 20 64 65 63 6f 64 65 73 20 61 20 70 61 63 6b |y decodes a pack| 00000600 65 74 20 6c 61 79 65 72 20 77 68 65 6e 20 69 74 |et layer when it| 00000610 20 6e 65 65 64 73 20 74 6f 20 74 6f 20 68 61 6e | needs to to han| 00000620 64 6c 65 20 61 20 66 75 6e 63 74 69 6f 6e 20 63 |dle a function c| 00000630 61 6c 6c 2e 0a 3c 2f 70 3e 0a 3c 70 72 65 3e 2f |all..

.
/|
        00000640  2f 20 43 72 65 61 74 65  20 61 20 70 61 63 6b 65  |/ Create a packe|
        00000650  74 2c 20 62 75 74 20 64  6f 6e 26 23 33 39 3b 74  |t, but don't|
        00000660  20 61 63 74 75 61 6c 6c  79 20 64 65 63 6f 64 65  | actually decode|
        00000670  20 61 6e 79 74 68 69 6e  67 20 79 65 74 0a 70 61  | anything yet.pa|
        00000680  63 6b 65 74 20 3a 3d 20  67 6f 70 61 63 6b 65 74  |cket := gopacket|
        00000690  2e 4e 65 77 50 61 63 6b  65 74 28 6d 79 50 61 63  |.NewPacket(myPac|
        000006a0  6b 65 74 44 61 74 61 2c  20 6c 61 79 65 72 73 2e  |ketData, layers.|
        000006b0  4c 61 79 65 72 54 79 70  65 45 74 68 65 72 6e 65  |LayerTypeEtherne|
        000006c0  74 2c 20 67 6f 70 61 63  6b 65 74 2e 4c 61 7a 79  |t, gopacket.Lazy|
        000006d0  29 0a 2f 2f 20 4e 6f 77  2c 20 64 65 63 6f 64 65  |).// Now, decode|
        000006e0  20 74 68 65 20 70 61 63  6b 65 74 20 75 70 20 74  | the packet up t|
        000006f0  6f 20 74 68 65 20 66 69  72 73 74 20 49 50 76 34  |o the first IPv4|
        00000700  20 6c 61 79 65 72 20 66  6f 75 6e 64 20 62 75 74  | layer found but|
        00000710  20 6e 6f 20 66 75 72 74  68 65 72 2e 0a 2f 2f 20  | no further..// |
        00000720  49 66 20 6e 6f 20 49 50  76 34 20 6c 61 79 65 72  |If no IPv4 layer|
        00000730  20 77 61 73 20 66 6f 75  6e 64 2c 20 74 68 65 20  | was found, the |
        00000740  77 68 6f 6c 65 20 70 61  63 6b 65 74 20 77 69 6c  |whole packet wil|
        00000750  6c 20 62 65 20 64 65 63  6f 64 65 64 20 6c 6f 6f  |l be decoded loo|
        00000760  6b 69 6e 67 20 66 6f 72  0a 2f 2f 20 69 74 2e 0a  |king for.// it..|
        00000770  69 70 34 20 3a 3d 20 70  61 63 6b 65 74 2e 4c 61  |ip4 := packet.La|
        00000780  79 65 72 28 6c 61 79 65  72 73 2e 4c 61 79 65 72  |yer(layers.Layer|
        00000790  54 79 70 65 49 50 76 34  29 0a 2f 2f 20 44 65 63  |TypeIPv4).// Dec|
        000007a0  6f 64 65 20 61 6c 6c 20  6c 61 79 65 72 73 20 61  |ode all layers a|
        000007b0  6e 64 20 72 65 74 75 72  6e 20 74 68 65 6d 2e 20  |nd return them. |
        000007c0  20 54 68 65 20 6c 61 79  65 72 73 20 75 70 20 74  | The layers up t|
        000007d0  6f 20 74 68 65 20 66 69  72 73 74 20 49 50 76 34  |o the first IPv4|
        000007e0  20 6c 61 79 65 72 0a 2f  2f 20 61 72 65 20 61 6c  | layer.// are al|
        000007f0  72 65 61 64 79 20 64 65  63 6f 64 65 64 2c 20 61  |ready decoded, a|
        00000800  6e 64 20 77 69 6c 6c 20  6e 6f 74 20 72 65 71 75  |nd will not requ|
        00000810  69 72 65 20 64 65 63 6f  64 69 6e 67 20 61 20 73  |ire decoding a s|
        00000820  65 63 6f 6e 64 20 74 69  6d 65 2e 0a 6c 61 79 65  |econd time..laye|
        00000830  72 73 20 3a 3d 20 70 61  63 6b 65 74 2e 4c 61 79  |rs := packet.Lay|
        00000840  65 72 73 28 29 0a 3c 2f  70 72 65 3e 0a 3c 70 3e  |ers().
.

| 00000850 0a 4c 61 7a 69 6c 79 2d 64 65 63 6f 64 65 64 20 |.Lazily-decoded | 00000860 70 61 63 6b 65 74 73 20 61 72 65 20 6e 6f 74 20 |packets are not | 00000870 63 6f 6e 63 75 72 72 65 6e 63 79 2d 73 61 66 65 |concurrency-safe| 00000880 2e 20 20 53 69 6e 63 65 20 6c 61 79 65 72 73 20 |. Since layers | 00000890 68 61 76 65 20 6e 6f 74 20 61 6c 6c 20 62 65 65 |have not all bee| 000008a0 6e 0a 64 65 63 6f 64 65 64 2c 20 65 61 63 68 20 |n.decoded, each | 000008b0 63 61 6c 6c 20 74 6f 20 4c 61 79 65 72 28 29 20 |call to Layer() | 000008c0 6f 72 20 4c 61 79 65 72 73 28 29 20 68 61 73 20 |or Layers() has | 000008d0 74 68 65 20 70 6f 74 65 6e 74 69 61 6c 20 74 6f |the potential to| 000008e0 20 6d 75 74 61 74 65 20 74 68 65 20 70 61 63 6b | mutate the pack| 000008f0 65 74 0a 69 6e 20 6f 72 64 65 72 20 74 6f 20 64 |et.in order to d| 00000900 65 63 6f 64 65 20 74 68 65 20 6e 65 78 74 20 6c |ecode the next l| 00000910 61 79 65 72 2e 20 20 49 66 20 61 20 70 61 63 6b |ayer. If a pack| 00000920 65 74 20 69 73 20 75 73 65 64 0a 69 6e 20 6d 75 |et is used.in mu| 00000930 6c 74 69 70 6c 65 20 67 6f 72 6f 75 74 69 6e 65 |ltiple goroutine| 00000940 73 20 63 6f 6e 63 75 72 72 65 6e 74 6c 79 2c 20 |s concurrently, | 00000950 64 6f 6e 26 23 33 39 3b 74 20 75 73 65 20 67 6f |don't use go| 00000960 70 61 63 6b 65 74 2e 4c 61 7a 79 2e 20 20 54 68 |packet.Lazy. Th| 00000970 65 6e 20 67 6f 70 61 63 6b 65 74 0a 77 69 6c 6c |en gopacket.will| 00000980 20 64 65 63 6f 64 65 20 74 68 65 20 70 61 63 6b | decode the pack| 00000990 65 74 20 66 75 6c 6c 79 2c 20 61 6e 64 20 61 6c |et fully, and al| 000009a0 6c 20 66 75 74 75 72 65 20 66 75 6e 63 74 69 6f |l future functio| 000009b0 6e 20 63 61 6c 6c 73 20 77 6f 6e 26 23 33 39 3b |n calls won'| 000009c0 74 20 6d 75 74 61 74 65 20 74 68 65 0a 6f 62 6a |t mutate the.obj| 000009d0 65 63 74 2e 0a 3c 2f 70 3e 0a 3c 68 33 20 69 64 |ect..

.

NoCopy Decodi| 00000a00 6e 67 3c 2f 68 33 3e 0a 3c 70 3e 0a 42 79 20 64 |ng

.

.By d| 00000a10 65 66 61 75 6c 74 2c 20 67 6f 70 61 63 6b 65 74 |efault, gopacket| 00000a20 20 77 69 6c 6c 20 63 6f 70 79 20 74 68 65 20 73 | will copy the s| 00000a30 6c 69 63 65 20 70 61 73 73 65 64 20 74 6f 20 4e |lice passed to N| 00000a40 65 77 50 61 63 6b 65 74 20 61 6e 64 20 73 74 6f |ewPacket and sto| 00000a50 72 65 20 74 68 65 0a 63 6f 70 79 20 77 69 74 68 |re the.copy with| 00000a60 69 6e 20 74 68 65 20 70 61 63 6b 65 74 2c 20 73 |in the packet, s| 00000a70 6f 20 66 75 74 75 72 65 20 6d 75 74 61 74 69 6f |o future mutatio| 00000a80 6e 73 20 74 6f 20 74 68 65 20 62 79 74 65 73 20 |ns to the bytes | 00000a90 75 6e 64 65 72 6c 79 69 6e 67 20 74 68 65 20 73 |underlying the s| 00000aa0 6c 69 63 65 0a 64 6f 6e 26 23 33 39 3b 74 20 61 |lice.don't a| 00000ab0 66 66 65 63 74 20 74 68 65 20 70 61 63 6b 65 74 |ffect the packet| 00000ac0 20 61 6e 64 20 69 74 73 20 6c 61 79 65 72 73 2e | and its layers.| 00000ad0 20 20 49 66 20 79 6f 75 20 63 61 6e 20 67 75 61 | If you can gua| 00000ae0 72 61 6e 74 65 65 20 74 68 61 74 20 74 68 65 0a |rantee that the.| 00000af0 75 6e 64 65 72 6c 79 69 6e 67 20 73 6c 69 63 65 |underlying slice| 00000b00 20 62 79 74 65 73 20 77 6f 6e 26 23 33 39 3b 74 | bytes won't| 00000b10 20 62 65 20 63 68 61 6e 67 65 64 2c 20 79 6f 75 | be changed, you| 00000b20 20 63 61 6e 20 75 73 65 20 4e 6f 43 6f 70 79 20 | can use NoCopy | 00000b30 74 6f 20 74 65 6c 6c 0a 67 6f 70 61 63 6b 65 74 |to tell.gopacket| 00000b40 2e 4e 65 77 50 61 63 6b 65 74 2c 20 61 6e 64 20 |.NewPacket, and | 00000b50 69 74 26 23 33 39 3b 6c 6c 20 75 73 65 20 74 68 |it'll use th| 00000b60 65 20 70 61 73 73 65 64 2d 69 6e 20 73 6c 69 63 |e passed-in slic| 00000b70 65 20 69 74 73 65 6c 66 2e 0a 3c 2f 70 3e 0a 3c |e itself..

.<| 00000b80 70 72 65 3e 2f 2f 20 54 68 69 73 20 63 68 61 6e |pre>// This chan| 00000b90 6e 65 6c 20 72 65 74 75 72 6e 73 20 6e 65 77 20 |nel returns new | 00000ba0 62 79 74 65 20 73 6c 69 63 65 73 2c 20 65 61 63 |byte slices, eac| 00000bb0 68 20 6f 66 20 77 68 69 63 68 20 70 6f 69 6e 74 |h of which point| 00000bc0 73 20 74 6f 20 61 20 6e 65 77 0a 2f 2f 20 6d 65 |s to a new.// me| 00000bd0 6d 6f 72 79 20 6c 6f 63 61 74 69 6f 6e 20 74 68 |mory location th| 00000be0 61 74 26 23 33 39 3b 73 20 67 75 61 72 61 6e 74 |at's guarant| 00000bf0 65 65 64 20 69 6d 6d 75 74 61 62 6c 65 20 66 6f |eed immutable fo| 00000c00 72 20 74 68 65 20 64 75 72 61 74 69 6f 6e 20 6f |r the duration o| 00000c10 66 20 74 68 65 0a 2f 2f 20 70 61 63 6b 65 74 2e |f the.// packet.| 00000c20 0a 66 6f 72 20 64 61 74 61 20 3a 3d 20 72 61 6e |.for data := ran| 00000c30 67 65 20 6d 79 42 79 74 65 53 6c 69 63 65 43 68 |ge myByteSliceCh| 00000c40 61 6e 6e 65 6c 20 7b 0a 20 20 70 20 3a 3d 20 67 |annel {. p := g| 00000c50 6f 70 61 63 6b 65 74 2e 4e 65 77 50 61 63 6b 65 |opacket.NewPacke| 00000c60 74 28 64 61 74 61 2c 20 6c 61 79 65 72 73 2e 4c |t(data, layers.L| 00000c70 61 79 65 72 54 79 70 65 45 74 68 65 72 6e 65 74 |ayerTypeEthernet| 00000c80 2c 20 67 6f 70 61 63 6b 65 74 2e 4e 6f 43 6f 70 |, gopacket.NoCop| 00000c90 79 29 0a 20 20 64 6f 53 6f 6d 65 74 68 69 6e 67 |y). doSomething| 00000ca0 57 69 74 68 50 61 63 6b 65 74 28 70 29 0a 7d 0a |WithPacket(p).}.| 00000cb0 3c 2f 70 72 65 3e 0a 3c 70 3e 0a 54 68 65 20 66 |
.

.The f| 00000cc0 61 73 74 65 73 74 20 6d 65 74 68 6f 64 20 6f 66 |astest method of| 00000cd0 20 64 65 63 6f 64 69 6e 67 20 69 73 20 74 6f 20 | decoding is to | 00000ce0 75 73 65 20 62 6f 74 68 20 4c 61 7a 79 20 61 6e |use both Lazy an| 00000cf0 64 20 4e 6f 43 6f 70 79 2c 20 62 75 74 20 6e 6f |d NoCopy, but no| 00000d00 74 65 20 66 72 6f 6d 0a 74 68 65 20 6d 61 6e 79 |te from.the many| 00000d10 20 63 61 76 65 61 74 73 20 61 62 6f 76 65 20 74 | caveats above t| 00000d20 68 61 74 20 66 6f 72 20 73 6f 6d 65 20 69 6d 70 |hat for some imp| 00000d30 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 74 68 65 |lementations the| 00000d40 79 20 6d 61 79 20 62 65 20 64 61 6e 67 65 72 6f |y may be dangero| 00000d50 75 73 0a 65 69 74 68 65 72 20 6f 72 20 62 6f 74 |us.either or bot| 00000d60 68 20 6d 61 79 20 62 65 20 64 61 6e 67 65 72 6f |h may be dangero| 00000d70 75 73 2e 0a 3c 2f 70 3e 0a 3c 68 33 20 69 64 3d |us..

.

Point| 00000da0 65 72 73 20 54 6f 20 4b 6e 6f 77 6e 20 4c 61 79 |ers To Known Lay| 00000db0 65 72 73 3c 2f 68 33 3e 0a 3c 70 3e 0a 44 75 72 |ers

.

.Dur| 00000dc0 69 6e 67 20 64 65 63 6f 64 69 6e 67 2c 20 63 65 |ing decoding, ce| 00000dd0 72 74 61 69 6e 20 6c 61 79 65 72 73 20 61 72 65 |rtain layers are| 00000de0 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 70 | stored in the p| 00000df0 61 63 6b 65 74 20 61 73 20 77 65 6c 6c 2d 6b 6e |acket as well-kn| 00000e00 6f 77 6e 0a 6c 61 79 65 72 20 74 79 70 65 73 2e |own.layer types.| 00000e10 20 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 49 | For example, I| 00000e20 50 76 34 20 61 6e 64 20 49 50 76 36 20 61 72 65 |Pv4 and IPv6 are| 00000e30 20 62 6f 74 68 20 63 6f 6e 73 69 64 65 72 65 64 | both considered| 00000e40 20 4e 65 74 77 6f 72 6b 4c 61 79 65 72 0a 6c 61 | NetworkLayer.la| 00000e50 79 65 72 73 2c 20 77 68 69 6c 65 20 54 43 50 20 |yers, while TCP | 00000e60 61 6e 64 20 55 44 50 20 61 72 65 20 62 6f 74 68 |and UDP are both| 00000e70 20 54 72 61 6e 73 70 6f 72 74 4c 61 79 65 72 20 | TransportLayer | 00000e80 6c 61 79 65 72 73 2e 20 20 57 65 20 73 75 70 70 |layers. We supp| 00000e90 6f 72 74 20 34 0a 6c 61 79 65 72 73 2c 20 63 6f |ort 4.layers, co| 00000ea0 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 74 |rresponding to t| 00000eb0 68 65 20 34 20 6c 61 79 65 72 73 20 6f 66 20 74 |he 4 layers of t| 00000ec0 68 65 20 54 43 50 2f 49 50 20 6c 61 79 65 72 69 |he TCP/IP layeri| 00000ed0 6e 67 20 73 63 68 65 6d 65 20 28 72 6f 75 67 68 |ng scheme (rough| 00000ee0 6c 79 0a 61 6e 61 67 61 6c 6f 75 73 20 74 6f 20 |ly.anagalous to | 00000ef0 6c 61 79 65 72 73 20 32 2c 20 33 2c 20 34 2c 20 |layers 2, 3, 4, | 00000f00 61 6e 64 20 37 20 6f 66 20 74 68 65 20 4f 53 49 |and 7 of the OSI| 00000f10 20 6d 6f 64 65 6c 29 2e 20 20 54 6f 20 61 63 63 | model). To acc| 00000f20 65 73 73 20 74 68 65 73 65 2c 0a 79 6f 75 20 63 |ess these,.you c| 00000f30 61 6e 20 75 73 65 20 74 68 65 20 70 61 63 6b 65 |an use the packe| 00000f40 74 2e 4c 69 6e 6b 4c 61 79 65 72 2c 20 70 61 63 |t.LinkLayer, pac| 00000f50 6b 65 74 2e 4e 65 74 77 6f 72 6b 4c 61 79 65 72 |ket.NetworkLayer| 00000f60 2c 0a 70 61 63 6b 65 74 2e 54 72 61 6e 73 70 6f |,.packet.Transpo| 00000f70 72 74 4c 61 79 65 72 2c 20 61 6e 64 20 70 61 63 |rtLayer, and pac| 00000f80 6b 65 74 2e 41 70 70 6c 69 63 61 74 69 6f 6e 4c |ket.ApplicationL| 00000f90 61 79 65 72 20 66 75 6e 63 74 69 6f 6e 73 2e 20 |ayer functions. | 00000fa0 20 45 61 63 68 20 6f 66 0a 74 68 65 73 65 20 66 | Each of.these f| 00000fb0 75 6e 63 74 69 6f 6e 73 20 72 65 74 75 72 6e 73 |unctions returns| 00000fc0 20 61 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 | a corresponding| 00000fd0 20 69 6e 74 65 72 66 61 63 65 0a 28 67 6f 70 61 | interface.(gopa| 00000fe0 63 6b 65 74 2e 7b 4c 69 6e 6b 2c 4e 65 74 77 6f |cket.{Link,Netwo| 00000ff0 72 6b 2c 54 72 61 6e 73 70 6f 72 74 2c 41 70 70 |rk,Transport,App| 00001000 6c 69 63 61 74 69 6f 6e 7d 4c 61 79 65 72 29 2e |lication}Layer).| 00001010 20 20 54 68 65 20 66 69 72 73 74 20 74 68 72 65 | The first thre| 00001020 65 0a 70 72 6f 76 69 64 65 20 6d 65 74 68 6f 64 |e.provide method| 00001030 73 20 66 6f 72 20 67 65 74 74 69 6e 67 20 73 72 |s for getting sr| 00001040 63 2f 64 73 74 20 61 64 64 72 65 73 73 65 73 20 |c/dst addresses | 00001050 66 6f 72 20 74 68 61 74 20 70 61 72 74 69 63 75 |for that particu| 00001060 6c 61 72 20 6c 61 79 65 72 2c 0a 77 68 69 6c 65 |lar layer,.while| 00001070 20 74 68 65 20 66 69 6e 61 6c 20 6c 61 79 65 72 | the final layer| 00001080 20 70 72 6f 76 69 64 65 73 20 61 20 50 61 79 6c | provides a Payl| 00001090 6f 61 64 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 |oad function to | 000010a0 67 65 74 20 70 61 79 6c 6f 61 64 20 64 61 74 61 |get payload data| 000010b0 2e 0a 54 68 69 73 20 69 73 20 68 65 6c 70 66 75 |..This is helpfu| 000010c0 6c 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 |l, for example, | 000010d0 74 6f 20 67 65 74 20 70 61 79 6c 6f 61 64 73 20 |to get payloads | 000010e0 66 6f 72 20 61 6c 6c 20 70 61 63 6b 65 74 73 20 |for all packets | 000010f0 72 65 67 61 72 64 6c 65 73 73 0a 6f 66 20 74 68 |regardless.of th| 00001100 65 69 72 20 75 6e 64 65 72 6c 79 69 6e 67 20 64 |eir underlying d| 00001110 61 74 61 20 74 79 70 65 3a 0a 3c 2f 70 3e 0a 3c |ata type:.

.<| 00001120 70 72 65 3e 2f 2f 20 47 65 74 20 70 61 63 6b 65 |pre>// Get packe| 00001130 74 73 20 66 72 6f 6d 20 73 6f 6d 65 20 73 6f 75 |ts from some sou| 00001140 72 63 65 0a 66 6f 72 20 70 61 63 6b 65 74 20 3a |rce.for packet :| 00001150 3d 20 72 61 6e 67 65 20 73 6f 6d 65 53 6f 75 72 |= range someSour| 00001160 63 65 20 7b 0a 20 20 69 66 20 61 70 70 20 3a 3d |ce {. if app :=| 00001170 20 70 61 63 6b 65 74 2e 41 70 70 6c 69 63 61 74 | packet.Applicat| 00001180 69 6f 6e 4c 61 79 65 72 28 29 3b 20 61 70 70 20 |ionLayer(); app | 00001190 21 3d 20 6e 69 6c 20 7b 0a 20 20 20 20 69 66 20 |!= nil {. if | 000011a0 73 74 72 69 6e 67 73 2e 43 6f 6e 74 61 69 6e 73 |strings.Contains| 000011b0 28 73 74 72 69 6e 67 28 61 70 70 2e 50 61 79 6c |(string(app.Payl| 000011c0 6f 61 64 28 29 29 2c 20 26 23 33 34 3b 6d 61 67 |oad()), "mag| 000011d0 69 63 20 73 74 72 69 6e 67 26 23 33 34 3b 29 20 |ic string") | 000011e0 7b 0a 20 20 20 20 20 20 66 6d 74 2e 50 72 69 6e |{. fmt.Prin| 000011f0 74 6c 6e 28 26 23 33 34 3b 46 6f 75 6e 64 20 6d |tln("Found m| 00001200 61 67 69 63 20 73 74 72 69 6e 67 20 69 6e 20 61 |agic string in a| 00001210 20 70 61 63 6b 65 74 21 26 23 33 34 3b 29 0a 20 | packet!"). | 00001220 20 20 20 7d 0a 20 20 7d 0a 7d 0a 3c 2f 70 72 65 | }. }.}..

.A particul| 00001240 61 72 6c 79 20 75 73 65 66 75 6c 20 6c 61 79 65 |arly useful laye| 00001250 72 20 69 73 20 45 72 72 6f 72 4c 61 79 65 72 2c |r is ErrorLayer,| 00001260 20 77 68 69 63 68 20 69 73 20 73 65 74 20 77 68 | which is set wh| 00001270 65 6e 65 76 65 72 20 74 68 65 72 65 26 23 33 39 |enever there'| 00001280 3b 73 0a 61 6e 20 65 72 72 6f 72 20 70 61 72 73 |;s.an error pars| 00001290 69 6e 67 20 70 61 72 74 20 6f 66 20 74 68 65 20 |ing part of the | 000012a0 70 61 63 6b 65 74 2e 0a 3c 2f 70 3e 0a 3c 70 72 |packet..

.packet := gopa| 000012c0 63 6b 65 74 2e 4e 65 77 50 61 63 6b 65 74 28 6d |cket.NewPacket(m| 000012d0 79 50 61 63 6b 65 74 44 61 74 61 2c 20 6c 61 79 |yPacketData, lay| 000012e0 65 72 73 2e 4c 61 79 65 72 54 79 70 65 45 74 68 |ers.LayerTypeEth| 000012f0 65 72 6e 65 74 2c 20 67 6f 70 61 63 6b 65 74 2e |ernet, gopacket.| 00001300 44 65 66 61 75 6c 74 29 0a 69 66 20 65 72 72 20 |Default).if err | 00001310 3a 3d 20 70 61 63 6b 65 74 2e 45 72 72 6f 72 4c |:= packet.ErrorL| 00001320 61 79 65 72 28 29 3b 20 65 72 72 20 21 3d 20 6e |ayer(); err != n| 00001330 69 6c 20 7b 0a 20 20 66 6d 74 2e 50 72 69 6e 74 |il {. fmt.Print| 00001340 6c 6e 28 26 23 33 34 3b 45 72 72 6f 72 20 64 65 |ln("Error de| 00001350 63 6f 64 69 6e 67 20 73 6f 6d 65 20 70 61 72 74 |coding some part| 00001360 20 6f 66 20 74 68 65 20 70 61 63 6b 65 74 3a 26 | of the packet:&| 00001370 23 33 34 3b 2c 20 65 72 72 29 0a 7d 0a 3c 2f 70 |#34;, err).}.
.

.Note tha| 00001390 74 20 77 65 20 64 6f 6e 26 23 33 39 3b 74 20 72 |t we don't r| 000013a0 65 74 75 72 6e 20 61 6e 20 65 72 72 6f 72 20 66 |eturn an error f| 000013b0 72 6f 6d 20 4e 65 77 50 61 63 6b 65 74 20 62 65 |rom NewPacket be| 000013c0 63 61 75 73 65 20 77 65 20 6d 61 79 20 68 61 76 |cause we may hav| 000013d0 65 20 64 65 63 6f 64 65 64 0a 61 20 6e 75 6d 62 |e decoded.a numb| 000013e0 65 72 20 6f 66 20 6c 61 79 65 72 73 20 73 75 63 |er of layers suc| 000013f0 63 65 73 73 66 75 6c 6c 79 20 62 65 66 6f 72 65 |cessfully before| 00001400 20 72 75 6e 6e 69 6e 67 20 69 6e 74 6f 20 6f 75 | running into ou| 00001410 72 20 65 72 72 6f 6e 65 6f 75 73 20 6c 61 79 65 |r erroneous laye| 00001420 72 2e 20 20 59 6f 75 0a 6d 61 79 20 73 74 69 6c |r. You.may stil| 00001430 6c 20 62 65 20 61 62 6c 65 20 74 6f 20 67 65 74 |l be able to get| 00001440 20 79 6f 75 72 20 45 74 68 65 72 6e 65 74 20 61 | your Ethernet a| 00001450 6e 64 20 49 50 76 34 20 6c 61 79 65 72 73 20 63 |nd IPv4 layers c| 00001460 6f 72 72 65 63 74 6c 79 2c 20 65 76 65 6e 20 69 |orrectly, even i| 00001470 66 0a 79 6f 75 72 20 54 43 50 20 6c 61 79 65 72 |f.your TCP layer| 00001480 20 69 73 20 6d 61 6c 66 6f 72 6d 65 64 2e 0a 3c | is malformed..<| 00001490 2f 70 3e 0a 3c 68 33 20 69 64 3d 22 46 6c 6f 77 |/p>.

F| 000014b0 6c 6f 77 20 41 6e 64 20 45 6e 64 70 6f 69 6e 74 |low And Endpoint| 000014c0 3c 2f 68 33 3e 0a 3c 70 3e 0a 67 6f 70 61 63 6b |

.

.gopack| 000014d0 65 74 20 68 61 73 20 74 77 6f 20 75 73 65 66 75 |et has two usefu| 000014e0 6c 20 6f 62 6a 65 63 74 73 2c 20 46 6c 6f 77 20 |l objects, Flow | 000014f0 61 6e 64 20 45 6e 64 70 6f 69 6e 74 2c 20 66 6f |and Endpoint, fo| 00001500 72 20 63 6f 6d 6d 75 6e 69 63 61 74 69 6e 67 20 |r communicating | 00001510 69 6e 20 61 20 70 72 6f 74 6f 63 6f 6c 0a 69 6e |in a protocol.in| 00001520 64 65 70 65 6e 64 65 6e 74 20 6d 61 6e 6e 65 72 |dependent manner| 00001530 20 74 68 65 20 66 61 63 74 20 74 68 61 74 20 61 | the fact that a| 00001540 20 70 61 63 6b 65 74 20 69 73 20 63 6f 6d 69 6e | packet is comin| 00001550 67 20 66 72 6f 6d 20 41 20 61 6e 64 20 67 6f 69 |g from A and goi| 00001560 6e 67 20 74 6f 20 42 2e 0a 54 68 65 20 67 65 6e |ng to B..The gen| 00001570 65 72 61 6c 20 6c 61 79 65 72 20 74 79 70 65 73 |eral layer types| 00001580 20 4c 69 6e 6b 4c 61 79 65 72 2c 20 4e 65 74 77 | LinkLayer, Netw| 00001590 6f 72 6b 4c 61 79 65 72 2c 20 61 6e 64 20 54 72 |orkLayer, and Tr| 000015a0 61 6e 73 70 6f 72 74 4c 61 79 65 72 20 61 6c 6c |ansportLayer all| 000015b0 20 70 72 6f 76 69 64 65 0a 6d 65 74 68 6f 64 73 | provide.methods| 000015c0 20 66 6f 72 20 65 78 74 72 61 63 74 69 6e 67 20 | for extracting | 000015d0 74 68 65 69 72 20 66 6c 6f 77 20 69 6e 66 6f 72 |their flow infor| 000015e0 6d 61 74 69 6f 6e 2c 20 77 69 74 68 6f 75 74 20 |mation, without | 000015f0 77 6f 72 72 79 69 6e 67 20 61 62 6f 75 74 20 74 |worrying about t| 00001600 68 65 20 74 79 70 65 0a 6f 66 20 74 68 65 20 75 |he type.of the u| 00001610 6e 64 65 72 6c 79 69 6e 67 20 4c 61 79 65 72 2e |nderlying Layer.| 00001620 0a 3c 2f 70 3e 0a 3c 70 3e 0a 41 20 46 6c 6f 77 |.

.

.A Flow| 00001630 20 69 73 20 61 20 73 69 6d 70 6c 65 20 6f 62 6a | is a simple obj| 00001640 65 63 74 20 6d 61 64 65 20 75 70 20 6f 66 20 61 |ect made up of a| 00001650 20 73 65 74 20 6f 66 20 74 77 6f 20 45 6e 64 70 | set of two Endp| 00001660 6f 69 6e 74 73 2c 20 6f 6e 65 20 73 6f 75 72 63 |oints, one sourc| 00001670 65 20 61 6e 64 20 6f 6e 65 0a 64 65 73 74 69 6e |e and one.destin| 00001680 61 74 69 6f 6e 2e 20 20 49 74 20 64 65 74 61 69 |ation. It detai| 00001690 6c 73 20 74 68 65 20 73 65 6e 64 65 72 20 61 6e |ls the sender an| 000016a0 64 20 72 65 63 65 69 76 65 72 20 6f 66 20 74 68 |d receiver of th| 000016b0 65 20 4c 61 79 65 72 20 6f 66 20 74 68 65 20 50 |e Layer of the P| 000016c0 61 63 6b 65 74 2e 0a 3c 2f 70 3e 0a 3c 70 3e 0a |acket..

.

.| 000016d0 41 6e 20 45 6e 64 70 6f 69 6e 74 20 69 73 20 61 |An Endpoint is a| 000016e0 20 68 61 73 68 61 62 6c 65 20 72 65 70 72 65 73 | hashable repres| 000016f0 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 20 73 6f |entation of a so| 00001700 75 72 63 65 20 6f 72 20 64 65 73 74 69 6e 61 74 |urce or destinat| 00001710 69 6f 6e 2e 20 20 46 6f 72 0a 65 78 61 6d 70 6c |ion. For.exampl| 00001720 65 2c 20 66 6f 72 20 4c 61 79 65 72 54 79 70 65 |e, for LayerType| 00001730 49 50 76 34 2c 20 61 6e 20 45 6e 64 70 6f 69 6e |IPv4, an Endpoin| 00001740 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 49 |t contains the I| 00001750 50 20 61 64 64 72 65 73 73 20 62 79 74 65 73 20 |P address bytes | 00001760 66 6f 72 20 61 20 76 34 0a 49 50 20 70 61 63 6b |for a v4.IP pack| 00001770 65 74 2e 20 20 41 20 46 6c 6f 77 20 63 61 6e 20 |et. A Flow can | 00001780 62 65 20 62 72 6f 6b 65 6e 20 69 6e 74 6f 20 45 |be broken into E| 00001790 6e 64 70 6f 69 6e 74 73 2c 20 61 6e 64 20 45 6e |ndpoints, and En| 000017a0 64 70 6f 69 6e 74 73 20 63 61 6e 20 62 65 20 63 |dpoints can be c| 000017b0 6f 6d 62 69 6e 65 64 0a 69 6e 74 6f 20 46 6c 6f |ombined.into Flo| 000017c0 77 73 3a 0a 3c 2f 70 3e 0a 3c 70 72 65 3e 70 61 |ws:.

.
pa|
        000017d0  63 6b 65 74 20 3a 3d 20  67 6f 70 61 63 6b 65 74  |cket := gopacket|
        000017e0  2e 4e 65 77 50 61 63 6b  65 74 28 6d 79 50 61 63  |.NewPacket(myPac|
        000017f0  6b 65 74 44 61 74 61 2c  20 6c 61 79 65 72 73 2e  |ketData, layers.|
        00001800  4c 61 79 65 72 54 79 70  65 45 74 68 65 72 6e 65  |LayerTypeEtherne|
        00001810  74 2c 20 67 6f 70 61 63  6b 65 74 2e 4c 61 7a 79  |t, gopacket.Lazy|
        00001820  29 0a 6e 65 74 46 6c 6f  77 20 3a 3d 20 70 61 63  |).netFlow := pac|
        00001830  6b 65 74 2e 4e 65 74 77  6f 72 6b 4c 61 79 65 72  |ket.NetworkLayer|
        00001840  28 29 2e 4e 65 74 77 6f  72 6b 46 6c 6f 77 28 29  |().NetworkFlow()|
        00001850  0a 73 72 63 2c 20 64 73  74 20 3a 3d 20 6e 65 74  |.src, dst := net|
        00001860  46 6c 6f 77 2e 45 6e 64  70 6f 69 6e 74 73 28 29  |Flow.Endpoints()|
        00001870  0a 72 65 76 65 72 73 65  46 6c 6f 77 20 3a 3d 20  |.reverseFlow := |
        00001880  67 6f 70 61 63 6b 65 74  2e 4e 65 77 46 6c 6f 77  |gopacket.NewFlow|
        00001890  28 64 73 74 2c 20 73 72  63 29 0a 3c 2f 70 72 65  |(dst, src)..

.Both Endpo| 000018b0 69 6e 74 20 61 6e 64 20 46 6c 6f 77 20 6f 62 6a |int and Flow obj| 000018c0 65 63 74 73 20 63 61 6e 20 62 65 20 75 73 65 64 |ects can be used| 000018d0 20 61 73 20 6d 61 70 20 6b 65 79 73 2c 20 61 6e | as map keys, an| 000018e0 64 20 74 68 65 20 65 71 75 61 6c 69 74 79 0a 6f |d the equality.o| 000018f0 70 65 72 61 74 6f 72 20 63 61 6e 20 63 6f 6d 70 |perator can comp| 00001900 61 72 65 20 74 68 65 6d 2c 20 73 6f 20 79 6f 75 |are them, so you| 00001910 20 63 61 6e 20 65 61 73 69 6c 79 20 67 72 6f 75 | can easily grou| 00001920 70 20 74 6f 67 65 74 68 65 72 20 61 6c 6c 20 70 |p together all p| 00001930 61 63 6b 65 74 73 0a 62 61 73 65 64 20 6f 6e 20 |ackets.based on | 00001940 65 6e 64 70 6f 69 6e 74 20 63 72 69 74 65 72 69 |endpoint criteri| 00001950 61 3a 0a 3c 2f 70 3e 0a 3c 70 72 65 3e 66 6c 6f |a:.

.
flo|
        00001960  77 73 20 3a 3d 20 6d 61  70 5b 67 6f 70 61 63 6b  |ws := map[gopack|
        00001970  65 74 2e 45 6e 64 70 6f  69 6e 74 5d 63 68 61 6e  |et.Endpoint]chan|
        00001980  20 67 6f 70 61 63 6b 65  74 2e 50 61 63 6b 65 74  | gopacket.Packet|
        00001990  0a 70 61 63 6b 65 74 20  3a 3d 20 67 6f 70 61 63  |.packet := gopac|
        000019a0  6b 65 74 2e 4e 65 77 50  61 63 6b 65 74 28 6d 79  |ket.NewPacket(my|
        000019b0  50 61 63 6b 65 74 44 61  74 61 2c 20 6c 61 79 65  |PacketData, laye|
        000019c0  72 73 2e 4c 61 79 65 72  54 79 70 65 45 74 68 65  |rs.LayerTypeEthe|
        000019d0  72 6e 65 74 2c 20 67 6f  70 61 63 6b 65 74 2e 4c  |rnet, gopacket.L|
        000019e0  61 7a 79 29 0a 2f 2f 20  53 65 6e 64 20 61 6c 6c  |azy).// Send all|
        000019f0  20 54 43 50 20 70 61 63  6b 65 74 73 20 74 6f 20  | TCP packets to |
        00001a00  63 68 61 6e 6e 65 6c 73  20 62 61 73 65 64 20 6f  |channels based o|
        00001a10  6e 20 74 68 65 69 72 20  64 65 73 74 69 6e 61 74  |n their destinat|
        00001a20  69 6f 6e 20 70 6f 72 74  2e 0a 69 66 20 74 63 70  |ion port..if tcp|
        00001a30  20 3a 3d 20 70 61 63 6b  65 74 2e 4c 61 79 65 72  | := packet.Layer|
        00001a40  28 6c 61 79 65 72 73 2e  4c 61 79 65 72 54 79 70  |(layers.LayerTyp|
        00001a50  65 54 43 50 29 3b 20 74  63 70 20 21 3d 20 6e 69  |eTCP); tcp != ni|
        00001a60  6c 20 7b 0a 20 20 66 6c  6f 77 73 5b 74 63 70 2e  |l {.  flows[tcp.|
        00001a70  54 72 61 6e 73 70 6f 72  74 46 6c 6f 77 28 29 2e  |TransportFlow().|
        00001a80  44 73 74 28 29 5d 20 26  6c 74 3b 2d 20 70 61 63  |Dst()] <- pac|
        00001a90  6b 65 74 0a 7d 0a 2f 2f  20 4c 6f 6f 6b 20 66 6f  |ket.}.// Look fo|
        00001aa0  72 20 61 6c 6c 20 70 61  63 6b 65 74 73 20 77 69  |r all packets wi|
        00001ab0  74 68 20 74 68 65 20 73  61 6d 65 20 73 6f 75 72  |th the same sour|
        00001ac0  63 65 20 61 6e 64 20 64  65 73 74 69 6e 61 74 69  |ce and destinati|
        00001ad0  6f 6e 20 6e 65 74 77 6f  72 6b 20 61 64 64 72 65  |on network addre|
        00001ae0  73 73 0a 69 66 20 6e 65  74 20 3a 3d 20 70 61 63  |ss.if net := pac|
        00001af0  6b 65 74 2e 4e 65 74 77  6f 72 6b 4c 61 79 65 72  |ket.NetworkLayer|
        00001b00  28 29 3b 20 6e 65 74 20  21 3d 20 6e 69 6c 20 7b  |(); net != nil {|
        00001b10  0a 20 20 73 72 63 2c 20  64 73 74 20 3a 3d 20 6e  |.  src, dst := n|
        00001b20  65 74 2e 4e 65 74 77 6f  72 6b 46 6c 6f 77 28 29  |et.NetworkFlow()|
        00001b30  2e 45 6e 64 70 6f 69 6e  74 73 28 29 0a 20 20 69  |.Endpoints().  i|
        00001b40  66 20 73 72 63 20 3d 3d  20 64 73 74 20 7b 0a 20  |f src == dst {. |
        00001b50  20 20 20 66 6d 74 2e 50  72 69 6e 74 6c 6e 28 26  |   fmt.Println(&|
        00001b60  23 33 34 3b 46 69 73 68  79 20 70 61 63 6b 65 74  |#34;Fishy packet|
        00001b70  20 68 61 73 20 73 61 6d  65 20 6e 65 74 77 6f 72  | has same networ|
        00001b80  6b 20 73 6f 75 72 63 65  20 61 6e 64 20 64 73 74  |k source and dst|
        00001b90  3a 20 25 73 26 23 33 34  3b 2c 20 73 72 63 29 0a  |: %s", src).|
        00001ba0  20 20 7d 0a 7d 0a 2f 2f  20 46 69 6e 64 20 61 6c  |  }.}.// Find al|
        00001bb0  6c 20 70 61 63 6b 65 74  73 20 63 6f 6d 69 6e 67  |l packets coming|
        00001bc0  20 66 72 6f 6d 20 55 44  50 20 70 6f 72 74 20 31  | from UDP port 1|
        00001bd0  30 30 30 20 74 6f 20 55  44 50 20 70 6f 72 74 20  |000 to UDP port |
        00001be0  35 30 30 0a 69 6e 74 65  72 65 73 74 69 6e 67 46  |500.interestingF|
        00001bf0  6c 6f 77 20 3a 3d 20 67  6f 70 61 63 6b 65 74 2e  |low := gopacket.|
        00001c00  4e 65 77 46 6c 6f 77 28  6c 61 79 65 72 73 2e 4e  |NewFlow(layers.N|
        00001c10  65 77 55 44 50 50 6f 72  74 45 6e 64 70 6f 69 6e  |ewUDPPortEndpoin|
        00001c20  74 28 31 30 30 30 29 2c  20 6c 61 79 65 72 73 2e  |t(1000), layers.|
        00001c30  4e 65 77 55 44 50 50 6f  72 74 45 6e 64 70 6f 69  |NewUDPPortEndpoi|
        00001c40  6e 74 28 35 30 30 29 29  0a 69 66 20 74 20 3a 3d  |nt(500)).if t :=|
        00001c50  20 70 61 63 6b 65 74 2e  4e 65 74 77 6f 72 6b 4c  | packet.NetworkL|
        00001c60  61 79 65 72 28 29 3b 20  74 20 21 3d 20 6e 69 6c  |ayer(); t != nil|
        00001c70  20 26 61 6d 70 3b 26 61  6d 70 3b 20 74 2e 54 72  | && t.Tr|
        00001c80  61 6e 73 70 6f 72 74 46  6c 6f 77 28 29 20 3d 3d  |ansportFlow() ==|
        00001c90  20 69 6e 74 65 72 65 73  74 69 6e 67 46 6c 6f 77  | interestingFlow|
        00001ca0  20 7b 0a 20 20 66 6d 74  2e 50 72 69 6e 74 6c 6e  | {.  fmt.Println|
        00001cb0  28 26 23 33 34 3b 46 6f  75 6e 64 20 74 68 61 74  |("Found that|
        00001cc0  20 55 44 50 20 66 6c 6f  77 20 49 20 77 61 73 20  | UDP flow I was |
        00001cd0  6c 6f 6f 6b 69 6e 67 20  66 6f 72 21 26 23 33 34  |looking for!"|
        00001ce0  3b 29 0a 7d 0a 3c 2f 70  72 65 3e 0a 3c 68 33 20  |;).}.
.

Implementing | 00001d20 59 6f 75 72 20 4f 77 6e 20 44 65 63 6f 64 65 72 |Your Own Decoder| 00001d30 3c 2f 68 33 3e 0a 3c 70 3e 0a 49 66 20 79 6f 75 |

.

.If you| 00001d40 72 20 6e 65 74 77 6f 72 6b 20 68 61 73 20 73 6f |r network has so| 00001d50 6d 65 20 73 74 72 61 6e 67 65 20 65 6e 63 61 70 |me strange encap| 00001d60 73 75 6c 61 74 69 6f 6e 2c 20 79 6f 75 20 63 61 |sulation, you ca| 00001d70 6e 20 69 6d 70 6c 65 6d 65 6e 74 20 79 6f 75 72 |n implement your| 00001d80 20 6f 77 6e 0a 64 65 63 6f 64 65 72 2e 20 20 49 | own.decoder. I| 00001d90 6e 20 74 68 69 73 20 65 78 61 6d 70 6c 65 2c 20 |n this example, | 00001da0 77 65 20 68 61 6e 64 6c 65 20 45 74 68 65 72 6e |we handle Ethern| 00001db0 65 74 20 70 61 63 6b 65 74 73 20 77 68 69 63 68 |et packets which| 00001dc0 20 61 72 65 20 65 6e 63 61 70 73 75 6c 61 74 65 | are encapsulate| 00001dd0 64 0a 69 6e 20 61 20 34 2d 62 79 74 65 20 68 65 |d.in a 4-byte he| 00001de0 61 64 65 72 2e 0a 3c 2f 70 3e 0a 3c 70 72 65 3e |ader..

.
|
        00001df0  2f 2f 20 43 72 65 61 74  65 20 61 20 6c 61 79 65  |// Create a laye|
        00001e00  72 20 74 79 70 65 2c 20  73 68 6f 75 6c 64 20 62  |r type, should b|
        00001e10  65 20 75 6e 69 71 75 65  20 61 6e 64 20 68 69 67  |e unique and hig|
        00001e20  68 2c 20 73 6f 20 69 74  20 64 6f 65 73 6e 26 23  |h, so it doesn&#|
        00001e30  33 39 3b 74 20 63 6f 6e  66 6c 69 63 74 2c 0a 2f  |39;t conflict,./|
        00001e40  2f 20 67 69 76 69 6e 67  20 69 74 20 61 20 6e 61  |/ giving it a na|
        00001e50  6d 65 20 61 6e 64 20 61  20 64 65 63 6f 64 65 72  |me and a decoder|
        00001e60  20 74 6f 20 75 73 65 2e  0a 76 61 72 20 4d 79 4c  | to use..var MyL|
        00001e70  61 79 65 72 54 79 70 65  20 3d 20 67 6f 70 61 63  |ayerType = gopac|
        00001e80  6b 65 74 2e 52 65 67 69  73 74 65 72 4c 61 79 65  |ket.RegisterLaye|
        00001e90  72 54 79 70 65 28 31 32  33 34 35 2c 20 26 23 33  |rType(12345, |
        00001ea0  34 3b 4d 79 4c 61 79 65  72 54 79 70 65 26 23 33  |4;MyLayerType|
        00001eb0  34 3b 2c 20 67 6f 70 61  63 6b 65 74 2e 44 65 63  |4;, gopacket.Dec|
        00001ec0  6f 64 65 46 75 6e 63 28  64 65 63 6f 64 65 4d 79  |odeFunc(decodeMy|
        00001ed0  4c 61 79 65 72 29 29 0a  0a 2f 2f 20 49 6d 70 6c  |Layer))..// Impl|
        00001ee0  65 6d 65 6e 74 20 6d 79  20 6c 61 79 65 72 0a 74  |ement my layer.t|
        00001ef0  79 70 65 20 4d 79 4c 61  79 65 72 20 73 74 72 75  |ype MyLayer stru|
        00001f00  63 74 20 7b 0a 20 20 53  74 72 61 6e 67 65 48 65  |ct {.  StrangeHe|
        00001f10  61 64 65 72 20 5b 5d 62  79 74 65 0a 20 20 70 61  |ader []byte.  pa|
        00001f20  79 6c 6f 61 64 20 5b 5d  62 79 74 65 0a 7d 0a 66  |yload []byte.}.f|
        00001f30  75 6e 63 20 28 6d 20 4d  79 4c 61 79 65 72 29 20  |unc (m MyLayer) |
        00001f40  4c 61 79 65 72 54 79 70  65 28 29 20 4c 61 79 65  |LayerType() Laye|
        00001f50  72 54 79 70 65 20 7b 20  72 65 74 75 72 6e 20 4d  |rType { return M|
        00001f60  79 4c 61 79 65 72 54 79  70 65 20 7d 0a 66 75 6e  |yLayerType }.fun|
        00001f70  63 20 28 6d 20 4d 79 4c  61 79 65 72 29 20 4c 61  |c (m MyLayer) La|
        00001f80  79 65 72 43 6f 6e 74 65  6e 74 73 28 29 20 5b 5d  |yerContents() []|
        00001f90  62 79 74 65 20 7b 20 72  65 74 75 72 6e 20 6d 2e  |byte { return m.|
        00001fa0  53 74 72 61 6e 67 65 48  65 61 64 65 72 20 7d 0a  |StrangeHeader }.|
        00001fb0  66 75 6e 63 20 28 6d 20  4d 79 4c 61 79 65 72 29  |func (m MyLayer)|
        00001fc0  20 4c 61 79 65 72 50 61  79 6c 6f 61 64 28 29 20  | LayerPayload() |
        00001fd0  5b 5d 62 79 74 65 20 7b  20 72 65 74 75 72 6e 20  |[]byte { return |
        00001fe0  6d 2e 70 61 79 6c 6f 61  64 20 7d 0a 0a 2f 2f 20  |m.payload }..// |
        00001ff0  4e 6f 77 20 69 6d 70 6c  65 6d 65 6e 74 20 61 20  |Now implement a |
        00002000  64 65 63 6f 64 65 72 2e  2e 2e 20 74 68 69 73 20  |decoder... this |
        00002010  6f 6e 65 20 73 74 72 69  70 73 20 6f 66 66 20 74  |one strips off t|
        00002020  68 65 20 66 69 72 73 74  20 34 20 62 79 74 65 73  |he first 4 bytes|
        00002030  20 6f 66 20 74 68 65 0a  2f 2f 20 70 61 63 6b 65  | of the.// packe|
        00002040  74 2e 0a 66 75 6e 63 20  64 65 63 6f 64 65 4d 79  |t..func decodeMy|
        00002050  4c 61 79 65 72 28 64 61  74 61 20 5b 5d 62 79 74  |Layer(data []byt|
        00002060  65 2c 20 70 20 67 6f 70  61 63 6b 65 74 2e 50 61  |e, p gopacket.Pa|
        00002070  63 6b 65 74 42 75 69 6c  64 65 72 29 20 65 72 72  |cketBuilder) err|
        00002080  6f 72 20 7b 0a 20 20 2f  2f 20 43 72 65 61 74 65  |or {.  // Create|
        00002090  20 6d 79 20 6c 61 79 65  72 0a 20 20 70 2e 41 64  | my layer.  p.Ad|
        000020a0  64 4c 61 79 65 72 28 26  61 6d 70 3b 4d 79 4c 61  |dLayer(&MyLa|
        000020b0  79 65 72 7b 64 61 74 61  5b 3a 34 5d 2c 20 64 61  |yer{data[:4], da|
        000020c0  74 61 5b 34 3a 5d 7d 29  0a 20 20 2f 2f 20 44 65  |ta[4:]}).  // De|
        000020d0  74 65 72 6d 69 6e 65 20  68 6f 77 20 74 6f 20 68  |termine how to h|
        000020e0  61 6e 64 6c 65 20 74 68  65 20 72 65 73 74 20 6f  |andle the rest o|
        000020f0  66 20 74 68 65 20 70 61  63 6b 65 74 0a 20 20 72  |f the packet.  r|
        00002100  65 74 75 72 6e 20 70 2e  4e 65 78 74 44 65 63 6f  |eturn p.NextDeco|
        00002110  64 65 72 28 6c 61 79 65  72 73 2e 4c 61 79 65 72  |der(layers.Layer|
        00002120  54 79 70 65 45 74 68 65  72 6e 65 74 29 0a 7d 0a  |TypeEthernet).}.|
        00002130  0a 2f 2f 20 46 69 6e 61  6c 6c 79 2c 20 64 65 63  |.// Finally, dec|
        00002140  6f 64 65 20 79 6f 75 72  20 70 61 63 6b 65 74 73  |ode your packets|
        00002150  3a 0a 70 20 3a 3d 20 67  6f 70 61 63 6b 65 74 2e  |:.p := gopacket.|
        00002160  4e 65 77 50 61 63 6b 65  74 28 64 61 74 61 2c 20  |NewPacket(data, |
        00002170  4d 79 4c 61 79 65 72 54  79 70 65 2c 20 67 6f 70  |MyLayerType, gop|
        00002180  61 63 6b 65 74 2e 4c 61  7a 79 29 0a 3c 2f 70 72  |acket.Lazy)..

.See the d| 000021a0 6f 63 73 20 66 6f 72 20 44 65 63 6f 64 65 72 20 |ocs for Decoder | 000021b0 61 6e 64 20 50 61 63 6b 65 74 42 75 69 6c 64 65 |and PacketBuilde| 000021c0 72 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 |r for more detai| 000021d0 6c 73 20 6f 6e 20 68 6f 77 20 63 6f 64 69 6e 67 |ls on how coding| 000021e0 0a 64 65 63 6f 64 65 72 73 20 77 6f 72 6b 73 2c |.decoders works,| 000021f0 20 6f 72 20 6c 6f 6f 6b 20 61 74 20 52 65 67 69 | or look at Regi| 00002200 73 74 65 72 4c 61 79 65 72 54 79 70 65 20 61 6e |sterLayerType an| 00002210 64 20 52 65 67 69 73 74 65 72 45 6e 64 70 6f 69 |d RegisterEndpoi| 00002220 6e 74 54 79 70 65 20 74 6f 20 73 65 65 20 68 6f |ntType to see ho| 00002230 77 0a 74 6f 20 61 64 64 20 6c 61 79 65 72 2f 65 |w.to add layer/e| 00002240 6e 64 70 6f 69 6e 74 20 74 79 70 65 73 20 74 6f |ndpoint types to| 00002250 20 67 6f 70 61 63 6b 65 74 2e 0a 3c 2f 70 3e 0a | gopacket..

.| 00002260 0a 09 09 09 3c 2f 64 69 76 3e 0a 09 09 3c 2f 64 |...............

In| 00002290 64 65 78 3c 2f 68 32 3e 0a 09 09 3c 21 2d 2d 20 |dex

......| 000022f0 3c 64 69 76 20 69 64 3d 22 6d 61 6e 75 61 6c 2d |
....
...| 00002310 09 0a 09 09 09 0a 09 09 09 09 3c 64 64 3e 3c 61 |..........
Variables| 00002340 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 0a 09 09 |
.......| 00002350 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c |...............<| 00002360 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 41 70 70 |dd>t| 00002380 79 70 65 20 41 70 70 6c 69 63 61 74 69 6f 6e 4c |ype ApplicationL| 00002390 61 79 65 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 |ayer...| 000023a0 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 |................| 000023b0 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 |.....
| 000023d0 74 79 70 65 20 43 61 70 74 75 72 65 49 6e 66 6f |type CaptureInfo| 000023e0 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 |
.......| 000023f0 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00002400 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 44 |.
ty| 00002420 70 65 20 44 65 63 6f 64 65 46 61 69 6c 75 72 65 |pe DecodeFailure| 00002430 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 |
.......| 00002440 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00002450 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00002460 20 3c 61 20 68 72 65 66 3d 22 23 44 65 63 6f 64 | | 00002480 66 75 6e 63 20 28 64 20 2a 44 65 63 6f 64 65 46 |func (d *DecodeF| 00002490 61 69 6c 75 72 65 29 20 45 72 72 6f 72 28 29 20 |ailure) Error() | 000024a0 65 72 72 6f 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |error..| 000024b0 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 000024c0 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 000024d0 20 3c 61 20 68 72 65 66 3d 22 23 44 65 63 6f 64 | func (d | 00002500 2a 44 65 63 6f 64 65 46 61 69 6c 75 72 65 29 20 |*DecodeFailure) | 00002510 4c 61 79 65 72 43 6f 6e 74 65 6e 74 73 28 29 20 |LayerContents() | 00002520 5b 5d 62 79 74 65 3c 2f 61 3e 3c 2f 64 64 3e 0a |[]byte.| 00002530 09 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 |................| 00002540 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 |
   | 00002550 3b 20 3c 61 20 68 72 65 66 3d 22 23 44 65 63 6f |; func (d | 00002580 2a 44 65 63 6f 64 65 46 61 69 6c 75 72 65 29 20 |*DecodeFailure) | 00002590 4c 61 79 65 72 50 61 79 6c 6f 61 64 28 29 20 5b |LayerPayload() [| 000025a0 5d 62 79 74 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |]byte
..| 000025b0 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 000025c0 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 000025d0 20 3c 61 20 68 72 65 66 3d 22 23 44 65 63 6f 64 | func (d *Dec| 00002600 6f 64 65 46 61 69 6c 75 72 65 29 20 4c 61 79 65 |odeFailure) Laye| 00002610 72 54 79 70 65 28 29 20 4c 61 79 65 72 54 79 70 |rType() LayerTyp| 00002620 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a |e......| 00002630 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 |...........
&| 00002640 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 |nbsp;   fun| 00002670 63 20 28 64 20 2a 44 65 63 6f 64 65 46 61 69 6c |c (d *DecodeFail| 00002680 75 72 65 29 20 53 74 72 69 6e 67 28 29 20 73 74 |ure) String() st| 00002690 72 69 6e 67 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 |ring
...| 000026a0 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 |................| 000026b0 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 44 65 |
type D| 000026d0 65 63 6f 64 65 46 75 6e 63 3c 2f 61 3e 3c 2f 64 |ecodeFunc..............| 000026f0 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e 62 73 |........
&nbs| 00002700 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 72 65 |p;   func (d D| 00002730 65 63 6f 64 65 46 75 6e 63 29 20 44 65 63 6f 64 |ecodeFunc) Decod| 00002740 65 28 64 61 74 61 20 5b 5d 62 79 74 65 2c 20 70 |e(data []byte, p| 00002750 20 50 61 63 6b 65 74 42 75 69 6c 64 65 72 29 20 | PacketBuilder) | 00002760 65 72 72 6f 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |error
..| 00002770 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00002780 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 44 |.
ty| 000027a0 70 65 20 44 65 63 6f 64 65 4f 70 74 69 6f 6e 73 |pe DecodeOptions| 000027b0 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 |
.......| 000027c0 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 000027d0 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 44 |.
type Dec| 000027f0 6f 64 65 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 |oder
...| 00002800 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 |................| 00002810 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 |.....
typ| 00002830 65 20 45 6e 64 70 6f 69 6e 74 3c 2f 61 3e 3c 2f |e Endpoint.............| 00002850 09 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 |....
  &| 00002860 6e 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 |nbsp; fun| 00002880 63 20 4e 65 77 45 6e 64 70 6f 69 6e 74 28 74 79 |c NewEndpoint(ty| 00002890 70 20 45 6e 64 70 6f 69 6e 74 54 79 70 65 2c 20 |p EndpointType, | 000028a0 72 61 77 20 5b 5d 62 79 74 65 29 20 45 6e 64 70 |raw []byte) Endp| 000028b0 6f 69 6e 74 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 |oint
...| 000028c0 09 09 0a 09 09 09 09 0a 09 09 09 09 09 0a 09 09 |................| 000028d0 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e |...
  &n| 000028e0 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 45 |bsp; func (e En| 00002910 64 70 6f 69 6e 74 29 20 45 6e 64 70 6f 69 6e 74 |dpoint) Endpoint| 00002920 54 79 70 65 28 29 20 45 6e 64 70 6f 69 6e 74 54 |Type() EndpointT| 00002930 79 70 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 |ype
....| 00002940 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 |.............    <| 00002960 61 20 68 72 65 66 3d 22 23 45 6e 64 70 6f 69 6e |a href="#Endpoin| 00002970 74 2e 4c 65 73 73 54 68 61 6e 22 3e 66 75 6e 63 |t.LessThan">func| 00002980 20 28 61 20 45 6e 64 70 6f 69 6e 74 29 20 4c 65 | (a Endpoint) Le| 00002990 73 73 54 68 61 6e 28 62 20 45 6e 64 70 6f 69 6e |ssThan(b Endpoin| 000029a0 74 29 20 62 6f 6f 6c 3c 2f 61 3e 3c 2f 64 64 3e |t) bool| 000029b0 0a 09 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 |................| 000029c0 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 |.
  &nbs| 000029d0 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 45 6e 64 |p; func | 000029f0 28 65 20 45 6e 64 70 6f 69 6e 74 29 20 52 61 77 |(e Endpoint) Raw| 00002a00 28 29 20 5b 5d 62 79 74 65 3c 2f 61 3e 3c 2f 64 |() []byte..............| 00002a20 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e |...
  &n| 00002a30 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 45 |bsp; | 00002a50 66 75 6e 63 20 28 65 20 45 6e 64 70 6f 69 6e 74 |func (e Endpoint| 00002a60 29 20 53 74 72 69 6e 67 28 29 20 73 74 72 69 6e |) String() strin| 00002a70 67 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a |g
......| 00002a80 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 |.............type En| 00002ab0 64 70 6f 69 6e 74 54 79 70 65 3c 2f 61 3e 3c 2f |dpointType.............| 00002ad0 09 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 |....
  &| 00002ae0 6e 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 |nbsp; func Regis| 00002b10 74 65 72 45 6e 64 70 6f 69 6e 74 54 79 70 65 28 |terEndpointType(| 00002b20 6e 75 6d 20 69 6e 74 2c 20 6d 65 74 61 20 45 6e |num int, meta En| 00002b30 64 70 6f 69 6e 74 54 79 70 65 4d 65 74 61 64 61 |dpointTypeMetada| 00002b40 74 61 29 20 45 6e 64 70 6f 69 6e 74 54 79 70 65 |ta) EndpointType| 00002b50 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 |
.......| 00002b60 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00002b70 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00002b80 20 3c 61 20 68 72 65 66 3d 22 23 45 6e 64 70 6f | | 00002ba0 66 75 6e 63 20 28 65 20 45 6e 64 70 6f 69 6e 74 |func (e Endpoint| 00002bb0 54 79 70 65 29 20 53 74 72 69 6e 67 28 29 20 73 |Type) String() s| 00002bc0 74 72 69 6e 67 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |tring..| 00002bd0 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00002be0 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 45 |.
type Endpoi| 00002c10 6e 74 54 79 70 65 4d 65 74 61 64 61 74 61 3c 2f |ntTypeMetadata
.........| 00002c30 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c |...............<| 00002c40 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 45 72 72 |dd>type Er| 00002c60 72 6f 72 4c 61 79 65 72 3c 2f 61 3e 3c 2f 64 64 |rorLayer
...............| 00002c80 09 09 09 09 0a 09 09 09 09 3c 64 64 3e 3c 61 20 |.........
typ| 00002ca0 65 20 46 6c 6f 77 3c 2f 61 3e 3c 2f 64 64 3e 0a |e Flow
.| 00002cb0 09 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 |................| 00002cc0 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 |
   | 00002cd0 3b 20 3c 61 20 68 72 65 66 3d 22 23 46 6c 6f 77 |; f| 00002cf0 75 6e 63 20 46 6c 6f 77 46 72 6f 6d 45 6e 64 70 |unc FlowFromEndp| 00002d00 6f 69 6e 74 73 28 73 72 63 2c 20 64 73 74 20 45 |oints(src, dst E| 00002d10 6e 64 70 6f 69 6e 74 29 20 28 5f 20 46 6c 6f 77 |ndpoint) (_ Flow| 00002d20 2c 20 65 72 72 20 65 72 72 6f 72 29 3c 2f 61 3e |, err error)| 00002d30 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 09 09 |
...........| 00002d40 0a 09 09 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b |......
 | 00002d50 20 26 6e 62 73 70 3b 20 3c 61 20 68 72 65 66 3d |   func | 00002d70 4e 65 77 46 6c 6f 77 28 74 20 45 6e 64 70 6f 69 |NewFlow(t Endpoi| 00002d80 6e 74 54 79 70 65 2c 20 73 72 63 2c 20 64 73 74 |ntType, src, dst| 00002d90 20 5b 5d 62 79 74 65 29 20 46 6c 6f 77 3c 2f 61 | []byte) Flow
..........| 00002db0 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e |............
| 00002dc0 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 |    func (f Flow) | 00002df0 44 73 74 28 29 20 28 64 73 74 20 45 6e 64 70 6f |Dst() (dst Endpo| 00002e00 69 6e 74 29 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 |int)
...| 00002e10 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 |..............    | 00002e30 3c 61 20 68 72 65 66 3d 22 23 46 6c 6f 77 2e 45 |fun| 00002e50 63 20 28 66 20 46 6c 6f 77 29 20 45 6e 64 70 6f |c (f Flow) Endpo| 00002e60 69 6e 74 54 79 70 65 28 29 20 45 6e 64 70 6f 69 |intType() Endpoi| 00002e70 6e 74 54 79 70 65 3c 2f 61 3e 3c 2f 64 64 3e 0a |ntType.| 00002e80 09 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 |................| 00002e90 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 |
   | 00002ea0 3b 20 3c 61 20 68 72 65 66 3d 22 23 46 6c 6f 77 |; func| 00002ec0 20 28 66 20 46 6c 6f 77 29 20 45 6e 64 70 6f 69 | (f Flow) Endpoi| 00002ed0 6e 74 73 28 29 20 28 73 72 63 2c 20 64 73 74 20 |nts() (src, dst | 00002ee0 45 6e 64 70 6f 69 6e 74 29 3c 2f 61 3e 3c 2f 64 |Endpoint)..............| 00002f00 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e |...
  &n| 00002f10 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 46 |bsp; fun| 00002f30 63 20 28 66 20 46 6c 6f 77 29 20 52 65 76 65 72 |c (f Flow) Rever| 00002f40 73 65 28 29 20 46 6c 6f 77 3c 2f 61 3e 3c 2f 64 |se() Flow..............| 00002f60 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e |...
  &n| 00002f70 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 46 |bsp; func (f| 00002f90 20 46 6c 6f 77 29 20 53 72 63 28 29 20 28 73 72 | Flow) Src() (sr| 00002fa0 63 20 45 6e 64 70 6f 69 6e 74 29 3c 2f 61 3e 3c |c Endpoint)<| 00002fb0 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 09 09 0a |/dd>............| 00002fc0 09 09 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 |.....
  | 00002fd0 26 6e 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 |  fu| 00002ff0 6e 63 20 28 66 20 46 6c 6f 77 29 20 53 74 72 69 |nc (f Flow) Stri| 00003000 6e 67 28 29 20 73 74 72 69 6e 67 3c 2f 61 3e 3c |ng() string<| 00003010 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 0a 09 09 |/dd>............| 00003020 09 09 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 |.......
type| 00003040 20 4c 61 79 65 72 3c 2f 61 3e 3c 2f 64 64 3e 0a | Layer
.| 00003050 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 |................| 00003060 09 09 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 |.......
type LayerClass| 00003090 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 |
.......| 000030a0 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e |..........
&n| 000030b0 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 |bsp;   func NewLay| 000030e0 65 72 43 6c 61 73 73 28 74 79 70 65 73 20 5b 5d |erClass(types []| 000030f0 4c 61 79 65 72 54 79 70 65 29 20 4c 61 79 65 72 |LayerType) Layer| 00003100 43 6c 61 73 73 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |Class
..| 00003110 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 |................| 00003120 09 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 |......
type LayerCla| 00003150 73 73 4d 61 70 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |ssMap
..| 00003160 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00003170 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00003180 20 3c 61 20 68 72 65 66 3d 22 23 4e 65 77 4c 61 | fun| 000031a0 63 20 4e 65 77 4c 61 79 65 72 43 6c 61 73 73 4d |c NewLayerClassM| 000031b0 61 70 28 74 79 70 65 73 20 5b 5d 4c 61 79 65 72 |ap(types []Layer| 000031c0 54 79 70 65 29 20 4c 61 79 65 72 43 6c 61 73 73 |Type) LayerClass| 000031d0 4d 61 70 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 |Map....| 000031e0 09 0a 09 09 09 09 0a 09 09 09 09 09 0a 09 09 09 |................| 000031f0 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 |..
  &nb| 00003200 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 4c 61 |sp; func (m La| 00003230 79 65 72 43 6c 61 73 73 4d 61 70 29 20 43 6f 6e |yerClassMap) Con| 00003240 74 61 69 6e 73 28 74 20 4c 61 79 65 72 54 79 70 |tains(t LayerTyp| 00003250 65 29 20 62 6f 6f 6c 3c 2f 61 3e 3c 2f 64 64 3e |e) bool
| 00003260 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 |................| 00003270 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 |...
type LayerClas| 000032a0 73 53 6c 69 63 65 3c 2f 61 3e 3c 2f 64 64 3e 0a |sSlice
.| 000032b0 09 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 |................| 000032c0 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 |
   | 000032d0 3b 20 3c 61 20 68 72 65 66 3d 22 23 4e 65 77 4c |; | 000032f0 66 75 6e 63 20 4e 65 77 4c 61 79 65 72 43 6c 61 |func NewLayerCla| 00003300 73 73 53 6c 69 63 65 28 74 79 70 65 73 20 5b 5d |ssSlice(types []| 00003310 4c 61 79 65 72 54 79 70 65 29 20 4c 61 79 65 72 |LayerType) Layer| 00003320 43 6c 61 73 73 53 6c 69 63 65 3c 2f 61 3e 3c 2f |ClassSlice.............| 00003340 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 6e 62 |.........
&nb| 00003350 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 68 72 |sp;   f| 00003380 75 6e 63 20 28 73 20 4c 61 79 65 72 43 6c 61 73 |unc (s LayerClas| 00003390 73 53 6c 69 63 65 29 20 43 6f 6e 74 61 69 6e 73 |sSlice) Contains| 000033a0 28 74 20 4c 61 79 65 72 54 79 70 65 29 20 62 6f |(t LayerType) bo| 000033b0 6f 6c 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 |ol
.....| 000033c0 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 |..............type Laye| 000033f0 72 54 79 70 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |rType..| 00003400 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00003410 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00003420 20 3c 61 20 68 72 65 66 3d 22 23 52 65 67 69 73 | fu| 00003440 6e 63 20 52 65 67 69 73 74 65 72 4c 61 79 65 72 |nc RegisterLayer| 00003450 54 79 70 65 28 6e 75 6d 20 69 6e 74 2c 20 6d 65 |Type(num int, me| 00003460 74 61 20 4c 61 79 65 72 54 79 70 65 4d 65 74 61 |ta LayerTypeMeta| 00003470 64 61 74 61 29 20 4c 61 79 65 72 54 79 70 65 3c |data) LayerType<| 00003480 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 09 |/a>........| 00003490 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 |..............    | 000034b0 3c 61 20 68 72 65 66 3d 22 23 4c 61 79 65 72 54 |func| 000034d0 20 28 74 20 4c 61 79 65 72 54 79 70 65 29 20 44 | (t LayerType) D| 000034e0 65 63 6f 64 65 28 64 61 74 61 20 5b 5d 62 79 74 |ecode(data []byt| 000034f0 65 2c 20 63 20 50 61 63 6b 65 74 42 75 69 6c 64 |e, c PacketBuild| 00003500 65 72 29 20 65 72 72 6f 72 3c 2f 61 3e 3c 2f 64 |er) error..............| 00003520 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e |...
  &n| 00003530 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 4c |bsp; func (t LayerTy| 00003560 70 65 29 20 53 74 72 69 6e 67 28 29 20 28 73 20 |pe) String() (s | 00003570 73 74 72 69 6e 67 29 3c 2f 61 3e 3c 2f 64 64 3e |string)
| 00003580 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 |................| 00003590 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 |...
type LayerTy| 000035c0 70 65 4d 65 74 61 64 61 74 61 3c 2f 61 3e 3c 2f |peMetadata.............| 000035e0 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 64 3e 3c |...........
<| 000035f0 61 20 68 72 65 66 3d 22 23 4c 69 6e 6b 4c 61 79 |a href="#LinkLay| 00003600 65 72 22 3e 74 79 70 65 20 4c 69 6e 6b 4c 61 79 |er">type LinkLay| 00003610 65 72 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 |er
.....| 00003620 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 |................| 00003630 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 |...
t| 00003650 79 70 65 20 4e 65 74 77 6f 72 6b 4c 61 79 65 72 |ype NetworkLayer| 00003660 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 |
.......| 00003670 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00003680 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d 22 23 50 |.
type Pack| 000036a0 65 74 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 |et
.....| 000036b0 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e |............
| 000036c0 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 |    func NewPacke| 000036f0 74 28 64 61 74 61 20 5b 5d 62 79 74 65 2c 20 66 |t(data []byte, f| 00003700 69 72 73 74 4c 61 79 65 72 44 65 63 6f 64 65 72 |irstLayerDecoder| 00003710 20 44 65 63 6f 64 65 72 2c 20 6f 70 74 69 6f 6e | Decoder, option| 00003720 73 20 44 65 63 6f 64 65 4f 70 74 69 6f 6e 73 29 |s DecodeOptions)| 00003730 20 50 61 63 6b 65 74 3c 2f 61 3e 3c 2f 64 64 3e | Packet
| 00003740 0a 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 |................| 00003750 09 09 09 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 |........
type Packet| 00003780 42 75 69 6c 64 65 72 3c 2f 61 3e 3c 2f 64 64 3e |Builder
| 00003790 0a 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 |................| 000037a0 09 09 09 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 |........
type Pac| 000037d0 6b 65 74 44 61 74 61 53 6f 75 72 63 65 3c 2f 61 |ketDataSource
..........| 000037f0 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 64 |..............type P| 00003820 61 63 6b 65 74 53 6f 75 72 63 65 3c 2f 61 3e 3c |acketSource<| 00003830 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 09 09 0a |/dd>............| 00003840 09 09 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 |.....
  | 00003850 26 6e 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 |  func NewPacket| 00003880 53 6f 75 72 63 65 28 73 6f 75 72 63 65 20 50 61 |Source(source Pa| 00003890 63 6b 65 74 44 61 74 61 53 6f 75 72 63 65 2c 20 |cketDataSource, | 000038a0 64 65 63 6f 64 65 72 20 44 65 63 6f 64 65 72 29 |decoder Decoder)| 000038b0 20 2a 50 61 63 6b 65 74 53 6f 75 72 63 65 3c 2f | *PacketSource
.........| 000038d0 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 |.............    <| 000038f0 61 20 68 72 65 66 3d 22 23 50 61 63 6b 65 74 53 |a href="#PacketS| 00003900 6f 75 72 63 65 2e 4e 65 78 74 50 61 63 6b 65 74 |ource.NextPacket| 00003910 22 3e 66 75 6e 63 20 28 70 20 2a 50 61 63 6b 65 |">func (p *Packe| 00003920 74 53 6f 75 72 63 65 29 20 4e 65 78 74 50 61 63 |tSource) NextPac| 00003930 6b 65 74 28 29 20 28 50 61 63 6b 65 74 2c 20 65 |ket() (Packet, e| 00003940 72 72 6f 72 29 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 |rror)..| 00003950 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 3c |...............<| 00003960 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b |dd>   | 00003970 20 3c 61 20 68 72 65 66 3d 22 23 50 61 63 6b 65 | func (p *Packet| 000039a0 53 6f 75 72 63 65 29 20 50 61 63 6b 65 74 73 28 |Source) Packets(| 000039b0 29 20 63 68 61 6e 20 50 61 63 6b 65 74 3c 2f 61 |) chan Packet..........| 000039d0 09 09 09 09 0a 09 09 09 09 3c 64 64 3e 3c 61 20 |.........
| 000039f0 74 79 70 65 20 50 61 79 6c 6f 61 64 3c 2f 61 3e |type Payload| 00003a00 3c 2f 64 64 3e 0a 09 09 09 09 0a 09 09 09 09 0a |
...........| 00003a10 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e 26 |...........
&| 00003a20 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 20 |nbsp;   fu| 00003a50 6e 63 20 28 70 20 2a 50 61 79 6c 6f 61 64 29 20 |nc (p *Payload) | 00003a60 4c 61 79 65 72 43 6f 6e 74 65 6e 74 73 28 29 20 |LayerContents() | 00003a70 5b 5d 62 79 74 65 3c 2f 61 3e 3c 2f 64 64 3e 0a |[]byte
.| 00003a80 09 09 09 09 0a 09 09 09 09 09 0a 09 09 09 09 09 |................| 00003a90 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e 62 73 70 |
   | 00003aa0 3b 20 3c 61 20 68 72 65 66 3d 22 23 50 61 79 6c |; func (p *Paylo| 00003ad0 61 64 29 20 4c 61 79 65 72 50 61 79 6c 6f 61 64 |ad) LayerPayload| 00003ae0 28 29 20 5b 5d 62 79 74 65 3c 2f 61 3e 3c 2f 64 |() []byte..............| 00003b00 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e |...
  &n| 00003b10 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 50 |bsp; func (p *Paylo| 00003b40 61 64 29 20 4c 61 79 65 72 54 79 70 65 28 29 20 |ad) LayerType() | 00003b50 4c 61 79 65 72 54 79 70 65 3c 2f 61 3e 3c 2f 64 |LayerType..............| 00003b70 09 09 09 3c 64 64 3e 26 6e 62 73 70 3b 20 26 6e |...
  &n| 00003b80 62 73 70 3b 20 3c 61 20 68 72 65 66 3d 22 23 50 |bsp; | 00003ba0 66 75 6e 63 20 28 70 20 2a 50 61 79 6c 6f 61 64 |func (p *Payload| 00003bb0 29 20 50 61 79 6c 6f 61 64 28 29 20 5b 5d 62 79 |) Payload() []by| 00003bc0 74 65 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 09 |te
.....| 00003bd0 0a 09 09 09 09 09 0a 09 09 09 09 09 3c 64 64 3e |............
| 00003be0 26 6e 62 73 70 3b 20 26 6e 62 73 70 3b 20 3c 61 |    func (p | 00003c10 2a 50 61 79 6c 6f 61 64 29 20 53 74 72 69 6e 67 |*Payload) String| 00003c20 28 29 20 73 74 72 69 6e 67 3c 2f 61 3e 3c 2f 64 |() string..............| 00003c40 0a 09 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 |.....
type Transpor| 00003c70 74 4c 61 79 65 72 3c 2f 61 3e 3c 2f 64 64 3e 0a |tLayer
.| 00003c80 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 |................| 00003c90 09 0a 09 09 3c 2f 64 6c 3e 0a 0a 09 09 0a 0a 09 |....
.......| 00003ca0 09 0a 09 09 09 3c 68 34 3e 50 61 63 6b 61 67 65 |.....

Package| 00003cb0 20 66 69 6c 65 73 3c 2f 68 34 3e 0a 09 09 09 3c | files

....<| 00003cc0 70 3e 0a 09 09 09 3c 73 70 61 6e 20 73 74 79 6c |p>.............base.go..| 00003d30 09 09 0a 09 09 09 09 3c 61 20 68 72 65 66 3d 22 |.......decode.go..| 00003d80 09 09 0a 09 09 09 09 3c 61 20 68 72 65 66 3d 22 |.......do| 00003dc0 63 2e 67 6f 3c 2f 61 3e 0a 09 09 09 0a 09 09 09 |c.go........| 00003dd0 09 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 |.flows.| 00003e10 67 6f 3c 2f 61 3e 0a 09 09 09 0a 09 09 09 09 3c |go.........<| 00003e20 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b 67 |a href="/src/pkg| 00003e30 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 67 63 6f 6e |/github.com/gcon| 00003e40 6e 65 6c 6c 2f 67 6f 70 61 63 6b 65 74 2f 6c 61 |nell/gopacket/la| 00003e50 79 65 72 63 6c 61 73 73 2e 67 6f 22 3e 6c 61 79 |yerclass.go">lay| 00003e60 65 72 63 6c 61 73 73 2e 67 6f 3c 2f 61 3e 0a 09 |erclass.go..| 00003e70 09 09 0a 09 09 09 09 3c 61 20 68 72 65 66 3d 22 |.......layertype.go| 00003ec0 3c 2f 61 3e 0a 09 09 09 0a 09 09 09 09 3c 61 20 |.........packet.go| 00003f10 3c 2f 61 3e 0a 09 09 09 0a 09 09 09 09 3c 61 20 |.........valid_mac_pre| 00003f70 66 69 78 65 73 2e 67 6f 3c 2f 61 3e 0a 09 09 09 |fixes.go....| 00003f80 0a 09 09 09 3c 2f 73 70 61 6e 3e 0a 09 09 09 3c |........<| 00003f90 2f 70 3e 0a 09 09 0a 09 0a 09 09 0a 09 09 0a 09 |/p>.............| 00003fa0 09 09 3c 68 32 20 69 64 3d 22 70 6b 67 2d 76 61 |..

Var| 00000050 69 61 62 6c 65 73 3c 2f 68 32 3e 0a 09 09 09 0a |iables

.....| 00000060 09 09 09 09 3c 70 72 65 3e 76 61 72 20 56 61 6c |....
var Val|
        00000070  69 64 4d 41 43 50 72 65  66 69 78 4d 61 70 20 3d  |idMACPrefixMap =|
        00000080  20 76 61 6c 69 64 4d 41  43 50 72 65 66 69 78 4d  | validMACPrefixM|
        00000090  61 70 3c 2f 70 72 65 3e  0a 09 09 09 09 3c 70 3e  |ap
.....

| 000000a0 0a 56 61 6c 69 64 4d 41 43 50 72 65 66 69 78 4d |.ValidMACPrefixM| 000000b0 61 70 20 6d 61 70 73 20 61 20 76 61 6c 69 64 20 |ap maps a valid | 000000c0 4d 41 43 20 61 64 64 72 65 73 73 20 70 72 65 66 |MAC address pref| 000000d0 69 78 20 74 6f 20 74 68 65 20 6e 61 6d 65 20 6f |ix to the name o| 000000e0 66 20 74 68 65 0a 6f 72 67 61 6e 69 7a 61 74 69 |f the.organizati| 000000f0 6f 6e 20 74 68 61 74 20 6f 77 6e 73 20 74 68 65 |on that owns the| 00000100 20 72 69 67 68 74 73 20 74 6f 20 75 73 65 20 69 | rights to use i| 00000110 74 2e 20 20 57 65 20 6d 61 70 20 69 74 20 74 6f |t. We map it to| 00000120 20 61 20 68 69 64 64 65 6e 0a 76 61 72 69 61 62 | a hidden.variab| 00000130 6c 65 20 73 6f 20 69 74 20 77 6f 6e 26 23 33 39 |le so it won'| 00000140 3b 74 20 73 68 6f 77 20 75 70 20 69 6e 20 67 6f |;t show up in go| 00000150 64 6f 63 2c 20 73 69 6e 63 65 20 69 74 26 23 33 |doc, since it| 00000160 39 3b 73 20 61 20 76 65 72 79 20 6c 61 72 67 65 |9;s a very large| 00000170 20 6d 61 70 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 0a | map..

......| 00000180 09 09 0a 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 |................| 00000190 0a 09 09 09 3c 68 32 20 69 64 3d 22 41 70 70 6c |....

ty| 000001b0 70 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |pe Appli| 00000200 63 61 74 69 6f 6e 4c 61 79 65 72 3c 2f 61 3e 3c |cationLayer<| 00000210 2f 68 32 3e 0a 09 09 09 3c 70 72 65 3e 74 79 70 |/h2>....
typ|
        00000220  65 20 41 70 70 6c 69 63  61 74 69 6f 6e 4c 61 79  |e ApplicationLay|
        00000230  65 72 20 69 6e 74 65 72  66 61 63 65 20 7b 0a 20  |er interface {. |
        00000240  20 20 20 4c 61 79 65 72  0a 20 20 20 20 50 61 79  |   Layer.    Pay|
        00000250  6c 6f 61 64 28 29 20 5b  5d 62 79 74 65 0a 7d 3c  |load() []byte.}<|
        00000260  2f 70 72 65 3e 0a 09 09  09 3c 70 3e 0a 41 70 70  |/pre>....

.App| 00000270 6c 69 63 61 74 69 6f 6e 4c 61 79 65 72 20 69 73 |licationLayer is| 00000280 20 74 68 65 20 70 61 63 6b 65 74 20 6c 61 79 65 | the packet laye| 00000290 72 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 |r corresponding | 000002a0 74 6f 20 74 68 65 20 54 43 50 2f 49 50 20 6c 61 |to the TCP/IP la| 000002b0 79 65 72 20 34 20 28 4f 53 49 0a 6c 61 79 65 72 |yer 4 (OSI.layer| 000002c0 20 37 29 2c 20 61 6c 73 6f 20 6b 6e 6f 77 6e 20 | 7), also known | 000002d0 61 73 20 74 68 65 20 70 61 63 6b 65 74 20 70 61 |as the packet pa| 000002e0 79 6c 6f 61 64 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 |yload..

.....| 000002f0 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 |................| 00000300 0a 0a 09 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 |................| 00000310 0a 09 09 09 3c 68 32 20 69 64 3d 22 43 61 70 74 |....

type CaptureInfo| 00000380 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 |

....type CaptureIn| 000003a0 66 6f 20 73 74 72 75 63 74 20 7b 0a 20 20 20 20 |fo struct {. | 000003b0 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 63 6f 6d |// Populat| 000003d0 65 64 20 69 73 20 73 65 74 20 74 6f 20 74 72 75 |ed is set to tru| 000003e0 65 20 69 66 20 74 68 65 20 72 65 73 74 20 6f 66 |e if the rest of| 000003f0 20 74 68 65 20 43 61 70 74 75 72 65 49 6e 66 6f | the CaptureInfo| 00000400 20 68 61 73 20 62 65 65 6e 20 70 6f 70 75 6c 61 | has been popula| 00000410 74 65 64 3c 2f 73 70 61 6e 3e 0a 20 20 20 20 3c |ted. <| 00000420 73 70 61 6e 20 63 6c 61 73 73 3d 22 63 6f 6d 6d |span class="comm| 00000430 65 6e 74 22 3e 2f 2f 20 77 69 74 68 20 61 63 74 |ent">// with act| 00000440 75 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2e |ual information.| 00000450 20 20 49 66 20 50 6f 70 75 6c 61 74 65 64 20 69 | If Populated i| 00000460 73 20 66 61 6c 73 65 2c 20 74 68 65 72 65 26 23 |s false, there&#| 00000470 33 39 3b 73 20 6e 6f 20 70 6f 69 6e 74 20 69 6e |39;s no point in| 00000480 3c 2f 73 70 61 6e 3e 0a 20 20 20 20 3c 73 70 61 |. // reading any| 000004b0 20 6f 66 20 74 68 65 20 6f 74 68 65 72 20 66 69 | of the other fi| 000004c0 65 6c 64 73 2e 3c 2f 73 70 61 6e 3e 0a 20 20 20 |elds.. | 000004d0 20 50 6f 70 75 6c 61 74 65 64 20 20 20 20 20 20 | Populated | 000004e0 20 20 20 20 20 20 20 62 6f 6f 6c 0a 20 20 20 20 | bool. | 000004f0 54 69 6d 65 73 74 61 6d 70 20 20 20 20 20 20 20 |Timestamp | 00000500 20 20 20 20 20 20 74 69 6d 65 2e 54 69 6d 65 0a | time.Time.| 00000510 20 20 20 20 43 61 70 74 75 72 65 4c 65 6e 67 74 | CaptureLengt| 00000520 68 2c 20 4c 65 6e 67 74 68 20 69 6e 74 0a 7d 3c |h, Length int.}<| 00000530 2f 70 72 65 3e 0a 09 09 09 3c 70 3e 0a 43 61 70 |/pre>....

.Cap| 00000540 74 75 72 65 49 6e 66 6f 20 63 6f 6e 74 61 69 6e |tureInfo contain| 00000550 73 20 63 61 70 74 75 72 65 20 6d 65 74 61 64 61 |s capture metada| 00000560 74 61 20 66 6f 72 20 61 20 70 61 63 6b 65 74 2e |ta for a packet.| 00000570 20 20 49 66 20 61 20 70 61 63 6b 65 74 20 77 61 | If a packet wa| 00000580 73 20 63 61 70 74 75 72 65 64 0a 6f 66 66 20 74 |s captured.off t| 00000590 68 65 20 77 69 72 65 20 6f 72 20 72 65 61 64 20 |he wire or read | 000005a0 66 72 6f 6d 20 61 20 70 63 61 70 20 66 69 6c 65 |from a pcap file| 000005b0 20 28 73 65 65 20 74 68 65 20 26 23 33 39 3b 70 | (see the 'p| 000005c0 63 61 70 26 23 33 39 3b 20 73 75 62 64 69 72 65 |cap' subdire| 000005d0 63 74 6f 72 79 29 2c 20 74 68 69 73 0a 69 6e 66 |ctory), this.inf| 000005e0 6f 72 6d 61 74 69 6f 6e 20 77 69 6c 6c 20 62 65 |ormation will be| 000005f0 20 61 74 74 61 63 68 65 64 20 74 6f 20 74 68 65 | attached to the| 00000600 20 70 61 63 6b 65 74 2e 0a 3c 2f 70 3e 0a 0a 0a | packet..

...| 00000610 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 |................| 00000620 09 09 0a 0a 09 09 09 0a 09 09 0a 09 09 09 0a 09 |................| 00000630 09 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 44 65 |......

typ| 00000650 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f |e Deco| 000006a0 64 65 46 61 69 6c 75 72 65 3c 2f 61 3e 3c 2f 68 |deFailure....
type |
        000006c0  44 65 63 6f 64 65 46 61  69 6c 75 72 65 20 73 74  |DecodeFailure st|
        000006d0  72 75 63 74 20 7b 0a 20  20 20 20 3c 73 70 61 6e  |ruct {.    // contains fil|
        00000700  74 65 72 65 64 20 6f 72  20 75 6e 65 78 70 6f 72  |tered or unexpor|
        00000710  74 65 64 20 66 69 65 6c  64 73 3c 2f 73 70 61 6e  |ted fields.}
....

| 00000730 0a 44 65 63 6f 64 65 46 61 69 6c 75 72 65 20 69 |.DecodeFailure i| 00000740 73 20 61 20 70 61 63 6b 65 74 20 6c 61 79 65 72 |s a packet layer| 00000750 20 63 72 65 61 74 65 64 20 69 66 20 64 65 63 6f | created if deco| 00000760 64 69 6e 67 20 6f 66 20 74 68 65 20 70 61 63 6b |ding of the pack| 00000770 65 74 20 64 61 74 61 20 66 61 69 6c 65 64 0a 66 |et data failed.f| 00000780 6f 72 20 73 6f 6d 65 20 72 65 61 73 6f 6e 2e 20 |or some reason. | 00000790 20 49 74 20 69 6d 70 6c 65 6d 65 6e 74 73 20 45 | It implements E| 000007a0 72 72 6f 72 4c 61 79 65 72 2e 20 20 4c 61 79 65 |rrorLayer. Laye| 000007b0 72 43 6f 6e 74 65 6e 74 73 20 77 69 6c 6c 20 62 |rContents will b| 000007c0 65 20 74 68 65 20 65 6e 74 69 72 65 0a 73 65 74 |e the entire.set| 000007d0 20 6f 66 20 62 79 74 65 73 20 74 68 61 74 20 66 | of bytes that f| 000007e0 61 69 6c 65 64 20 74 6f 20 70 61 72 73 65 2c 20 |ailed to parse, | 000007f0 61 6e 64 20 45 72 72 6f 72 20 77 69 6c 6c 20 72 |and Error will r| 00000800 65 74 75 72 6e 20 74 68 65 20 72 65 61 73 6f 6e |eturn the reason| 00000810 20 70 61 72 73 69 6e 67 0a 66 61 69 6c 65 64 2e | parsing.failed.| 00000820 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 09 |.

...........| 00000830 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a |................| 00000840 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d |.........

func (*Dec| 00000870 6f 64 65 46 61 69 6c 75 72 65 29 20 3c 61 20 68 |odeFailure) Error<| 000008d0 2f 68 33 3e 0a 09 09 09 09 3c 70 72 65 3e 66 75 |/h3>.....
fu|
        000008e0  6e 63 20 28 64 20 2a 44  65 63 6f 64 65 46 61 69  |nc (d *DecodeFai|
        000008f0  6c 75 72 65 29 20 45 72  72 6f 72 28 29 20 65 72  |lure) Error() er|
        00000900  72 6f 72 3c 2f 70 72 65  3e 0a 09 09 09 09 3c 70  |ror
......Error returns | 00000920 74 68 65 20 65 72 72 6f 72 20 65 6e 63 6f 75 6e |the error encoun| 00000930 74 65 72 65 64 20 64 75 72 69 6e 67 20 64 65 63 |tered during dec| 00000940 6f 64 69 6e 67 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 |oding..

.....| 00000950 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a |................| 00000960 09 09 09 09 3c 68 33 20 69 64 3d 22 44 65 63 6f |....

func (*| 00000990 44 65 63 6f 64 65 46 61 69 6c 75 72 65 29 20 3c |DecodeFailure) <| 000009a0 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b 67 |a href="/src/pkg| 000009b0 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 67 63 6f 6e |/github.com/gcon| 000009c0 6e 65 6c 6c 2f 67 6f 70 61 63 6b 65 74 2f 64 65 |nell/gopacket/de| 000009d0 63 6f 64 65 2e 67 6f 3f 73 3d 33 35 30 33 3a 33 |code.go?s=3503:3| 000009e0 35 34 39 23 4c 38 30 22 3e 4c 61 79 65 72 43 6f |549#L80">LayerCo| 000009f0 6e 74 65 6e 74 73 3c 2f 61 3e 3c 2f 68 33 3e 0a |ntents

.| 00000a00 09 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 64 |....
func (d|
        00000a10  20 2a 44 65 63 6f 64 65  46 61 69 6c 75 72 65 29  | *DecodeFailure)|
        00000a20  20 4c 61 79 65 72 43 6f  6e 74 65 6e 74 73 28 29  | LayerContents()|
        00000a30  20 5b 5d 62 79 74 65 3c  2f 70 72 65 3e 0a 09 09  | []byte
...| 00000a40 09 09 0a 09 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00000a50 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 |..........

fu| 00000a80 6e 63 20 28 2a 44 65 63 6f 64 65 46 61 69 6c 75 |nc (*DecodeFailu| 00000a90 72 65 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 |re) La| 00000ae0 79 65 72 50 61 79 6c 6f 61 64 3c 2f 61 3e 3c 2f |yerPayload.....
fun|
        00000b00  63 20 28 64 20 2a 44 65  63 6f 64 65 46 61 69 6c  |c (d *DecodeFail|
        00000b10  75 72 65 29 20 4c 61 79  65 72 50 61 79 6c 6f 61  |ure) LayerPayloa|
        00000b20  64 28 29 20 5b 5d 62 79  74 65 3c 2f 70 72 65 3e  |d() []byte
| 00000b30 0a 09 09 09 09 0a 09 09 09 09 0a 09 09 09 09 0a |................| 00000b40 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 |.............fu| 00000b70 6e 63 20 28 2a 44 65 63 6f 64 65 46 61 69 6c 75 |nc (*DecodeFailu| 00000b80 72 65 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 |re) La| 00000bd0 79 65 72 54 79 70 65 3c 2f 61 3e 3c 2f 68 33 3e |yerType

| 00000be0 0a 09 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 |.....
func (|
        00000bf0  64 20 2a 44 65 63 6f 64  65 46 61 69 6c 75 72 65  |d *DecodeFailure|
        00000c00  29 20 4c 61 79 65 72 54  79 70 65 28 29 20 4c 61  |) LayerType() La|
        00000c10  79 65 72 54 79 70 65 3c  2f 70 72 65 3e 0a 09 09  |yerType
...| 00000c20 09 09 3c 70 3e 0a 4c 61 79 65 72 54 79 70 65 20 |..

.LayerType | 00000c30 72 65 74 75 72 6e 73 20 4c 61 79 65 72 54 79 70 |returns LayerTyp| 00000c40 65 44 65 63 6f 64 65 46 61 69 6c 75 72 65 0a 3c |eDecodeFailure.<| 00000c50 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 09 09 0a 09 |/p>.............| 00000c60 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 |............

func (| 00000c90 2a 44 65 63 6f 64 65 46 61 69 6c 75 72 65 29 20 |*DecodeFailure) | 00000ca0 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b |String| 00000cf0 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 |

.....func (d *Deco| 00000d10 64 65 46 61 69 6c 75 72 65 29 20 53 74 72 69 6e |deFailure) Strin| 00000d20 67 28 29 20 73 74 72 69 6e 67 3c 2f 70 72 65 3e |g() string

| 00000d30 0a 09 09 09 09 0a 09 09 09 09 0a 09 09 09 09 0a |................| 00000d40 09 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 |................| 00000d50 09 09 3c 68 32 20 69 64 3d 22 44 65 63 6f 64 65 |..

type DecodeFunc<| 00000dc0 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 65 |/a>

....type DecodeFunc| 00000de0 20 66 75 6e 63 28 5b 5d 62 79 74 65 2c 20 50 61 | func([]byte, Pa| 00000df0 63 6b 65 74 42 75 69 6c 64 65 72 29 20 65 72 72 |cketBuilder) err| 00000e00 6f 72 3c 2f 70 72 65 3e 0a 09 09 09 3c 70 3e 0a |or
....

.| 00000e10 44 65 63 6f 64 65 46 75 6e 63 20 77 72 61 70 73 |DecodeFunc wraps| 00000e20 20 61 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 6d | a function to m| 00000e30 61 6b 65 20 69 74 20 61 20 44 65 63 6f 64 65 72 |ake it a Decoder| 00000e40 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 |..

..........| 00000e50 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 |................| 00000e60 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 |..........

func (Decod| 00000e90 65 46 75 6e 63 29 20 3c 61 20 68 72 65 66 3d 22 |eFunc) Decode

| 00000ef0 0a 09 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 |.....
func (|
        00000f00  64 20 44 65 63 6f 64 65  46 75 6e 63 29 20 44 65  |d DecodeFunc) De|
        00000f10  63 6f 64 65 28 64 61 74  61 20 5b 5d 62 79 74 65  |code(data []byte|
        00000f20  2c 20 70 20 50 61 63 6b  65 74 42 75 69 6c 64 65  |, p PacketBuilde|
        00000f30  72 29 20 65 72 72 6f 72  3c 2f 70 72 65 3e 0a 09  |r) error
..| 00000f40 09 09 09 0a 09 09 09 09 0a 09 09 09 09 0a 09 09 |................| 00000f50 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 |................| 00000f60 3c 68 32 20 69 64 3d 22 44 65 63 6f 64 65 4f 70 |

type DecodeOpt| 00000fd0 69 6f 6e 73 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 |ions

...| 00000fe0 09 3c 70 72 65 3e 74 79 70 65 20 44 65 63 6f 64 |.
type Decod|
        00000ff0  65 4f 70 74 69 6f 6e 73  20 73 74 72 75 63 74 20  |eOptions struct |
        00001000  7b 0a 20 20 20 20 3c 73  70 61 6e 20 63 6c 61 73  |{.    // L|
        00001020  61 7a 79 20 64 65 63 6f  64 69 6e 67 20 64 65 63  |azy decoding dec|
        00001030  6f 64 65 73 20 74 68 65  20 6d 69 6e 69 6d 75 6d  |odes the minimum|
        00001040  20 6e 75 6d 62 65 72 20  6f 66 20 6c 61 79 65 72  | number of layer|
        00001050  73 20 6e 65 65 64 65 64  20 74 6f 20 72 65 74 75  |s needed to retu|
        00001060  72 6e 20 64 61 74 61 3c  2f 73 70 61 6e 3e 0a 20  |rn data. |
        00001070  20 20 20 3c 73 70 61 6e  20 63 6c 61 73 73 3d 22  |   // for |
        00001090  61 20 70 61 63 6b 65 74  20 61 74 20 65 61 63 68  |a packet at each|
        000010a0  20 66 75 6e 63 74 69 6f  6e 20 63 61 6c 6c 2e 20  | function call. |
        000010b0  20 42 65 20 63 61 72 65  66 75 6c 20 75 73 69 6e  | Be careful usin|
        000010c0  67 20 74 68 69 73 20 77  69 74 68 20 63 6f 6e 63  |g this with conc|
        000010d0  75 72 72 65 6e 74 3c 2f  73 70 61 6e 3e 0a 20 20  |urrent.  |
        000010e0  20 20 3c 73 70 61 6e 20  63 6c 61 73 73 3d 22 63  |  // packe|
        00001100  74 20 70 72 6f 63 65 73  73 6f 72 73 2c 20 61 73  |t processors, as|
        00001110  20 65 61 63 68 20 63 61  6c 6c 20 74 6f 20 70 61  | each call to pa|
        00001120  63 6b 65 74 2e 2a 20 63  6f 75 6c 64 20 6d 75 74  |cket.* could mut|
        00001130  61 74 65 20 74 68 65 20  70 61 63 6b 65 74 2c 20  |ate the packet, |
        00001140  61 6e 64 3c 2f 73 70 61  6e 3e 0a 20 20 20 20 3c  |and.    <|
        00001150  73 70 61 6e 20 63 6c 61  73 73 3d 22 63 6f 6d 6d  |span class="comm|
        00001160  65 6e 74 22 3e 2f 2f 20  74 77 6f 20 63 6f 6e 63  |ent">// two conc|
        00001170  75 72 72 65 6e 74 20 66  75 6e 63 74 69 6f 6e 20  |urrent function |
        00001180  63 61 6c 6c 73 20 63 6f  75 6c 64 20 69 6e 74 65  |calls could inte|
        00001190  72 61 63 74 20 70 6f 6f  72 6c 79 2e 3c 2f 73 70  |ract poorly..    Lazy boo|
        000011b0  6c 0a 20 20 20 20 3c 73  70 61 6e 20 63 6c 61 73  |l.    // N|
        000011d0  6f 43 6f 70 79 20 64 65  63 6f 64 69 6e 67 20 64  |oCopy decoding d|
        000011e0  6f 65 73 6e 26 23 33 39  3b 74 20 63 6f 70 79 20  |oesn't copy |
        000011f0  69 74 73 20 69 6e 70 75  74 20 62 75 66 66 65 72  |its input buffer|
        00001200  20 69 6e 74 6f 20 73 74  6f 72 61 67 65 20 74 68  | into storage th|
        00001210  61 74 26 23 33 39 3b 73  20 6f 77 6e 65 64 20 62  |at's owned b|
        00001220  79 3c 2f 73 70 61 6e 3e  0a 20 20 20 20 3c 73 70  |y.    // the packet|
        00001250  2e 20 20 49 66 20 79 6f  75 20 63 61 6e 20 67 75  |.  If you can gu|
        00001260  61 72 61 6e 74 65 65 20  74 68 61 74 20 74 68 65  |arantee that the|
        00001270  20 62 79 74 65 73 20 75  6e 64 65 72 6c 79 69 6e  | bytes underlyin|
        00001280  67 20 74 68 65 20 73 6c  69 63 65 3c 2f 73 70 61  |g the slice.    // |
        000012b0  70 61 73 73 65 64 20 69  6e 74 6f 20 4e 65 77 50  |passed into NewP|
        000012c0  61 63 6b 65 74 20 61 72  65 6e 26 23 33 39 3b 74  |acket aren't|
        000012d0  20 67 6f 69 6e 67 20 74  6f 20 62 65 20 6d 6f 64  | going to be mod|
        000012e0  69 66 69 65 64 2c 20 74  68 69 73 20 63 61 6e 20  |ified, this can |
        000012f0  62 65 20 66 61 73 74 65  72 2e 20 20 49 66 3c 2f  |be faster.  If.    |
        00001320  2f 2f 20 74 68 65 72 65  26 23 33 39 3b 73 20 61  |// there's a|
        00001330  6e 79 20 63 68 61 6e 63  65 20 74 68 61 74 20 74  |ny chance that t|
        00001340  68 6f 73 65 20 62 79 74  65 73 20 57 49 4c 4c 20  |hose bytes WILL |
        00001350  62 65 20 63 68 61 6e 67  65 64 2c 20 74 68 69 73  |be changed, this|
        00001360  20 77 69 6c 6c 20 69 6e  76 61 6c 69 64 61 74 65  | will invalidate|
        00001370  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 3c 73 70 61  |.    // your packet|
        000013a0  73 2e 3c 2f 73 70 61 6e  3e 0a 20 20 20 20 4e 6f  |s..    No|
        000013b0  43 6f 70 79 20 62 6f 6f  6c 0a 7d 3c 2f 70 72 65  |Copy bool.}....

.DecodeO| 000013d0 70 74 69 6f 6e 73 20 74 65 6c 6c 73 20 67 6f 70 |ptions tells gop| 000013e0 61 63 6b 65 74 20 68 6f 77 20 74 6f 20 64 65 63 |acket how to dec| 000013f0 6f 64 65 20 61 20 70 61 63 6b 65 74 2e 0a 3c 2f |ode a packet................| 00001410 09 09 3c 70 72 65 3e 76 61 72 20 44 65 66 61 75 |..

var Defau|
        00001420  6c 74 20 44 65 63 6f 64  65 4f 70 74 69 6f 6e 73  |lt DecodeOptions|
        00001430  20 3d 20 44 65 63 6f 64  65 4f 70 74 69 6f 6e 73  | = DecodeOptions|
        00001440  7b 7d 3c 2f 70 72 65 3e  0a 09 09 09 09 3c 70 3e  |{}
.....

| 00001450 0a 44 65 66 61 75 6c 74 20 64 65 63 6f 64 69 6e |.Default decodin| 00001460 67 20 70 72 6f 76 69 64 65 73 20 74 68 65 20 73 |g provides the s| 00001470 61 66 65 73 74 20 28 62 75 74 20 73 6c 6f 77 65 |afest (but slowe| 00001480 73 74 29 20 6d 65 74 68 6f 64 20 66 6f 72 20 64 |st) method for d| 00001490 65 63 6f 64 69 6e 67 0a 70 61 63 6b 65 74 73 2e |ecoding.packets.| 000014a0 20 20 49 74 20 65 61 67 65 72 6c 79 20 70 72 6f | It eagerly pro| 000014b0 63 65 73 73 65 73 20 61 6c 6c 20 6c 61 79 65 72 |cesses all layer| 000014c0 73 20 28 73 6f 20 69 74 26 23 33 39 3b 73 20 63 |s (so it's c| 000014d0 6f 6e 63 75 72 72 65 6e 63 79 2d 73 61 66 65 29 |oncurrency-safe)| 000014e0 20 61 6e 64 20 69 74 0a 63 6f 70 69 65 73 20 69 | and it.copies i| 000014f0 74 73 20 69 6e 70 75 74 20 62 75 66 66 65 72 20 |ts input buffer | 00001500 75 70 6f 6e 20 63 72 65 61 74 69 6f 6e 20 6f 66 |upon creation of| 00001510 20 74 68 65 20 70 61 63 6b 65 74 20 28 73 6f 20 | the packet (so | 00001520 74 68 65 20 70 61 63 6b 65 74 20 72 65 6d 61 69 |the packet remai| 00001530 6e 73 0a 76 61 6c 69 64 20 69 66 20 74 68 65 20 |ns.valid if the | 00001540 75 6e 64 65 72 6c 79 69 6e 67 20 73 6c 69 63 65 |underlying slice| 00001550 20 69 73 20 6d 6f 64 69 66 69 65 64 2e 20 20 42 | is modified. B| 00001560 6f 74 68 20 6f 66 20 74 68 65 73 65 20 74 61 6b |oth of these tak| 00001570 65 20 74 69 6d 65 2c 0a 74 68 6f 75 67 68 2c 20 |e time,.though, | 00001580 73 6f 20 62 65 77 61 72 65 2e 20 20 49 66 20 79 |so beware. If y| 00001590 6f 75 20 63 61 6e 20 67 75 61 72 61 6e 74 65 65 |ou can guarantee| 000015a0 20 74 68 61 74 20 74 68 65 20 70 61 63 6b 65 74 | that the packet| 000015b0 20 77 69 6c 6c 20 6f 6e 6c 79 20 62 65 20 75 73 | will only be us| 000015c0 65 64 0a 62 79 20 6f 6e 65 20 67 6f 72 6f 75 74 |ed.by one gorout| 000015d0 69 6e 65 20 61 74 20 61 20 74 69 6d 65 2c 20 73 |ine at a time, s| 000015e0 65 74 20 4c 61 7a 79 20 64 65 63 6f 64 69 6e 67 |et Lazy decoding| 000015f0 2e 20 20 49 66 20 79 6f 75 20 63 61 6e 20 67 75 |. If you can gu| 00001600 61 72 61 6e 74 65 65 20 74 68 61 74 0a 74 68 65 |arantee that.the| 00001610 20 75 6e 64 65 72 6c 79 69 6e 67 20 73 6c 69 63 | underlying slic| 00001620 65 20 77 6f 6e 26 23 33 39 3b 74 20 63 68 61 6e |e won't chan| 00001630 67 65 2c 20 73 65 74 20 4e 6f 43 6f 70 79 20 64 |ge, set NoCopy d| 00001640 65 63 6f 64 69 6e 67 2e 0a 3c 2f 70 3e 0a 0a 09 |ecoding..

...| 00001650 09 09 0a 09 09 09 09 3c 70 72 65 3e 76 61 72 20 |.......
var |
        00001660  4c 61 7a 79 20 44 65 63  6f 64 65 4f 70 74 69 6f  |Lazy DecodeOptio|
        00001670  6e 73 20 3d 20 44 65 63  6f 64 65 4f 70 74 69 6f  |ns = DecodeOptio|
        00001680  6e 73 7b 4c 61 7a 79 3a  20 74 72 75 65 7d 3c 2f  |ns{Lazy: true}.....

.Laz| 000016a0 79 20 69 73 20 61 20 44 65 63 6f 64 65 4f 70 74 |y is a DecodeOpt| 000016b0 69 6f 6e 73 20 77 69 74 68 20 6a 75 73 74 20 4c |ions with just L| 000016c0 61 7a 79 20 73 65 74 2e 0a 3c 2f 70 3e 0a 0a 09 |azy set..

...| 000016d0 09 09 0a 09 09 09 09 3c 70 72 65 3e 76 61 72 20 |.......
var |
        000016e0  4e 6f 43 6f 70 79 20 44  65 63 6f 64 65 4f 70 74  |NoCopy DecodeOpt|
        000016f0  69 6f 6e 73 20 3d 20 44  65 63 6f 64 65 4f 70 74  |ions = DecodeOpt|
        00001700  69 6f 6e 73 7b 4e 6f 43  6f 70 79 3a 20 74 72 75  |ions{NoCopy: tru|
        00001710  65 7d 3c 2f 70 72 65 3e  0a 09 09 09 09 3c 70 3e  |e}
.....

| 00001720 0a 4e 6f 43 6f 70 79 20 69 73 20 61 20 44 65 63 |.NoCopy is a Dec| 00001730 6f 64 65 4f 70 74 69 6f 6e 73 20 77 69 74 68 20 |odeOptions with | 00001740 6a 75 73 74 20 4e 6f 43 6f 70 79 20 73 65 74 2e |just NoCopy set.| 00001750 0a 3c 2f 70 3e 0a 0a 09 09 09 0a 0a 09 09 09 0a |.

...........| 00001760 0a 09 09 09 0a 0a 09 09 09 0a 09 09 0a 09 09 09 |................| 00001770 0a 09 09 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 |........

type Decoder<| 000017e0 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 65 |/a>

....type Decoder in| 00001800 74 65 72 66 61 63 65 20 7b 0a 20 20 20 20 3c 73 |terface {. // Decode de| 00001830 63 6f 64 65 73 20 74 68 65 20 62 79 74 65 73 20 |codes the bytes | 00001840 6f 66 20 61 20 70 61 63 6b 65 74 2c 20 73 65 6e |of a packet, sen| 00001850 64 69 6e 67 20 64 65 63 6f 64 65 64 20 76 61 6c |ding decoded val| 00001860 75 65 73 20 61 6e 64 20 6f 74 68 65 72 3c 2f 73 |ues and other. /| 00001890 2f 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 74 6f |/ information to| 000018a0 20 50 61 63 6b 65 74 42 75 69 6c 64 65 72 2c 20 | PacketBuilder, | 000018b0 61 6e 64 20 72 65 74 75 72 6e 69 6e 67 20 61 6e |and returning an| 000018c0 20 65 72 72 6f 72 20 69 66 20 75 6e 73 75 63 63 | error if unsucc| 000018d0 65 73 73 66 75 6c 2e 20 20 53 65 65 3c 2f 73 70 |essful. See. //| 00001900 20 74 68 65 20 50 61 63 6b 65 74 42 75 69 6c 64 | the PacketBuild| 00001910 65 72 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e |er documentation| 00001920 20 66 6f 72 20 6d 6f 72 65 20 64 65 74 61 69 6c | for more detail| 00001930 73 2e 3c 2f 73 70 61 6e 3e 0a 20 20 20 20 44 65 |s.. De| 00001940 63 6f 64 65 28 5b 5d 62 79 74 65 2c 20 50 61 63 |code([]byte, Pac| 00001950 6b 65 74 42 75 69 6c 64 65 72 29 20 65 72 72 6f |ketBuilder) erro| 00001960 72 0a 7d 3c 2f 70 72 65 3e 0a 09 09 09 3c 70 3e |r.}
....

| 00001970 0a 44 65 63 6f 64 65 72 20 69 73 20 61 6e 20 69 |.Decoder is an i| 00001980 6e 74 65 72 66 61 63 65 20 66 6f 72 20 6c 6f 67 |nterface for log| 00001990 69 63 20 74 6f 20 64 65 63 6f 64 65 20 61 20 70 |ic to decode a p| 000019a0 61 63 6b 65 74 20 6c 61 79 65 72 2e 20 20 55 73 |acket layer. Us| 000019b0 65 72 73 20 6d 61 79 0a 69 6d 70 6c 65 6d 65 6e |ers may.implemen| 000019c0 74 20 61 20 44 65 63 6f 64 65 72 20 74 6f 20 68 |t a Decoder to h| 000019d0 61 6e 64 6c 65 20 74 68 65 69 72 20 6f 77 6e 20 |andle their own | 000019e0 73 74 72 61 6e 67 65 20 70 61 63 6b 65 74 20 74 |strange packet t| 000019f0 79 70 65 73 2c 20 6f 72 20 6d 61 79 20 75 73 65 |ypes, or may use| 00001a00 20 6f 6e 65 0a 6f 66 20 74 68 65 20 6d 61 6e 79 | one.of the many| 00001a10 20 64 65 63 6f 64 65 72 73 20 61 76 61 69 6c 61 | decoders availa| 00001a20 62 6c 65 20 69 6e 20 74 68 65 20 26 23 33 39 3b |ble in the '| 00001a30 6c 61 79 65 72 73 26 23 33 39 3b 20 73 75 62 70 |layers' subp| 00001a40 61 63 6b 61 67 65 20 74 6f 20 64 65 63 6f 64 65 |ackage to decode| 00001a50 20 74 68 69 6e 67 73 0a 66 6f 72 20 74 68 65 6d | things.for them| 00001a60 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 |..

..........| 00001a70 09 0a 09 09 09 09 3c 70 72 65 3e 76 61 72 20 44 |......
var D|
        00001a80  65 63 6f 64 65 50 61 79  6c 6f 61 64 20 44 65 63  |ecodePayload Dec|
        00001a90  6f 64 65 72 20 3d 20 44  65 63 6f 64 65 46 75 6e  |oder = DecodeFun|
        00001aa0  63 28 64 65 63 6f 64 65  50 61 79 6c 6f 61 64 29  |c(decodePayload)|
        00001ab0  3c 2f 70 72 65 3e 0a 09  09 09 09 3c 70 3e 0a 44  |
.....

.D| 00001ac0 65 63 6f 64 65 50 61 79 6c 6f 61 64 20 69 73 20 |ecodePayload is | 00001ad0 61 20 44 65 63 6f 64 65 72 20 74 68 61 74 20 72 |a Decoder that r| 00001ae0 65 74 75 72 6e 73 20 61 20 50 61 79 6c 6f 61 64 |eturns a Payload| 00001af0 20 6c 61 79 65 72 20 63 6f 6e 74 61 69 6e 69 6e | layer containin| 00001b00 67 20 61 6c 6c 0a 72 65 6d 61 69 6e 69 6e 67 20 |g all.remaining | 00001b10 62 79 74 65 73 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 |bytes..

.....| 00001b20 0a 09 09 09 09 3c 70 72 65 3e 76 61 72 20 44 65 |.....
var De|
        00001b30  63 6f 64 65 55 6e 6b 6e  6f 77 6e 20 44 65 63 6f  |codeUnknown Deco|
        00001b40  64 65 72 20 3d 20 44 65  63 6f 64 65 46 75 6e 63  |der = DecodeFunc|
        00001b50  28 64 65 63 6f 64 65 55  6e 6b 6e 6f 77 6e 29 3c  |(decodeUnknown)<|
        00001b60  2f 70 72 65 3e 0a 09 09  09 09 3c 70 3e 0a 44 65  |/pre>.....

.De| 00001b70 63 6f 64 65 55 6e 6b 6e 6f 77 6e 20 69 73 20 61 |codeUnknown is a| 00001b80 20 44 65 63 6f 64 65 72 20 74 68 61 74 20 72 65 | Decoder that re| 00001b90 74 75 72 6e 73 20 61 20 44 65 63 6f 64 65 46 61 |turns a DecodeFa| 00001ba0 69 6c 75 72 65 20 6c 61 79 65 72 20 63 6f 6e 74 |ilure layer cont| 00001bb0 61 69 6e 69 6e 67 20 61 6c 6c 0a 72 65 6d 61 69 |aining all.remai| 00001bc0 6e 69 6e 67 20 62 79 74 65 73 2c 20 75 73 65 66 |ning bytes, usef| 00001bd0 75 6c 20 69 66 20 79 6f 75 20 72 75 6e 20 75 70 |ul if you run up| 00001be0 20 61 67 61 69 6e 73 74 20 61 20 6c 61 79 65 72 | against a layer| 00001bf0 20 74 68 61 74 20 79 6f 75 26 23 33 39 3b 72 65 | that you're| 00001c00 20 75 6e 61 62 6c 65 20 74 6f 0a 64 65 63 6f 64 | unable to.decod| 00001c10 65 20 79 65 74 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 |e yet..

.....| 00001c20 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a |................| 00001c30 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 3c 68 |..............| 00001c50 74 79 70 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 |type Endpo| 00001ca0 69 6e 74 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 |int

....| 00001cb0 3c 70 72 65 3e 74 79 70 65 20 45 6e 64 70 6f 69 |
type Endpoi|
        00001cc0  6e 74 20 73 74 72 75 63  74 20 7b 0a 20 20 20 20  |nt struct {.    |
        00001cd0  3c 73 70 61 6e 20 63 6c  61 73 73 3d 22 63 6f 6d  |// contain|
        00001cf0  73 20 66 69 6c 74 65 72  65 64 20 6f 72 20 75 6e  |s filtered or un|
        00001d00  65 78 70 6f 72 74 65 64  20 66 69 65 6c 64 73 3c  |exported fields<|
        00001d10  2f 73 70 61 6e 3e 0a 7d  3c 2f 70 72 65 3e 0a 09  |/span>.}
..| 00001d20 09 09 3c 70 3e 0a 45 6e 64 70 6f 69 6e 74 20 69 |..

.Endpoint i| 00001d30 73 20 74 68 65 20 73 65 74 20 6f 66 20 62 79 74 |s the set of byt| 00001d40 65 73 20 75 73 65 64 20 74 6f 20 61 64 64 72 65 |es used to addre| 00001d50 73 73 20 70 61 63 6b 65 74 73 20 61 74 20 76 61 |ss packets at va| 00001d60 72 69 6f 75 73 20 6c 61 79 65 72 73 2e 0a 53 65 |rious layers..Se| 00001d70 65 20 4c 69 6e 6b 4c 61 79 65 72 2c 20 4e 65 74 |e LinkLayer, Net| 00001d80 77 6f 72 6b 4c 61 79 65 72 2c 20 61 6e 64 20 54 |workLayer, and T| 00001d90 72 61 6e 73 70 6f 72 74 4c 61 79 65 72 20 73 70 |ransportLayer sp| 00001da0 65 63 69 66 69 63 61 74 69 6f 6e 73 2e 0a 45 6e |ecifications..En| 00001db0 64 70 6f 69 6e 74 73 20 61 72 65 20 75 73 61 62 |dpoints are usab| 00001dc0 6c 65 20 61 73 20 6d 61 70 20 6b 65 79 73 2e 0a |le as map keys..| 00001dd0 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 09 0a |

............| 00001de0 0a 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 0a 09 |................| 00001df0 09 09 09 3c 68 33 20 69 64 3d 22 4e 65 77 45 6e |...

func NewEndpoin| 00001e60 74 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c |t

.....<| 00001e70 70 72 65 3e 66 75 6e 63 20 4e 65 77 45 6e 64 70 |pre>func NewEndp| 00001e80 6f 69 6e 74 28 74 79 70 20 45 6e 64 70 6f 69 6e |oint(typ Endpoin| 00001e90 74 54 79 70 65 2c 20 72 61 77 20 5b 5d 62 79 74 |tType, raw []byt| 00001ea0 65 29 20 45 6e 64 70 6f 69 6e 74 3c 2f 70 72 65 |e) Endpoint.....

.NewEnd| 00001ec0 70 6f 69 6e 74 20 63 72 65 61 74 65 73 20 61 20 |point creates a | 00001ed0 6e 65 77 20 45 6e 64 70 6f 69 6e 74 20 6f 62 6a |new Endpoint obj| 00001ee0 65 63 74 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a |ect..

.......| 00001ef0 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 0a 09 09 |................| 00001f00 09 09 3c 68 33 20 69 64 3d 22 45 6e 64 70 6f 69 |..

func (Endpoint)| 00001f30 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 | Endpoint| 00001f80 54 79 70 65 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 |Type

...| 00001f90 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 65 20 45 |..
func (e E|
        00001fa0  6e 64 70 6f 69 6e 74 29  20 45 6e 64 70 6f 69 6e  |ndpoint) Endpoin|
        00001fb0  74 54 79 70 65 28 29 20  45 6e 64 70 6f 69 6e 74  |tType() Endpoint|
        00001fc0  54 79 70 65 3c 2f 70 72  65 3e 0a 09 09 09 09 3c  |Type
.....<| 00001fd0 70 3e 0a 45 6e 64 70 6f 69 6e 74 54 79 70 65 20 |p>.EndpointType | 00001fe0 72 65 74 75 72 6e 73 20 74 68 65 20 65 6e 64 70 |returns the endp| 00001ff0 6f 69 6e 74 20 74 79 70 65 20 61 73 73 6f 63 69 |oint type associ| 00002000 61 74 65 64 20 77 69 74 68 20 74 68 69 73 20 65 |ated with this e| 00002010 6e 64 70 6f 69 6e 74 2e 0a 3c 2f 70 3e 0a 0a 09 |ndpoint..

...| 00002020 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 |................| 00002030 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 45 6e |......

func (Endpoint)| 00002060 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 | LessTh| 000020b0 61 6e 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 |an

.....| 000020c0 3c 70 72 65 3e 66 75 6e 63 20 28 61 20 45 6e 64 |
func (a End|
        000020d0  70 6f 69 6e 74 29 20 4c  65 73 73 54 68 61 6e 28  |point) LessThan(|
        000020e0  62 20 45 6e 64 70 6f 69  6e 74 29 20 62 6f 6f 6c  |b Endpoint) bool|
        000020f0  3c 2f 70 72 65 3e 0a 09  09 09 09 3c 70 3e 0a 4c  |
.....

.L| 00002100 65 73 73 54 68 61 6e 20 70 72 6f 76 69 64 65 73 |essThan provides| 00002110 20 61 20 73 74 61 62 6c 65 20 6f 72 64 65 72 69 | a stable orderi| 00002120 6e 67 20 66 6f 72 20 61 6c 6c 20 65 6e 64 70 6f |ng for all endpo| 00002130 69 6e 74 73 2e 20 20 49 74 20 73 6f 72 74 73 20 |ints. It sorts | 00002140 66 69 72 73 74 20 62 61 73 65 64 0a 6f 6e 20 74 |first based.on t| 00002150 68 65 20 45 6e 64 70 6f 69 6e 74 54 79 70 65 20 |he EndpointType | 00002160 6f 66 20 61 6e 20 65 6e 64 70 6f 69 6e 74 2c 20 |of an endpoint, | 00002170 74 68 65 6e 20 62 61 73 65 64 20 6f 6e 20 74 68 |then based on th| 00002180 65 20 72 61 77 20 62 79 74 65 73 20 6f 66 20 74 |e raw bytes of t| 00002190 68 61 74 20 65 6e 64 70 6f 69 6e 74 2e 0a 46 6f |hat endpoint..Fo| 000021a0 72 20 73 6f 6d 65 20 65 6e 64 70 6f 69 6e 74 73 |r some endpoints| 000021b0 2c 20 74 68 65 20 61 63 74 75 61 6c 20 63 6f 6d |, the actual com| 000021c0 70 61 72 69 73 6f 6e 20 6d 61 79 20 6e 6f 74 20 |parison may not | 000021d0 6d 61 6b 65 20 73 65 6e 73 65 2c 20 68 6f 77 65 |make sense, howe| 000021e0 76 65 72 20 74 68 69 73 0a 6f 72 64 65 72 69 6e |ver this.orderin| 000021f0 67 20 64 6f 65 73 20 70 72 6f 76 69 64 65 20 75 |g does provide u| 00002200 73 65 66 75 6c 20 69 6e 66 6f 72 6d 61 74 69 6f |seful informatio| 00002210 6e 20 66 6f 72 20 6d 6f 73 74 20 45 6e 64 70 6f |n for most Endpo| 00002220 69 6e 74 20 74 79 70 65 73 2e 0a 3c 2f 70 3e 0a |int types..

.| 00002230 0a 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 |................| 00002240 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 |........

fu| 00002260 6e 63 20 28 45 6e 64 70 6f 69 6e 74 29 20 3c 61 |nc (Endpoint) Raw.....
func |
        000022d0  28 65 20 45 6e 64 70 6f  69 6e 74 29 20 52 61 77  |(e Endpoint) Raw|
        000022e0  28 29 20 5b 5d 62 79 74  65 3c 2f 70 72 65 3e 0a  |() []byte
.| 000022f0 09 09 09 09 3c 70 3e 0a 52 61 77 20 72 65 74 75 |....

.Raw retu| 00002300 72 6e 73 20 74 68 65 20 72 61 77 20 62 79 74 65 |rns the raw byte| 00002310 73 20 6f 66 20 74 68 69 73 20 65 6e 64 70 6f 69 |s of this endpoi| 00002320 6e 74 2e 20 20 54 68 65 73 65 20 61 72 65 6e 26 |nt. These aren&| 00002330 23 33 39 3b 74 20 68 75 6d 61 6e 2d 72 65 61 64 |#39;t human-read| 00002340 61 62 6c 65 0a 6d 6f 73 74 20 6f 66 20 74 68 65 |able.most of the| 00002350 20 74 69 6d 65 2c 20 62 75 74 20 74 68 65 79 20 | time, but they | 00002360 61 72 65 20 66 61 73 74 65 72 20 74 68 61 6e 20 |are faster than | 00002370 63 61 6c 6c 69 6e 67 20 53 74 72 69 6e 67 2e 0a |calling String..| 00002380 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 09 09 0a |

............| 00002390 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 |.............func (Endp| 000023c0 6f 69 6e 74 29 20 3c 61 20 68 72 65 66 3d 22 2f |oint) S| 00002410 74 72 69 6e 67 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 |tring

..| 00002420 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 65 20 |...
func (e |
        00002430  45 6e 64 70 6f 69 6e 74  29 20 53 74 72 69 6e 67  |Endpoint) String|
        00002440  28 29 20 73 74 72 69 6e  67 3c 2f 70 72 65 3e 0a  |() string
.| 00002450 09 09 09 09 0a 09 09 09 09 0a 09 09 09 09 0a 09 |................| 00002460 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 |................| 00002470 09 3c 68 32 20 69 64 3d 22 45 6e 64 70 6f 69 6e |.

type EndpointTyp| 000024e0 65 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 |e

....type Endpoint| 00002500 54 79 70 65 20 69 6e 74 36 34 3c 2f 70 72 65 3e |Type int64| 00002510 0a 09 09 09 3c 70 3e 0a 45 6e 64 70 6f 69 6e 74 |....

.Endpoint| 00002520 54 79 70 65 20 69 73 20 74 68 65 20 74 79 70 65 |Type is the type| 00002530 20 6f 66 20 61 20 67 6f 70 61 63 6b 65 74 20 45 | of a gopacket E| 00002540 6e 64 70 6f 69 6e 74 2e 20 20 54 68 69 73 20 74 |ndpoint. This t| 00002550 79 70 65 20 64 65 74 65 72 6d 69 6e 65 73 20 68 |ype determines h| 00002560 6f 77 0a 74 68 65 20 62 79 74 65 73 20 73 74 6f |ow.the bytes sto| 00002570 72 65 64 20 69 6e 20 74 68 65 20 65 6e 64 70 6f |red in the endpo| 00002580 69 6e 74 20 73 68 6f 75 6c 64 20 62 65 20 69 6e |int should be in| 00002590 74 65 72 70 72 65 74 65 64 2e 0a 3c 2f 70 3e 0a |terpreted..

.| 000025a0 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a |................| 000025b0 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 |..............func| 000025e0 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 | Regist| 00002630 65 72 45 6e 64 70 6f 69 6e 74 54 79 70 65 3c 2f |erEndpointType.....func RegisterEn| 00002660 64 70 6f 69 6e 74 54 79 70 65 28 6e 75 6d 20 69 |dpointType(num i| 00002670 6e 74 2c 20 6d 65 74 61 20 45 6e 64 70 6f 69 6e |nt, meta Endpoin| 00002680 74 54 79 70 65 4d 65 74 61 64 61 74 61 29 20 45 |tTypeMetadata) E| 00002690 6e 64 70 6f 69 6e 74 54 79 70 65 3c 2f 70 72 65 |ndpointType.....

.Regist| 000026b0 65 72 45 6e 64 70 6f 69 6e 74 54 79 70 65 20 63 |erEndpointType c| 000026c0 72 65 61 74 65 73 20 61 20 6e 65 77 20 45 6e 64 |reates a new End| 000026d0 70 6f 69 6e 74 54 79 70 65 20 61 6e 64 20 72 65 |pointType and re| 000026e0 67 69 73 74 65 72 73 20 69 74 20 67 6c 6f 62 61 |gisters it globa| 000026f0 6c 6c 79 2e 0a 49 74 20 4d 55 53 54 20 62 65 20 |lly..It MUST be | 00002700 70 61 73 73 65 64 20 61 20 75 6e 69 71 75 65 20 |passed a unique | 00002710 6e 75 6d 62 65 72 2c 20 6f 72 20 69 74 20 77 69 |number, or it wi| 00002720 6c 6c 20 70 61 6e 69 63 2e 20 20 4e 75 6d 62 65 |ll panic. Numbe| 00002730 72 73 20 30 2d 39 39 39 20 61 72 65 0a 72 65 73 |rs 0-999 are.res| 00002740 65 72 76 65 64 20 66 6f 72 20 67 6f 70 61 63 6b |erved for gopack| 00002750 65 74 26 23 33 39 3b 73 20 75 73 65 2e 0a 3c 2f |et's use................| 00002770 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 |...........

func (En| 000027a0 64 70 6f 69 6e 74 54 79 70 65 29 20 3c 61 20 68 |dpointType) String<| 00002800 2f 68 33 3e 0a 09 09 09 09 3c 70 72 65 3e 66 75 |/h3>.....
fu|
        00002810  6e 63 20 28 65 20 45 6e  64 70 6f 69 6e 74 54 79  |nc (e EndpointTy|
        00002820  70 65 29 20 53 74 72 69  6e 67 28 29 20 73 74 72  |pe) String() str|
        00002830  69 6e 67 3c 2f 70 72 65  3e 0a 09 09 09 09 0a 09  |ing
.......| 00002840 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 0a |................| 00002850 09 09 09 0a 09 09 09 0a 09 09 09 3c 68 32 20 69 |...........

type EndpointT| 000028d0 79 70 65 4d 65 74 61 64 61 74 61 3c 2f 61 3e 3c |ypeMetadata<| 000028e0 2f 68 32 3e 0a 09 09 09 3c 70 72 65 3e 74 79 70 |/h2>....
typ|
        000028f0  65 20 45 6e 64 70 6f 69  6e 74 54 79 70 65 4d 65  |e EndpointTypeMe|
        00002900  74 61 64 61 74 61 20 73  74 72 75 63 74 20 7b 0a  |tadata struct {.|
        00002910  20 20 20 20 3c 73 70 61  6e 20 63 6c 61 73 73 3d  |    // Nam|
        00002930  65 20 69 73 20 74 68 65  20 73 74 72 69 6e 67 20  |e is the string |
        00002940  72 65 74 75 72 6e 65 64  20 62 79 20 61 6e 20 45  |returned by an E|
        00002950  6e 64 70 6f 69 6e 74 54  79 70 65 26 23 33 39 3b  |ndpointType'|
        00002960  73 20 53 74 72 69 6e 67  20 66 75 6e 63 74 69 6f  |s String functio|
        00002970  6e 2e 3c 2f 73 70 61 6e  3e 0a 20 20 20 20 4e 61  |n..    Na|
        00002980  6d 65 20 73 74 72 69 6e  67 0a 20 20 20 20 3c 73  |me string.    // Formatter|
        000029b0  20 69 73 20 63 61 6c 6c  65 64 20 66 72 6f 6d 20  | is called from |
        000029c0  61 6e 20 45 6e 64 70 6f  69 6e 74 26 23 33 39 3b  |an Endpoint'|
        000029d0  73 20 53 74 72 69 6e 67  20 66 75 6e 63 74 69 6f  |s String functio|
        000029e0  6e 20 74 6f 20 66 6f 72  6d 61 74 20 74 68 65 20  |n to format the |
        000029f0  72 61 77 3c 2f 73 70 61  6e 3e 0a 20 20 20 20 3c  |raw.    <|
        00002a00  73 70 61 6e 20 63 6c 61  73 73 3d 22 63 6f 6d 6d  |span class="comm|
        00002a10  65 6e 74 22 3e 2f 2f 20  62 79 74 65 73 20 69 6e  |ent">// bytes in|
        00002a20  20 61 6e 20 45 6e 64 70  6f 69 6e 74 20 69 6e 74  | an Endpoint int|
        00002a30  6f 20 61 20 68 75 6d 61  6e 2d 72 65 61 64 61 62  |o a human-readab|
        00002a40  6c 65 20 73 74 72 69 6e  67 2e 3c 2f 73 70 61 6e  |le string..    Formatter |
        00002a60  66 75 6e 63 28 5b 5d 62  79 74 65 29 20 73 74 72  |func([]byte) str|
        00002a70  69 6e 67 0a 7d 3c 2f 70  72 65 3e 0a 09 09 09 3c  |ing.}
....<| 00002a80 70 3e 0a 45 6e 64 70 6f 69 6e 74 54 79 70 65 4d |p>.EndpointTypeM| 00002a90 65 74 61 64 61 74 61 20 69 73 20 75 73 65 64 20 |etadata is used | 00002aa0 74 6f 20 72 65 67 69 73 74 65 72 20 61 20 6e 65 |to register a ne| 00002ab0 77 20 65 6e 64 70 6f 69 6e 74 20 74 79 70 65 2e |w endpoint type.| 00002ac0 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 09 |.

...........| 00002ad0 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a |................| 00002ae0 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 3c 68 |..............type E| 00002b50 72 72 6f 72 4c 61 79 65 72 3c 2f 61 3e 3c 2f 68 |rrorLayer....
type |
        00002b70  45 72 72 6f 72 4c 61 79  65 72 20 69 6e 74 65 72  |ErrorLayer inter|
        00002b80  66 61 63 65 20 7b 0a 20  20 20 20 4c 61 79 65 72  |face {.    Layer|
        00002b90  0a 20 20 20 20 45 72 72  6f 72 28 29 20 65 72 72  |.    Error() err|
        00002ba0  6f 72 0a 7d 3c 2f 70 72  65 3e 0a 09 09 09 3c 70  |or.}
.....ErrorLayer is | 00002bc0 61 20 70 61 63 6b 65 74 20 6c 61 79 65 72 20 63 |a packet layer c| 00002bd0 72 65 61 74 65 64 20 77 68 65 6e 20 64 65 63 6f |reated when deco| 00002be0 64 69 6e 67 20 6f 66 20 74 68 65 20 70 61 63 6b |ding of the pack| 00002bf0 65 74 20 68 61 73 20 66 61 69 6c 65 64 2e 0a 49 |et has failed..I| 00002c00 74 73 20 70 61 79 6c 6f 61 64 20 69 73 20 61 6c |ts payload is al| 00002c10 6c 20 74 68 65 20 62 79 74 65 73 20 74 68 61 74 |l the bytes that| 00002c20 20 77 65 20 77 65 72 65 20 75 6e 61 62 6c 65 20 | we were unable | 00002c30 74 6f 20 64 65 63 6f 64 65 2c 20 61 6e 64 20 74 |to decode, and t| 00002c40 68 65 20 72 65 74 75 72 6e 65 64 0a 65 72 72 6f |he returned.erro| 00002c50 72 20 64 65 74 61 69 6c 73 20 77 68 79 20 74 68 |r details why th| 00002c60 65 20 64 65 63 6f 64 69 6e 67 20 66 61 69 6c 65 |e decoding faile| 00002c70 64 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 |d..

.........| 00002c80 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 |................| 00002c90 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 |................| 00002ca0 3c 68 32 20 69 64 3d 22 46 6c 6f 77 22 3e 74 79 |

ty| 00002cb0 70 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |pe Flow| 00002d00 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 |

....type Flow stru| 00002d20 63 74 20 7b 0a 20 20 20 20 3c 73 70 61 6e 20 63 |ct {. /| 00002d40 2f 20 63 6f 6e 74 61 69 6e 73 20 66 69 6c 74 65 |/ contains filte| 00002d50 72 65 64 20 6f 72 20 75 6e 65 78 70 6f 72 74 65 |red or unexporte| 00002d60 64 20 66 69 65 6c 64 73 3c 2f 73 70 61 6e 3e 0a |d fields.| 00002d70 7d 3c 2f 70 72 65 3e 0a 09 09 09 3c 70 3e 0a 46 |}....

.F| 00002d80 6c 6f 77 20 72 65 70 72 65 73 65 6e 74 73 20 74 |low represents t| 00002d90 68 65 20 64 69 72 65 63 74 69 6f 6e 20 6f 66 20 |he direction of | 00002da0 74 72 61 66 66 69 63 20 66 6f 72 20 61 20 70 61 |traffic for a pa| 00002db0 63 6b 65 74 20 6c 61 79 65 72 2c 20 61 73 20 61 |cket layer, as a| 00002dc0 20 73 6f 75 72 63 65 20 61 6e 64 20 64 65 73 74 | source and dest| 00002dd0 69 6e 61 74 69 6f 6e 20 45 6e 64 70 6f 69 6e 74 |ination Endpoint| 00002de0 2e 0a 46 6c 6f 77 73 20 61 72 65 20 75 73 61 62 |..Flows are usab| 00002df0 6c 65 20 61 73 20 6d 61 70 20 6b 65 79 73 2e 0a |le as map keys..| 00002e00 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 09 0a |

............| 00002e10 0a 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 0a 09 |................| 00002e20 09 09 09 3c 68 33 20 69 64 3d 22 46 6c 6f 77 46 |...

fu| 00002e40 6e 63 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |nc Flow| 00002e90 46 72 6f 6d 45 6e 64 70 6f 69 6e 74 73 3c 2f 61 |FromEndpoints

.....
|
        00002eb0  66 75 6e 63 20 46 6c 6f  77 46 72 6f 6d 45 6e 64  |func FlowFromEnd|
        00002ec0  70 6f 69 6e 74 73 28 73  72 63 2c 20 64 73 74 20  |points(src, dst |
        00002ed0  45 6e 64 70 6f 69 6e 74  29 20 28 5f 20 46 6c 6f  |Endpoint) (_ Flo|
        00002ee0  77 2c 20 65 72 72 20 65  72 72 6f 72 29 3c 2f 70  |w, err error).....

.Flow| 00002f00 46 72 6f 6d 45 6e 64 70 6f 69 6e 74 73 20 63 72 |FromEndpoints cr| 00002f10 65 61 74 65 73 20 61 20 6e 65 77 20 66 6c 6f 77 |eates a new flow| 00002f20 20 62 79 20 70 61 73 74 69 6e 67 20 74 6f 67 65 | by pasting toge| 00002f30 74 68 65 72 20 74 77 6f 20 65 6e 64 70 6f 69 6e |ther two endpoin| 00002f40 74 73 2e 0a 54 68 65 20 65 6e 64 70 6f 69 6e 74 |ts..The endpoint| 00002f50 73 20 6d 75 73 74 20 68 61 76 65 20 74 68 65 20 |s must have the | 00002f60 73 61 6d 65 20 45 6e 64 70 6f 69 6e 74 54 79 70 |same EndpointTyp| 00002f70 65 2c 20 6f 72 20 74 68 69 73 20 66 75 6e 63 74 |e, or this funct| 00002f80 69 6f 6e 20 77 69 6c 6c 20 72 65 74 75 72 6e 0a |ion will return.| 00002f90 61 6e 20 65 72 72 6f 72 2e 0a 3c 2f 70 3e 0a 0a |an error..

..| 00002fa0 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 |................| 00002fb0 09 09 3c 68 33 20 69 64 3d 22 4e 65 77 46 6c 6f |..

func NewFlow.....
func|
        00003030  20 4e 65 77 46 6c 6f 77  28 74 20 45 6e 64 70 6f  | NewFlow(t Endpo|
        00003040  69 6e 74 54 79 70 65 2c  20 73 72 63 2c 20 64 73  |intType, src, ds|
        00003050  74 20 5b 5d 62 79 74 65  29 20 46 6c 6f 77 3c 2f  |t []byte) Flow.....

.New| 00003070 46 6c 6f 77 20 63 72 65 61 74 65 73 20 61 20 6e |Flow creates a n| 00003080 65 77 20 66 6c 6f 77 2e 0a 3c 2f 70 3e 0a 0a 09 |ew flow..

...| 00003090 09 09 09 0a 09 09 09 0a 0a 09 09 09 0a 09 09 09 |................| 000030a0 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 46 6c |......

func (Fl| 000030c0 6f 77 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 |ow) Ds| 00003110 74 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c |t

.....<| 00003120 70 72 65 3e 66 75 6e 63 20 28 66 20 46 6c 6f 77 |pre>func (f Flow| 00003130 29 20 44 73 74 28 29 20 28 64 73 74 20 45 6e 64 |) Dst() (dst End| 00003140 70 6f 69 6e 74 29 3c 2f 70 72 65 3e 0a 09 09 09 |point)
....| 00003150 09 3c 70 3e 0a 44 73 74 20 72 65 74 75 72 6e 73 |.

.Dst returns| 00003160 20 74 68 65 20 64 65 73 74 69 6e 61 74 69 6f 6e | the destination| 00003170 20 45 6e 64 70 6f 69 6e 74 20 66 6f 72 20 74 68 | Endpoint for th| 00003180 69 73 20 66 6c 6f 77 2e 0a 3c 2f 70 3e 0a 0a 09 |is flow..

...| 00003190 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 |................| 000031a0 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 46 6c |......

func (Flow) EndpointTy| 00003220 70 65 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 |pe

.....| 00003230 3c 70 72 65 3e 66 75 6e 63 20 28 66 20 46 6c 6f |
func (f Flo|
        00003240  77 29 20 45 6e 64 70 6f  69 6e 74 54 79 70 65 28  |w) EndpointType(|
        00003250  29 20 45 6e 64 70 6f 69  6e 74 54 79 70 65 3c 2f  |) EndpointType.....

.End| 00003270 70 6f 69 6e 74 54 79 70 65 20 72 65 74 75 72 6e |pointType return| 00003280 73 20 74 68 65 20 45 6e 64 70 6f 69 6e 74 54 79 |s the EndpointTy| 00003290 70 65 20 66 6f 72 20 74 68 69 73 20 46 6c 6f 77 |pe for this Flow| 000032a0 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 09 |..

..........| 000032b0 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c |...............<| 000032c0 68 33 20 69 64 3d 22 46 6c 6f 77 2e 45 6e 64 70 |h3 id="Flow.Endp| 000032d0 6f 69 6e 74 73 22 3e 66 75 6e 63 20 28 46 6c 6f |oints">func (Flo| 000032e0 77 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |w) End| 00003330 70 6f 69 6e 74 73 3c 2f 61 3e 3c 2f 68 33 3e 0a |points

.| 00003340 09 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 66 |....
func (f|
        00003350  20 46 6c 6f 77 29 20 45  6e 64 70 6f 69 6e 74 73  | Flow) Endpoints|
        00003360  28 29 20 28 73 72 63 2c  20 64 73 74 20 45 6e 64  |() (src, dst End|
        00003370  70 6f 69 6e 74 29 3c 2f  70 72 65 3e 0a 09 09 09  |point)
....| 00003380 09 3c 70 3e 0a 45 6e 64 70 6f 69 6e 74 73 20 72 |.

.Endpoints r| 00003390 65 74 75 72 6e 73 20 74 68 65 20 74 77 6f 20 45 |eturns the two E| 000033a0 6e 64 70 6f 69 6e 74 73 20 66 6f 72 20 74 68 69 |ndpoints for thi| 000033b0 73 20 66 6c 6f 77 2e 0a 3c 2f 70 3e 0a 0a 09 09 |s flow..

....| 000033c0 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 |................| 000033d0 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 46 6c 6f |.....

func | 000033f0 28 46 6c 6f 77 29 20 3c 61 20 68 72 65 66 3d 22 |(Flow) Reverse.....
func |
        00003460  28 66 20 46 6c 6f 77 29  20 52 65 76 65 72 73 65  |(f Flow) Reverse|
        00003470  28 29 20 46 6c 6f 77 3c  2f 70 72 65 3e 0a 09 09  |() Flow
...| 00003480 09 09 3c 70 3e 0a 52 65 76 65 72 73 65 20 72 65 |..

.Reverse re| 00003490 74 75 72 6e 73 20 61 20 6e 65 77 20 66 6c 6f 77 |turns a new flow| 000034a0 20 77 69 74 68 20 65 6e 64 70 6f 69 6e 74 73 20 | with endpoints | 000034b0 72 65 76 65 72 73 65 64 2e 0a 3c 2f 70 3e 0a 0a |reversed..

..| 000034c0 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 |................| 000034d0 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 46 |.......

func (F| 000034f0 6c 6f 77 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 |low) S| 00003540 72 63 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 |rc

.....| 00003550 3c 70 72 65 3e 66 75 6e 63 20 28 66 20 46 6c 6f |
func (f Flo|
        00003560  77 29 20 53 72 63 28 29  20 28 73 72 63 20 45 6e  |w) Src() (src En|
        00003570  64 70 6f 69 6e 74 29 3c  2f 70 72 65 3e 0a 09 09  |dpoint)
...| 00003580 09 09 3c 70 3e 0a 53 72 63 20 72 65 74 75 72 6e |..

.Src return| 00003590 73 20 74 68 65 20 73 6f 75 72 63 65 20 45 6e 64 |s the source End| 000035a0 70 6f 69 6e 74 20 66 6f 72 20 74 68 69 73 20 66 |point for this f| 000035b0 6c 6f 77 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a |low..

.......| 000035c0 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 |................| 000035d0 09 09 3c 68 33 20 69 64 3d 22 46 6c 6f 77 2e 53 |..

func (Flo| 000035f0 77 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |w) Stri| 00003640 6e 67 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 |ng

.....| 00003650 3c 70 72 65 3e 66 75 6e 63 20 28 66 20 46 6c 6f |
func (f Flo|
        00003660  77 29 20 53 74 72 69 6e  67 28 29 20 73 74 72 69  |w) String() stri|
        00003670  6e 67 3c 2f 70 72 65 3e  0a 09 09 09 09 3c 70 3e  |ng
.....

| 00003680 0a 53 74 72 69 6e 67 20 72 65 74 75 72 6e 73 20 |.String returns | 00003690 61 20 68 75 6d 61 6e 2d 72 65 61 64 61 62 6c 65 |a human-readable| 000036a0 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 | representation | 000036b0 6f 66 20 74 68 69 73 20 66 6c 6f 77 2c 20 69 6e |of this flow, in| 000036c0 20 74 68 65 20 66 6f 72 6d 0a 26 23 33 34 3b 53 | the form."S| 000036d0 72 63 2d 26 67 74 3b 44 73 74 26 23 33 34 3b 0a |rc->Dst".| 000036e0 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 09 09 0a |

............| 000036f0 09 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 |................| 00003700 09 09 3c 68 32 20 69 64 3d 22 4c 61 79 65 72 22 |..

type Layer| 00003760 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 |

....type Layer int| 00003780 65 72 66 61 63 65 20 7b 0a 20 20 20 20 66 6d 74 |erface {. fmt| 00003790 2e 53 74 72 69 6e 67 65 72 0a 20 20 20 20 3c 73 |.Stringer. // LayerType| 000037c0 20 69 73 20 74 68 65 20 67 6f 70 61 63 6b 65 74 | is the gopacket| 000037d0 20 74 79 70 65 20 66 6f 72 20 74 68 69 73 20 6c | type for this l| 000037e0 61 79 65 72 2e 3c 2f 73 70 61 6e 3e 0a 20 20 20 |ayer.. | 000037f0 20 4c 61 79 65 72 54 79 70 65 28 29 20 4c 61 79 | LayerType() Lay| 00003800 65 72 54 79 70 65 0a 20 20 20 20 3c 73 70 61 6e |erType. // LayerContent| 00003830 73 20 72 65 74 75 72 6e 73 20 74 68 65 20 73 65 |s returns the se| 00003840 74 20 6f 66 20 62 79 74 65 73 20 74 68 61 74 20 |t of bytes that | 00003850 6d 61 6b 65 20 75 70 20 74 68 69 73 20 6c 61 79 |make up this lay| 00003860 65 72 2e 3c 2f 73 70 61 6e 3e 0a 20 20 20 20 4c |er.. L| 00003870 61 79 65 72 43 6f 6e 74 65 6e 74 73 28 29 20 5b |ayerContents() [| 00003880 5d 62 79 74 65 0a 20 20 20 20 3c 73 70 61 6e 20 |]byte. | 000038a0 2f 2f 20 4c 61 79 65 72 50 61 79 6c 6f 61 64 20 |// LayerPayload | 000038b0 72 65 74 75 72 6e 73 20 74 68 65 20 73 65 74 20 |returns the set | 000038c0 6f 66 20 62 79 74 65 73 20 63 6f 6e 74 61 69 6e |of bytes contain| 000038d0 65 64 20 77 69 74 68 69 6e 20 74 68 69 73 20 6c |ed within this l| 000038e0 61 79 65 72 2c 20 6e 6f 74 3c 2f 73 70 61 6e 3e |ayer, not| 000038f0 0a 20 20 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 |. // in| 00003910 63 6c 75 64 69 6e 67 20 74 68 65 20 6c 61 79 65 |cluding the laye| 00003920 72 20 69 74 73 65 6c 66 2e 3c 2f 73 70 61 6e 3e |r itself.| 00003930 0a 20 20 20 20 4c 61 79 65 72 50 61 79 6c 6f 61 |. LayerPayloa| 00003940 64 28 29 20 5b 5d 62 79 74 65 0a 7d 3c 2f 70 72 |d() []byte.}....

.Layer | 00003960 72 65 70 72 65 73 65 6e 74 73 20 61 20 73 69 6e |represents a sin| 00003970 67 6c 65 20 64 65 63 6f 64 65 64 20 70 61 63 6b |gle decoded pack| 00003980 65 74 20 6c 61 79 65 72 20 28 75 73 69 6e 67 20 |et layer (using | 00003990 65 69 74 68 65 72 20 74 68 65 0a 4f 53 49 20 6f |either the.OSI o| 000039a0 72 20 54 43 50 2f 49 50 20 64 65 66 69 6e 69 74 |r TCP/IP definit| 000039b0 69 6f 6e 20 6f 66 20 61 20 6c 61 79 65 72 29 2e |ion of a layer).| 000039c0 20 20 57 68 65 6e 20 64 65 63 6f 64 69 6e 67 2c | When decoding,| 000039d0 20 61 20 70 61 63 6b 65 74 26 23 33 39 3b 73 20 | a packet's | 000039e0 64 61 74 61 20 69 73 0a 62 72 6f 6b 65 6e 20 75 |data is.broken u| 000039f0 70 20 69 6e 74 6f 20 61 20 6e 75 6d 62 65 72 20 |p into a number | 00003a00 6f 66 20 6c 61 79 65 72 73 2e 20 20 54 68 65 20 |of layers. The | 00003a10 63 61 6c 6c 65 72 20 6d 61 79 20 63 61 6c 6c 20 |caller may call | 00003a20 4c 61 79 65 72 54 79 70 65 28 29 20 74 6f 0a 66 |LayerType() to.f| 00003a30 69 67 75 72 65 20 6f 75 74 20 77 68 69 63 68 20 |igure out which | 00003a40 74 79 70 65 20 6f 66 20 6c 61 79 65 72 20 68 65 |type of layer he| 00003a50 26 23 33 39 3b 73 20 72 65 63 65 69 76 65 64 20 |'s received | 00003a60 66 72 6f 6d 20 74 68 65 20 70 61 63 6b 65 74 2e |from the packet.| 00003a70 20 20 4f 70 74 69 6f 6e 61 6c 6c 79 2c 0a 68 65 | Optionally,.he| 00003a80 20 6d 61 79 20 74 68 65 6e 20 75 73 65 20 61 20 | may then use a | 00003a90 74 79 70 65 20 61 73 73 65 72 74 69 6f 6e 20 74 |type assertion t| 00003aa0 6f 20 67 65 74 20 74 68 65 20 61 63 74 75 61 6c |o get the actual| 00003ab0 20 6c 61 79 65 72 20 74 79 70 65 20 66 6f 72 20 | layer type for | 00003ac0 64 65 65 70 0a 69 6e 73 70 65 63 74 69 6f 6e 20 |deep.inspection | 00003ad0 6f 66 20 74 68 65 20 64 61 74 61 2e 0a 3c 2f 70 |of the data.................| 00003af0 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 0a 09 |................| 00003b00 09 09 0a 09 09 09 0a 09 09 09 3c 68 32 20 69 64 |..........

ty| 00003b20 70 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |pe La| 00003b70 79 65 72 43 6c 61 73 73 3c 2f 61 3e 3c 2f 68 32 |yerClass....
type L|
        00003b90  61 79 65 72 43 6c 61 73  73 20 69 6e 74 65 72 66  |ayerClass interf|
        00003ba0  61 63 65 20 7b 0a 20 20  20 20 3c 73 70 61 6e 20  |ace {.    |
        00003bc0  2f 2f 20 43 6f 6e 74 61  69 6e 73 20 72 65 74 75  |// Contains retu|
        00003bd0  72 6e 73 20 74 72 75 65  20 69 66 20 74 68 65 20  |rns true if the |
        00003be0  67 69 76 65 6e 20 6c 61  79 65 72 20 74 79 70 65  |given layer type|
        00003bf0  20 73 68 6f 75 6c 64 20  62 65 20 63 6f 6e 73 69  | should be consi|
        00003c00  64 65 72 65 64 20 70 61  72 74 3c 2f 73 70 61 6e  |dered part.    // o|
        00003c30  66 20 74 68 69 73 20 6c  61 79 65 72 20 63 6c 61  |f this layer cla|
        00003c40  73 73 2e 3c 2f 73 70 61  6e 3e 0a 20 20 20 20 43  |ss..    C|
        00003c50  6f 6e 74 61 69 6e 73 28  4c 61 79 65 72 54 79 70  |ontains(LayerTyp|
        00003c60  65 29 20 62 6f 6f 6c 0a  7d 3c 2f 70 72 65 3e 0a  |e) bool.}
.| 00003c70 09 09 09 3c 70 3e 0a 4c 61 79 65 72 43 6c 61 73 |...

.LayerClas| 00003c80 73 20 69 73 20 61 20 73 65 74 20 6f 66 20 4c 61 |s is a set of La| 00003c90 79 65 72 54 79 70 65 73 2c 20 75 73 65 64 20 66 |yerTypes, used f| 00003ca0 6f 72 20 67 72 61 62 62 69 6e 67 20 6f 6e 65 20 |or grabbing one | 00003cb0 6f 66 20 61 20 6e 75 6d 62 65 72 20 6f 66 0a 64 |of a number of.d| 00003cc0 69 66 66 65 72 65 6e 74 20 74 79 70 65 73 20 66 |ifferent types f| 00003cd0 72 6f 6d 20 61 20 70 61 63 6b 65 74 2e 0a 3c 2f |rom a packet................| 00003cf0 09 09 0a 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00003d00 09 3c 68 33 20 69 64 3d 22 4e 65 77 4c 61 79 65 |.

func NewLa| 00003d70 79 65 72 43 6c 61 73 73 3c 2f 61 3e 3c 2f 68 33 |yerClass.....
func |
        00003d90  4e 65 77 4c 61 79 65 72  43 6c 61 73 73 28 74 79  |NewLayerClass(ty|
        00003da0  70 65 73 20 5b 5d 4c 61  79 65 72 54 79 70 65 29  |pes []LayerType)|
        00003db0  20 4c 61 79 65 72 43 6c  61 73 73 3c 2f 70 72 65  | LayerClass.....

.NewLay| 00003dd0 65 72 43 6c 61 73 73 20 63 72 65 61 74 65 73 20 |erClass creates | 00003de0 61 20 4c 61 79 65 72 43 6c 61 73 73 2c 20 61 74 |a LayerClass, at| 00003df0 74 65 6d 70 74 69 6e 67 20 74 6f 20 62 65 20 73 |tempting to be s| 00003e00 6d 61 72 74 20 61 62 6f 75 74 20 77 68 69 63 68 |mart about which| 00003e10 20 74 79 70 65 0a 69 74 20 63 72 65 61 74 65 73 | type.it creates| 00003e20 20 62 61 73 65 64 20 6f 6e 20 77 68 69 63 68 20 | based on which | 00003e30 74 79 70 65 73 20 61 72 65 20 70 61 73 73 65 64 |types are passed| 00003e40 20 69 6e 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a | in..

.......| 00003e50 09 09 09 0a 0a 09 09 09 0a 09 09 0a 09 09 09 0a |................| 00003e60 09 09 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 4c |.......

ty| 00003e80 70 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |pe LayerClassMap

....
|
        00003ef0  74 79 70 65 20 4c 61 79  65 72 43 6c 61 73 73 4d  |type LayerClassM|
        00003f00  61 70 20 6d 61 70 5b 4c  61 79 65 72 54 79 70 65  |ap map[LayerType|
        00003f10  5d 62 6f 6f 6c 3c 2f 70  72 65 3e 0a 09 09 09 3c  |]bool
....<| 00003f20 70 3e 0a 4c 61 79 65 72 43 6c 61 73 73 4d 61 70 |p>.LayerClassMap| 00003f30 20 69 6d 70 6c 65 6d 65 6e 74 73 20 61 20 4c 61 | implements a La| 00003f40 79 65 72 43 6c 61 73 73 20 77 69 74 68 20 61 20 |yerClass with a | 00003f50 6d 61 70 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a |map..

.......| 00003f60 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 |................| 00003f70 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 |........

func NewLayerCla| 00003ff0 73 73 4d 61 70 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 |ssMap

..| 00004000 09 09 09 3c |...<| --- Layer 1 --- Loopback {Contents=[30, 0, 0, 0] Payload=[..16384..] Family=IPv6} 00000000 1e 00 00 00 |....| --- Layer 2 --- IPv6 {Contents=[..40..] Payload=[..16344..] Version=6 TrafficClass=0 FlowLabel=100497 Length=16344 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 00000000 60 01 88 91 3f d8 06 40 00 00 00 00 00 00 00 00 |`...?..@........| 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 01 |........| --- Layer 3 --- TCP {Contents=[..32..] Payload=[..16312..] SrcPort=8080(http-alt) DstPort=58799 Seq=174438055 Ack=144119882 DataOffset=8 FIN=false SYN=false RST=false PSH=false ACK=true URG=false ECE=false CWR=false NS=false Window=8962 Checksum=16352 Urgent=0 Options=[TCPOption(NOP:), TCPOption(NOP:), TCPOption(Timestamps:96505270/96505084 0x05c08db605c08cfc)] Padding=[]} 00000000 1f 90 e5 af 0a 65 b6 a7 08 97 18 4a 80 10 23 02 |.....e.....J..#.| 00000010 3f e0 00 00 01 01 08 0a 05 c0 8d b6 05 c0 8c fc |?...............| --- Layer 4 --- Payload 16312 byte(s) 00000000 3e 56 61 72 69 61 62 6c 65 73 3c 2f 68 32 3e 0a |>Variables

.| 00000010 09 09 09 0a 09 09 09 09 3c 70 72 65 3e 76 61 72 |........
var|
        00000020  20 56 61 6c 69 64 4d 41  43 50 72 65 66 69 78 4d  | ValidMACPrefixM|
        00000030  61 70 20 3d 20 76 61 6c  69 64 4d 41 43 50 72 65  |ap = validMACPre|
        00000040  66 69 78 4d 61 70 3c 2f  70 72 65 3e 0a 09 09 09  |fixMap
....| 00000050 09 3c 70 3e 0a 56 61 6c 69 64 4d 41 43 50 72 65 |.

.ValidMACPre| 00000060 66 69 78 4d 61 70 20 6d 61 70 73 20 61 20 76 61 |fixMap maps a va| 00000070 6c 69 64 20 4d 41 43 20 61 64 64 72 65 73 73 20 |lid MAC address | 00000080 70 72 65 66 69 78 20 74 6f 20 74 68 65 20 6e 61 |prefix to the na| 00000090 6d 65 20 6f 66 20 74 68 65 0a 6f 72 67 61 6e 69 |me of the.organi| 000000a0 7a 61 74 69 6f 6e 20 74 68 61 74 20 6f 77 6e 73 |zation that owns| 000000b0 20 74 68 65 20 72 69 67 68 74 73 20 74 6f 20 75 | the rights to u| 000000c0 73 65 20 69 74 2e 20 20 57 65 20 6d 61 70 20 69 |se it. We map i| 000000d0 74 20 74 6f 20 61 20 68 69 64 64 65 6e 0a 76 61 |t to a hidden.va| 000000e0 72 69 61 62 6c 65 20 73 6f 20 69 74 20 77 6f 6e |riable so it won| 000000f0 26 23 33 39 3b 74 20 73 68 6f 77 20 75 70 20 69 |'t show up i| 00000100 6e 20 67 6f 64 6f 63 2c 20 73 69 6e 63 65 20 69 |n godoc, since i| 00000110 74 26 23 33 39 3b 73 20 61 20 76 65 72 79 20 6c |t's a very l| 00000120 61 72 67 65 20 6d 61 70 2e 0a 3c 2f 70 3e 0a 0a |arge map..

..| 00000130 09 09 09 0a 09 09 0a 09 09 0a 09 09 0a 09 09 09 |................| 00000140 0a 09 09 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 |........

type A| 000001b0 70 70 6c 69 63 61 74 69 6f 6e 4c 61 79 65 72 3c |pplicationLayer<| 000001c0 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 65 |/a>

....type Applicatio| 000001e0 6e 4c 61 79 65 72 20 69 6e 74 65 72 66 61 63 65 |nLayer interface| 000001f0 20 7b 0a 20 20 20 20 4c 61 79 65 72 0a 20 20 20 | {. Layer. | 00000200 20 50 61 79 6c 6f 61 64 28 29 20 5b 5d 62 79 74 | Payload() []byt| 00000210 65 0a 7d 3c 2f 70 72 65 3e 0a 09 09 09 3c 70 3e |e.}....

| 00000220 0a 41 70 70 6c 69 63 61 74 69 6f 6e 4c 61 79 65 |.ApplicationLaye| 00000230 72 20 69 73 20 74 68 65 20 70 61 63 6b 65 74 20 |r is the packet | 00000240 6c 61 79 65 72 20 63 6f 72 72 65 73 70 6f 6e 64 |layer correspond| 00000250 69 6e 67 20 74 6f 20 74 68 65 20 54 43 50 2f 49 |ing to the TCP/I| 00000260 50 20 6c 61 79 65 72 20 34 20 28 4f 53 49 0a 6c |P layer 4 (OSI.l| 00000270 61 79 65 72 20 37 29 2c 20 61 6c 73 6f 20 6b 6e |ayer 7), also kn| 00000280 6f 77 6e 20 61 73 20 74 68 65 20 70 61 63 6b 65 |own as the packe| 00000290 74 20 70 61 79 6c 6f 61 64 2e 0a 3c 2f 70 3e 0a |t payload..

.| 000002a0 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a |................| 000002b0 0a 09 09 09 0a 0a 09 09 09 0a 09 09 0a 09 09 09 |................| 000002c0 0a 09 09 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 |........

typ| 000002e0 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f |e Capture| 00000330 49 6e 66 6f 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 |Info

...| 00000340 09 3c 70 72 65 3e 74 79 70 65 20 43 61 70 74 75 |.
type Captu|
        00000350  72 65 49 6e 66 6f 20 73  74 72 75 63 74 20 7b 0a  |reInfo struct {.|
        00000360  20 20 20 20 3c 73 70 61  6e 20 63 6c 61 73 73 3d  |    // Pop|
        00000380  75 6c 61 74 65 64 20 69  73 20 73 65 74 20 74 6f  |ulated is set to|
        00000390  20 74 72 75 65 20 69 66  20 74 68 65 20 72 65 73  | true if the res|
        000003a0  74 20 6f 66 20 74 68 65  20 43 61 70 74 75 72 65  |t of the Capture|
        000003b0  49 6e 66 6f 20 68 61 73  20 62 65 65 6e 20 70 6f  |Info has been po|
        000003c0  70 75 6c 61 74 65 64 3c  2f 73 70 61 6e 3e 0a 20  |pulated. |
        000003d0  20 20 20 3c 73 70 61 6e  20 63 6c 61 73 73 3d 22  |   // with|
        000003f0  20 61 63 74 75 61 6c 20  69 6e 66 6f 72 6d 61 74  | actual informat|
        00000400  69 6f 6e 2e 20 20 49 66  20 50 6f 70 75 6c 61 74  |ion.  If Populat|
        00000410  65 64 20 69 73 20 66 61  6c 73 65 2c 20 74 68 65  |ed is false, the|
        00000420  72 65 26 23 33 39 3b 73  20 6e 6f 20 70 6f 69 6e  |re's no poin|
        00000430  74 20 69 6e 3c 2f 73 70  61 6e 3e 0a 20 20 20 20  |t in.    |
        00000440  3c 73 70 61 6e 20 63 6c  61 73 73 3d 22 63 6f 6d  |// reading|
        00000460  20 61 6e 79 20 6f 66 20  74 68 65 20 6f 74 68 65  | any of the othe|
        00000470  72 20 66 69 65 6c 64 73  2e 3c 2f 73 70 61 6e 3e  |r fields.|
        00000480  0a 20 20 20 20 50 6f 70  75 6c 61 74 65 64 20 20  |.    Populated  |
        00000490  20 20 20 20 20 20 20 20  20 20 20 62 6f 6f 6c 0a  |           bool.|
        000004a0  20 20 20 20 54 69 6d 65  73 74 61 6d 70 20 20 20  |    Timestamp   |
        000004b0  20 20 20 20 20 20 20 20  20 20 74 69 6d 65 2e 54  |          time.T|
        000004c0  69 6d 65 0a 20 20 20 20  43 61 70 74 75 72 65 4c  |ime.    CaptureL|
        000004d0  65 6e 67 74 68 2c 20 4c  65 6e 67 74 68 20 69 6e  |ength, Length in|
        000004e0  74 0a 7d 3c 2f 70 72 65  3e 0a 09 09 09 3c 70 3e  |t.}
....

| 000004f0 0a 43 61 70 74 75 72 65 49 6e 66 6f 20 63 6f 6e |.CaptureInfo con| 00000500 74 61 69 6e 73 20 63 61 70 74 75 72 65 20 6d 65 |tains capture me| 00000510 74 61 64 61 74 61 20 66 6f 72 20 61 20 70 61 63 |tadata for a pac| 00000520 6b 65 74 2e 20 20 49 66 20 61 20 70 61 63 6b 65 |ket. If a packe| 00000530 74 20 77 61 73 20 63 61 70 74 75 72 65 64 0a 6f |t was captured.o| 00000540 66 66 20 74 68 65 20 77 69 72 65 20 6f 72 20 72 |ff the wire or r| 00000550 65 61 64 20 66 72 6f 6d 20 61 20 70 63 61 70 20 |ead from a pcap | 00000560 66 69 6c 65 20 28 73 65 65 20 74 68 65 20 26 23 |file (see the &#| 00000570 33 39 3b 70 63 61 70 26 23 33 39 3b 20 73 75 62 |39;pcap' sub| 00000580 64 69 72 65 63 74 6f 72 79 29 2c 20 74 68 69 73 |directory), this| 00000590 0a 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 77 69 6c |.information wil| 000005a0 6c 20 62 65 20 61 74 74 61 63 68 65 64 20 74 6f |l be attached to| 000005b0 20 74 68 65 20 70 61 63 6b 65 74 2e 0a 3c 2f 70 | the packet.................| 000005d0 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 0a 09 |................| 000005e0 09 09 0a 09 09 09 0a 09 09 09 3c 68 32 20 69 64 |..........

type | 00000650 44 65 63 6f 64 65 46 61 69 6c 75 72 65 3c 2f 61 |DecodeFailure

....
t|
        00000670  79 70 65 20 44 65 63 6f  64 65 46 61 69 6c 75 72  |ype DecodeFailur|
        00000680  65 20 73 74 72 75 63 74  20 7b 0a 20 20 20 20 3c  |e struct {.    <|
        00000690  73 70 61 6e 20 63 6c 61  73 73 3d 22 63 6f 6d 6d  |span class="comm|
        000006a0  65 6e 74 22 3e 2f 2f 20  63 6f 6e 74 61 69 6e 73  |ent">// contains|
        000006b0  20 66 69 6c 74 65 72 65  64 20 6f 72 20 75 6e 65  | filtered or une|
        000006c0  78 70 6f 72 74 65 64 20  66 69 65 6c 64 73 3c 2f  |xported fields.}
...| 000006e0 09 3c 70 3e 0a 44 65 63 6f 64 65 46 61 69 6c 75 |.

.DecodeFailu| 000006f0 72 65 20 69 73 20 61 20 70 61 63 6b 65 74 20 6c |re is a packet l| 00000700 61 79 65 72 20 63 72 65 61 74 65 64 20 69 66 20 |ayer created if | 00000710 64 65 63 6f 64 69 6e 67 20 6f 66 20 74 68 65 20 |decoding of the | 00000720 70 61 63 6b 65 74 20 64 61 74 61 20 66 61 69 6c |packet data fail| 00000730 65 64 0a 66 6f 72 20 73 6f 6d 65 20 72 65 61 73 |ed.for some reas| 00000740 6f 6e 2e 20 20 49 74 20 69 6d 70 6c 65 6d 65 6e |on. It implemen| 00000750 74 73 20 45 72 72 6f 72 4c 61 79 65 72 2e 20 20 |ts ErrorLayer. | 00000760 4c 61 79 65 72 43 6f 6e 74 65 6e 74 73 20 77 69 |LayerContents wi| 00000770 6c 6c 20 62 65 20 74 68 65 20 65 6e 74 69 72 65 |ll be the entire| 00000780 0a 73 65 74 20 6f 66 20 62 79 74 65 73 20 74 68 |.set of bytes th| 00000790 61 74 20 66 61 69 6c 65 64 20 74 6f 20 70 61 72 |at failed to par| 000007a0 73 65 2c 20 61 6e 64 20 45 72 72 6f 72 20 77 69 |se, and Error wi| 000007b0 6c 6c 20 72 65 74 75 72 6e 20 74 68 65 20 72 65 |ll return the re| 000007c0 61 73 6f 6e 20 70 61 72 73 69 6e 67 0a 66 61 69 |ason parsing.fai| 000007d0 6c 65 64 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a |led..

.......| 000007e0 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a |................| 000007f0 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 |.............func (| 00000820 2a 44 65 63 6f 64 65 46 61 69 6c 75 72 65 29 20 |*DecodeFailure) | 00000830 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b |
Error<| 00000880 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 72 |/a>.....func (d *Decod| 000008a0 65 46 61 69 6c 75 72 65 29 20 45 72 72 6f 72 28 |eFailure) Error(| 000008b0 29 20 65 72 72 6f 72 3c 2f 70 72 65 3e 0a 09 09 |) error...| 000008c0 09 09 3c 70 3e 0a 45 72 72 6f 72 20 72 65 74 75 |..

.Error retu| 000008d0 72 6e 73 20 74 68 65 20 65 72 72 6f 72 20 65 6e |rns the error en| 000008e0 63 6f 75 6e 74 65 72 65 64 20 64 75 72 69 6e 67 |countered during| 000008f0 20 64 65 63 6f 64 69 6e 67 2e 0a 3c 2f 70 3e 0a | decoding..

.| 00000900 0a 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 |................| 00000910 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 |........

fun| 00000940 63 20 28 2a 44 65 63 6f 64 65 46 61 69 6c 75 72 |c (*DecodeFailur| 00000950 65 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |e) Lay| 000009a0 65 72 43 6f 6e 74 65 6e 74 73 3c 2f 61 3e 3c 2f |erContents.....
fun|
        000009c0  63 20 28 64 20 2a 44 65  63 6f 64 65 46 61 69 6c  |c (d *DecodeFail|
        000009d0  75 72 65 29 20 4c 61 79  65 72 43 6f 6e 74 65 6e  |ure) LayerConten|
        000009e0  74 73 28 29 20 5b 5d 62  79 74 65 3c 2f 70 72 65  |ts() []byte...............|
        00000a00  0a 09 09 09 0a 09 09 09  09 0a 09 09 09 09 3c 68  |..............func (*DecodeF|
        00000a40  61 69 6c 75 72 65 29 20  3c 61 20 68 72 65 66 3d  |ailure) LayerPayload

.....func (d *Decode| 00000ac0 46 61 69 6c 75 72 65 29 20 4c 61 79 65 72 50 61 |Failure) LayerPa| 00000ad0 79 6c 6f 61 64 28 29 20 5b 5d 62 79 74 65 3c 2f |yload() []byte............| 00000af0 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00000b00 09 3c 68 33 20 69 64 3d 22 44 65 63 6f 64 65 46 |.

func (*DecodeF| 00000b30 61 69 6c 75 72 65 29 20 3c 61 20 68 72 65 66 3d |ailure) LayerType<| 00000b90 2f 68 33 3e 0a 09 09 09 09 3c 70 72 65 3e 66 75 |/h3>.....
fu|
        00000ba0  6e 63 20 28 64 20 2a 44  65 63 6f 64 65 46 61 69  |nc (d *DecodeFai|
        00000bb0  6c 75 72 65 29 20 4c 61  79 65 72 54 79 70 65 28  |lure) LayerType(|
        00000bc0  29 20 4c 61 79 65 72 54  79 70 65 3c 2f 70 72 65  |) LayerType.....

.LayerT| 00000be0 79 70 65 20 72 65 74 75 72 6e 73 20 4c 61 79 65 |ype returns Laye| 00000bf0 72 54 79 70 65 44 65 63 6f 64 65 46 61 69 6c 75 |rTypeDecodeFailu| 00000c00 72 65 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 |re.

.........| 00000c10 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 |................| 00000c20 3c 68 33 20 69 64 3d 22 44 65 63 6f 64 65 46 61 |

fu| 00000c40 6e 63 20 28 2a 44 65 63 6f 64 65 46 61 69 6c 75 |nc (*DecodeFailu| 00000c50 72 65 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 |re) St| 00000ca0 72 69 6e 67 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 |ring

...| 00000cb0 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 64 20 2a |..
func (d *|
        00000cc0  44 65 63 6f 64 65 46 61  69 6c 75 72 65 29 20 53  |DecodeFailure) S|
        00000cd0  74 72 69 6e 67 28 29 20  73 74 72 69 6e 67 3c 2f  |tring() string............|
        00000cf0  09 09 09 0a 09 09 09 0a  09 09 0a 09 09 09 0a 09  |................|
        00000d00  09 09 0a 09 09 09 3c 68  32 20 69 64 3d 22 44 65  |......

type <| 00000d20 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b 67 |a href="/src/pkg| 00000d30 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 67 63 6f 6e |/github.com/gcon| 00000d40 6e 65 6c 6c 2f 67 6f 70 61 63 6b 65 74 2f 64 65 |nell/gopacket/de| 00000d50 63 6f 64 65 2e 67 6f 3f 73 3d 32 31 30 34 3a 32 |code.go?s=2104:2| 00000d60 31 35 33 23 4c 34 36 22 3e 44 65 63 6f 64 65 46 |153#L46">DecodeF| 00000d70 75 6e 63 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 |unc

....| 00000d80 3c 70 72 65 3e 74 79 70 65 20 44 65 63 6f 64 65 |
type Decode|
        00000d90  46 75 6e 63 20 66 75 6e  63 28 5b 5d 62 79 74 65  |Func func([]byte|
        00000da0  2c 20 50 61 63 6b 65 74  42 75 69 6c 64 65 72 29  |, PacketBuilder)|
        00000db0  20 65 72 72 6f 72 3c 2f  70 72 65 3e 0a 09 09 09  | error
....| 00000dc0 3c 70 3e 0a 44 65 63 6f 64 65 46 75 6e 63 20 77 |

.DecodeFunc w| 00000dd0 72 61 70 73 20 61 20 66 75 6e 63 74 69 6f 6e 20 |raps a function | 00000de0 74 6f 20 6d 61 6b 65 20 69 74 20 61 20 44 65 63 |to make it a Dec| 00000df0 6f 64 65 72 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 |oder..

......| 00000e00 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a |................| 00000e10 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 |..............func (D| 00000e40 65 63 6f 64 65 46 75 6e 63 29 20 3c 61 20 68 72 |ecodeFunc) Decode<| 00000ea0 2f 68 33 3e 0a 09 09 09 09 3c 70 72 65 3e 66 75 |/h3>.....
fu|
        00000eb0  6e 63 20 28 64 20 44 65  63 6f 64 65 46 75 6e 63  |nc (d DecodeFunc|
        00000ec0  29 20 44 65 63 6f 64 65  28 64 61 74 61 20 5b 5d  |) Decode(data []|
        00000ed0  62 79 74 65 2c 20 70 20  50 61 63 6b 65 74 42 75  |byte, p PacketBu|
        00000ee0  69 6c 64 65 72 29 20 65  72 72 6f 72 3c 2f 70 72  |ilder) error..............|
        00000f00  09 0a 09 09 09 0a 09 09  0a 09 09 09 0a 09 09 09  |................|
        00000f10  0a 09 09 09 3c 68 32 20  69 64 3d 22 44 65 63 6f  |....

type | 00000f30 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b |Decod| 00000f80 65 4f 70 74 69 6f 6e 73 3c 2f 61 3e 3c 2f 68 32 |eOptions....
type D|
        00000fa0  65 63 6f 64 65 4f 70 74  69 6f 6e 73 20 73 74 72  |ecodeOptions str|
        00000fb0  75 63 74 20 7b 0a 20 20  20 20 3c 73 70 61 6e 20  |uct {.    |
        00000fd0  2f 2f 20 4c 61 7a 79 20  64 65 63 6f 64 69 6e 67  |// Lazy decoding|
        00000fe0  20 64 65 63 6f 64 65 73  20 74 68 65 20 6d 69 6e  | decodes the min|
        00000ff0  69 6d 75 6d 20 6e 75 6d  62 65 72 20 6f 66 20 6c  |imum number of l|
        00001000  61 79 65 72 73 20 6e 65  65 64 65 64 20 74 6f 20  |ayers needed to |
        00001010  72 65 74 75 72 6e 20 64  61 74 61 3c 2f 73 70 61  |return data.    // |
        00001040  66 6f 72 20 61 20 70 61  63 6b 65 74 20 61 74 20  |for a packet at |
        00001050  65 61 63 68 20 66 75 6e  63 74 69 6f 6e 20 63 61  |each function ca|
        00001060  6c 6c 2e 20 20 42 65 20  63 61 72 65 66 75 6c 20  |ll.  Be careful |
        00001070  75 73 69 6e 67 20 74 68  69 73 20 77 69 74 68 20  |using this with |
        00001080  63 6f 6e 63 75 72 72 65  6e 74 3c 2f 73 70 61 6e  |concurrent.    // p|
        000010b0  61 63 6b 65 74 20 70 72  6f 63 65 73 73 6f 72 73  |acket processors|
        000010c0  2c 20 61 73 20 65 61 63  68 20 63 61 6c 6c 20 74  |, as each call t|
        000010d0  6f 20 70 61 63 6b 65 74  2e 2a 20 63 6f 75 6c 64  |o packet.* could|
        000010e0  20 6d 75 74 61 74 65 20  74 68 65 20 70 61 63 6b  | mutate the pack|
        000010f0  65 74 2c 20 61 6e 64 3c  2f 73 70 61 6e 3e 0a 20  |et, and. |
        00001100  20 20 20 3c 73 70 61 6e  20 63 6c 61 73 73 3d 22  |   // two |
        00001120  63 6f 6e 63 75 72 72 65  6e 74 20 66 75 6e 63 74  |concurrent funct|
        00001130  69 6f 6e 20 63 61 6c 6c  73 20 63 6f 75 6c 64 20  |ion calls could |
        00001140  69 6e 74 65 72 61 63 74  20 70 6f 6f 72 6c 79 2e  |interact poorly.|
        00001150  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 4c 61 7a 79  |.    Lazy|
        00001160  20 62 6f 6f 6c 0a 20 20  20 20 3c 73 70 61 6e 20  | bool.    |
        00001180  2f 2f 20 4e 6f 43 6f 70  79 20 64 65 63 6f 64 69  |// NoCopy decodi|
        00001190  6e 67 20 64 6f 65 73 6e  26 23 33 39 3b 74 20 63  |ng doesn't c|
        000011a0  6f 70 79 20 69 74 73 20  69 6e 70 75 74 20 62 75  |opy its input bu|
        000011b0  66 66 65 72 20 69 6e 74  6f 20 73 74 6f 72 61 67  |ffer into storag|
        000011c0  65 20 74 68 61 74 26 23  33 39 3b 73 20 6f 77 6e  |e that's own|
        000011d0  65 64 20 62 79 3c 2f 73  70 61 6e 3e 0a 20 20 20  |ed by.   |
        000011e0  20 3c 73 70 61 6e 20 63  6c 61 73 73 3d 22 63 6f  | // the pa|
        00001200  63 6b 65 74 2e 20 20 49  66 20 79 6f 75 20 63 61  |cket.  If you ca|
        00001210  6e 20 67 75 61 72 61 6e  74 65 65 20 74 68 61 74  |n guarantee that|
        00001220  20 74 68 65 20 62 79 74  65 73 20 75 6e 64 65 72  | the bytes under|
        00001230  6c 79 69 6e 67 20 74 68  65 20 73 6c 69 63 65 3c  |lying the slice<|
        00001240  2f 73 70 61 6e 3e 0a 20  20 20 20 3c 73 70 61 6e  |/span>.    // passed into |
        00001270  4e 65 77 50 61 63 6b 65  74 20 61 72 65 6e 26 23  |NewPacket aren&#|
        00001280  33 39 3b 74 20 67 6f 69  6e 67 20 74 6f 20 62 65  |39;t going to be|
        00001290  20 6d 6f 64 69 66 69 65  64 2c 20 74 68 69 73 20  | modified, this |
        000012a0  63 61 6e 20 62 65 20 66  61 73 74 65 72 2e 20 20  |can be faster.  |
        000012b0  49 66 3c 2f 73 70 61 6e  3e 0a 20 20 20 20 3c 73  |If.    // there'|
        000012e0  3b 73 20 61 6e 79 20 63  68 61 6e 63 65 20 74 68  |;s any chance th|
        000012f0  61 74 20 74 68 6f 73 65  20 62 79 74 65 73 20 57  |at those bytes W|
        00001300  49 4c 4c 20 62 65 20 63  68 61 6e 67 65 64 2c 20  |ILL be changed, |
        00001310  74 68 69 73 20 77 69 6c  6c 20 69 6e 76 61 6c 69  |this will invali|
        00001320  64 61 74 65 3c 2f 73 70  61 6e 3e 0a 20 20 20 20  |date.    |
        00001330  3c 73 70 61 6e 20 63 6c  61 73 73 3d 22 63 6f 6d  |// your pa|
        00001350  63 6b 65 74 73 2e 3c 2f  73 70 61 6e 3e 0a 20 20  |ckets..  |
        00001360  20 20 4e 6f 43 6f 70 79  20 62 6f 6f 6c 0a 7d 3c  |  NoCopy bool.}<|
        00001370  2f 70 72 65 3e 0a 09 09  09 3c 70 3e 0a 44 65 63  |/pre>....

.Dec| 00001380 6f 64 65 4f 70 74 69 6f 6e 73 20 74 65 6c 6c 73 |odeOptions tells| 00001390 20 67 6f 70 61 63 6b 65 74 20 68 6f 77 20 74 6f | gopacket how to| 000013a0 20 64 65 63 6f 64 65 20 61 20 70 61 63 6b 65 74 | decode a packet| 000013b0 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 |..

..........| 000013c0 09 0a 09 09 09 09 3c 70 72 65 3e 76 61 72 20 44 |......
var D|
        000013d0  65 66 61 75 6c 74 20 44  65 63 6f 64 65 4f 70 74  |efault DecodeOpt|
        000013e0  69 6f 6e 73 20 3d 20 44  65 63 6f 64 65 4f 70 74  |ions = DecodeOpt|
        000013f0  69 6f 6e 73 7b 7d 3c 2f  70 72 65 3e 0a 09 09 09  |ions{}
....| 00001400 09 3c 70 3e 0a 44 65 66 61 75 6c 74 20 64 65 63 |.

.Default dec| 00001410 6f 64 69 6e 67 20 70 72 6f 76 69 64 65 73 20 74 |oding provides t| 00001420 68 65 20 73 61 66 65 73 74 20 28 62 75 74 20 73 |he safest (but s| 00001430 6c 6f 77 65 73 74 29 20 6d 65 74 68 6f 64 20 66 |lowest) method f| 00001440 6f 72 20 64 65 63 6f 64 69 6e 67 0a 70 61 63 6b |or decoding.pack| 00001450 65 74 73 2e 20 20 49 74 20 65 61 67 65 72 6c 79 |ets. It eagerly| 00001460 20 70 72 6f 63 65 73 73 65 73 20 61 6c 6c 20 6c | processes all l| 00001470 61 79 65 72 73 20 28 73 6f 20 69 74 26 23 33 39 |ayers (so it'| 00001480 3b 73 20 63 6f 6e 63 75 72 72 65 6e 63 79 2d 73 |;s concurrency-s| 00001490 61 66 65 29 20 61 6e 64 20 69 74 0a 63 6f 70 69 |afe) and it.copi| 000014a0 65 73 20 69 74 73 20 69 6e 70 75 74 20 62 75 66 |es its input buf| 000014b0 66 65 72 20 75 70 6f 6e 20 63 72 65 61 74 69 6f |fer upon creatio| 000014c0 6e 20 6f 66 20 74 68 65 20 70 61 63 6b 65 74 20 |n of the packet | 000014d0 28 73 6f 20 74 68 65 20 70 61 63 6b 65 74 20 72 |(so the packet r| 000014e0 65 6d 61 69 6e 73 0a 76 61 6c 69 64 20 69 66 20 |emains.valid if | 000014f0 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 73 |the underlying s| 00001500 6c 69 63 65 20 69 73 20 6d 6f 64 69 66 69 65 64 |lice is modified| 00001510 2e 20 20 42 6f 74 68 20 6f 66 20 74 68 65 73 65 |. Both of these| 00001520 20 74 61 6b 65 20 74 69 6d 65 2c 0a 74 68 6f 75 | take time,.thou| 00001530 67 68 2c 20 73 6f 20 62 65 77 61 72 65 2e 20 20 |gh, so beware. | 00001540 49 66 20 79 6f 75 20 63 61 6e 20 67 75 61 72 61 |If you can guara| 00001550 6e 74 65 65 20 74 68 61 74 20 74 68 65 20 70 61 |ntee that the pa| 00001560 63 6b 65 74 20 77 69 6c 6c 20 6f 6e 6c 79 20 62 |cket will only b| 00001570 65 20 75 73 65 64 0a 62 79 20 6f 6e 65 20 67 6f |e used.by one go| 00001580 72 6f 75 74 69 6e 65 20 61 74 20 61 20 74 69 6d |routine at a tim| 00001590 65 2c 20 73 65 74 20 4c 61 7a 79 20 64 65 63 6f |e, set Lazy deco| 000015a0 64 69 6e 67 2e 20 20 49 66 20 79 6f 75 20 63 61 |ding. If you ca| 000015b0 6e 20 67 75 61 72 61 6e 74 65 65 20 74 68 61 74 |n guarantee that| 000015c0 0a 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 |.the underlying | 000015d0 73 6c 69 63 65 20 77 6f 6e 26 23 33 39 3b 74 20 |slice won't | 000015e0 63 68 61 6e 67 65 2c 20 73 65 74 20 4e 6f 43 6f |change, set NoCo| 000015f0 70 79 20 64 65 63 6f 64 69 6e 67 2e 0a 3c 2f 70 |py decoding............

|
        00001610  76 61 72 20 4c 61 7a 79  20 44 65 63 6f 64 65 4f  |var Lazy DecodeO|
        00001620  70 74 69 6f 6e 73 20 3d  20 44 65 63 6f 64 65 4f  |ptions = DecodeO|
        00001630  70 74 69 6f 6e 73 7b 4c  61 7a 79 3a 20 74 72 75  |ptions{Lazy: tru|
        00001640  65 7d 3c 2f 70 72 65 3e  0a 09 09 09 09 3c 70 3e  |e}
.....

| 00001650 0a 4c 61 7a 79 20 69 73 20 61 20 44 65 63 6f 64 |.Lazy is a Decod| 00001660 65 4f 70 74 69 6f 6e 73 20 77 69 74 68 20 6a 75 |eOptions with ju| 00001670 73 74 20 4c 61 7a 79 20 73 65 74 2e 0a 3c 2f 70 |st Lazy set............

|
        00001690  76 61 72 20 4e 6f 43 6f  70 79 20 44 65 63 6f 64  |var NoCopy Decod|
        000016a0  65 4f 70 74 69 6f 6e 73  20 3d 20 44 65 63 6f 64  |eOptions = Decod|
        000016b0  65 4f 70 74 69 6f 6e 73  7b 4e 6f 43 6f 70 79 3a  |eOptions{NoCopy:|
        000016c0  20 74 72 75 65 7d 3c 2f  70 72 65 3e 0a 09 09 09  | true}
....| 000016d0 09 3c 70 3e 0a 4e 6f 43 6f 70 79 20 69 73 20 61 |.

.NoCopy is a| 000016e0 20 44 65 63 6f 64 65 4f 70 74 69 6f 6e 73 20 77 | DecodeOptions w| 000016f0 69 74 68 20 6a 75 73 74 20 4e 6f 43 6f 70 79 20 |ith just NoCopy | 00001700 73 65 74 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 0a 0a |set..

.......| 00001710 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 |................| 00001720 0a 09 09 09 0a 09 09 09 0a 09 09 09 3c 68 32 20 |............

typ| 00001740 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f |e Deco| 00001790 64 65 72 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 |der

....| 000017a0 3c 70 72 65 3e 74 79 70 65 20 44 65 63 6f 64 65 |
type Decode|
        000017b0  72 20 69 6e 74 65 72 66  61 63 65 20 7b 0a 20 20  |r interface {.  |
        000017c0  20 20 3c 73 70 61 6e 20  63 6c 61 73 73 3d 22 63  |  // Decod|
        000017e0  65 20 64 65 63 6f 64 65  73 20 74 68 65 20 62 79  |e decodes the by|
        000017f0  74 65 73 20 6f 66 20 61  20 70 61 63 6b 65 74 2c  |tes of a packet,|
        00001800  20 73 65 6e 64 69 6e 67  20 64 65 63 6f 64 65 64  | sending decoded|
        00001810  20 76 61 6c 75 65 73 20  61 6e 64 20 6f 74 68 65  | values and othe|
        00001820  72 3c 2f 73 70 61 6e 3e  0a 20 20 20 20 3c 73 70  |r.    // informatio|
        00001850  6e 20 74 6f 20 50 61 63  6b 65 74 42 75 69 6c 64  |n to PacketBuild|
        00001860  65 72 2c 20 61 6e 64 20  72 65 74 75 72 6e 69 6e  |er, and returnin|
        00001870  67 20 61 6e 20 65 72 72  6f 72 20 69 66 20 75 6e  |g an error if un|
        00001880  73 75 63 63 65 73 73 66  75 6c 2e 20 20 53 65 65  |successful.  See|
        00001890  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 3c 73 70 61  |.    // the PacketB|
        000018c0  75 69 6c 64 65 72 20 64  6f 63 75 6d 65 6e 74 61  |uilder documenta|
        000018d0  74 69 6f 6e 20 66 6f 72  20 6d 6f 72 65 20 64 65  |tion for more de|
        000018e0  74 61 69 6c 73 2e 3c 2f  73 70 61 6e 3e 0a 20 20  |tails..  |
        000018f0  20 20 44 65 63 6f 64 65  28 5b 5d 62 79 74 65 2c  |  Decode([]byte,|
        00001900  20 50 61 63 6b 65 74 42  75 69 6c 64 65 72 29 20  | PacketBuilder) |
        00001910  65 72 72 6f 72 0a 7d 3c  2f 70 72 65 3e 0a 09 09  |error.}
...| 00001920 09 3c 70 3e 0a 44 65 63 6f 64 65 72 20 69 73 20 |.

.Decoder is | 00001930 61 6e 20 69 6e 74 65 72 66 61 63 65 20 66 6f 72 |an interface for| 00001940 20 6c 6f 67 69 63 20 74 6f 20 64 65 63 6f 64 65 | logic to decode| 00001950 20 61 20 70 61 63 6b 65 74 20 6c 61 79 65 72 2e | a packet layer.| 00001960 20 20 55 73 65 72 73 20 6d 61 79 0a 69 6d 70 6c | Users may.impl| 00001970 65 6d 65 6e 74 20 61 20 44 65 63 6f 64 65 72 20 |ement a Decoder | 00001980 74 6f 20 68 61 6e 64 6c 65 20 74 68 65 69 72 20 |to handle their | 00001990 6f 77 6e 20 73 74 72 61 6e 67 65 20 70 61 63 6b |own strange pack| 000019a0 65 74 20 74 79 70 65 73 2c 20 6f 72 20 6d 61 79 |et types, or may| 000019b0 20 75 73 65 20 6f 6e 65 0a 6f 66 20 74 68 65 20 | use one.of the | 000019c0 6d 61 6e 79 20 64 65 63 6f 64 65 72 73 20 61 76 |many decoders av| 000019d0 61 69 6c 61 62 6c 65 20 69 6e 20 74 68 65 20 26 |ailable in the &| 000019e0 23 33 39 3b 6c 61 79 65 72 73 26 23 33 39 3b 20 |#39;layers' | 000019f0 73 75 62 70 61 63 6b 61 67 65 20 74 6f 20 64 65 |subpackage to de| 00001a00 63 6f 64 65 20 74 68 69 6e 67 73 0a 66 6f 72 20 |code things.for | 00001a10 74 68 65 6d 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 |them..

......| 00001a20 0a 0a 09 09 09 0a 09 09 09 09 3c 70 72 65 3e 76 |..........
v|
        00001a30  61 72 20 44 65 63 6f 64  65 50 61 79 6c 6f 61 64  |ar DecodePayload|
        00001a40  20 44 65 63 6f 64 65 72  20 3d 20 44 65 63 6f 64  | Decoder = Decod|
        00001a50  65 46 75 6e 63 28 64 65  63 6f 64 65 50 61 79 6c  |eFunc(decodePayl|
        00001a60  6f 61 64 29 3c 2f 70 72  65 3e 0a 09 09 09 09 3c  |oad)
.....<| 00001a70 70 3e 0a 44 65 63 6f 64 65 50 61 79 6c 6f 61 64 |p>.DecodePayload| 00001a80 20 69 73 20 61 20 44 65 63 6f 64 65 72 20 74 68 | is a Decoder th| 00001a90 61 74 20 72 65 74 75 72 6e 73 20 61 20 50 61 79 |at returns a Pay| 00001aa0 6c 6f 61 64 20 6c 61 79 65 72 20 63 6f 6e 74 61 |load layer conta| 00001ab0 69 6e 69 6e 67 20 61 6c 6c 0a 72 65 6d 61 69 6e |ining all.remain| 00001ac0 69 6e 67 20 62 79 74 65 73 2e 0a 3c 2f 70 3e 0a |ing bytes..

.| 00001ad0 0a 09 09 09 0a 09 09 09 09 3c 70 72 65 3e 76 61 |.........
va|
        00001ae0  72 20 44 65 63 6f 64 65  55 6e 6b 6e 6f 77 6e 20  |r DecodeUnknown |
        00001af0  44 65 63 6f 64 65 72 20  3d 20 44 65 63 6f 64 65  |Decoder = Decode|
        00001b00  46 75 6e 63 28 64 65 63  6f 64 65 55 6e 6b 6e 6f  |Func(decodeUnkno|
        00001b10  77 6e 29 3c 2f 70 72 65  3e 0a 09 09 09 09 3c 70  |wn)
......DecodeUnknown | 00001b30 69 73 20 61 20 44 65 63 6f 64 65 72 20 74 68 61 |is a Decoder tha| 00001b40 74 20 72 65 74 75 72 6e 73 20 61 20 44 65 63 6f |t returns a Deco| 00001b50 64 65 46 61 69 6c 75 72 65 20 6c 61 79 65 72 20 |deFailure layer | 00001b60 63 6f 6e 74 61 69 6e 69 6e 67 20 61 6c 6c 0a 72 |containing all.r| 00001b70 65 6d 61 69 6e 69 6e 67 20 62 79 74 65 73 2c 20 |emaining bytes, | 00001b80 75 73 65 66 75 6c 20 69 66 20 79 6f 75 20 72 75 |useful if you ru| 00001b90 6e 20 75 70 20 61 67 61 69 6e 73 74 20 61 20 6c |n up against a l| 00001ba0 61 79 65 72 20 74 68 61 74 20 79 6f 75 26 23 33 |ayer that you| 00001bb0 39 3b 72 65 20 75 6e 61 62 6c 65 20 74 6f 0a 64 |9;re unable to.d| 00001bc0 65 63 6f 64 65 20 79 65 74 2e 0a 3c 2f 70 3e 0a |ecode yet..

.| 00001bd0 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a |................| 00001be0 09 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 |................| 00001bf0 09 09 3c 68 32 20 69 64 3d 22 45 6e 64 70 6f 69 |..

type E| 00001c50 6e 64 70 6f 69 6e 74 3c 2f 61 3e 3c 2f 68 32 3e |ndpoint

| 00001c60 0a 09 09 09 3c 70 72 65 3e 74 79 70 65 20 45 6e |....
type En|
        00001c70  64 70 6f 69 6e 74 20 73  74 72 75 63 74 20 7b 0a  |dpoint struct {.|
        00001c80  20 20 20 20 3c 73 70 61  6e 20 63 6c 61 73 73 3d  |    // con|
        00001ca0  74 61 69 6e 73 20 66 69  6c 74 65 72 65 64 20 6f  |tains filtered o|
        00001cb0  72 20 75 6e 65 78 70 6f  72 74 65 64 20 66 69 65  |r unexported fie|
        00001cc0  6c 64 73 3c 2f 73 70 61  6e 3e 0a 7d 3c 2f 70 72  |lds.}....

.Endpoi| 00001ce0 6e 74 20 69 73 20 74 68 65 20 73 65 74 20 6f 66 |nt is the set of| 00001cf0 20 62 79 74 65 73 20 75 73 65 64 20 74 6f 20 61 | bytes used to a| 00001d00 64 64 72 65 73 73 20 70 61 63 6b 65 74 73 20 61 |ddress packets a| 00001d10 74 20 76 61 72 69 6f 75 73 20 6c 61 79 65 72 73 |t various layers| 00001d20 2e 0a 53 65 65 20 4c 69 6e 6b 4c 61 79 65 72 2c |..See LinkLayer,| 00001d30 20 4e 65 74 77 6f 72 6b 4c 61 79 65 72 2c 20 61 | NetworkLayer, a| 00001d40 6e 64 20 54 72 61 6e 73 70 6f 72 74 4c 61 79 65 |nd TransportLaye| 00001d50 72 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e 73 |r specifications| 00001d60 2e 0a 45 6e 64 70 6f 69 6e 74 73 20 61 72 65 20 |..Endpoints are | 00001d70 75 73 61 62 6c 65 20 61 73 20 6d 61 70 20 6b 65 |usable as map ke| 00001d80 79 73 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a |ys..

........| 00001d90 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 |................| 00001da0 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 4e |.......

func| 00001dc0 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 | NewEnd| 00001e10 70 6f 69 6e 74 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 |point

..| 00001e20 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 4e 65 77 |...
func New|
        00001e30  45 6e 64 70 6f 69 6e 74  28 74 79 70 20 45 6e 64  |Endpoint(typ End|
        00001e40  70 6f 69 6e 74 54 79 70  65 2c 20 72 61 77 20 5b  |pointType, raw [|
        00001e50  5d 62 79 74 65 29 20 45  6e 64 70 6f 69 6e 74 3c  |]byte) Endpoint<|
        00001e60  2f 70 72 65 3e 0a 09 09  09 09 3c 70 3e 0a 4e 65  |/pre>.....

.Ne| 00001e70 77 45 6e 64 70 6f 69 6e 74 20 63 72 65 61 74 65 |wEndpoint create| 00001e80 73 20 61 20 6e 65 77 20 45 6e 64 70 6f 69 6e 74 |s a new Endpoint| 00001e90 20 6f 62 6a 65 63 74 2e 0a 3c 2f 70 3e 0a 0a 09 | object..

...| 00001ea0 09 09 09 0a 09 09 09 0a 0a 09 09 09 0a 09 09 09 |................| 00001eb0 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 45 6e |......

func (Endpo| 00001ee0 69 6e 74 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 |int) Endp| 00001f30 6f 69 6e 74 54 79 70 65 3c 2f 61 3e 3c 2f 68 33 |ointType.....
func |
        00001f50  28 65 20 45 6e 64 70 6f  69 6e 74 29 20 45 6e 64  |(e Endpoint) End|
        00001f60  70 6f 69 6e 74 54 79 70  65 28 29 20 45 6e 64 70  |pointType() Endp|
        00001f70  6f 69 6e 74 54 79 70 65  3c 2f 70 72 65 3e 0a 09  |ointType
..| 00001f80 09 09 09 3c 70 3e 0a 45 6e 64 70 6f 69 6e 74 54 |...

.EndpointT| 00001f90 79 70 65 20 72 65 74 75 72 6e 73 20 74 68 65 20 |ype returns the | 00001fa0 65 6e 64 70 6f 69 6e 74 20 74 79 70 65 20 61 73 |endpoint type as| 00001fb0 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 |sociated with th| 00001fc0 69 73 20 65 6e 64 70 6f 69 6e 74 2e 0a 3c 2f 70 |is endpoint.................| 00001fe0 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 |..........

func (Endpo| 00002010 69 6e 74 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 |int) Le| 00002060 73 73 54 68 61 6e 3c 2f 61 3e 3c 2f 68 33 3e 0a |ssThan

.| 00002070 09 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 61 |....
func (a|
        00002080  20 45 6e 64 70 6f 69 6e  74 29 20 4c 65 73 73 54  | Endpoint) LessT|
        00002090  68 61 6e 28 62 20 45 6e  64 70 6f 69 6e 74 29 20  |han(b Endpoint) |
        000020a0  62 6f 6f 6c 3c 2f 70 72  65 3e 0a 09 09 09 09 3c  |bool
.....<| 000020b0 70 3e 0a 4c 65 73 73 54 68 61 6e 20 70 72 6f 76 |p>.LessThan prov| 000020c0 69 64 65 73 20 61 20 73 74 61 62 6c 65 20 6f 72 |ides a stable or| 000020d0 64 65 72 69 6e 67 20 66 6f 72 20 61 6c 6c 20 65 |dering for all e| 000020e0 6e 64 70 6f 69 6e 74 73 2e 20 20 49 74 20 73 6f |ndpoints. It so| 000020f0 72 74 73 20 66 69 72 73 74 20 62 61 73 65 64 0a |rts first based.| 00002100 6f 6e 20 74 68 65 20 45 6e 64 70 6f 69 6e 74 54 |on the EndpointT| 00002110 79 70 65 20 6f 66 20 61 6e 20 65 6e 64 70 6f 69 |ype of an endpoi| 00002120 6e 74 2c 20 74 68 65 6e 20 62 61 73 65 64 20 6f |nt, then based o| 00002130 6e 20 74 68 65 20 72 61 77 20 62 79 74 65 73 20 |n the raw bytes | 00002140 6f 66 20 74 68 61 74 20 65 6e 64 70 6f 69 6e 74 |of that endpoint| 00002150 2e 0a 46 6f 72 20 73 6f 6d 65 20 65 6e 64 70 6f |..For some endpo| 00002160 69 6e 74 73 2c 20 74 68 65 20 61 63 74 75 61 6c |ints, the actual| 00002170 20 63 6f 6d 70 61 72 69 73 6f 6e 20 6d 61 79 20 | comparison may | 00002180 6e 6f 74 20 6d 61 6b 65 20 73 65 6e 73 65 2c 20 |not make sense, | 00002190 68 6f 77 65 76 65 72 20 74 68 69 73 0a 6f 72 64 |however this.ord| 000021a0 65 72 69 6e 67 20 64 6f 65 73 20 70 72 6f 76 69 |ering does provi| 000021b0 64 65 20 75 73 65 66 75 6c 20 69 6e 66 6f 72 6d |de useful inform| 000021c0 61 74 69 6f 6e 20 66 6f 72 20 6d 6f 73 74 20 45 |ation for most E| 000021d0 6e 64 70 6f 69 6e 74 20 74 79 70 65 73 2e 0a 3c |ndpoint types..<| 000021e0 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 09 09 0a 09 |/p>.............| 000021f0 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 |............

func (Endpoint| 00002220 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f |) Raw| 00002270 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 72 65 3e 66 |

.....
f|
        00002280  75 6e 63 20 28 65 20 45  6e 64 70 6f 69 6e 74 29  |unc (e Endpoint)|
        00002290  20 52 61 77 28 29 20 5b  5d 62 79 74 65 3c 2f 70  | Raw() []byte.....

.Raw | 000022b0 72 65 74 75 72 6e 73 20 74 68 65 20 72 61 77 20 |returns the raw | 000022c0 62 79 74 65 73 20 6f 66 20 74 68 69 73 20 65 6e |bytes of this en| 000022d0 64 70 6f 69 6e 74 2e 20 20 54 68 65 73 65 20 61 |dpoint. These a| 000022e0 72 65 6e 26 23 33 39 3b 74 20 68 75 6d 61 6e 2d |ren't human-| 000022f0 72 65 61 64 61 62 6c 65 0a 6d 6f 73 74 20 6f 66 |readable.most of| 00002300 20 74 68 65 20 74 69 6d 65 2c 20 62 75 74 20 74 | the time, but t| 00002310 68 65 79 20 61 72 65 20 66 61 73 74 65 72 20 74 |hey are faster t| 00002320 68 61 6e 20 63 61 6c 6c 69 6e 67 20 53 74 72 69 |han calling Stri| 00002330 6e 67 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 |ng..

........| 00002340 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00002350 09 3c 68 33 20 69 64 3d 22 45 6e 64 70 6f 69 6e |.

func (| 00002370 45 6e 64 70 6f 69 6e 74 29 20 3c 61 20 68 72 65 |Endpoint) String.....
func|
        000023e0  20 28 65 20 45 6e 64 70  6f 69 6e 74 29 20 53 74  | (e Endpoint) St|
        000023f0  72 69 6e 67 28 29 20 73  74 72 69 6e 67 3c 2f 70  |ring() string.............|
        00002410  09 09 0a 09 09 09 0a 09  09 0a 09 09 09 0a 09 09  |................|
        00002420  09 0a 09 09 09 3c 68 32  20 69 64 3d 22 45 6e 64  |.....

type | 00002440 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b |Endpoin| 00002490 74 54 79 70 65 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 |tType

..| 000024a0 09 09 3c 70 72 65 3e 74 79 70 65 20 45 6e 64 70 |..
type Endp|
        000024b0  6f 69 6e 74 54 79 70 65  20 69 6e 74 36 34 3c 2f  |ointType int64....

.Endp| 000024d0 6f 69 6e 74 54 79 70 65 20 69 73 20 74 68 65 20 |ointType is the | 000024e0 74 79 70 65 20 6f 66 20 61 20 67 6f 70 61 63 6b |type of a gopack| 000024f0 65 74 20 45 6e 64 70 6f 69 6e 74 2e 20 20 54 68 |et Endpoint. Th| 00002500 69 73 20 74 79 70 65 20 64 65 74 65 72 6d 69 6e |is type determin| 00002510 65 73 20 68 6f 77 0a 74 68 65 20 62 79 74 65 73 |es how.the bytes| 00002520 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 65 | stored in the e| 00002530 6e 64 70 6f 69 6e 74 20 73 68 6f 75 6c 64 20 62 |ndpoint should b| 00002540 65 20 69 6e 74 65 72 70 72 65 74 65 64 2e 0a 3c |e interpreted..<| 00002550 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a |/p>.............| 00002560 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 0a 09 09 |................| 00002570 09 09 3c 68 33 20 69 64 3d 22 52 65 67 69 73 74 |..

| 00002590 66 75 6e 63 20 3c 61 20 68 72 65 66 3d 22 2f 73 |func Re| 000025e0 67 69 73 74 65 72 45 6e 64 70 6f 69 6e 74 54 79 |gisterEndpointTy| 000025f0 70 65 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 |pe

.....| 00002600 3c 70 72 65 3e 66 75 6e 63 20 52 65 67 69 73 74 |
func Regist|
        00002610  65 72 45 6e 64 70 6f 69  6e 74 54 79 70 65 28 6e  |erEndpointType(n|
        00002620  75 6d 20 69 6e 74 2c 20  6d 65 74 61 20 45 6e 64  |um int, meta End|
        00002630  70 6f 69 6e 74 54 79 70  65 4d 65 74 61 64 61 74  |pointTypeMetadat|
        00002640  61 29 20 45 6e 64 70 6f  69 6e 74 54 79 70 65 3c  |a) EndpointType<|
        00002650  2f 70 72 65 3e 0a 09 09  09 09 3c 70 3e 0a 52 65  |/pre>.....

.Re| 00002660 67 69 73 74 65 72 45 6e 64 70 6f 69 6e 74 54 79 |gisterEndpointTy| 00002670 70 65 20 63 72 65 61 74 65 73 20 61 20 6e 65 77 |pe creates a new| 00002680 20 45 6e 64 70 6f 69 6e 74 54 79 70 65 20 61 6e | EndpointType an| 00002690 64 20 72 65 67 69 73 74 65 72 73 20 69 74 20 67 |d registers it g| 000026a0 6c 6f 62 61 6c 6c 79 2e 0a 49 74 20 4d 55 53 54 |lobally..It MUST| 000026b0 20 62 65 20 70 61 73 73 65 64 20 61 20 75 6e 69 | be passed a uni| 000026c0 71 75 65 20 6e 75 6d 62 65 72 2c 20 6f 72 20 69 |que number, or i| 000026d0 74 20 77 69 6c 6c 20 70 61 6e 69 63 2e 20 20 4e |t will panic. N| 000026e0 75 6d 62 65 72 73 20 30 2d 39 39 39 20 61 72 65 |umbers 0-999 are| 000026f0 0a 72 65 73 65 72 76 65 64 20 66 6f 72 20 67 6f |.reserved for go| 00002700 70 61 63 6b 65 74 26 23 33 39 3b 73 20 75 73 65 |packet's use| 00002710 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 09 |..

..........| 00002720 0a 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c |...............<| 00002730 68 33 20 69 64 3d 22 45 6e 64 70 6f 69 6e 74 54 |h3 id="EndpointT| 00002740 79 70 65 2e 53 74 72 69 6e 67 22 3e 66 75 6e 63 |ype.String">func| 00002750 20 28 45 6e 64 70 6f 69 6e 74 54 79 70 65 29 20 | (EndpointType) | 00002760 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b |String<| 000027b0 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 72 |/a>

.....func (e Endpoi| 000027d0 6e 74 54 79 70 65 29 20 53 74 72 69 6e 67 28 29 |ntType) String()| 000027e0 20 73 74 72 69 6e 67 3c 2f 70 72 65 3e 0a 09 09 | string
...| 000027f0 09 09 0a 09 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00002800 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 3c |...............<| 00002810 68 32 20 69 64 3d 22 45 6e 64 70 6f 69 6e 74 54 |h2 id="EndpointT| 00002820 79 70 65 4d 65 74 61 64 61 74 61 22 3e 74 79 70 |ypeMetadata">typ| 00002830 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f |e Endpo| 00002880 69 6e 74 54 79 70 65 4d 65 74 61 64 61 74 61 3c |intTypeMetadata<| 00002890 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 65 |/a>

....type EndpointTy| 000028b0 70 65 4d 65 74 61 64 61 74 61 20 73 74 72 75 63 |peMetadata struc| 000028c0 74 20 7b 0a 20 20 20 20 3c 73 70 61 6e 20 63 6c |t {. //| 000028e0 20 4e 61 6d 65 20 69 73 20 74 68 65 20 73 74 72 | Name is the str| 000028f0 69 6e 67 20 72 65 74 75 72 6e 65 64 20 62 79 20 |ing returned by | 00002900 61 6e 20 45 6e 64 70 6f 69 6e 74 54 79 70 65 26 |an EndpointType&| 00002910 23 33 39 3b 73 20 53 74 72 69 6e 67 20 66 75 6e |#39;s String fun| 00002920 63 74 69 6f 6e 2e 3c 2f 73 70 61 6e 3e 0a 20 20 |ction.. | 00002930 20 20 4e 61 6d 65 20 73 74 72 69 6e 67 0a 20 20 | Name string. | 00002940 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 63 | // Forma| 00002960 74 74 65 72 20 69 73 20 63 61 6c 6c 65 64 20 66 |tter is called f| 00002970 72 6f 6d 20 61 6e 20 45 6e 64 70 6f 69 6e 74 26 |rom an Endpoint&| 00002980 23 33 39 3b 73 20 53 74 72 69 6e 67 20 66 75 6e |#39;s String fun| 00002990 63 74 69 6f 6e 20 74 6f 20 66 6f 72 6d 61 74 20 |ction to format | 000029a0 74 68 65 20 72 61 77 3c 2f 73 70 61 6e 3e 0a 20 |the raw. | 000029b0 20 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 | // byte| 000029d0 73 20 69 6e 20 61 6e 20 45 6e 64 70 6f 69 6e 74 |s in an Endpoint| 000029e0 20 69 6e 74 6f 20 61 20 68 75 6d 61 6e 2d 72 65 | into a human-re| 000029f0 61 64 61 62 6c 65 20 73 74 72 69 6e 67 2e 3c 2f |adable string.. Format| 00002a10 74 65 72 20 66 75 6e 63 28 5b 5d 62 79 74 65 29 |ter func([]byte)| 00002a20 20 73 74 72 69 6e 67 0a 7d 3c 2f 70 72 65 3e 0a | string.}
.| 00002a30 09 09 09 3c 70 3e 0a 45 6e 64 70 6f 69 6e 74 54 |...

.EndpointT| 00002a40 79 70 65 4d 65 74 61 64 61 74 61 20 69 73 20 75 |ypeMetadata is u| 00002a50 73 65 64 20 74 6f 20 72 65 67 69 73 74 65 72 20 |sed to register | 00002a60 61 20 6e 65 77 20 65 6e 64 70 6f 69 6e 74 20 74 |a new endpoint t| 00002a70 79 70 65 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a |ype..

.......| 00002a80 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a |................| 00002a90 09 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 |................| 00002aa0 09 09 3c 68 32 20 69 64 3d 22 45 72 72 6f 72 4c |..

type ErrorLayer

....
t|
        00002b20  79 70 65 20 45 72 72 6f  72 4c 61 79 65 72 20 69  |ype ErrorLayer i|
        00002b30  6e 74 65 72 66 61 63 65  20 7b 0a 20 20 20 20 4c  |nterface {.    L|
        00002b40  61 79 65 72 0a 20 20 20  20 45 72 72 6f 72 28 29  |ayer.    Error()|
        00002b50  20 65 72 72 6f 72 0a 7d  3c 2f 70 72 65 3e 0a 09  | error.}
..| 00002b60 09 09 3c 70 3e 0a 45 72 72 6f 72 4c 61 79 65 72 |..

.ErrorLayer| 00002b70 20 69 73 20 61 20 70 61 63 6b 65 74 20 6c 61 79 | is a packet lay| 00002b80 65 72 20 63 72 65 61 74 65 64 20 77 68 65 6e 20 |er created when | 00002b90 64 65 63 6f 64 69 6e 67 20 6f 66 20 74 68 65 20 |decoding of the | 00002ba0 70 61 63 6b 65 74 20 68 61 73 20 66 61 69 6c 65 |packet has faile| 00002bb0 64 2e 0a 49 74 73 20 70 61 79 6c 6f 61 64 20 69 |d..Its payload i| 00002bc0 73 20 61 6c 6c 20 74 68 65 20 62 79 74 65 73 20 |s all the bytes | 00002bd0 74 68 61 74 20 77 65 20 77 65 72 65 20 75 6e 61 |that we were una| 00002be0 62 6c 65 20 74 6f 20 64 65 63 6f 64 65 2c 20 61 |ble to decode, a| 00002bf0 6e 64 20 74 68 65 20 72 65 74 75 72 6e 65 64 0a |nd the returned.| 00002c00 65 72 72 6f 72 20 64 65 74 61 69 6c 73 20 77 68 |error details wh| 00002c10 79 20 74 68 65 20 64 65 63 6f 64 69 6e 67 20 66 |y the decoding f| 00002c20 61 69 6c 65 64 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 |ailed..

.....| 00002c30 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 |................| 00002c40 0a 0a 09 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 |................| 00002c50 0a 09 09 09 3c 68 32 20 69 64 3d 22 46 6c 6f 77 |....

type | 00002cb0 46 6c 6f 77 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 |Flow

...| 00002cc0 09 3c 70 72 65 3e 74 79 70 65 20 46 6c 6f 77 20 |.
type Flow |
        00002cd0  73 74 72 75 63 74 20 7b  0a 20 20 20 20 3c 73 70  |struct {.    // contains f|
        00002d00  69 6c 74 65 72 65 64 20  6f 72 20 75 6e 65 78 70  |iltered or unexp|
        00002d10  6f 72 74 65 64 20 66 69  65 6c 64 73 3c 2f 73 70  |orted fields.}
....<| 00002d30 70 3e 0a 46 6c 6f 77 20 72 65 70 72 65 73 65 6e |p>.Flow represen| 00002d40 74 73 20 74 68 65 20 64 69 72 65 63 74 69 6f 6e |ts the direction| 00002d50 20 6f 66 20 74 72 61 66 66 69 63 20 66 6f 72 20 | of traffic for | 00002d60 61 20 70 61 63 6b 65 74 20 6c 61 79 65 72 2c 20 |a packet layer, | 00002d70 61 73 20 61 20 73 6f 75 72 63 65 20 61 6e 64 20 |as a source and | 00002d80 64 65 73 74 69 6e 61 74 69 6f 6e 20 45 6e 64 70 |destination Endp| 00002d90 6f 69 6e 74 2e 0a 46 6c 6f 77 73 20 61 72 65 20 |oint..Flows are | 00002da0 75 73 61 62 6c 65 20 61 73 20 6d 61 70 20 6b 65 |usable as map ke| 00002db0 79 73 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a |ys..

........| 00002dc0 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 |................| 00002dd0 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 46 |.......

func | 00002e40 46 6c 6f 77 46 72 6f 6d 45 6e 64 70 6f 69 6e 74 |FlowFromEndpoint| 00002e50 73 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c |s

.....<| 00002e60 70 72 65 3e 66 75 6e 63 20 46 6c 6f 77 46 72 6f |pre>func FlowFro| 00002e70 6d 45 6e 64 70 6f 69 6e 74 73 28 73 72 63 2c 20 |mEndpoints(src, | 00002e80 64 73 74 20 45 6e 64 70 6f 69 6e 74 29 20 28 5f |dst Endpoint) (_| 00002e90 20 46 6c 6f 77 2c 20 65 72 72 20 65 72 72 6f 72 | Flow, err error| 00002ea0 29 3c 2f 70 72 65 3e 0a 09 09 09 09 3c 70 3e 0a |)
.....

.| 00002eb0 46 6c 6f 77 46 72 6f 6d 45 6e 64 70 6f 69 6e 74 |FlowFromEndpoint| 00002ec0 73 20 63 72 65 61 74 65 73 20 61 20 6e 65 77 20 |s creates a new | 00002ed0 66 6c 6f 77 20 62 79 20 70 61 73 74 69 6e 67 20 |flow by pasting | 00002ee0 74 6f 67 65 74 68 65 72 20 74 77 6f 20 65 6e 64 |together two end| 00002ef0 70 6f 69 6e 74 73 2e 0a 54 68 65 20 65 6e 64 70 |points..The endp| 00002f00 6f 69 6e 74 73 20 6d 75 73 74 20 68 61 76 65 20 |oints must have | 00002f10 74 68 65 20 73 61 6d 65 20 45 6e 64 70 6f 69 6e |the same Endpoin| 00002f20 74 54 79 70 65 2c 20 6f 72 20 74 68 69 73 20 66 |tType, or this f| 00002f30 75 6e 63 74 69 6f 6e 20 77 69 6c 6c 20 72 65 74 |unction will ret| 00002f40 75 72 6e 0a 61 6e 20 65 72 72 6f 72 2e 0a 3c 2f |urn.an error................| 00002f60 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 4e 65 |......

func NewFlow

.....
|
        00002fe0  66 75 6e 63 20 4e 65 77  46 6c 6f 77 28 74 20 45  |func NewFlow(t E|
        00002ff0  6e 64 70 6f 69 6e 74 54  79 70 65 2c 20 73 72 63  |ndpointType, src|
        00003000  2c 20 64 73 74 20 5b 5d  62 79 74 65 29 20 46 6c  |, dst []byte) Fl|
        00003010  6f 77 3c 2f 70 72 65 3e  0a 09 09 09 09 3c 70 3e  |ow
.....

| 00003020 0a 4e 65 77 46 6c 6f 77 20 63 72 65 61 74 65 73 |.NewFlow creates| 00003030 20 61 20 6e 65 77 20 66 6c 6f 77 2e 0a 3c 2f 70 | a new flow.................| 00003050 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 |..........

func| 00003070 20 28 46 6c 6f 77 29 20 3c 61 20 68 72 65 66 3d | (Flow) Dst

..| 000030d0 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 66 20 |...
func (f |
        000030e0  46 6c 6f 77 29 20 44 73  74 28 29 20 28 64 73 74  |Flow) Dst() (dst|
        000030f0  20 45 6e 64 70 6f 69 6e  74 29 3c 2f 70 72 65 3e  | Endpoint)
| 00003100 0a 09 09 09 09 3c 70 3e 0a 44 73 74 20 72 65 74 |.....

.Dst ret| 00003110 75 72 6e 73 20 74 68 65 20 64 65 73 74 69 6e 61 |urns the destina| 00003120 74 69 6f 6e 20 45 6e 64 70 6f 69 6e 74 20 66 6f |tion Endpoint fo| 00003130 72 20 74 68 69 73 20 66 6c 6f 77 2e 0a 3c 2f 70 |r this flow.................| 00003150 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 |..........

func (Flow)| 00003180 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 | Endpoi| 000031d0 6e 74 54 79 70 65 3c 2f 61 3e 3c 2f 68 33 3e 0a |ntType

.| 000031e0 09 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 66 |....
func (f|
        000031f0  20 46 6c 6f 77 29 20 45  6e 64 70 6f 69 6e 74 54  | Flow) EndpointT|
        00003200  79 70 65 28 29 20 45 6e  64 70 6f 69 6e 74 54 79  |ype() EndpointTy|
        00003210  70 65 3c 2f 70 72 65 3e  0a 09 09 09 09 3c 70 3e  |pe
.....

| 00003220 0a 45 6e 64 70 6f 69 6e 74 54 79 70 65 20 72 65 |.EndpointType re| 00003230 74 75 72 6e 73 20 74 68 65 20 45 6e 64 70 6f 69 |turns the Endpoi| 00003240 6e 74 54 79 70 65 20 66 6f 72 20 74 68 69 73 20 |ntType for this | 00003250 46 6c 6f 77 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 |Flow..

......| 00003260 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 |................| 00003270 09 09 09 3c 68 33 20 69 64 3d 22 46 6c 6f 77 2e |...

func | 00003290 28 46 6c 6f 77 29 20 3c 61 20 68 72 65 66 3d 22 |(Flow) Endpoints.....
fun|
        00003300  63 20 28 66 20 46 6c 6f  77 29 20 45 6e 64 70 6f  |c (f Flow) Endpo|
        00003310  69 6e 74 73 28 29 20 28  73 72 63 2c 20 64 73 74  |ints() (src, dst|
        00003320  20 45 6e 64 70 6f 69 6e  74 29 3c 2f 70 72 65 3e  | Endpoint)
| 00003330 0a 09 09 09 09 3c 70 3e 0a 45 6e 64 70 6f 69 6e |.....

.Endpoin| 00003340 74 73 20 72 65 74 75 72 6e 73 20 74 68 65 20 74 |ts returns the t| 00003350 77 6f 20 45 6e 64 70 6f 69 6e 74 73 20 66 6f 72 |wo Endpoints for| 00003360 20 74 68 69 73 20 66 6c 6f 77 2e 0a 3c 2f 70 3e | this flow..

| 00003370 0a 0a 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a |................| 00003380 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d |.........

f| 000033a0 75 6e 63 20 28 46 6c 6f 77 29 20 3c 61 20 68 72 |unc (Flow) Reverse| 00003400 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 72 65 3e 66 |

.....
f|
        00003410  75 6e 63 20 28 66 20 46  6c 6f 77 29 20 52 65 76  |unc (f Flow) Rev|
        00003420  65 72 73 65 28 29 20 46  6c 6f 77 3c 2f 70 72 65  |erse() Flow.....

.Revers| 00003440 65 20 72 65 74 75 72 6e 73 20 61 20 6e 65 77 20 |e returns a new | 00003450 66 6c 6f 77 20 77 69 74 68 20 65 6e 64 70 6f 69 |flow with endpoi| 00003460 6e 74 73 20 72 65 76 65 72 73 65 64 2e 0a 3c 2f |nts reversed................| 00003480 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 |...........

fun| 000034a0 63 20 28 46 6c 6f 77 29 20 3c 61 20 68 72 65 66 |c (Flow) Src

.| 00003500 09 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 66 |....
func (f|
        00003510  20 46 6c 6f 77 29 20 53  72 63 28 29 20 28 73 72  | Flow) Src() (sr|
        00003520  63 20 45 6e 64 70 6f 69  6e 74 29 3c 2f 70 72 65  |c Endpoint).....

.Src re| 00003540 74 75 72 6e 73 20 74 68 65 20 73 6f 75 72 63 65 |turns the source| 00003550 20 45 6e 64 70 6f 69 6e 74 20 66 6f 72 20 74 68 | Endpoint for th| 00003560 69 73 20 66 6c 6f 77 2e 0a 3c 2f 70 3e 0a 0a 09 |is flow..

...| 00003570 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 |................| 00003580 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 46 6c |......

func | 000035a0 28 46 6c 6f 77 29 20 3c 61 20 68 72 65 66 3d 22 |(Flow) | 000035f0 53 74 72 69 6e 67 3c 2f 61 3e 3c 2f 68 33 3e 0a |String

.| 00003600 09 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 66 |....
func (f|
        00003610  20 46 6c 6f 77 29 20 53  74 72 69 6e 67 28 29 20  | Flow) String() |
        00003620  73 74 72 69 6e 67 3c 2f  70 72 65 3e 0a 09 09 09  |string
....| 00003630 09 3c 70 3e 0a 53 74 72 69 6e 67 20 72 65 74 75 |.

.String retu| 00003640 72 6e 73 20 61 20 68 75 6d 61 6e 2d 72 65 61 64 |rns a human-read| 00003650 61 62 6c 65 20 72 65 70 72 65 73 65 6e 74 61 74 |able representat| 00003660 69 6f 6e 20 6f 66 20 74 68 69 73 20 66 6c 6f 77 |ion of this flow| 00003670 2c 20 69 6e 20 74 68 65 20 66 6f 72 6d 0a 26 23 |, in the form.&#| 00003680 33 34 3b 53 72 63 2d 26 67 74 3b 44 73 74 26 23 |34;Src->Dst&#| 00003690 33 34 3b 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 |34;.

........| 000036a0 09 09 09 0a 09 09 09 0a 09 09 0a 09 09 09 0a 09 |................| 000036b0 09 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 4c 61 |......

type L| 00003710 61 79 65 72 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 |ayer

...| 00003720 09 3c 70 72 65 3e 74 79 70 65 20 4c 61 79 65 72 |.
type Layer|
        00003730  20 69 6e 74 65 72 66 61  63 65 20 7b 0a 20 20 20  | interface {.   |
        00003740  20 66 6d 74 2e 53 74 72  69 6e 67 65 72 0a 20 20  | fmt.Stringer.  |
        00003750  20 20 3c 73 70 61 6e 20  63 6c 61 73 73 3d 22 63  |  // Layer|
        00003770  54 79 70 65 20 69 73 20  74 68 65 20 67 6f 70 61  |Type is the gopa|
        00003780  63 6b 65 74 20 74 79 70  65 20 66 6f 72 20 74 68  |cket type for th|
        00003790  69 73 20 6c 61 79 65 72  2e 3c 2f 73 70 61 6e 3e  |is layer.|
        000037a0  0a 20 20 20 20 4c 61 79  65 72 54 79 70 65 28 29  |.    LayerType()|
        000037b0  20 4c 61 79 65 72 54 79  70 65 0a 20 20 20 20 3c  | LayerType.    <|
        000037c0  73 70 61 6e 20 63 6c 61  73 73 3d 22 63 6f 6d 6d  |span class="comm|
        000037d0  65 6e 74 22 3e 2f 2f 20  4c 61 79 65 72 43 6f 6e  |ent">// LayerCon|
        000037e0  74 65 6e 74 73 20 72 65  74 75 72 6e 73 20 74 68  |tents returns th|
        000037f0  65 20 73 65 74 20 6f 66  20 62 79 74 65 73 20 74  |e set of bytes t|
        00003800  68 61 74 20 6d 61 6b 65  20 75 70 20 74 68 69 73  |hat make up this|
        00003810  20 6c 61 79 65 72 2e 3c  2f 73 70 61 6e 3e 0a 20  | layer.. |
        00003820  20 20 20 4c 61 79 65 72  43 6f 6e 74 65 6e 74 73  |   LayerContents|
        00003830  28 29 20 5b 5d 62 79 74  65 0a 20 20 20 20 3c 73  |() []byte.    // LayerPayl|
        00003860  6f 61 64 20 72 65 74 75  72 6e 73 20 74 68 65 20  |oad returns the |
        00003870  73 65 74 20 6f 66 20 62  79 74 65 73 20 63 6f 6e  |set of bytes con|
        00003880  74 61 69 6e 65 64 20 77  69 74 68 69 6e 20 74 68  |tained within th|
        00003890  69 73 20 6c 61 79 65 72  2c 20 6e 6f 74 3c 2f 73  |is layer, not.    /|
        000038c0  2f 20 69 6e 63 6c 75 64  69 6e 67 20 74 68 65 20  |/ including the |
        000038d0  6c 61 79 65 72 20 69 74  73 65 6c 66 2e 3c 2f 73  |layer itself..    LayerPa|
        000038f0  79 6c 6f 61 64 28 29 20  5b 5d 62 79 74 65 0a 7d  |yload() []byte.}|
        00003900  3c 2f 70 72 65 3e 0a 09  09 09 3c 70 3e 0a 4c 61  |
....

.La| 00003910 79 65 72 20 72 65 70 72 65 73 65 6e 74 73 20 61 |yer represents a| 00003920 20 73 69 6e 67 6c 65 20 64 65 63 6f 64 65 64 20 | single decoded | 00003930 70 61 63 6b 65 74 20 6c 61 79 65 72 20 28 75 73 |packet layer (us| 00003940 69 6e 67 20 65 69 74 68 65 72 20 74 68 65 0a 4f |ing either the.O| 00003950 53 49 20 6f 72 20 54 43 50 2f 49 50 20 64 65 66 |SI or TCP/IP def| 00003960 69 6e 69 74 69 6f 6e 20 6f 66 20 61 20 6c 61 79 |inition of a lay| 00003970 65 72 29 2e 20 20 57 68 65 6e 20 64 65 63 6f 64 |er). When decod| 00003980 69 6e 67 2c 20 61 20 70 61 63 6b 65 74 26 23 33 |ing, a packet| 00003990 39 3b 73 20 64 61 74 61 20 69 73 0a 62 72 6f 6b |9;s data is.brok| 000039a0 65 6e 20 75 70 20 69 6e 74 6f 20 61 20 6e 75 6d |en up into a num| 000039b0 62 65 72 20 6f 66 20 6c 61 79 65 72 73 2e 20 20 |ber of layers. | 000039c0 54 68 65 20 63 61 6c 6c 65 72 20 6d 61 79 20 63 |The caller may c| 000039d0 61 6c 6c 20 4c 61 79 65 72 54 79 70 65 28 29 20 |all LayerType() | 000039e0 74 6f 0a 66 69 67 75 72 65 20 6f 75 74 20 77 68 |to.figure out wh| 000039f0 69 63 68 20 74 79 70 65 20 6f 66 20 6c 61 79 65 |ich type of laye| 00003a00 72 20 68 65 26 23 33 39 3b 73 20 72 65 63 65 69 |r he's recei| 00003a10 76 65 64 20 66 72 6f 6d 20 74 68 65 20 70 61 63 |ved from the pac| 00003a20 6b 65 74 2e 20 20 4f 70 74 69 6f 6e 61 6c 6c 79 |ket. Optionally| 00003a30 2c 0a 68 65 20 6d 61 79 20 74 68 65 6e 20 75 73 |,.he may then us| 00003a40 65 20 61 20 74 79 70 65 20 61 73 73 65 72 74 69 |e a type asserti| 00003a50 6f 6e 20 74 6f 20 67 65 74 20 74 68 65 20 61 63 |on to get the ac| 00003a60 74 75 61 6c 20 6c 61 79 65 72 20 74 79 70 65 20 |tual layer type | 00003a70 66 6f 72 20 64 65 65 70 0a 69 6e 73 70 65 63 74 |for deep.inspect| 00003a80 69 6f 6e 20 6f 66 20 74 68 65 20 64 61 74 61 2e |ion of the data.| 00003a90 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 09 |.

...........| 00003aa0 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a |................| 00003ab0 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 3c 68 |..............type LayerClass| 00003b30 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 65 3e 74 79 |

....
ty|
        00003b40  70 65 20 4c 61 79 65 72  43 6c 61 73 73 20 69 6e  |pe LayerClass in|
        00003b50  74 65 72 66 61 63 65 20  7b 0a 20 20 20 20 3c 73  |terface {.    // Contains |
        00003b80  72 65 74 75 72 6e 73 20  74 72 75 65 20 69 66 20  |returns true if |
        00003b90  74 68 65 20 67 69 76 65  6e 20 6c 61 79 65 72 20  |the given layer |
        00003ba0  74 79 70 65 20 73 68 6f  75 6c 64 20 62 65 20 63  |type should be c|
        00003bb0  6f 6e 73 69 64 65 72 65  64 20 70 61 72 74 3c 2f  |onsidered part.    |
        00003be0  2f 2f 20 6f 66 20 74 68  69 73 20 6c 61 79 65 72  |// of this layer|
        00003bf0  20 63 6c 61 73 73 2e 3c  2f 73 70 61 6e 3e 0a 20  | class.. |
        00003c00  20 20 20 43 6f 6e 74 61  69 6e 73 28 4c 61 79 65  |   Contains(Laye|
        00003c10  72 54 79 70 65 29 20 62  6f 6f 6c 0a 7d 3c 2f 70  |rType) bool.}....

.Layer| 00003c30 43 6c 61 73 73 20 69 73 20 61 20 73 65 74 20 6f |Class is a set o| 00003c40 66 20 4c 61 79 65 72 54 79 70 65 73 2c 20 75 73 |f LayerTypes, us| 00003c50 65 64 20 66 6f 72 20 67 72 61 62 62 69 6e 67 20 |ed for grabbing | 00003c60 6f 6e 65 20 6f 66 20 61 20 6e 75 6d 62 65 72 20 |one of a number | 00003c70 6f 66 0a 64 69 66 66 65 72 65 6e 74 20 74 79 70 |of.different typ| 00003c80 65 73 20 66 72 6f 6d 20 61 20 70 61 63 6b 65 74 |es from a packet| 00003c90 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 |..

..........| 00003ca0 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 |................| 00003cb0 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 4e 65 77 |.....

func| 00003cd0 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 | N| 00003d20 65 77 4c 61 79 65 72 43 6c 61 73 73 3c 2f 61 3e |ewLayerClass| 00003d30 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 72 65 3e 66 |

.....
f|
        00003d40  75 6e 63 20 4e 65 77 4c  61 79 65 72 43 6c 61 73  |unc NewLayerClas|
        00003d50  73 28 74 79 70 65 73 20  5b 5d 4c 61 79 65 72 54  |s(types []LayerT|
        00003d60  79 70 65 29 20 4c 61 79  65 72 43 6c 61 73 73 3c  |ype) LayerClass<|
        00003d70  2f 70 72 65 3e 0a 09 09  09 09 3c 70 3e 0a 4e 65  |/pre>.....

.Ne| 00003d80 77 4c 61 79 65 72 43 6c 61 73 73 20 63 72 65 61 |wLayerClass crea| 00003d90 74 65 73 20 61 20 4c 61 79 65 72 43 6c 61 73 73 |tes a LayerClass| 00003da0 2c 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 |, attempting to | 00003db0 62 65 20 73 6d 61 72 74 20 61 62 6f 75 74 20 77 |be smart about w| 00003dc0 68 69 63 68 20 74 79 70 65 0a 69 74 20 63 72 65 |hich type.it cre| 00003dd0 61 74 65 73 20 62 61 73 65 64 20 6f 6e 20 77 68 |ates based on wh| 00003de0 69 63 68 20 74 79 70 65 73 20 61 72 65 20 70 61 |ich types are pa| 00003df0 73 73 65 64 20 69 6e 2e 0a 3c 2f 70 3e 0a 0a 09 |ssed in..

...| 00003e00 09 09 09 0a 09 09 09 0a 0a 09 09 09 0a 09 09 0a |................| 00003e10 09 09 09 0a 09 09 09 0a 09 09 09 3c 68 32 20 69 |...........

type LayerClassM| 00003e90 61 70 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c |ap

....<| 00003ea0 70 72 65 3e 74 79 70 65 20 4c 61 79 65 72 43 6c |pre>type LayerCl| 00003eb0 61 73 73 4d 61 70 20 6d 61 70 5b 4c 61 79 65 72 |assMap map[Layer| 00003ec0 54 79 70 65 5d 62 6f 6f 6c 3c 2f 70 72 65 3e 0a |Type]bool
.| 00003ed0 09 09 09 3c 70 3e 0a 4c 61 79 65 72 43 6c 61 73 |...

.LayerClas| 00003ee0 73 4d 61 70 20 69 6d 70 6c 65 6d 65 6e 74 73 20 |sMap implements | 00003ef0 61 20 4c 61 79 65 72 43 6c 61 73 73 20 77 69 74 |a LayerClass wit| 00003f00 68 20 61 20 6d 61 70 2e 0a 3c 2f 70 3e 0a 0a 0a |h a map..

...| 00003f10 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 |................| 00003f20 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 |............

func NewLaye| 00003fa0 72 43 6c 61 73 73 4d 61 70 3c 2f 61 3e 3c 2f 68 |rClassMap.....<| pcap_test.go:110: -- FULL PACKET DATA (16388 bytes) ------------------------------------ 00000000 1e 00 00 00 60 01 88 91 3f d8 06 40 00 00 00 00 |....`...?..@....| 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 01 1f 90 e5 af |................| 00000030 0a 65 f6 5f 08 97 18 4a 80 10 23 02 3f e0 00 00 |.e._...J..#.?...| 00000040 01 01 08 0a 05 c0 8d b6 05 c0 8c fc 70 72 65 3e |............pre>| 00000050 66 75 6e 63 20 4e 65 77 4c 61 79 65 72 43 6c 61 |func NewLayerCla| 00000060 73 73 4d 61 70 28 74 79 70 65 73 20 5b 5d 4c 61 |ssMap(types []La| 00000070 79 65 72 54 79 70 65 29 20 4c 61 79 65 72 43 6c |yerType) LayerCl| 00000080 61 73 73 4d 61 70 3c 2f 70 72 65 3e 0a 09 09 09 |assMap

....| 00000090 09 3c 70 3e 0a 4e 65 77 4c 61 79 65 72 43 6c 61 |.

.NewLayerCla| 000000a0 73 73 4d 61 70 20 63 72 65 61 74 65 73 20 61 20 |ssMap creates a | 000000b0 4c 61 79 65 72 43 6c 61 73 73 4d 61 70 20 61 6e |LayerClassMap an| 000000c0 64 20 73 65 74 73 20 6d 61 70 5b 74 5d 20 74 6f |d sets map[t] to| 000000d0 20 74 72 75 65 20 66 6f 72 20 65 61 63 68 0a 74 | true for each.t| 000000e0 79 70 65 20 69 6e 20 74 79 70 65 73 2e 0a 3c 2f |ype in types................| 00000100 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 |...........

func | 00000130 28 4c 61 79 65 72 43 6c 61 73 73 4d 61 70 29 20 |(LayerClassMap) | 00000140 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b |Co| 00000190 6e 74 61 69 6e 73 3c 2f 61 3e 3c 2f 68 33 3e 0a |ntains

.| 000001a0 09 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 6d |....
func (m|
        000001b0  20 4c 61 79 65 72 43 6c  61 73 73 4d 61 70 29 20  | LayerClassMap) |
        000001c0  43 6f 6e 74 61 69 6e 73  28 74 20 4c 61 79 65 72  |Contains(t Layer|
        000001d0  54 79 70 65 29 20 62 6f  6f 6c 3c 2f 70 72 65 3e  |Type) bool
| 000001e0 0a 09 09 09 09 3c 70 3e 0a 43 6f 6e 74 61 69 6e |.....

.Contain| 000001f0 73 20 72 65 74 75 72 6e 73 20 74 72 75 65 20 69 |s returns true i| 00000200 66 20 74 68 65 20 67 69 76 65 6e 20 6c 61 79 65 |f the given laye| 00000210 72 20 74 79 70 65 20 73 68 6f 75 6c 64 20 62 65 |r type should be| 00000220 20 63 6f 6e 73 69 64 65 72 65 64 20 70 61 72 74 | considered part| 00000230 0a 6f 66 20 74 68 69 73 20 6c 61 79 65 72 20 63 |.of this layer c| 00000240 6c 61 73 73 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 |lass..

......| 00000250 0a 09 09 09 09 0a 09 09 09 0a 09 09 0a 09 09 09 |................| 00000260 0a 09 09 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 |........

type LayerClassSlice| 000002e0 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 |

....type LayerClas| 00000300 73 53 6c 69 63 65 20 5b 5d 62 6f 6f 6c 3c 2f 70 |sSlice []bool
....

.Layer| 00000320 43 6c 61 73 73 53 6c 69 63 65 20 69 6d 70 6c 65 |ClassSlice imple| 00000330 6d 65 6e 74 73 20 61 20 4c 61 79 65 72 43 6c 61 |ments a LayerCla| 00000340 73 73 20 77 69 74 68 20 61 20 73 6c 69 63 65 2e |ss with a slice.| 00000350 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 09 |.

...........| 00000360 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 0a |................| 00000370 09 09 09 09 3c 68 33 20 69 64 3d 22 4e 65 77 4c |....

| 00000390 66 75 6e 63 20 3c 61 20 68 72 65 66 3d 22 2f 73 |func NewLayerClassSl| 000003f0 69 63 65 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 |ice

....| 00000400 09 3c 70 72 65 3e 66 75 6e 63 20 4e 65 77 4c 61 |.
func NewLa|
        00000410  79 65 72 43 6c 61 73 73  53 6c 69 63 65 28 74 79  |yerClassSlice(ty|
        00000420  70 65 73 20 5b 5d 4c 61  79 65 72 54 79 70 65 29  |pes []LayerType)|
        00000430  20 4c 61 79 65 72 43 6c  61 73 73 53 6c 69 63 65  | LayerClassSlice|
        00000440  3c 2f 70 72 65 3e 0a 09  09 09 09 3c 70 3e 0a 4e  |
.....

.N| 00000450 65 77 4c 61 79 65 72 43 6c 61 73 73 53 6c 69 63 |ewLayerClassSlic| 00000460 65 20 63 72 65 61 74 65 73 20 61 20 6e 65 77 20 |e creates a new | 00000470 4c 61 79 65 72 43 6c 61 73 73 53 6c 69 63 65 20 |LayerClassSlice | 00000480 62 79 20 63 72 65 61 74 69 6e 67 20 61 20 73 6c |by creating a sl| 00000490 69 63 65 20 6f 66 0a 73 69 7a 65 20 6d 61 78 28 |ice of.size max(| 000004a0 74 79 70 65 73 29 20 61 6e 64 20 73 65 74 74 69 |types) and setti| 000004b0 6e 67 20 73 6c 69 63 65 5b 74 5d 20 74 6f 20 74 |ng slice[t] to t| 000004c0 72 75 65 20 66 6f 72 20 65 61 63 68 20 74 79 70 |rue for each typ| 000004d0 65 20 74 2e 20 20 4e 6f 74 65 2c 20 69 66 0a 79 |e t. Note, if.y| 000004e0 6f 75 20 69 6d 70 6c 65 6d 65 6e 74 20 79 6f 75 |ou implement you| 000004f0 72 20 6f 77 6e 20 4c 61 79 65 72 54 79 70 65 20 |r own LayerType | 00000500 61 6e 64 20 67 69 76 65 20 69 74 20 61 20 68 69 |and give it a hi| 00000510 67 68 20 76 61 6c 75 65 2c 20 74 68 69 73 20 57 |gh value, this W| 00000520 49 4c 4c 20 63 72 65 61 74 65 0a 61 20 76 65 72 |ILL create.a ver| 00000530 79 20 6c 61 72 67 65 20 73 6c 69 63 65 2e 0a 3c |y large slice..<| 00000540 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 09 0a 0a 09 |/p>.............| 00000550 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 |............

fu| 00000580 6e 63 20 28 4c 61 79 65 72 43 6c 61 73 73 53 6c |nc (LayerClassSl| 00000590 69 63 65 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 |ice) | 000005e0 43 6f 6e 74 61 69 6e 73 3c 2f 61 3e 3c 2f 68 33 |Contains.....
func |
        00000600  28 73 20 4c 61 79 65 72  43 6c 61 73 73 53 6c 69  |(s LayerClassSli|
        00000610  63 65 29 20 43 6f 6e 74  61 69 6e 73 28 74 20 4c  |ce) Contains(t L|
        00000620  61 79 65 72 54 79 70 65  29 20 62 6f 6f 6c 3c 2f  |ayerType) bool.....

.Con| 00000640 74 61 69 6e 73 20 72 65 74 75 72 6e 73 20 74 72 |tains returns tr| 00000650 75 65 20 69 66 20 74 68 65 20 67 69 76 65 6e 20 |ue if the given | 00000660 6c 61 79 65 72 20 74 79 70 65 20 73 68 6f 75 6c |layer type shoul| 00000670 64 20 62 65 20 63 6f 6e 73 69 64 65 72 65 64 20 |d be considered | 00000680 70 61 72 74 0a 6f 66 20 74 68 69 73 20 6c 61 79 |part.of this lay| 00000690 65 72 20 63 6c 61 73 73 2e 0a 3c 2f 70 3e 0a 0a |er class..

..| 000006a0 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 |................| 000006b0 0a 09 09 09 0a 09 09 09 0a 09 09 09 3c 68 32 20 |............

t| 000006d0 79 70 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 |ype La| 00000720 79 65 72 54 79 70 65 3c 2f 61 3e 3c 2f 68 32 3e |yerType

| 00000730 0a 09 09 09 3c 70 72 65 3e 74 79 70 65 20 4c 61 |....
type La|
        00000740  79 65 72 54 79 70 65 20  69 6e 74 36 34 3c 2f 70  |yerType int64....

.Layer| 00000760 54 79 70 65 20 69 73 20 61 20 75 6e 69 71 75 65 |Type is a unique| 00000770 20 69 64 65 6e 74 69 66 69 65 72 20 66 6f 72 20 | identifier for | 00000780 65 61 63 68 20 74 79 70 65 20 6f 66 20 6c 61 79 |each type of lay| 00000790 65 72 2e 20 20 54 68 69 73 20 65 6e 75 6d 65 72 |er. This enumer| 000007a0 61 74 69 6f 6e 0a 64 6f 65 73 20 6e 6f 74 20 6d |ation.does not m| 000007b0 61 74 63 68 20 77 69 74 68 20 61 6e 79 20 65 78 |atch with any ex| 000007c0 74 65 72 6e 61 6c 6c 79 20 61 76 61 69 6c 61 62 |ternally availab| 000007d0 6c 65 20 6e 75 6d 62 65 72 69 6e 67 20 73 63 68 |le numbering sch| 000007e0 65 6d 65 2e 2e 2e 20 69 74 26 23 33 39 3b 73 20 |eme... it's | 000007f0 73 6f 6c 65 6c 79 0a 75 73 61 62 6c 65 2f 75 73 |solely.usable/us| 00000800 65 66 75 6c 20 77 69 74 68 69 6e 20 74 68 69 73 |eful within this| 00000810 20 6c 69 62 72 61 72 79 20 61 73 20 61 20 6d 65 | library as a me| 00000820 61 6e 73 20 66 6f 72 20 72 65 71 75 65 73 74 69 |ans for requesti| 00000830 6e 67 20 6c 61 79 65 72 20 74 79 70 65 73 0a 28 |ng layer types.(| 00000840 73 65 65 20 50 61 63 6b 65 74 2e 4c 61 79 65 72 |see Packet.Layer| 00000850 29 20 61 6e 64 20 64 65 74 65 72 6d 69 6e 69 6e |) and determinin| 00000860 67 20 77 68 69 63 68 20 74 79 70 65 73 20 6f 66 |g which types of| 00000870 20 6c 61 79 65 72 73 20 68 61 76 65 20 62 65 65 | layers have bee| 00000880 6e 20 64 65 63 6f 64 65 64 2e 0a 3c 2f 70 3e 0a |n decoded..

.| 00000890 3c 70 3e 0a 4e 65 77 20 4c 61 79 65 72 54 79 70 |

.New LayerTyp| 000008a0 65 73 20 6d 61 79 20 62 65 20 63 72 65 61 74 65 |es may be create| 000008b0 64 20 62 79 20 63 61 6c 6c 69 6e 67 20 67 6f 70 |d by calling gop| 000008c0 61 63 6b 65 74 2e 52 65 67 69 73 74 65 72 4c 61 |acket.RegisterLa| 000008d0 79 65 72 54 79 70 65 2e 0a 3c 2f 70 3e 0a 0a 0a |yerType..

...| 000008e0 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 3c 70 72 |.............var LayerTypeD| 00000900 65 63 6f 64 65 46 61 69 6c 75 72 65 20 4c 61 79 |ecodeFailure Lay| 00000910 65 72 54 79 70 65 20 3d 20 52 65 67 69 73 74 65 |erType = Registe| 00000920 72 4c 61 79 65 72 54 79 70 65 28 30 2c 20 4c 61 |rLayerType(0, La| 00000930 79 65 72 54 79 70 65 4d 65 74 61 64 61 74 61 7b |yerTypeMetadata{| 00000940 26 23 33 34 3b 44 65 63 6f 64 65 20 46 61 69 6c |"Decode Fail| 00000950 75 72 65 26 23 33 34 3b 2c 20 44 65 63 6f 64 65 |ure", Decode| 00000960 55 6e 6b 6e 6f 77 6e 7d 29 3c 2f 70 72 65 3e 0a |Unknown})
.| 00000970 09 09 09 09 3c 70 3e 0a 4c 61 79 65 72 54 79 70 |....

.LayerTyp| 00000980 65 44 65 63 6f 64 65 46 61 69 6c 75 72 65 20 69 |eDecodeFailure i| 00000990 73 20 74 68 65 20 6c 61 79 65 72 20 74 79 70 65 |s the layer type| 000009a0 20 66 6f 72 20 74 68 65 20 64 65 66 61 75 6c 74 | for the default| 000009b0 20 65 72 72 6f 72 20 6c 61 79 65 72 2e 0a 3c 2f | error layer............var LayerTypePa| 000009e0 79 6c 6f 61 64 20 4c 61 79 65 72 54 79 70 65 20 |yload LayerType | 000009f0 3d 20 52 65 67 69 73 74 65 72 4c 61 79 65 72 54 |= RegisterLayerT| 00000a00 79 70 65 28 31 2c 20 4c 61 79 65 72 54 79 70 65 |ype(1, LayerType| 00000a10 4d 65 74 61 64 61 74 61 7b 26 23 33 34 3b 50 61 |Metadata{"Pa| 00000a20 79 6c 6f 61 64 26 23 33 34 3b 2c 20 44 65 63 6f |yload", Deco| 00000a30 64 65 50 61 79 6c 6f 61 64 7d 29 3c 2f 70 72 65 |dePayload}).....

.LayerT| 00000a50 79 70 65 50 61 79 6c 6f 61 64 20 69 73 20 74 68 |ypePayload is th| 00000a60 65 20 6c 61 79 65 72 20 74 79 70 65 20 66 6f 72 |e layer type for| 00000a70 20 61 20 70 61 79 6c 6f 61 64 20 74 68 61 74 20 | a payload that | 00000a80 77 65 20 64 6f 6e 26 23 33 39 3b 74 20 74 72 79 |we don't try| 00000a90 20 74 6f 20 64 65 63 6f 64 65 0a 62 75 74 20 74 | to decode.but t| 00000aa0 72 65 61 74 20 61 73 20 61 20 73 75 63 63 65 73 |reat as a succes| 00000ab0 73 2c 20 49 45 3a 20 61 6e 20 61 70 70 6c 69 63 |s, IE: an applic| 00000ac0 61 74 69 6f 6e 2d 6c 65 76 65 6c 20 70 61 79 6c |ation-level payl| 00000ad0 6f 61 64 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 0a 0a |oad..

.......| 00000ae0 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 0a 09 09 |................| 00000af0 09 09 3c 68 33 20 69 64 3d 22 52 65 67 69 73 74 |..

fun| 00000b10 63 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f |c R| 00000b60 65 67 69 73 74 65 72 4c 61 79 65 72 54 79 70 65 |egisterLayerType| 00000b70 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 |

.....func Register| 00000b90 4c 61 79 65 72 54 79 70 65 28 6e 75 6d 20 69 6e |LayerType(num in| 00000ba0 74 2c 20 6d 65 74 61 20 4c 61 79 65 72 54 79 70 |t, meta LayerTyp| 00000bb0 65 4d 65 74 61 64 61 74 61 29 20 4c 61 79 65 72 |eMetadata) Layer| 00000bc0 54 79 70 65 3c 2f 70 72 65 3e 0a 09 09 09 09 3c |Type
.....<| 00000bd0 70 3e 0a 52 65 67 69 73 74 65 72 4c 61 79 65 72 |p>.RegisterLayer| 00000be0 54 79 70 65 20 63 72 65 61 74 65 73 20 61 20 6e |Type creates a n| 00000bf0 65 77 20 6c 61 79 65 72 20 74 79 70 65 20 61 6e |ew layer type an| 00000c00 64 20 72 65 67 69 73 74 65 72 73 20 69 74 20 67 |d registers it g| 00000c10 6c 6f 62 61 6c 6c 79 2e 0a 54 68 65 20 6e 75 6d |lobally..The num| 00000c20 62 65 72 20 70 61 73 73 65 64 20 69 6e 20 6d 75 |ber passed in mu| 00000c30 73 74 20 62 65 20 75 6e 69 71 75 65 2c 20 6f 72 |st be unique, or| 00000c40 20 61 20 72 75 6e 74 69 6d 65 20 70 61 6e 69 63 | a runtime panic| 00000c50 20 77 69 6c 6c 20 6f 63 63 75 72 2e 20 20 4e 75 | will occur. Nu| 00000c60 6d 62 65 72 73 0a 30 2d 39 39 39 20 61 72 65 20 |mbers.0-999 are | 00000c70 72 65 73 65 72 76 65 64 20 66 6f 72 20 74 68 65 |reserved for the| 00000c80 20 67 6f 70 61 63 6b 65 74 20 6c 69 62 72 61 72 | gopacket librar| 00000c90 79 2e 20 20 4e 75 6d 62 65 72 73 20 31 30 30 30 |y. Numbers 1000| 00000ca0 2d 31 39 39 39 20 73 68 6f 75 6c 64 20 62 65 0a |-1999 should be.| 00000cb0 75 73 65 64 20 66 6f 72 20 63 6f 6d 6d 6f 6e 20 |used for common | 00000cc0 61 70 70 6c 69 63 61 74 69 6f 6e 2d 73 70 65 63 |application-spec| 00000cd0 69 66 69 63 20 74 79 70 65 73 2c 20 61 6e 64 20 |ific types, and | 00000ce0 61 72 65 20 76 65 72 79 20 66 61 73 74 2e 20 20 |are very fast. | 00000cf0 41 6e 79 20 6f 74 68 65 72 0a 6e 75 6d 62 65 72 |Any other.number| 00000d00 20 28 6e 65 67 61 74 69 76 65 20 6f 72 20 26 67 | (negative or &g| 00000d10 74 3b 3d 20 32 30 30 30 29 20 6d 61 79 20 62 65 |t;= 2000) may be| 00000d20 20 75 73 65 64 20 66 6f 72 20 75 6e 63 6f 6d 6d | used for uncomm| 00000d30 6f 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 2d 73 |on application-s| 00000d40 70 65 63 69 66 69 63 0a 74 79 70 65 73 2c 20 61 |pecific.types, a| 00000d50 6e 64 20 61 72 65 20 73 6f 6d 65 77 68 61 74 20 |nd are somewhat | 00000d60 73 6c 6f 77 65 72 20 28 74 68 65 79 20 72 65 71 |slower (they req| 00000d70 75 69 72 65 20 61 20 6d 61 70 20 6c 6f 6f 6b 75 |uire a map looku| 00000d80 70 20 6f 76 65 72 20 61 6e 20 61 72 72 61 79 0a |p over an array.| 00000d90 69 6e 64 65 78 29 2e 0a 3c 2f 70 3e 0a 0a 09 09 |index)..

....| 00000da0 09 09 0a 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 |................| 00000db0 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 4c 61 79 |.....

f| 00000dd0 75 6e 63 20 28 4c 61 79 65 72 54 79 70 65 29 20 |unc (LayerType) | 00000de0 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b |Dec| 00000e30 6f 64 65 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 |ode

....| 00000e40 09 3c 70 72 65 3e 66 75 6e 63 20 28 74 20 4c 61 |.
func (t La|
        00000e50  79 65 72 54 79 70 65 29  20 44 65 63 6f 64 65 28  |yerType) Decode(|
        00000e60  64 61 74 61 20 5b 5d 62  79 74 65 2c 20 63 20 50  |data []byte, c P|
        00000e70  61 63 6b 65 74 42 75 69  6c 64 65 72 29 20 65 72  |acketBuilder) er|
        00000e80  72 6f 72 3c 2f 70 72 65  3e 0a 09 09 09 09 3c 70  |ror
......Decode decodes| 00000ea0 20 74 68 65 20 67 69 76 65 6e 20 64 61 74 61 20 | the given data | 00000eb0 75 73 69 6e 67 20 74 68 65 20 64 65 63 6f 64 65 |using the decode| 00000ec0 72 20 72 65 67 69 73 74 65 72 65 64 20 77 69 74 |r registered wit| 00000ed0 68 20 74 68 65 20 6c 61 79 65 72 0a 74 79 70 65 |h the layer.type| 00000ee0 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 09 |..

..........| 00000ef0 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c |...............<| 00000f00 68 33 20 69 64 3d 22 4c 61 79 65 72 54 79 70 65 |h3 id="LayerType| 00000f10 2e 53 74 72 69 6e 67 22 3e 66 75 6e 63 20 28 4c |.String">func (L| 00000f20 61 79 65 72 54 79 70 65 29 20 3c 61 20 68 72 65 |ayerType) String.....
|
        00000f90  66 75 6e 63 20 28 74 20  4c 61 79 65 72 54 79 70  |func (t LayerTyp|
        00000fa0  65 29 20 53 74 72 69 6e  67 28 29 20 28 73 20 73  |e) String() (s s|
        00000fb0  74 72 69 6e 67 29 3c 2f  70 72 65 3e 0a 09 09 09  |tring)
....| 00000fc0 09 3c 70 3e 0a 53 74 72 69 6e 67 20 72 65 74 75 |.

.String retu| 00000fd0 72 6e 73 20 74 68 65 20 73 74 72 69 6e 67 20 61 |rns the string a| 00000fe0 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 |ssociated with t| 00000ff0 68 69 73 20 6c 61 79 65 72 20 74 79 70 65 2e 0a |his layer type..| 00001000 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 09 09 0a |

............| 00001010 09 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 |................| 00001020 09 09 3c 68 32 20 69 64 3d 22 4c 61 79 65 72 54 |..

typ| 00001040 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f |e Laye| 00001090 72 54 79 70 65 4d 65 74 61 64 61 74 61 3c 2f 61 |rTypeMetadata

....
t|
        000010b0  79 70 65 20 4c 61 79 65  72 54 79 70 65 4d 65 74  |ype LayerTypeMet|
        000010c0  61 64 61 74 61 20 73 74  72 75 63 74 20 7b 0a 20  |adata struct {. |
        000010d0  20 20 20 3c 73 70 61 6e  20 63 6c 61 73 73 3d 22  |   // Name|
        000010f0  20 69 73 20 74 68 65 20  73 74 72 69 6e 67 20 72  | is the string r|
        00001100  65 74 75 72 6e 65 64 20  62 79 20 65 61 63 68 20  |eturned by each |
        00001110  6c 61 79 65 72 20 74 79  70 65 26 23 33 39 3b 73  |layer type's|
        00001120  20 53 74 72 69 6e 67 20  6d 65 74 68 6f 64 2e 3c  | String method.<|
        00001130  2f 73 70 61 6e 3e 0a 20  20 20 20 4e 61 6d 65 20  |/span>.    Name |
        00001140  73 74 72 69 6e 67 0a 20  20 20 20 3c 73 70 61 6e  |string.    // Decoder is t|
        00001170  68 65 20 64 65 63 6f 64  65 72 20 74 6f 20 75 73  |he decoder to us|
        00001180  65 20 77 68 65 6e 20 74  68 65 20 6c 61 79 65 72  |e when the layer|
        00001190  20 74 79 70 65 20 69 73  20 70 61 73 73 65 64 20  | type is passed |
        000011a0  69 6e 20 61 73 20 61 3c  2f 73 70 61 6e 3e 0a 20  |in as a. |
        000011b0  20 20 20 3c 73 70 61 6e  20 63 6c 61 73 73 3d 22  |   // Deco|
        000011d0  64 65 72 2e 3c 2f 73 70  61 6e 3e 0a 20 20 20 20  |der..    |
        000011e0  44 65 63 6f 64 65 72 20  44 65 63 6f 64 65 72 0a  |Decoder Decoder.|
        000011f0  7d 3c 2f 70 72 65 3e 0a  09 09 09 3c 70 3e 0a 4c  |}
....

.L| 00001200 61 79 65 72 54 79 70 65 4d 65 74 61 64 61 74 61 |ayerTypeMetadata| 00001210 20 63 6f 6e 74 61 69 6e 73 20 6d 65 74 61 64 61 | contains metada| 00001220 74 61 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 |ta associated wi| 00001230 74 68 20 65 61 63 68 20 4c 61 79 65 72 54 79 70 |th each LayerTyp| 00001240 65 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 |e..

.........| 00001250 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 |................| 00001260 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 |................| 00001270 3c 68 32 20 69 64 3d 22 4c 69 6e 6b 4c 61 79 65 |

type | 000012d0 4c 69 6e 6b 4c 61 79 65 72 3c 2f 61 3e 3c 2f 68 |LinkLayer....
type |
        000012f0  4c 69 6e 6b 4c 61 79 65  72 20 69 6e 74 65 72 66  |LinkLayer interf|
        00001300  61 63 65 20 7b 0a 20 20  20 20 4c 61 79 65 72 0a  |ace {.    Layer.|
        00001310  20 20 20 20 4c 69 6e 6b  46 6c 6f 77 28 29 20 46  |    LinkFlow() F|
        00001320  6c 6f 77 0a 7d 3c 2f 70  72 65 3e 0a 09 09 09 3c  |low.}
....<| 00001330 70 3e 0a 4c 69 6e 6b 4c 61 79 65 72 20 69 73 20 |p>.LinkLayer is | 00001340 74 68 65 20 70 61 63 6b 65 74 20 6c 61 79 65 72 |the packet layer| 00001350 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 | corresponding t| 00001360 6f 20 54 43 50 2f 49 50 20 6c 61 79 65 72 20 31 |o TCP/IP layer 1| 00001370 20 28 4f 53 49 20 6c 61 79 65 72 20 32 29 0a 3c | (OSI layer 2).<| 00001380 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a |/p>.............| 00001390 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 |................| 000013a0 0a 09 09 09 0a 09 09 09 0a 09 09 09 3c 68 32 20 |............

type N| 00001410 65 74 77 6f 72 6b 4c 61 79 65 72 3c 2f 61 3e 3c |etworkLayer<| 00001420 2f 68 32 3e 0a 09 09 09 3c 70 72 65 3e 74 79 70 |/h2>....
typ|
        00001430  65 20 4e 65 74 77 6f 72  6b 4c 61 79 65 72 20 69  |e NetworkLayer i|
        00001440  6e 74 65 72 66 61 63 65  20 7b 0a 20 20 20 20 4c  |nterface {.    L|
        00001450  61 79 65 72 0a 20 20 20  20 4e 65 74 77 6f 72 6b  |ayer.    Network|
        00001460  46 6c 6f 77 28 29 20 46  6c 6f 77 0a 7d 3c 2f 70  |Flow() Flow.}....

.Netwo| 00001480 72 6b 4c 61 79 65 72 20 69 73 20 74 68 65 20 70 |rkLayer is the p| 00001490 61 63 6b 65 74 20 6c 61 79 65 72 20 63 6f 72 72 |acket layer corr| 000014a0 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 54 43 50 |esponding to TCP| 000014b0 2f 49 50 20 6c 61 79 65 72 20 32 20 28 4f 53 49 |/IP layer 2 (OSI| 000014c0 0a 6c 61 79 65 72 20 33 29 0a 3c 2f 70 3e 0a 0a |.layer 3).

..| 000014d0 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a |................| 000014e0 09 09 09 0a 0a 09 09 09 0a 09 09 0a 09 09 09 0a |................| 000014f0 09 09 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 50 |.......

type Packet<| 00001560 2f 68 32 3e 0a 09 09 09 3c 70 72 65 3e 74 79 70 |/h2>....
typ|
        00001570  65 20 50 61 63 6b 65 74  20 69 6e 74 65 72 66 61  |e Packet interfa|
        00001580  63 65 20 7b 0a 20 20 20  20 66 6d 74 2e 53 74 72  |ce {.    fmt.Str|
        00001590  69 6e 67 65 72 0a 20 20  20 20 3c 73 70 61 6e 20  |inger.    |
        000015b0  2f 2f 20 44 61 74 61 20  72 65 74 75 72 6e 73 20  |// Data returns |
        000015c0  61 6c 6c 20 64 61 74 61  20 61 73 73 6f 63 69 61  |all data associa|
        000015d0  74 65 64 20 77 69 74 68  20 74 68 69 73 20 70 61  |ted with this pa|
        000015e0  63 6b 65 74 3c 2f 73 70  61 6e 3e 0a 20 20 20 20  |cket.    |
        000015f0  44 61 74 61 28 29 20 5b  5d 62 79 74 65 0a 20 20  |Data() []byte.  |
        00001600  20 20 3c 73 70 61 6e 20  63 6c 61 73 73 3d 22 63  |  // Layer|
        00001620  73 20 72 65 74 75 72 6e  73 20 61 6c 6c 20 6c 61  |s returns all la|
        00001630  79 65 72 73 20 69 6e 20  74 68 69 73 20 70 61 63  |yers in this pac|
        00001640  6b 65 74 2c 20 63 6f 6d  70 75 74 69 6e 67 20 74  |ket, computing t|
        00001650  68 65 6d 20 61 73 20 6e  65 63 65 73 73 61 72 79  |hem as necessary|
        00001660  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 4c 61 79 65  |.    Laye|
        00001670  72 73 28 29 20 5b 5d 4c  61 79 65 72 0a 20 20 20  |rs() []Layer.   |
        00001680  20 3c 73 70 61 6e 20 63  6c 61 73 73 3d 22 63 6f  | // Layer |
        000016a0  72 65 74 75 72 6e 73 20  74 68 65 20 66 69 72 73  |returns the firs|
        000016b0  74 20 6c 61 79 65 72 20  69 6e 20 74 68 69 73 20  |t layer in this |
        000016c0  70 61 63 6b 65 74 20 6f  66 20 74 68 65 20 67 69  |packet of the gi|
        000016d0  76 65 6e 20 74 79 70 65  2c 20 6f 72 20 6e 69 6c  |ven type, or nil|
        000016e0  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 4c 61 79 65  |.    Laye|
        000016f0  72 28 4c 61 79 65 72 54  79 70 65 29 20 4c 61 79  |r(LayerType) Lay|
        00001700  65 72 0a 20 20 20 20 3c  73 70 61 6e 20 63 6c 61  |er.    // |
        00001720  4c 61 79 65 72 43 6c 61  73 73 20 72 65 74 75 72  |LayerClass retur|
        00001730  6e 73 20 74 68 65 20 66  69 72 73 74 20 6c 61 79  |ns the first lay|
        00001740  65 72 20 69 6e 20 74 68  69 73 20 70 61 63 6b 65  |er in this packe|
        00001750  74 20 6f 66 20 74 68 65  20 67 69 76 65 6e 20 63  |t of the given c|
        00001760  6c 61 73 73 2c 3c 2f 73  70 61 6e 3e 0a 20 20 20  |lass,.   |
        00001770  20 3c 73 70 61 6e 20 63  6c 61 73 73 3d 22 63 6f  | // or nil|
        00001790  2e 3c 2f 73 70 61 6e 3e  0a 20 20 20 20 4c 61 79  |..    Lay|
        000017a0  65 72 43 6c 61 73 73 28  4c 61 79 65 72 43 6c 61  |erClass(LayerCla|
        000017b0  73 73 29 20 4c 61 79 65  72 0a 20 20 20 20 3c 73  |ss) Layer.    // CaptureIn|
        000017e0  66 6f 20 72 65 74 75 72  6e 73 20 74 68 65 20 63  |fo returns the c|
        000017f0  61 70 75 74 75 72 65 20  69 6e 66 6f 72 6d 61 74  |aputure informat|
        00001800  69 6f 6e 20 66 6f 72 20  74 68 69 73 20 70 61 63  |ion for this pac|
        00001810  6b 65 74 2e 20 20 54 68  69 73 20 72 65 74 75 72  |ket.  This retur|
        00001820  6e 73 3c 2f 73 70 61 6e  3e 0a 20 20 20 20 3c 73  |ns.    // a pointer|
        00001850  20 74 6f 20 74 68 65 20  70 61 63 6b 65 74 26 23  | to the packet&#|
        00001860  33 39 3b 73 20 73 74 72  75 63 74 2c 20 73 6f 20  |39;s struct, so |
        00001870  69 74 20 63 61 6e 20 62  65 20 75 73 65 64 20 62  |it can be used b|
        00001880  6f 74 68 20 66 6f 72 20  72 65 61 64 69 6e 67 20  |oth for reading |
        00001890  61 6e 64 3c 2f 73 70 61  6e 3e 0a 20 20 20 20 3c  |and.    <|
        000018a0  73 70 61 6e 20 63 6c 61  73 73 3d 22 63 6f 6d 6d  |span class="comm|
        000018b0  65 6e 74 22 3e 2f 2f 20  77 72 69 74 69 6e 67 20  |ent">// writing |
        000018c0  74 68 65 20 69 6e 66 6f  72 6d 61 74 69 6f 6e 2e  |the information.|
        000018d0  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 43 61 70 74  |.    Capt|
        000018e0  75 72 65 49 6e 66 6f 28  29 20 2a 43 61 70 74 75  |ureInfo() *Captu|
        000018f0  72 65 49 6e 66 6f 0a 0a  20 20 20 20 3c 73 70 61  |reInfo..    // LinkLayer r|
        00001920  65 74 75 72 6e 73 20 74  68 65 20 66 69 72 73 74  |eturns the first|
        00001930  20 6c 69 6e 6b 20 6c 61  79 65 72 20 69 6e 20 74  | link layer in t|
        00001940  68 65 20 70 61 63 6b 65  74 3c 2f 73 70 61 6e 3e  |he packet|
        00001950  0a 20 20 20 20 4c 69 6e  6b 4c 61 79 65 72 28 29  |.    LinkLayer()|
        00001960  20 4c 69 6e 6b 4c 61 79  65 72 0a 20 20 20 20 3c  | LinkLayer.    <|
        00001970  73 70 61 6e 20 63 6c 61  73 73 3d 22 63 6f 6d 6d  |span class="comm|
        00001980  65 6e 74 22 3e 2f 2f 20  4e 65 74 77 6f 72 6b 4c  |ent">// NetworkL|
        00001990  61 79 65 72 20 72 65 74  75 72 6e 73 20 74 68 65  |ayer returns the|
        000019a0  20 66 69 72 73 74 20 6e  65 74 77 6f 72 6b 20 6c  | first network l|
        000019b0  61 79 65 72 20 69 6e 20  74 68 65 20 70 61 63 6b  |ayer in the pack|
        000019c0  65 74 3c 2f 73 70 61 6e  3e 0a 20 20 20 20 4e 65  |et.    Ne|
        000019d0  74 77 6f 72 6b 4c 61 79  65 72 28 29 20 4e 65 74  |tworkLayer() Net|
        000019e0  77 6f 72 6b 4c 61 79 65  72 0a 20 20 20 20 3c 73  |workLayer.    // Transport|
        00001a10  4c 61 79 65 72 20 72 65  74 75 72 6e 73 20 74 68  |Layer returns th|
        00001a20  65 20 66 69 72 73 74 20  74 72 61 6e 73 70 6f 72  |e first transpor|
        00001a30  74 20 6c 61 79 65 72 20  69 6e 20 74 68 65 20 70  |t layer in the p|
        00001a40  61 63 6b 65 74 3c 2f 73  70 61 6e 3e 0a 20 20 20  |acket.   |
        00001a50  20 54 72 61 6e 73 70 6f  72 74 4c 61 79 65 72 28  | TransportLayer(|
        00001a60  29 20 54 72 61 6e 73 70  6f 72 74 4c 61 79 65 72  |) TransportLayer|
        00001a70  0a 20 20 20 20 3c 73 70  61 6e 20 63 6c 61 73 73  |.    // Ap|
        00001a90  70 6c 69 63 61 74 69 6f  6e 4c 61 79 65 72 20 72  |plicationLayer r|
        00001aa0  65 74 75 72 6e 73 20 74  68 65 20 66 69 72 73 74  |eturns the first|
        00001ab0  20 61 70 70 6c 69 63 61  74 69 6f 6e 20 6c 61 79  | application lay|
        00001ac0  65 72 20 69 6e 20 74 68  65 20 70 61 63 6b 65 74  |er in the packet|
        00001ad0  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 41 70 70 6c  |.    Appl|
        00001ae0  69 63 61 74 69 6f 6e 4c  61 79 65 72 28 29 20 41  |icationLayer() A|
        00001af0  70 70 6c 69 63 61 74 69  6f 6e 4c 61 79 65 72 0a  |pplicationLayer.|
        00001b00  20 20 20 20 3c 73 70 61  6e 20 63 6c 61 73 73 3d  |    // Err|
        00001b20  6f 72 4c 61 79 65 72 20  69 73 20 70 61 72 74 69  |orLayer is parti|
        00001b30  63 75 6c 61 72 6c 79 20  75 73 65 66 75 6c 2c 20  |cularly useful, |
        00001b40  73 69 6e 63 65 20 69 74  20 72 65 74 75 72 6e 73  |since it returns|
        00001b50  20 6e 69 6c 20 69 66 20  74 68 65 20 70 61 63 6b  | nil if the pack|
        00001b60  65 74 3c 2f 73 70 61 6e  3e 0a 20 20 20 20 3c 73  |et.    // was fully|
        00001b90  20 64 65 63 6f 64 65 64  20 73 75 63 63 65 73 73  | decoded success|
        00001ba0  66 75 6c 6c 79 2c 20 61  6e 64 20 6e 6f 6e 2d 6e  |fully, and non-n|
        00001bb0  69 6c 20 69 66 20 61 6e  20 65 72 72 6f 72 20 77  |il if an error w|
        00001bc0  61 73 20 65 6e 63 6f 75  6e 74 65 72 65 64 3c 2f  |as encountered.    |
        00001bf0  2f 2f 20 69 6e 20 64 65  63 6f 64 69 6e 67 20 61  |// in decoding a|
        00001c00  6e 64 20 74 68 65 20 70  61 63 6b 65 74 20 77 61  |nd the packet wa|
        00001c10  73 20 6f 6e 6c 79 20 70  61 72 74 69 61 6c 6c 79  |s only partially|
        00001c20  20 64 65 63 6f 64 65 64  2e 20 20 54 68 75 73 2c  | decoded.  Thus,|
        00001c30  20 69 74 73 20 6f 75 74  70 75 74 3c 2f 73 70 61  | its output.    // |
        00001c60  63 61 6e 20 62 65 20 75  73 65 64 20 74 6f 20 64  |can be used to d|
        00001c70  65 74 65 72 6d 69 6e 65  20 69 66 20 74 68 65 20  |etermine if the |
        00001c80  65 6e 74 69 72 65 20 70  61 63 6b 65 74 20 77 61  |entire packet wa|
        00001c90  73 20 61 62 6c 65 20 74  6f 20 62 65 20 64 65 63  |s able to be dec|
        00001ca0  6f 64 65 64 2e 3c 2f 73  70 61 6e 3e 0a 20 20 20  |oded..   |
        00001cb0  20 45 72 72 6f 72 4c 61  79 65 72 28 29 20 45 72  | ErrorLayer() Er|
        00001cc0  72 6f 72 4c 61 79 65 72  0a 7d 3c 2f 70 72 65 3e  |rorLayer.}
| 00001cd0 0a 09 09 09 3c 70 3e 0a 50 61 63 6b 65 74 20 69 |....

.Packet i| 00001ce0 73 20 74 68 65 20 70 72 69 6d 61 72 79 20 6f 62 |s the primary ob| 00001cf0 6a 65 63 74 20 75 73 65 64 20 62 79 20 67 6f 70 |ject used by gop| 00001d00 61 63 6b 65 74 2e 20 20 50 61 63 6b 65 74 73 20 |acket. Packets | 00001d10 61 72 65 20 63 72 65 61 74 65 64 20 62 79 20 61 |are created by a| 00001d20 0a 44 65 63 6f 64 65 72 26 23 33 39 3b 73 20 44 |.Decoder's D| 00001d30 65 63 6f 64 65 20 63 61 6c 6c 2e 20 20 41 20 70 |ecode call. A p| 00001d40 61 63 6b 65 74 20 69 73 20 6d 61 64 65 20 75 70 |acket is made up| 00001d50 20 6f 66 20 61 20 73 65 74 20 6f 66 20 44 61 74 | of a set of Dat| 00001d60 61 2c 20 77 68 69 63 68 0a 69 73 20 62 72 6f 6b |a, which.is brok| 00001d70 65 6e 20 69 6e 74 6f 20 61 20 6e 75 6d 62 65 72 |en into a number| 00001d80 20 6f 66 20 4c 61 79 65 72 73 20 61 73 20 69 74 | of Layers as it| 00001d90 20 69 73 20 64 65 63 6f 64 65 64 2e 0a 3c 2f 70 | is decoded.................| 00001db0 09 0a 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 |................| 00001dc0 3c 68 33 20 69 64 3d 22 4e 65 77 50 61 63 6b 65 |

func NewPacket

.....
|
        00001e40  66 75 6e 63 20 4e 65 77  50 61 63 6b 65 74 28 64  |func NewPacket(d|
        00001e50  61 74 61 20 5b 5d 62 79  74 65 2c 20 66 69 72 73  |ata []byte, firs|
        00001e60  74 4c 61 79 65 72 44 65  63 6f 64 65 72 20 44 65  |tLayerDecoder De|
        00001e70  63 6f 64 65 72 2c 20 6f  70 74 69 6f 6e 73 20 44  |coder, options D|
        00001e80  65 63 6f 64 65 4f 70 74  69 6f 6e 73 29 20 50 61  |ecodeOptions) Pa|
        00001e90  63 6b 65 74 3c 2f 70 72  65 3e 0a 09 09 09 09 3c  |cket
.....<| 00001ea0 70 3e 0a 4e 65 77 50 61 63 6b 65 74 20 63 72 65 |p>.NewPacket cre| 00001eb0 61 74 65 73 20 61 20 6e 65 77 20 50 61 63 6b 65 |ates a new Packe| 00001ec0 74 20 6f 62 6a 65 63 74 20 66 72 6f 6d 20 61 20 |t object from a | 00001ed0 73 65 74 20 6f 66 20 62 79 74 65 73 2e 20 20 54 |set of bytes. T| 00001ee0 68 65 0a 66 69 72 73 74 4c 61 79 65 72 44 65 63 |he.firstLayerDec| 00001ef0 6f 64 65 72 20 74 65 6c 6c 73 20 69 74 20 68 6f |oder tells it ho| 00001f00 77 20 74 6f 20 69 6e 74 65 72 70 72 65 74 20 74 |w to interpret t| 00001f10 68 65 20 66 69 72 73 74 20 6c 61 79 65 72 20 66 |he first layer f| 00001f20 72 6f 6d 20 74 68 65 20 62 79 74 65 73 2c 0a 66 |rom the bytes,.f| 00001f30 75 74 75 72 65 20 6c 61 79 65 72 73 20 77 69 6c |uture layers wil| 00001f40 6c 20 62 65 20 67 65 6e 65 72 61 74 65 64 20 66 |l be generated f| 00001f50 72 6f 6d 20 74 68 61 74 20 66 69 72 73 74 20 6c |rom that first l| 00001f60 61 79 65 72 20 61 75 74 6f 6d 61 74 69 63 61 6c |ayer automatical| 00001f70 6c 79 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 |ly..

........| 00001f80 09 09 0a 0a 09 09 09 0a 09 09 0a 09 09 09 0a 09 |................| 00001f90 09 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 50 61 |......

typ| 00001fb0 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f |e Packe| 00002000 74 42 75 69 6c 64 65 72 3c 2f 61 3e 3c 2f 68 32 |tBuilder....
type P|
        00002020  61 63 6b 65 74 42 75 69  6c 64 65 72 20 69 6e 74  |acketBuilder int|
        00002030  65 72 66 61 63 65 20 7b  0a 20 20 20 20 3c 73 70  |erface {.    // AddLayer s|
        00002060  68 6f 75 6c 64 20 62 65  20 63 61 6c 6c 65 64 20  |hould be called |
        00002070  62 79 20 61 20 64 65 63  6f 64 65 72 20 69 6d 6d  |by a decoder imm|
        00002080  65 64 69 61 74 65 6c 79  20 75 70 6f 6e 20 73 75  |ediately upon su|
        00002090  63 63 65 73 73 66 75 6c  3c 2f 73 70 61 6e 3e 0a  |ccessful.|
        000020a0  20 20 20 20 3c 73 70 61  6e 20 63 6c 61 73 73 3d  |    // dec|
        000020c0  6f 64 69 6e 67 20 6f 66  20 61 20 6c 61 79 65 72  |oding of a layer|
        000020d0  2e 3c 2f 73 70 61 6e 3e  0a 20 20 20 20 41 64 64  |..    Add|
        000020e0  4c 61 79 65 72 28 6c 20  4c 61 79 65 72 29 0a 20  |Layer(l Layer). |
        000020f0  20 20 20 3c 73 70 61 6e  20 63 6c 61 73 73 3d 22  |   // The |
        00002110  66 6f 6c 6c 6f 77 69 6e  67 20 66 75 6e 63 74 69  |following functi|
        00002120  6f 6e 73 20 73 65 74 20  74 68 65 20 76 61 72 69  |ons set the vari|
        00002130  6f 75 73 20 73 70 65 63  69 66 69 63 20 6c 61 79  |ous specific lay|
        00002140  65 72 73 20 69 6e 20 74  68 65 20 66 69 6e 61 6c  |ers in the final|
        00002150  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 3c 73 70 61  |.    // packet.  No|
        00002180  74 65 20 74 68 61 74 20  69 66 20 6d 61 6e 79 20  |te that if many |
        00002190  6c 61 79 65 72 73 20 63  61 6c 6c 20 53 65 74 58  |layers call SetX|
        000021a0  2c 20 74 68 65 20 66 69  72 73 74 20 63 61 6c 6c  |, the first call|
        000021b0  20 69 73 20 6b 65 70 74  20 61 6e 64 20 61 6c 6c  | is kept and all|
        000021c0  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 3c 73 70 61  |.    // other calls|
        000021f0  20 61 72 65 20 69 67 6e  6f 72 65 64 2e 3c 2f 73  | are ignored..    SetLink|
        00002210  4c 61 79 65 72 28 4c 69  6e 6b 4c 61 79 65 72 29  |Layer(LinkLayer)|
        00002220  0a 20 20 20 20 53 65 74  4e 65 74 77 6f 72 6b 4c  |.    SetNetworkL|
        00002230  61 79 65 72 28 4e 65 74  77 6f 72 6b 4c 61 79 65  |ayer(NetworkLaye|
        00002240  72 29 0a 20 20 20 20 53  65 74 54 72 61 6e 73 70  |r).    SetTransp|
        00002250  6f 72 74 4c 61 79 65 72  28 54 72 61 6e 73 70 6f  |ortLayer(Transpo|
        00002260  72 74 4c 61 79 65 72 29  0a 20 20 20 20 53 65 74  |rtLayer).    Set|
        00002270  41 70 70 6c 69 63 61 74  69 6f 6e 4c 61 79 65 72  |ApplicationLayer|
        00002280  28 41 70 70 6c 69 63 61  74 69 6f 6e 4c 61 79 65  |(ApplicationLaye|
        00002290  72 29 0a 20 20 20 20 53  65 74 45 72 72 6f 72 4c  |r).    SetErrorL|
        000022a0  61 79 65 72 28 45 72 72  6f 72 4c 61 79 65 72 29  |ayer(ErrorLayer)|
        000022b0  0a 20 20 20 20 3c 73 70  61 6e 20 63 6c 61 73 73  |.    // Ne|
        000022d0  78 74 44 65 63 6f 64 65  72 20 73 68 6f 75 6c 64  |xtDecoder should|
        000022e0  20 62 65 20 63 61 6c 6c  65 64 20 62 79 20 61 20  | be called by a |
        000022f0  64 65 63 6f 64 65 72 20  77 68 65 6e 20 74 68 65  |decoder when the|
        00002300  79 26 23 33 39 3b 72 65  20 64 6f 6e 65 20 64 65  |y're done de|
        00002310  63 6f 64 69 6e 67 20 61  3c 2f 73 70 61 6e 3e 0a  |coding a.|
        00002320  20 20 20 20 3c 73 70 61  6e 20 63 6c 61 73 73 3d  |    // pac|
        00002340  6b 65 74 20 6c 61 79 65  72 20 62 75 74 20 6e 6f  |ket layer but no|
        00002350  74 20 64 6f 6e 65 20 77  69 74 68 20 64 65 63 6f  |t done with deco|
        00002360  64 69 6e 67 20 74 68 65  20 65 6e 74 69 72 65 20  |ding the entire |
        00002370  70 61 63 6b 65 74 2e 20  20 54 68 65 20 6e 65 78  |packet.  The nex|
        00002380  74 3c 2f 73 70 61 6e 3e  0a 20 20 20 20 3c 73 70  |t.    // decoder wi|
        000023b0  6c 6c 20 62 65 20 63 61  6c 6c 65 64 20 74 6f 20  |ll be called to |
        000023c0  64 65 63 6f 64 65 20 74  68 65 20 6c 61 73 74 20  |decode the last |
        000023d0  41 64 64 4c 61 79 65 72  26 23 33 39 3b 73 20 4c  |AddLayer's L|
        000023e0  61 79 65 72 50 61 79 6c  6f 61 64 2e 3c 2f 73 70  |ayerPayload..    //|
        00002410  20 42 65 63 61 75 73 65  20 6f 66 20 74 68 69 73  | Because of this|
        00002420  2c 20 4e 65 78 74 44 65  63 6f 64 65 72 20 6d 75  |, NextDecoder mu|
        00002430  73 74 20 6f 6e 6c 79 20  62 65 20 63 61 6c 6c 65  |st only be calle|
        00002440  64 20 6f 6e 63 65 20 61  6c 6c 20 6f 74 68 65 72  |d once all other|
        00002450  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 3c 73 70 61  |.    // PacketBuild|
        00002480  65 72 20 63 61 6c 6c 73  20 68 61 76 65 20 62 65  |er calls have be|
        00002490  65 6e 20 6d 61 64 65 2e  20 20 53 65 74 2a 4c 61  |en made.  Set*La|
        000024a0  79 65 72 20 61 6e 64 20  41 64 64 4c 61 79 65 72  |yer and AddLayer|
        000024b0  20 63 61 6c 6c 73 20 61  66 74 65 72 3c 2f 73 70  | calls after.    //|
        000024e0  20 4e 65 78 74 44 65 63  6f 64 65 72 20 63 61 6c  | NextDecoder cal|
        000024f0  6c 73 20 77 69 6c 6c 20  62 65 68 61 76 65 20 69  |ls will behave i|
        00002500  6e 63 6f 72 72 65 63 74  6c 79 2e 3c 2f 73 70 61  |ncorrectly..    NextDecod|
        00002520  65 72 28 6e 65 78 74 20  44 65 63 6f 64 65 72 29  |er(next Decoder)|
        00002530  20 65 72 72 6f 72 0a 7d  3c 2f 70 72 65 3e 0a 09  | error.}
..| 00002540 09 09 3c 70 3e 0a 50 61 63 6b 65 74 42 75 69 6c |..

.PacketBuil| 00002550 64 65 72 20 69 73 20 75 73 65 64 20 62 79 20 6c |der is used by l| 00002560 61 79 65 72 20 64 65 63 6f 64 65 72 73 20 74 6f |ayer decoders to| 00002570 20 73 74 6f 72 65 20 74 68 65 20 6c 61 79 65 72 | store the layer| 00002580 73 20 74 68 65 79 26 23 33 39 3b 76 65 20 64 65 |s they've de| 00002590 63 6f 64 65 64 2c 0a 61 6e 64 20 74 6f 20 64 65 |coded,.and to de| 000025a0 66 65 72 20 66 75 74 75 72 65 20 64 65 63 6f 64 |fer future decod| 000025b0 69 6e 67 20 76 69 61 20 4e 65 78 74 44 65 63 6f |ing via NextDeco| 000025c0 64 65 72 2e 0a 54 79 70 69 63 61 6c 6c 79 2c 20 |der..Typically, | 000025d0 74 68 65 20 70 61 74 74 65 72 6e 20 66 6f 72 20 |the pattern for | 000025e0 75 73 65 20 69 73 3a 0a 3c 2f 70 3e 0a 3c 70 72 |use is:.

.func (m *myDec| 00002600 6f 64 65 72 29 20 44 65 63 6f 64 65 28 64 61 74 |oder) Decode(dat| 00002610 61 20 5b 5d 62 79 74 65 2c 20 70 20 50 61 63 6b |a []byte, p Pack| 00002620 65 74 42 75 69 6c 64 65 72 29 20 65 72 72 6f 72 |etBuilder) error| 00002630 20 7b 0a 20 20 69 66 20 6d 79 4c 61 79 65 72 2c | {. if myLayer,| 00002640 20 65 72 72 20 3a 3d 20 6d 79 44 65 63 6f 64 69 | err := myDecodi| 00002650 6e 67 4c 6f 67 69 63 28 64 61 74 61 29 3b 20 65 |ngLogic(data); e| 00002660 72 72 20 21 3d 20 6e 69 6c 20 7b 0a 20 20 20 20 |rr != nil {. | 00002670 72 65 74 75 72 6e 20 65 72 72 0a 20 20 7d 20 65 |return err. } e| 00002680 6c 73 65 20 7b 0a 20 20 20 20 70 2e 41 64 64 4c |lse {. p.AddL| 00002690 61 79 65 72 28 6d 79 4c 61 79 65 72 29 0a 20 20 |ayer(myLayer). | 000026a0 7d 0a 20 20 2f 2f 20 6d 61 79 62 65 20 64 6f 20 |}. // maybe do | 000026b0 74 68 69 73 2c 20 69 66 20 6d 79 4c 61 79 65 72 |this, if myLayer| 000026c0 20 69 73 20 61 20 4c 69 6e 6b 4c 61 79 65 72 0a | is a LinkLayer.| 000026d0 20 20 70 2e 53 65 74 4c 69 6e 6b 4c 61 79 65 72 | p.SetLinkLayer| 000026e0 28 6d 79 4c 61 79 65 72 29 0a 20 20 72 65 74 75 |(myLayer). retu| 000026f0 72 6e 20 70 2e 4e 65 78 74 44 65 63 6f 64 65 72 |rn p.NextDecoder| 00002700 28 6e 65 78 74 44 65 63 6f 64 65 72 29 0a 7d 0a |(nextDecoder).}.| 00002710 3c 2f 70 72 65 3e 0a 0a 0a 09 09 09 0a 0a 09 09 |

..........| 00002720 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 |................| 00002730 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 3c |...............<| 00002740 68 32 20 69 64 3d 22 50 61 63 6b 65 74 44 61 74 |h2 id="PacketDat| 00002750 61 53 6f 75 72 63 65 22 3e 74 79 70 65 20 3c 61 |aSource">type Packe| 000027b0 74 44 61 74 61 53 6f 75 72 63 65 3c 2f 61 3e 3c |tDataSource<| 000027c0 2f 68 32 3e 0a 09 09 09 3c 70 72 65 3e 74 79 70 |/h2>....
typ|
        000027d0  65 20 50 61 63 6b 65 74  44 61 74 61 53 6f 75 72  |e PacketDataSour|
        000027e0  63 65 20 69 6e 74 65 72  66 61 63 65 20 7b 0a 20  |ce interface {. |
        000027f0  20 20 20 3c 73 70 61 6e  20 63 6c 61 73 73 3d 22  |   // Read|
        00002810  50 61 63 6b 65 74 44 61  74 61 20 72 65 74 75 72  |PacketData retur|
        00002820  6e 73 20 74 68 65 20 6e  65 78 74 20 70 61 63 6b  |ns the next pack|
        00002830  65 74 20 61 76 61 69 6c  61 62 6c 65 20 66 72 6f  |et available fro|
        00002840  6d 20 74 68 69 73 20 64  61 74 61 20 73 6f 75 72  |m this data sour|
        00002850  63 65 2e 3c 2f 73 70 61  6e 3e 0a 20 20 20 20 3c  |ce..    <|
        00002860  73 70 61 6e 20 63 6c 61  73 73 3d 22 63 6f 6d 6d  |span class="comm|
        00002870  65 6e 74 22 3e 2f 2f 20  49 74 20 72 65 74 75 72  |ent">// It retur|
        00002880  6e 73 3a 3c 2f 73 70 61  6e 3e 0a 20 20 20 20 3c  |ns:.    <|
        00002890  73 70 61 6e 20 63 6c 61  73 73 3d 22 63 6f 6d 6d  |span class="comm|
        000028a0  65 6e 74 22 3e 2f 2f 20  20 64 61 74 61 3a 20 20  |ent">//  data:  |
        000028b0  54 68 65 20 62 79 74 65  73 20 6f 66 20 61 6e 20  |The bytes of an |
        000028c0  69 6e 64 69 76 69 64 75  61 6c 20 70 61 63 6b 65  |individual packe|
        000028d0  74 2e 3c 2f 73 70 61 6e  3e 0a 20 20 20 20 3c 73  |t..    //  ci:  Met|
        00002900  61 64 61 74 61 20 61 62  6f 75 74 20 74 68 65 20  |adata about the |
        00002910  63 61 70 74 75 72 65 3c  2f 73 70 61 6e 3e 0a 20  |capture. |
        00002920  20 20 20 3c 73 70 61 6e  20 63 6c 61 73 73 3d 22  |   //  err|
        00002940  3a 20 20 41 6e 20 65 72  72 6f 72 20 65 6e 63 6f  |:  An error enco|
        00002950  75 6e 74 65 72 65 64 20  77 68 69 6c 65 20 72 65  |untered while re|
        00002960  61 64 69 6e 67 20 70 61  63 6b 65 74 20 64 61 74  |ading packet dat|
        00002970  61 2e 20 20 49 66 20 65  72 72 20 21 3d 20 6e 69  |a.  If err != ni|
        00002980  6c 2c 3c 2f 73 70 61 6e  3e 0a 20 20 20 20 3c 73  |l,.    //    then d|
        000029b0  61 74 61 2f 63 69 20 77  69 6c 6c 20 62 65 20 69  |ata/ci will be i|
        000029c0  67 6e 6f 72 65 64 2e 3c  2f 73 70 61 6e 3e 0a 20  |gnored.. |
        000029d0  20 20 20 52 65 61 64 50  61 63 6b 65 74 44 61 74  |   ReadPacketDat|
        000029e0  61 28 29 20 28 64 61 74  61 20 5b 5d 62 79 74 65  |a() (data []byte|
        000029f0  2c 20 63 69 20 43 61 70  74 75 72 65 49 6e 66 6f  |, ci CaptureInfo|
        00002a00  2c 20 65 72 72 20 65 72  72 6f 72 29 0a 7d 3c 2f  |, err error).}....

.Pack| 00002a20 65 74 44 61 74 61 53 6f 75 72 63 65 20 69 73 20 |etDataSource is | 00002a30 61 6e 20 69 6e 74 65 72 66 61 63 65 20 66 6f 72 |an interface for| 00002a40 20 73 6f 6d 65 20 73 6f 75 72 63 65 20 6f 66 20 | some source of | 00002a50 70 61 63 6b 65 74 20 64 61 74 61 2e 20 20 55 73 |packet data. Us| 00002a60 65 72 73 20 6d 61 79 0a 63 72 65 61 74 65 20 74 |ers may.create t| 00002a70 68 65 69 72 20 6f 77 6e 20 69 6d 70 6c 65 6d 65 |heir own impleme| 00002a80 6e 74 61 74 69 6f 6e 73 2c 20 6f 72 20 75 73 65 |ntations, or use| 00002a90 20 74 68 65 20 65 78 69 73 74 69 6e 67 20 69 6d | the existing im| 00002aa0 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 69 6e |plementations in| 00002ab0 0a 67 6f 70 61 63 6b 65 74 2f 70 63 61 70 20 28 |.gopacket/pcap (| 00002ac0 6c 69 62 70 63 61 70 2c 20 61 6c 6c 6f 77 73 20 |libpcap, allows | 00002ad0 72 65 61 64 69 6e 67 20 66 72 6f 6d 20 6c 69 76 |reading from liv| 00002ae0 65 20 69 6e 74 65 72 66 61 63 65 73 20 6f 72 20 |e interfaces or | 00002af0 66 72 6f 6d 0a 70 63 61 70 20 66 69 6c 65 73 29 |from.pcap files)| 00002b00 20 6f 72 20 67 6f 70 61 63 6b 65 74 2f 70 66 72 | or gopacket/pfr| 00002b10 69 6e 67 20 28 50 46 5f 52 49 4e 47 2c 20 61 6c |ing (PF_RING, al| 00002b20 6c 6f 77 73 20 72 65 61 64 69 6e 67 20 66 72 6f |lows reading fro| 00002b30 6d 20 6c 69 76 65 0a 69 6e 74 65 72 66 61 63 65 |m live.interface| 00002b40 73 29 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a |s)..

........| 00002b50 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 |................| 00002b60 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 |................| 00002b70 09 3c 68 32 20 69 64 3d 22 50 61 63 6b 65 74 53 |.

type PacketS| 00002be0 6f 75 72 63 65 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 |ource

..| 00002bf0 09 09 3c 70 72 65 3e 74 79 70 65 20 50 61 63 6b |..
type Pack|
        00002c00  65 74 53 6f 75 72 63 65  20 73 74 72 75 63 74 20  |etSource struct |
        00002c10  7b 0a 0a 20 20 20 20 3c  73 70 61 6e 20 63 6c 61  |{..    // |
        00002c30  44 65 63 6f 64 65 4f 70  74 69 6f 6e 73 20 69 73  |DecodeOptions is|
        00002c40  20 74 68 65 20 73 65 74  20 6f 66 20 6f 70 74 69  | the set of opti|
        00002c50  6f 6e 73 20 74 6f 20 75  73 65 20 66 6f 72 20 64  |ons to use for d|
        00002c60  65 63 6f 64 69 6e 67 20  65 61 63 68 20 70 69 65  |ecoding each pie|
        00002c70  63 65 3c 2f 73 70 61 6e  3e 0a 20 20 20 20 3c 73  |ce.    // of packet|
        00002ca0  20 64 61 74 61 2e 20 20  54 68 69 73 20 63 61 6e  | data.  This can|
        00002cb0  2f 73 68 6f 75 6c 64 20  62 65 20 63 68 61 6e 67  |/should be chang|
        00002cc0  65 64 20 62 79 20 74 68  65 20 75 73 65 72 20 74  |ed by the user t|
        00002cd0  6f 20 72 65 66 6c 65 63  74 20 74 68 65 3c 2f 73  |o reflect the.    /|
        00002d00  2f 20 77 61 79 20 70 61  63 6b 65 74 73 20 73 68  |/ way packets sh|
        00002d10  6f 75 6c 64 20 62 65 20  64 65 63 6f 64 65 64 2e  |ould be decoded.|
        00002d20  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 44 65 63 6f  |.    Deco|
        00002d30  64 65 4f 70 74 69 6f 6e  73 0a 20 20 20 20 3c 73  |deOptions.    // contains |
        00002d60  66 69 6c 74 65 72 65 64  20 6f 72 20 75 6e 65 78  |filtered or unex|
        00002d70  70 6f 72 74 65 64 20 66  69 65 6c 64 73 3c 2f 73  |ported fields.}
....| 00002d90 3c 70 3e 0a 50 61 63 6b 65 74 53 6f 75 72 63 65 |

.PacketSource| 00002da0 20 72 65 61 64 73 20 69 6e 20 70 61 63 6b 65 74 | reads in packet| 00002db0 73 20 66 72 6f 6d 20 61 20 50 61 63 6b 65 74 44 |s from a PacketD| 00002dc0 61 74 61 53 6f 75 72 63 65 2c 20 64 65 63 6f 64 |ataSource, decod| 00002dd0 65 73 20 74 68 65 6d 2c 20 61 6e 64 0a 72 65 74 |es them, and.ret| 00002de0 75 72 6e 73 20 74 68 65 6d 2e 0a 3c 2f 70 3e 0a |urns them..

.| 00002df0 3c 70 3e 0a 54 68 65 72 65 20 61 72 65 20 63 75 |

.There are cu| 00002e00 72 72 65 6e 74 6c 79 20 74 77 6f 20 64 69 66 66 |rrently two diff| 00002e10 65 72 65 6e 74 20 6d 65 74 68 6f 64 73 20 66 6f |erent methods fo| 00002e20 72 20 72 65 61 64 69 6e 67 20 70 61 63 6b 65 74 |r reading packet| 00002e30 73 20 69 6e 20 74 68 72 6f 75 67 68 0a 61 20 50 |s in through.a P| 00002e40 61 63 6b 65 74 53 6f 75 72 63 65 3a 0a 3c 2f 70 |acketSource:..

Reading| 00002e80 20 57 69 74 68 20 50 61 63 6b 65 74 73 20 46 75 | With Packets Fu| 00002e90 6e 63 74 69 6f 6e 3c 2f 68 33 3e 0a 3c 70 3e 0a |nction

.

.| 00002ea0 54 68 69 73 20 6d 65 74 68 6f 64 20 69 73 20 74 |This method is t| 00002eb0 68 65 20 6d 6f 73 74 20 63 6f 6e 76 65 6e 69 65 |he most convenie| 00002ec0 6e 74 20 61 6e 64 20 65 61 73 69 65 73 74 20 74 |nt and easiest t| 00002ed0 6f 20 63 6f 64 65 2c 20 62 75 74 20 6c 61 63 6b |o code, but lack| 00002ee0 73 0a 66 6c 65 78 69 62 69 6c 69 74 79 2e 20 20 |s.flexibility. | 00002ef0 50 61 63 6b 65 74 73 20 72 65 74 75 72 6e 73 20 |Packets returns | 00002f00 61 20 26 23 33 39 3b 63 68 61 6e 20 50 61 63 6b |a 'chan Pack| 00002f10 65 74 26 23 33 39 3b 2c 20 74 68 65 6e 20 61 73 |et', then as| 00002f20 79 6e 63 68 72 6f 6e 6f 75 73 6c 79 20 77 72 69 |ynchronously wri| 00002f30 74 65 73 0a 70 61 63 6b 65 74 73 20 69 6e 74 6f |tes.packets into| 00002f40 20 74 68 61 74 20 63 68 61 6e 6e 65 6c 2e 20 20 | that channel. | 00002f50 50 61 63 6b 65 74 73 20 75 73 65 73 20 61 20 62 |Packets uses a b| 00002f60 6c 6f 63 6b 69 6e 67 20 63 68 61 6e 6e 65 6c 2c |locking channel,| 00002f70 20 61 6e 64 20 63 6c 6f 73 65 73 0a 69 74 20 69 | and closes.it i| 00002f80 66 20 61 6e 20 69 6f 2e 45 4f 46 20 69 73 20 72 |f an io.EOF is r| 00002f90 65 74 75 72 6e 65 64 20 62 79 20 74 68 65 20 75 |eturned by the u| 00002fa0 6e 64 65 72 6c 79 69 6e 67 20 50 61 63 6b 65 74 |nderlying Packet| 00002fb0 44 61 74 61 53 6f 75 72 63 65 2e 20 20 41 6c 6c |DataSource. All| 00002fc0 20 6f 74 68 65 72 0a 50 61 63 6b 65 74 44 61 74 | other.PacketDat| 00002fd0 61 53 6f 75 72 63 65 20 65 72 72 6f 72 73 20 61 |aSource errors a| 00002fe0 72 65 20 69 67 6e 6f 72 65 64 20 61 6e 64 20 64 |re ignored and d| 00002ff0 69 73 63 61 72 64 65 64 2e 0a 3c 2f 70 3e 0a 3c |iscarded..

.<| 00003000 70 72 65 3e 66 6f 72 20 70 61 63 6b 65 74 20 3a |pre>for packet :| 00003010 3d 20 72 61 6e 67 65 20 70 61 63 6b 65 74 53 6f |= range packetSo| 00003020 75 72 63 65 2e 50 61 63 6b 65 74 73 28 29 20 7b |urce.Packets() {| 00003030 0a 20 20 2e 2e 2e 0a 7d 0a 3c 2f 70 72 65 3e 0a |. ....}.
.| 00003040 3c 68 33 20 69 64 3d 22 52 65 61 64 69 6e 67 5f |

Readin| 00003070 67 20 57 69 74 68 20 4e 65 78 74 50 61 63 6b 65 |g With NextPacke| 00003080 74 20 46 75 6e 63 74 69 6f 6e 3c 2f 68 33 3e 0a |t Function

.| 00003090 3c 70 3e 0a 54 68 69 73 20 6d 65 74 68 6f 64 20 |

.This method | 000030a0 69 73 20 74 68 65 20 6d 6f 73 74 20 66 6c 65 78 |is the most flex| 000030b0 69 62 6c 65 2c 20 61 6e 64 20 65 78 70 6f 73 65 |ible, and expose| 000030c0 73 20 65 72 72 6f 72 73 20 74 68 61 74 20 6d 61 |s errors that ma| 000030d0 79 20 62 65 0a 65 6e 63 6f 75 6e 74 65 72 65 64 |y be.encountered| 000030e0 20 62 79 20 74 68 65 20 75 6e 64 65 72 6c 79 69 | by the underlyi| 000030f0 6e 67 20 50 61 63 6b 65 74 44 61 74 61 53 6f 75 |ng PacketDataSou| 00003100 72 63 65 2e 20 20 49 74 26 23 33 39 3b 73 20 61 |rce. It's a| 00003110 6c 73 6f 20 74 68 65 20 66 61 73 74 65 73 74 0a |lso the fastest.| 00003120 69 6e 20 61 20 74 69 67 68 74 20 6c 6f 6f 70 2c |in a tight loop,| 00003130 20 73 69 6e 63 65 20 69 74 20 64 6f 65 73 6e 26 | since it doesn&| 00003140 23 33 39 3b 74 20 68 61 76 65 20 74 68 65 20 6f |#39;t have the o| 00003150 76 65 72 68 65 61 64 20 6f 66 20 61 20 63 68 61 |verhead of a cha| 00003160 6e 6e 65 6c 0a 72 65 61 64 2f 77 72 69 74 65 2e |nnel.read/write.| 00003170 20 20 48 6f 77 65 76 65 72 2c 20 69 74 20 72 65 | However, it re| 00003180 71 75 69 72 65 73 20 74 68 65 20 75 73 65 72 20 |quires the user | 00003190 74 6f 20 68 61 6e 64 6c 65 20 65 72 72 6f 72 73 |to handle errors| 000031a0 2c 20 6d 6f 73 74 0a 69 6d 70 6f 72 74 61 6e 74 |, most.important| 000031b0 6c 79 20 74 68 65 20 69 6f 2e 45 4f 46 20 65 72 |ly the io.EOF er| 000031c0 72 6f 72 20 69 6e 20 63 61 73 65 73 20 77 68 65 |ror in cases whe| 000031d0 72 65 20 70 61 63 6b 65 74 73 20 61 72 65 20 62 |re packets are b| 000031e0 65 69 6e 67 20 72 65 61 64 20 66 72 6f 6d 0a 61 |eing read from.a| 000031f0 20 66 69 6c 65 2e 0a 3c 2f 70 3e 0a 3c 70 72 65 | file..

.for {. packet,| 00003210 20 65 72 72 20 3a 3d 20 70 61 63 6b 65 74 53 6f | err := packetSo| 00003220 75 72 63 65 2e 4e 65 78 74 50 61 63 6b 65 74 28 |urce.NextPacket(| 00003230 29 20 7b 0a 20 20 69 66 20 65 72 72 20 3d 3d 20 |) {. if err == | 00003240 69 6f 2e 45 4f 46 20 7b 0a 20 20 20 20 62 72 65 |io.EOF {. bre| 00003250 61 6b 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 65 |ak. } else if e| 00003260 72 72 20 21 3d 20 6e 69 6c 20 7b 0a 20 20 20 20 |rr != nil {. | 00003270 6c 6f 67 2e 50 72 69 6e 74 6c 6e 28 26 23 33 34 |log.Println("| 00003280 3b 45 72 72 6f 72 3a 26 23 33 34 3b 2c 20 65 72 |;Error:", er| 00003290 72 29 0a 20 20 20 20 63 6f 6e 74 69 6e 75 65 0a |r). continue.| 000032a0 20 20 7d 0a 20 20 68 61 6e 64 6c 65 50 61 63 6b | }. handlePack| 000032b0 65 74 28 70 61 63 6b 65 74 29 20 20 2f 2f 20 44 |et(packet) // D| 000032c0 6f 20 73 6f 6d 65 74 68 69 6e 67 20 77 69 74 68 |o something with| 000032d0 20 65 61 63 68 20 70 61 63 6b 65 74 2e 0a 7d 0a | each packet..}.| 000032e0 3c 2f 70 72 65 3e 0a 0a 0a 09 09 09 0a 0a 09 09 |..........| 000032f0 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 |................| 00003300 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 4e 65 77 |.....

fu| 00003320 6e 63 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |nc | 00003370 4e 65 77 50 61 63 6b 65 74 53 6f 75 72 63 65 3c |NewPacketSource<| 00003380 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 72 |/a>

.....func NewPacket| 000033a0 53 6f 75 72 63 65 28 73 6f 75 72 63 65 20 50 61 |Source(source Pa| 000033b0 63 6b 65 74 44 61 74 61 53 6f 75 72 63 65 2c 20 |cketDataSource, | 000033c0 64 65 63 6f 64 65 72 20 44 65 63 6f 64 65 72 29 |decoder Decoder)| 000033d0 20 2a 50 61 63 6b 65 74 53 6f 75 72 63 65 3c 2f | *PacketSource.....

.New| 000033f0 50 61 63 6b 65 74 53 6f 75 72 63 65 20 63 72 65 |PacketSource cre| 00003400 61 74 65 73 20 61 20 70 61 63 6b 65 74 20 64 61 |ates a packet da| 00003410 74 61 20 73 6f 75 72 63 65 2e 0a 3c 2f 70 3e 0a |ta source..

.| 00003420 0a 09 09 09 09 0a 09 09 09 0a 0a 09 09 09 0a 09 |................| 00003430 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 |........

func (*| 00003460 50 61 63 6b 65 74 53 6f 75 72 63 65 29 20 3c 61 |PacketSource) NextP| 000034c0 61 63 6b 65 74 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 |acket

..| 000034d0 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 70 20 |...
func (p |
        000034e0  2a 50 61 63 6b 65 74 53  6f 75 72 63 65 29 20 4e  |*PacketSource) N|
        000034f0  65 78 74 50 61 63 6b 65  74 28 29 20 28 50 61 63  |extPacket() (Pac|
        00003500  6b 65 74 2c 20 65 72 72  6f 72 29 3c 2f 70 72 65  |ket, error).....

.NextPa| 00003520 63 6b 65 74 20 72 65 74 75 72 6e 73 20 74 68 65 |cket returns the| 00003530 20 6e 65 78 74 20 64 65 63 6f 64 65 64 20 70 61 | next decoded pa| 00003540 63 6b 65 74 20 66 72 6f 6d 20 74 68 65 20 50 61 |cket from the Pa| 00003550 63 6b 65 74 53 6f 75 72 63 65 2e 20 20 4f 6e 20 |cketSource. On | 00003560 65 72 72 6f 72 2c 0a 69 74 20 72 65 74 75 72 6e |error,.it return| 00003570 73 20 61 20 6e 69 6c 20 70 61 63 6b 65 74 20 61 |s a nil packet a| 00003580 6e 64 20 61 20 6e 6f 6e 2d 6e 69 6c 20 65 72 72 |nd a non-nil err| 00003590 6f 72 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 |or..

........| 000035a0 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 000035b0 09 3c 68 33 20 69 64 3d 22 50 61 63 6b 65 74 53 |.

f| 000035d0 75 6e 63 20 28 2a 50 61 63 6b 65 74 53 6f 75 72 |unc (*PacketSour| 000035e0 63 65 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 |ce) Packets.....
func |
        00003650  28 70 20 2a 50 61 63 6b  65 74 53 6f 75 72 63 65  |(p *PacketSource|
        00003660  29 20 50 61 63 6b 65 74  73 28 29 20 63 68 61 6e  |) Packets() chan|
        00003670  20 50 61 63 6b 65 74 3c  2f 70 72 65 3e 0a 09 09  | Packet
...| 00003680 09 09 3c 70 3e 0a 50 61 63 6b 65 74 73 20 72 65 |..

.Packets re| 00003690 74 75 72 6e 73 20 61 20 62 6c 6f 63 6b 69 6e 67 |turns a blocking| 000036a0 20 63 68 61 6e 6e 65 6c 20 6f 66 20 70 61 63 6b | channel of pack| 000036b0 65 74 73 2c 20 61 6c 6c 6f 77 69 6e 67 20 65 61 |ets, allowing ea| 000036c0 73 79 20 69 74 65 72 61 74 69 6e 67 20 6f 76 65 |sy iterating ove| 000036d0 72 0a 70 61 63 6b 65 74 73 2e 20 20 50 61 63 6b |r.packets. Pack| 000036e0 65 74 73 20 77 69 6c 6c 20 62 65 20 61 73 79 6e |ets will be asyn| 000036f0 63 68 72 6f 6e 6f 75 73 6c 79 20 72 65 61 64 20 |chronously read | 00003700 69 6e 20 66 72 6f 6d 20 74 68 65 20 75 6e 64 65 |in from the unde| 00003710 72 6c 79 69 6e 67 0a 50 61 63 6b 65 74 44 61 74 |rlying.PacketDat| 00003720 61 53 6f 75 72 63 65 20 61 6e 64 20 77 72 69 74 |aSource and writ| 00003730 74 65 6e 20 74 6f 20 74 68 65 20 72 65 74 75 72 |ten to the retur| 00003740 6e 65 64 20 63 68 61 6e 6e 65 6c 2e 20 20 49 66 |ned channel. If| 00003750 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 0a | the underlying.| 00003760 50 61 63 6b 65 74 44 61 74 61 53 6f 75 72 63 65 |PacketDataSource| 00003770 20 72 65 74 75 72 6e 73 20 61 6e 20 69 6f 2e 45 | returns an io.E| 00003780 4f 46 20 65 72 72 6f 72 2c 20 74 68 65 20 63 68 |OF error, the ch| 00003790 61 6e 6e 65 6c 20 77 69 6c 6c 20 62 65 20 63 6c |annel will be cl| 000037a0 6f 73 65 64 2e 0a 49 66 20 61 6e 79 20 6f 74 68 |osed..If any oth| 000037b0 65 72 20 65 72 72 6f 72 20 69 73 20 65 6e 63 6f |er error is enco| 000037c0 75 6e 74 65 72 65 64 2c 20 69 74 20 69 73 20 69 |untered, it is i| 000037d0 67 6e 6f 72 65 64 2e 0a 3c 2f 70 3e 0a 3c 70 72 |gnored..

.for packet := | 000037f0 72 61 6e 67 65 20 70 61 63 6b 65 74 53 6f 75 72 |range packetSour| 00003800 63 65 2e 50 61 63 6b 65 74 73 28 29 20 7b 0a 20 |ce.Packets() {. | 00003810 20 68 61 6e 64 6c 65 50 61 63 6b 65 74 28 70 61 | handlePacket(pa| 00003820 63 6b 65 74 29 20 20 2f 2f 20 44 6f 20 73 6f 6d |cket) // Do som| 00003830 65 74 68 69 6e 67 20 77 69 74 68 20 65 61 63 68 |ething with each| 00003840 20 70 61 63 6b 65 74 2e 0a 7d 0a 3c 2f 70 72 65 | packet..}................| 00003860 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 3c |...............<| 00003870 68 32 20 69 64 3d 22 50 61 79 6c 6f 61 64 22 3e |h2 id="Payload">| 00003880 74 79 70 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 |type Pay| 000038d0 6c 6f 61 64 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 |load

...| 000038e0 09 3c 70 72 65 3e 74 79 70 65 20 50 61 79 6c 6f |.
type Paylo|
        000038f0  61 64 20 73 74 72 75 63  74 20 7b 0a 20 20 20 20  |ad struct {.    |
        00003900  44 61 74 61 20 5b 5d 62  79 74 65 0a 7d 3c 2f 70  |Data []byte.}....

.Paylo| 00003920 61 64 20 69 73 20 61 20 4c 61 79 65 72 20 63 6f |ad is a Layer co| 00003930 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 70 61 79 |ntaining the pay| 00003940 6c 6f 61 64 20 6f 66 20 61 20 70 61 63 6b 65 74 |load of a packet| 00003950 2e 20 20 54 68 65 20 64 65 66 69 6e 69 74 69 6f |. The definitio| 00003960 6e 20 6f 66 0a 77 68 61 74 20 63 6f 6e 73 74 69 |n of.what consti| 00003970 74 75 74 65 73 20 74 68 65 20 70 61 79 6c 6f 61 |tutes the payloa| 00003980 64 20 6f 66 20 61 20 70 61 63 6b 65 74 20 64 65 |d of a packet de| 00003990 70 65 6e 64 73 20 6f 6e 20 70 72 65 76 69 6f 75 |pends on previou| 000039a0 73 20 6c 61 79 65 72 73 3b 20 66 6f 72 0a 54 43 |s layers; for.TC| 000039b0 50 20 61 6e 64 20 55 44 50 2c 20 77 65 20 73 74 |P and UDP, we st| 000039c0 6f 70 20 64 65 63 6f 64 69 6e 67 20 61 62 6f 76 |op decoding abov| 000039d0 65 20 6c 61 79 65 72 20 34 20 61 6e 64 20 72 65 |e layer 4 and re| 000039e0 74 75 72 6e 20 74 68 65 20 72 65 6d 61 69 6e 69 |turn the remaini| 000039f0 6e 67 0a 62 79 74 65 73 20 61 73 20 61 20 50 61 |ng.bytes as a Pa| 00003a00 79 6c 6f 61 64 2e 20 20 50 61 79 6c 6f 61 64 20 |yload. Payload | 00003a10 69 73 20 61 6e 20 41 70 70 6c 69 63 61 74 69 6f |is an Applicatio| 00003a20 6e 4c 61 79 65 72 2e 0a 3c 2f 70 3e 0a 0a 0a 09 |nLayer..

....| 00003a30 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 |................| 00003a40 09 0a 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 |................| 00003a50 3c 68 33 20 69 64 3d 22 50 61 79 6c 6f 61 64 2e |

f| 00003a70 75 6e 63 20 28 2a 50 61 79 6c 6f 61 64 29 20 3c |unc (*Payload) <| 00003a80 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b 67 |a href="/src/pkg| 00003a90 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 67 63 6f 6e |/github.com/gcon| 00003aa0 6e 65 6c 6c 2f 67 6f 70 61 63 6b 65 74 2f 62 61 |nell/gopacket/ba| 00003ab0 73 65 2e 67 6f 3f 73 3d 31 32 36 35 3a 31 33 30 |se.go?s=1265:130| 00003ac0 35 23 4c 32 37 22 3e 4c 61 79 65 72 43 6f 6e 74 |5#L27">LayerCont| 00003ad0 65 6e 74 73 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 |ents

...| 00003ae0 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 70 20 2a |..
func (p *|
        00003af0  50 61 79 6c 6f 61 64 29  20 4c 61 79 65 72 43 6f  |Payload) LayerCo|
        00003b00  6e 74 65 6e 74 73 28 29  20 5b 5d 62 79 74 65 3c  |ntents() []byte<|
        00003b10  2f 70 72 65 3e 0a 09 09  09 09 0a 09 09 09 09 0a  |/pre>...........|
        00003b20  09 09 09 09 0a 09 09 09  0a 09 09 09 09 0a 09 09  |................|
        00003b30  09 09 3c 68 33 20 69 64  3d 22 50 61 79 6c 6f 61  |..

| 00003b50 66 75 6e 63 20 28 2a 50 61 79 6c 6f 61 64 29 20 |func (*Payload) | 00003b60 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b |LayerPay| 00003bb0 6c 6f 61 64 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 |load

...| 00003bc0 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 70 20 2a |..
func (p *|
        00003bd0  50 61 79 6c 6f 61 64 29  20 4c 61 79 65 72 50 61  |Payload) LayerPa|
        00003be0  79 6c 6f 61 64 28 29 20  5b 5d 62 79 74 65 3c 2f  |yload() []byte............|
        00003c00  09 09 09 0a 09 09 09 0a  09 09 09 09 0a 09 09 09  |................|
        00003c10  09 3c 68 33 20 69 64 3d  22 50 61 79 6c 6f 61 64  |.

func| 00003c30 20 28 2a 50 61 79 6c 6f 61 64 29 20 3c 61 20 68 | (*Payload) LayerType

.....
|
        00003ca0  66 75 6e 63 20 28 70 20  2a 50 61 79 6c 6f 61 64  |func (p *Payload|
        00003cb0  29 20 4c 61 79 65 72 54  79 70 65 28 29 20 4c 61  |) LayerType() La|
        00003cc0  79 65 72 54 79 70 65 3c  2f 70 72 65 3e 0a 09 09  |yerType
...| 00003cd0 09 09 3c 70 3e 0a 4c 61 79 65 72 54 79 70 65 20 |..

.LayerType | 00003ce0 72 65 74 75 72 6e 73 20 4c 61 79 65 72 54 79 70 |returns LayerTyp| 00003cf0 65 50 61 79 6c 6f 61 64 0a 3c 2f 70 3e 0a 0a 09 |ePayload.

...| 00003d00 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 |................| 00003d10 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 50 61 |......

f| 00003d30 75 6e 63 20 28 2a 50 61 79 6c 6f 61 64 29 20 3c |unc (*Payload) <| 00003d40 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b 67 |a href="/src/pkg| 00003d50 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 67 63 6f 6e |/github.com/gcon| 00003d60 6e 65 6c 6c 2f 67 6f 70 61 63 6b 65 74 2f 62 61 |nell/gopacket/ba| 00003d70 73 65 2e 67 6f 3f 73 3d 31 33 38 30 3a 31 34 31 |se.go?s=1380:141| 00003d80 34 23 4c 32 39 22 3e 50 61 79 6c 6f 61 64 3c 2f |4#L29">Payload

.....func (p *Payloa| 00003db0 64 29 20 50 61 79 6c 6f 61 64 28 29 20 5b 5d 62 |d) Payload() []b| 00003dc0 79 74 65 3c 2f 70 72 65 3e 0a 09 09 09 09 0a 09 |yte
.......| 00003dd0 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 |................| 00003de0 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 50 61 |......

fu| 00003e00 6e 63 20 28 2a 50 61 79 6c 6f 61 64 29 20 3c 61 |nc (*Payload) String| 00003e60 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 72 65 3e 66 |

.....
f|
        00003e70  75 6e 63 20 28 70 20 2a  50 61 79 6c 6f 61 64 29  |unc (p *Payload)|
        00003e80  20 53 74 72 69 6e 67 28  29 20 73 74 72 69 6e 67  | String() string|
        00003e90  3c 2f 70 72 65 3e 0a 09  09 09 09 0a 09 09 09 09  |
..........| 00003ea0 0a 09 09 09 09 0a 09 09 09 0a 09 09 0a 09 09 09 |................| 00003eb0 0a 09 09 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 |........

| 00003ed0 74 79 70 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 |type Tra| 00003f20 6e 73 70 6f 72 74 4c 61 79 65 72 3c 2f 61 3e 3c |nsportLayer<| 00003f30 2f 68 32 3e 0a 09 09 09 3c 70 72 65 3e 74 79 70 |/h2>....
typ|
        00003f40  65 20 54 72 61 6e 73 70  6f 72 74 4c 61 79 65 72  |e TransportLayer|
        00003f50  20 69 6e 74 65 72 66 61  63 65 20 7b 0a 20 20 20  | interface {.   |
        00003f60  20 4c 61 79 65 72 0a 20  20 20 20 54 72 61 6e 73  | Layer.    Trans|
        00003f70  70 6f 72 74 46 6c 6f 77  28 29 20 46 6c 6f 77 0a  |portFlow() Flow.|
        00003f80  7d 3c 2f 70 72 65 3e 0a  09 09 09 3c 70 3e 0a 54  |}
....

.T| 00003f90 72 61 6e 73 70 6f 72 74 4c 61 79 65 72 20 69 73 |ransportLayer is| 00003fa0 20 74 68 65 20 70 61 63 6b 65 74 20 6c 61 79 65 | the packet laye| 00003fb0 72 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 |r corresponding | 00003fc0 74 6f 20 74 68 65 20 54 43 50 2f 49 50 20 6c 61 |to the TCP/IP la| 00003fd0 79 65 72 20 33 20 28 4f 53 49 0a 6c 61 79 65 72 |yer 3 (OSI.layer| 00003fe0 20 34 29 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a | 4).

........| 00003ff0 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 |................| 00004000 09 09 0a 09 |....| --- Layer 1 --- Loopback {Contents=[30, 0, 0, 0] Payload=[..16384..] Family=IPv6} 00000000 1e 00 00 00 |....| --- Layer 2 --- IPv6 {Contents=[..40..] Payload=[..16344..] Version=6 TrafficClass=0 FlowLabel=100497 Length=16344 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 00000000 60 01 88 91 3f d8 06 40 00 00 00 00 00 00 00 00 |`...?..@........| 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 01 |........| --- Layer 3 --- TCP {Contents=[..32..] Payload=[..16312..] SrcPort=8080(http-alt) DstPort=58799 Seq=174454367 Ack=144119882 DataOffset=8 FIN=false SYN=false RST=false PSH=false ACK=true URG=false ECE=false CWR=false NS=false Window=8962 Checksum=16352 Urgent=0 Options=[TCPOption(NOP:), TCPOption(NOP:), TCPOption(Timestamps:96505270/96505084 0x05c08db605c08cfc)] Padding=[]} 00000000 1f 90 e5 af 0a 65 f6 5f 08 97 18 4a 80 10 23 02 |.....e._...J..#.| 00000010 3f e0 00 00 01 01 08 0a 05 c0 8d b6 05 c0 8c fc |?...............| --- Layer 4 --- Payload 16312 byte(s) 00000000 70 72 65 3e 66 75 6e 63 20 4e 65 77 4c 61 79 65 |pre>func NewLaye| 00000010 72 43 6c 61 73 73 4d 61 70 28 74 79 70 65 73 20 |rClassMap(types | 00000020 5b 5d 4c 61 79 65 72 54 79 70 65 29 20 4c 61 79 |[]LayerType) Lay| 00000030 65 72 43 6c 61 73 73 4d 61 70 3c 2f 70 72 65 3e |erClassMap

| 00000040 0a 09 09 09 09 3c 70 3e 0a 4e 65 77 4c 61 79 65 |.....

.NewLaye| 00000050 72 43 6c 61 73 73 4d 61 70 20 63 72 65 61 74 65 |rClassMap create| 00000060 73 20 61 20 4c 61 79 65 72 43 6c 61 73 73 4d 61 |s a LayerClassMa| 00000070 70 20 61 6e 64 20 73 65 74 73 20 6d 61 70 5b 74 |p and sets map[t| 00000080 5d 20 74 6f 20 74 72 75 65 20 66 6f 72 20 65 61 |] to true for ea| 00000090 63 68 0a 74 79 70 65 20 69 6e 20 74 79 70 65 73 |ch.type in types| 000000a0 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 09 |..

..........| 000000b0 0a 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 3c |...............<| 000000c0 68 33 20 69 64 3d 22 4c 61 79 65 72 43 6c 61 73 |h3 id="LayerClas| 000000d0 73 4d 61 70 2e 43 6f 6e 74 61 69 6e 73 22 3e 66 |sMap.Contains">f| 000000e0 75 6e 63 20 28 4c 61 79 65 72 43 6c 61 73 73 4d |unc (LayerClassM| 000000f0 61 70 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 |ap) Contains.....
fun|
        00000160  63 20 28 6d 20 4c 61 79  65 72 43 6c 61 73 73 4d  |c (m LayerClassM|
        00000170  61 70 29 20 43 6f 6e 74  61 69 6e 73 28 74 20 4c  |ap) Contains(t L|
        00000180  61 79 65 72 54 79 70 65  29 20 62 6f 6f 6c 3c 2f  |ayerType) bool.....

.Con| 000001a0 74 61 69 6e 73 20 72 65 74 75 72 6e 73 20 74 72 |tains returns tr| 000001b0 75 65 20 69 66 20 74 68 65 20 67 69 76 65 6e 20 |ue if the given | 000001c0 6c 61 79 65 72 20 74 79 70 65 20 73 68 6f 75 6c |layer type shoul| 000001d0 64 20 62 65 20 63 6f 6e 73 69 64 65 72 65 64 20 |d be considered | 000001e0 70 61 72 74 0a 6f 66 20 74 68 69 73 20 6c 61 79 |part.of this lay| 000001f0 65 72 20 63 6c 61 73 73 2e 0a 3c 2f 70 3e 0a 0a |er class..

..| 00000200 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 |................| 00000210 0a 09 09 09 0a 09 09 09 0a 09 09 09 3c 68 32 20 |............

type LayerClassS| 00000290 6c 69 63 65 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 |lice

...| 000002a0 09 3c 70 72 65 3e 74 79 70 65 20 4c 61 79 65 72 |.
type Layer|
        000002b0  43 6c 61 73 73 53 6c 69  63 65 20 5b 5d 62 6f 6f  |ClassSlice []boo|
        000002c0  6c 3c 2f 70 72 65 3e 0a  09 09 09 3c 70 3e 0a 4c  |l
....

.L| 000002d0 61 79 65 72 43 6c 61 73 73 53 6c 69 63 65 20 69 |ayerClassSlice i| 000002e0 6d 70 6c 65 6d 65 6e 74 73 20 61 20 4c 61 79 65 |mplements a Laye| 000002f0 72 43 6c 61 73 73 20 77 69 74 68 20 61 20 73 6c |rClass with a sl| 00000300 69 63 65 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a |ice..

.......| 00000310 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 |................| 00000320 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 |........

func NewLayerCla| 000003a0 73 73 53 6c 69 63 65 3c 2f 61 3e 3c 2f 68 33 3e |ssSlice

| 000003b0 0a 09 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 4e |.....
func N|
        000003c0  65 77 4c 61 79 65 72 43  6c 61 73 73 53 6c 69 63  |ewLayerClassSlic|
        000003d0  65 28 74 79 70 65 73 20  5b 5d 4c 61 79 65 72 54  |e(types []LayerT|
        000003e0  79 70 65 29 20 4c 61 79  65 72 43 6c 61 73 73 53  |ype) LayerClassS|
        000003f0  6c 69 63 65 3c 2f 70 72  65 3e 0a 09 09 09 09 3c  |lice
.....<| 00000400 70 3e 0a 4e 65 77 4c 61 79 65 72 43 6c 61 73 73 |p>.NewLayerClass| 00000410 53 6c 69 63 65 20 63 72 65 61 74 65 73 20 61 20 |Slice creates a | 00000420 6e 65 77 20 4c 61 79 65 72 43 6c 61 73 73 53 6c |new LayerClassSl| 00000430 69 63 65 20 62 79 20 63 72 65 61 74 69 6e 67 20 |ice by creating | 00000440 61 20 73 6c 69 63 65 20 6f 66 0a 73 69 7a 65 20 |a slice of.size | 00000450 6d 61 78 28 74 79 70 65 73 29 20 61 6e 64 20 73 |max(types) and s| 00000460 65 74 74 69 6e 67 20 73 6c 69 63 65 5b 74 5d 20 |etting slice[t] | 00000470 74 6f 20 74 72 75 65 20 66 6f 72 20 65 61 63 68 |to true for each| 00000480 20 74 79 70 65 20 74 2e 20 20 4e 6f 74 65 2c 20 | type t. Note, | 00000490 69 66 0a 79 6f 75 20 69 6d 70 6c 65 6d 65 6e 74 |if.you implement| 000004a0 20 79 6f 75 72 20 6f 77 6e 20 4c 61 79 65 72 54 | your own LayerT| 000004b0 79 70 65 20 61 6e 64 20 67 69 76 65 20 69 74 20 |ype and give it | 000004c0 61 20 68 69 67 68 20 76 61 6c 75 65 2c 20 74 68 |a high value, th| 000004d0 69 73 20 57 49 4c 4c 20 63 72 65 61 74 65 0a 61 |is WILL create.a| 000004e0 20 76 65 72 79 20 6c 61 72 67 65 20 73 6c 69 63 | very large slic| 000004f0 65 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 |e..

.........| 00000500 09 0a 0a 09 09 09 0a 09 09 09 09 0a 09 09 09 09 |................| 00000510 3c 68 33 20 69 64 3d 22 4c 61 79 65 72 43 6c 61 |

func (LayerCla| 00000540 73 73 53 6c 69 63 65 29 20 3c 61 20 68 72 65 66 |ssSlice) Contains| 000005a0 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 72 65 3e 66 |

.....
f|
        000005b0  75 6e 63 20 28 73 20 4c  61 79 65 72 43 6c 61 73  |unc (s LayerClas|
        000005c0  73 53 6c 69 63 65 29 20  43 6f 6e 74 61 69 6e 73  |sSlice) Contains|
        000005d0  28 74 20 4c 61 79 65 72  54 79 70 65 29 20 62 6f  |(t LayerType) bo|
        000005e0  6f 6c 3c 2f 70 72 65 3e  0a 09 09 09 09 3c 70 3e  |ol
.....

| 000005f0 0a 43 6f 6e 74 61 69 6e 73 20 72 65 74 75 72 6e |.Contains return| 00000600 73 20 74 72 75 65 20 69 66 20 74 68 65 20 67 69 |s true if the gi| 00000610 76 65 6e 20 6c 61 79 65 72 20 74 79 70 65 20 73 |ven layer type s| 00000620 68 6f 75 6c 64 20 62 65 20 63 6f 6e 73 69 64 65 |hould be conside| 00000630 72 65 64 20 70 61 72 74 0a 6f 66 20 74 68 69 73 |red part.of this| 00000640 20 6c 61 79 65 72 20 63 6c 61 73 73 2e 0a 3c 2f | layer class................| 00000660 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 |................| 00000670 3c 68 32 20 69 64 3d 22 4c 61 79 65 72 54 79 70 |

type LayerType<| 000006e0 2f 68 32 3e 0a 09 09 09 3c 70 72 65 3e 74 79 70 |/h2>....
typ|
        000006f0  65 20 4c 61 79 65 72 54  79 70 65 20 69 6e 74 36  |e LayerType int6|
        00000700  34 3c 2f 70 72 65 3e 0a  09 09 09 3c 70 3e 0a 4c  |4
....

.L| 00000710 61 79 65 72 54 79 70 65 20 69 73 20 61 20 75 6e |ayerType is a un| 00000720 69 71 75 65 20 69 64 65 6e 74 69 66 69 65 72 20 |ique identifier | 00000730 66 6f 72 20 65 61 63 68 20 74 79 70 65 20 6f 66 |for each type of| 00000740 20 6c 61 79 65 72 2e 20 20 54 68 69 73 20 65 6e | layer. This en| 00000750 75 6d 65 72 61 74 69 6f 6e 0a 64 6f 65 73 20 6e |umeration.does n| 00000760 6f 74 20 6d 61 74 63 68 20 77 69 74 68 20 61 6e |ot match with an| 00000770 79 20 65 78 74 65 72 6e 61 6c 6c 79 20 61 76 61 |y externally ava| 00000780 69 6c 61 62 6c 65 20 6e 75 6d 62 65 72 69 6e 67 |ilable numbering| 00000790 20 73 63 68 65 6d 65 2e 2e 2e 20 69 74 26 23 33 | scheme... it| 000007a0 39 3b 73 20 73 6f 6c 65 6c 79 0a 75 73 61 62 6c |9;s solely.usabl| 000007b0 65 2f 75 73 65 66 75 6c 20 77 69 74 68 69 6e 20 |e/useful within | 000007c0 74 68 69 73 20 6c 69 62 72 61 72 79 20 61 73 20 |this library as | 000007d0 61 20 6d 65 61 6e 73 20 66 6f 72 20 72 65 71 75 |a means for requ| 000007e0 65 73 74 69 6e 67 20 6c 61 79 65 72 20 74 79 70 |esting layer typ| 000007f0 65 73 0a 28 73 65 65 20 50 61 63 6b 65 74 2e 4c |es.(see Packet.L| 00000800 61 79 65 72 29 20 61 6e 64 20 64 65 74 65 72 6d |ayer) and determ| 00000810 69 6e 69 6e 67 20 77 68 69 63 68 20 74 79 70 65 |ining which type| 00000820 73 20 6f 66 20 6c 61 79 65 72 73 20 68 61 76 65 |s of layers have| 00000830 20 62 65 65 6e 20 64 65 63 6f 64 65 64 2e 0a 3c | been decoded..<| 00000840 2f 70 3e 0a 3c 70 3e 0a 4e 65 77 20 4c 61 79 65 |/p>.

.New Laye| 00000850 72 54 79 70 65 73 20 6d 61 79 20 62 65 20 63 72 |rTypes may be cr| 00000860 65 61 74 65 64 20 62 79 20 63 61 6c 6c 69 6e 67 |eated by calling| 00000870 20 67 6f 70 61 63 6b 65 74 2e 52 65 67 69 73 74 | gopacket.Regist| 00000880 65 72 4c 61 79 65 72 54 79 70 65 2e 0a 3c 2f 70 |erLayerType.................| 000008a0 09 3c 70 72 65 3e 76 61 72 20 4c 61 79 65 72 54 |.

var LayerT|
        000008b0  79 70 65 44 65 63 6f 64  65 46 61 69 6c 75 72 65  |ypeDecodeFailure|
        000008c0  20 4c 61 79 65 72 54 79  70 65 20 3d 20 52 65 67  | LayerType = Reg|
        000008d0  69 73 74 65 72 4c 61 79  65 72 54 79 70 65 28 30  |isterLayerType(0|
        000008e0  2c 20 4c 61 79 65 72 54  79 70 65 4d 65 74 61 64  |, LayerTypeMetad|
        000008f0  61 74 61 7b 26 23 33 34  3b 44 65 63 6f 64 65 20  |ata{"Decode |
        00000900  46 61 69 6c 75 72 65 26  23 33 34 3b 2c 20 44 65  |Failure", De|
        00000910  63 6f 64 65 55 6e 6b 6e  6f 77 6e 7d 29 3c 2f 70  |codeUnknown}).....

.Laye| 00000930 72 54 79 70 65 44 65 63 6f 64 65 46 61 69 6c 75 |rTypeDecodeFailu| 00000940 72 65 20 69 73 20 74 68 65 20 6c 61 79 65 72 20 |re is the layer | 00000950 74 79 70 65 20 66 6f 72 20 74 68 65 20 64 65 66 |type for the def| 00000960 61 75 6c 74 20 65 72 72 6f 72 20 6c 61 79 65 72 |ault error layer| 00000970 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 0a 09 09 09 09 |..

..........| 00000980 3c 70 72 65 3e 76 61 72 20 4c 61 79 65 72 54 79 |
var LayerTy|
        00000990  70 65 50 61 79 6c 6f 61  64 20 4c 61 79 65 72 54  |pePayload LayerT|
        000009a0  79 70 65 20 3d 20 52 65  67 69 73 74 65 72 4c 61  |ype = RegisterLa|
        000009b0  79 65 72 54 79 70 65 28  31 2c 20 4c 61 79 65 72  |yerType(1, Layer|
        000009c0  54 79 70 65 4d 65 74 61  64 61 74 61 7b 26 23 33  |TypeMetadata{|
        000009d0  34 3b 50 61 79 6c 6f 61  64 26 23 33 34 3b 2c 20  |4;Payload", |
        000009e0  44 65 63 6f 64 65 50 61  79 6c 6f 61 64 7d 29 3c  |DecodePayload})<|
        000009f0  2f 70 72 65 3e 0a 09 09  09 09 3c 70 3e 0a 4c 61  |/pre>.....

.La| 00000a00 79 65 72 54 79 70 65 50 61 79 6c 6f 61 64 20 69 |yerTypePayload i| 00000a10 73 20 74 68 65 20 6c 61 79 65 72 20 74 79 70 65 |s the layer type| 00000a20 20 66 6f 72 20 61 20 70 61 79 6c 6f 61 64 20 74 | for a payload t| 00000a30 68 61 74 20 77 65 20 64 6f 6e 26 23 33 39 3b 74 |hat we don't| 00000a40 20 74 72 79 20 74 6f 20 64 65 63 6f 64 65 0a 62 | try to decode.b| 00000a50 75 74 20 74 72 65 61 74 20 61 73 20 61 20 73 75 |ut treat as a su| 00000a60 63 63 65 73 73 2c 20 49 45 3a 20 61 6e 20 61 70 |ccess, IE: an ap| 00000a70 70 6c 69 63 61 74 69 6f 6e 2d 6c 65 76 65 6c 20 |plication-level | 00000a80 70 61 79 6c 6f 61 64 2e 0a 3c 2f 70 3e 0a 0a 09 |payload..

...| 00000a90 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 09 |................| 00000aa0 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 52 65 |......

func RegisterLayer| 00000b20 54 79 70 65 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 |Type

...| 00000b30 09 09 3c 70 72 65 3e 66 75 6e 63 20 52 65 67 69 |..
func Regi|
        00000b40  73 74 65 72 4c 61 79 65  72 54 79 70 65 28 6e 75  |sterLayerType(nu|
        00000b50  6d 20 69 6e 74 2c 20 6d  65 74 61 20 4c 61 79 65  |m int, meta Laye|
        00000b60  72 54 79 70 65 4d 65 74  61 64 61 74 61 29 20 4c  |rTypeMetadata) L|
        00000b70  61 79 65 72 54 79 70 65  3c 2f 70 72 65 3e 0a 09  |ayerType
..| 00000b80 09 09 09 3c 70 3e 0a 52 65 67 69 73 74 65 72 4c |...

.RegisterL| 00000b90 61 79 65 72 54 79 70 65 20 63 72 65 61 74 65 73 |ayerType creates| 00000ba0 20 61 20 6e 65 77 20 6c 61 79 65 72 20 74 79 70 | a new layer typ| 00000bb0 65 20 61 6e 64 20 72 65 67 69 73 74 65 72 73 20 |e and registers | 00000bc0 69 74 20 67 6c 6f 62 61 6c 6c 79 2e 0a 54 68 65 |it globally..The| 00000bd0 20 6e 75 6d 62 65 72 20 70 61 73 73 65 64 20 69 | number passed i| 00000be0 6e 20 6d 75 73 74 20 62 65 20 75 6e 69 71 75 65 |n must be unique| 00000bf0 2c 20 6f 72 20 61 20 72 75 6e 74 69 6d 65 20 70 |, or a runtime p| 00000c00 61 6e 69 63 20 77 69 6c 6c 20 6f 63 63 75 72 2e |anic will occur.| 00000c10 20 20 4e 75 6d 62 65 72 73 0a 30 2d 39 39 39 20 | Numbers.0-999 | 00000c20 61 72 65 20 72 65 73 65 72 76 65 64 20 66 6f 72 |are reserved for| 00000c30 20 74 68 65 20 67 6f 70 61 63 6b 65 74 20 6c 69 | the gopacket li| 00000c40 62 72 61 72 79 2e 20 20 4e 75 6d 62 65 72 73 20 |brary. Numbers | 00000c50 31 30 30 30 2d 31 39 39 39 20 73 68 6f 75 6c 64 |1000-1999 should| 00000c60 20 62 65 0a 75 73 65 64 20 66 6f 72 20 63 6f 6d | be.used for com| 00000c70 6d 6f 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 2d |mon application-| 00000c80 73 70 65 63 69 66 69 63 20 74 79 70 65 73 2c 20 |specific types, | 00000c90 61 6e 64 20 61 72 65 20 76 65 72 79 20 66 61 73 |and are very fas| 00000ca0 74 2e 20 20 41 6e 79 20 6f 74 68 65 72 0a 6e 75 |t. Any other.nu| 00000cb0 6d 62 65 72 20 28 6e 65 67 61 74 69 76 65 20 6f |mber (negative o| 00000cc0 72 20 26 67 74 3b 3d 20 32 30 30 30 29 20 6d 61 |r >= 2000) ma| 00000cd0 79 20 62 65 20 75 73 65 64 20 66 6f 72 20 75 6e |y be used for un| 00000ce0 63 6f 6d 6d 6f 6e 20 61 70 70 6c 69 63 61 74 69 |common applicati| 00000cf0 6f 6e 2d 73 70 65 63 69 66 69 63 0a 74 79 70 65 |on-specific.type| 00000d00 73 2c 20 61 6e 64 20 61 72 65 20 73 6f 6d 65 77 |s, and are somew| 00000d10 68 61 74 20 73 6c 6f 77 65 72 20 28 74 68 65 79 |hat slower (they| 00000d20 20 72 65 71 75 69 72 65 20 61 20 6d 61 70 20 6c | require a map l| 00000d30 6f 6f 6b 75 70 20 6f 76 65 72 20 61 6e 20 61 72 |ookup over an ar| 00000d40 72 61 79 0a 69 6e 64 65 78 29 2e 0a 3c 2f 70 3e |ray.index)..

| 00000d50 0a 0a 09 09 09 09 0a 09 09 09 0a 0a 09 09 09 0a |................| 00000d60 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d |.........

func (LayerTy| 00000d90 70 65 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 |pe) Decode

| 00000df0 0a 09 09 09 09 3c 70 72 65 3e 66 75 6e 63 20 28 |.....
func (|
        00000e00  74 20 4c 61 79 65 72 54  79 70 65 29 20 44 65 63  |t LayerType) Dec|
        00000e10  6f 64 65 28 64 61 74 61  20 5b 5d 62 79 74 65 2c  |ode(data []byte,|
        00000e20  20 63 20 50 61 63 6b 65  74 42 75 69 6c 64 65 72  | c PacketBuilder|
        00000e30  29 20 65 72 72 6f 72 3c  2f 70 72 65 3e 0a 09 09  |) error
...| 00000e40 09 09 3c 70 3e 0a 44 65 63 6f 64 65 20 64 65 63 |..

.Decode dec| 00000e50 6f 64 65 73 20 74 68 65 20 67 69 76 65 6e 20 64 |odes the given d| 00000e60 61 74 61 20 75 73 69 6e 67 20 74 68 65 20 64 65 |ata using the de| 00000e70 63 6f 64 65 72 20 72 65 67 69 73 74 65 72 65 64 |coder registered| 00000e80 20 77 69 74 68 20 74 68 65 20 6c 61 79 65 72 0a | with the layer.| 00000e90 74 79 70 65 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 |type..

......| 00000ea0 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 0a 09 |................| 00000eb0 09 09 09 3c 68 33 20 69 64 3d 22 4c 61 79 65 72 |...

fun| 00000ed0 63 20 28 4c 61 79 65 72 54 79 70 65 29 20 3c 61 |c (LayerType) Strin| 00000f30 67 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c |g

.....<| 00000f40 70 72 65 3e 66 75 6e 63 20 28 74 20 4c 61 79 65 |pre>func (t Laye| 00000f50 72 54 79 70 65 29 20 53 74 72 69 6e 67 28 29 20 |rType) String() | 00000f60 28 73 20 73 74 72 69 6e 67 29 3c 2f 70 72 65 3e |(s string)
| 00000f70 0a 09 09 09 09 3c 70 3e 0a 53 74 72 69 6e 67 20 |.....

.String | 00000f80 72 65 74 75 72 6e 73 20 74 68 65 20 73 74 72 69 |returns the stri| 00000f90 6e 67 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 |ng associated wi| 00000fa0 74 68 20 74 68 69 73 20 6c 61 79 65 72 20 74 79 |th this layer ty| 00000fb0 70 65 2e 0a 3c 2f 70 3e 0a 0a 09 09 09 09 0a 09 |pe..

........| 00000fc0 09 09 09 0a 09 09 09 0a 09 09 0a 09 09 09 0a 09 |................| 00000fd0 09 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 4c 61 |......

type | 00001040 4c 61 79 65 72 54 79 70 65 4d 65 74 61 64 61 74 |LayerTypeMetadat| 00001050 61 3c 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 |a

....type LayerTyp| 00001070 65 4d 65 74 61 64 61 74 61 20 73 74 72 75 63 74 |eMetadata struct| 00001080 20 7b 0a 20 20 20 20 3c 73 70 61 6e 20 63 6c 61 | {. // | 000010a0 4e 61 6d 65 20 69 73 20 74 68 65 20 73 74 72 69 |Name is the stri| 000010b0 6e 67 20 72 65 74 75 72 6e 65 64 20 62 79 20 65 |ng returned by e| 000010c0 61 63 68 20 6c 61 79 65 72 20 74 79 70 65 26 23 |ach layer type&#| 000010d0 33 39 3b 73 20 53 74 72 69 6e 67 20 6d 65 74 68 |39;s String meth| 000010e0 6f 64 2e 3c 2f 73 70 61 6e 3e 0a 20 20 20 20 4e |od.. N| 000010f0 61 6d 65 20 73 74 72 69 6e 67 0a 20 20 20 20 3c |ame string. <| 00001100 73 70 61 6e 20 63 6c 61 73 73 3d 22 63 6f 6d 6d |span class="comm| 00001110 65 6e 74 22 3e 2f 2f 20 44 65 63 6f 64 65 72 20 |ent">// Decoder | 00001120 69 73 20 74 68 65 20 64 65 63 6f 64 65 72 20 74 |is the decoder t| 00001130 6f 20 75 73 65 20 77 68 65 6e 20 74 68 65 20 6c |o use when the l| 00001140 61 79 65 72 20 74 79 70 65 20 69 73 20 70 61 73 |ayer type is pas| 00001150 73 65 64 20 69 6e 20 61 73 20 61 3c 2f 73 70 61 |sed in as a. // | 00001180 44 65 63 6f 64 65 72 2e 3c 2f 73 70 61 6e 3e 0a |Decoder..| 00001190 20 20 20 20 44 65 63 6f 64 65 72 20 44 65 63 6f | Decoder Deco| 000011a0 64 65 72 0a 7d 3c 2f 70 72 65 3e 0a 09 09 09 3c |der.}
....<| 000011b0 70 3e 0a 4c 61 79 65 72 54 79 70 65 4d 65 74 61 |p>.LayerTypeMeta| 000011c0 64 61 74 61 20 63 6f 6e 74 61 69 6e 73 20 6d 65 |data contains me| 000011d0 74 61 64 61 74 61 20 61 73 73 6f 63 69 61 74 65 |tadata associate| 000011e0 64 20 77 69 74 68 20 65 61 63 68 20 4c 61 79 65 |d with each Laye| 000011f0 72 54 79 70 65 2e 0a 3c 2f 70 3e 0a 0a 0a 09 09 |rType..

.....| 00001200 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 |................| 00001210 0a 0a 09 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 |................| 00001220 0a 09 09 09 3c 68 32 20 69 64 3d 22 4c 69 6e 6b |....

type LinkLayer

....
t|
        000012a0  79 70 65 20 4c 69 6e 6b  4c 61 79 65 72 20 69 6e  |ype LinkLayer in|
        000012b0  74 65 72 66 61 63 65 20  7b 0a 20 20 20 20 4c 61  |terface {.    La|
        000012c0  79 65 72 0a 20 20 20 20  4c 69 6e 6b 46 6c 6f 77  |yer.    LinkFlow|
        000012d0  28 29 20 46 6c 6f 77 0a  7d 3c 2f 70 72 65 3e 0a  |() Flow.}
.| 000012e0 09 09 09 3c 70 3e 0a 4c 69 6e 6b 4c 61 79 65 72 |...

.LinkLayer| 000012f0 20 69 73 20 74 68 65 20 70 61 63 6b 65 74 20 6c | is the packet l| 00001300 61 79 65 72 20 63 6f 72 72 65 73 70 6f 6e 64 69 |ayer correspondi| 00001310 6e 67 20 74 6f 20 54 43 50 2f 49 50 20 6c 61 79 |ng to TCP/IP lay| 00001320 65 72 20 31 20 28 4f 53 49 20 6c 61 79 65 72 20 |er 1 (OSI layer | 00001330 32 29 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 |2).

.........| 00001340 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 |................| 00001350 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a 09 09 09 |................| 00001360 3c 68 32 20 69 64 3d 22 4e 65 74 77 6f 72 6b 4c |

type NetworkLayer<| 000013d0 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 65 |/a>

....type NetworkLay| 000013f0 65 72 20 69 6e 74 65 72 66 61 63 65 20 7b 0a 20 |er interface {. | 00001400 20 20 20 4c 61 79 65 72 0a 20 20 20 20 4e 65 74 | Layer. Net| 00001410 77 6f 72 6b 46 6c 6f 77 28 29 20 46 6c 6f 77 0a |workFlow() Flow.| 00001420 7d 3c 2f 70 72 65 3e 0a 09 09 09 3c 70 3e 0a 4e |}
....

.N| 00001430 65 74 77 6f 72 6b 4c 61 79 65 72 20 69 73 20 74 |etworkLayer is t| 00001440 68 65 20 70 61 63 6b 65 74 20 6c 61 79 65 72 20 |he packet layer | 00001450 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f |corresponding to| 00001460 20 54 43 50 2f 49 50 20 6c 61 79 65 72 20 32 20 | TCP/IP layer 2 | 00001470 28 4f 53 49 0a 6c 61 79 65 72 20 33 29 0a 3c 2f |(OSI.layer 3)...............| 00001490 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 0a |................| 000014a0 09 09 09 0a 09 09 09 0a 09 09 09 3c 68 32 20 69 |...........

type | 000014c0 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b |Packet<| 00001510 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 65 |/a>

....type Packet int| 00001530 65 72 66 61 63 65 20 7b 0a 20 20 20 20 66 6d 74 |erface {. fmt| 00001540 2e 53 74 72 69 6e 67 65 72 0a 20 20 20 20 3c 73 |.Stringer. // Data retu| 00001570 72 6e 73 20 61 6c 6c 20 64 61 74 61 20 61 73 73 |rns all data ass| 00001580 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 69 |ociated with thi| 00001590 73 20 70 61 63 6b 65 74 3c 2f 73 70 61 6e 3e 0a |s packet.| 000015a0 20 20 20 20 44 61 74 61 28 29 20 5b 5d 62 79 74 | Data() []byt| 000015b0 65 0a 20 20 20 20 3c 73 70 61 6e 20 63 6c 61 73 |e. // L| 000015d0 61 79 65 72 73 20 72 65 74 75 72 6e 73 20 61 6c |ayers returns al| 000015e0 6c 20 6c 61 79 65 72 73 20 69 6e 20 74 68 69 73 |l layers in this| 000015f0 20 70 61 63 6b 65 74 2c 20 63 6f 6d 70 75 74 69 | packet, computi| 00001600 6e 67 20 74 68 65 6d 20 61 73 20 6e 65 63 65 73 |ng them as neces| 00001610 73 61 72 79 3c 2f 73 70 61 6e 3e 0a 20 20 20 20 |sary. | 00001620 4c 61 79 65 72 73 28 29 20 5b 5d 4c 61 79 65 72 |Layers() []Layer| 00001630 0a 20 20 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 |. // La| 00001650 79 65 72 20 72 65 74 75 72 6e 73 20 74 68 65 20 |yer returns the | 00001660 66 69 72 73 74 20 6c 61 79 65 72 20 69 6e 20 74 |first layer in t| 00001670 68 69 73 20 70 61 63 6b 65 74 20 6f 66 20 74 68 |his packet of th| 00001680 65 20 67 69 76 65 6e 20 74 79 70 65 2c 20 6f 72 |e given type, or| 00001690 20 6e 69 6c 3c 2f 73 70 61 6e 3e 0a 20 20 20 20 | nil. | 000016a0 4c 61 79 65 72 28 4c 61 79 65 72 54 79 70 65 29 |Layer(LayerType)| 000016b0 20 4c 61 79 65 72 0a 20 20 20 20 3c 73 70 61 6e | Layer. // LayerClass r| 000016e0 65 74 75 72 6e 73 20 74 68 65 20 66 69 72 73 74 |eturns the first| 000016f0 20 6c 61 79 65 72 20 69 6e 20 74 68 69 73 20 70 | layer in this p| 00001700 61 63 6b 65 74 20 6f 66 20 74 68 65 20 67 69 76 |acket of the giv| 00001710 65 6e 20 63 6c 61 73 73 2c 3c 2f 73 70 61 6e 3e |en class,| 00001720 0a 20 20 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 |. // or| 00001740 20 6e 69 6c 2e 3c 2f 73 70 61 6e 3e 0a 20 20 20 | nil.. | 00001750 20 4c 61 79 65 72 43 6c 61 73 73 28 4c 61 79 65 | LayerClass(Laye| 00001760 72 43 6c 61 73 73 29 20 4c 61 79 65 72 0a 20 20 |rClass) Layer. | 00001770 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 63 | // Captu| 00001790 72 65 49 6e 66 6f 20 72 65 74 75 72 6e 73 20 74 |reInfo returns t| 000017a0 68 65 20 63 61 70 75 74 75 72 65 20 69 6e 66 6f |he caputure info| 000017b0 72 6d 61 74 69 6f 6e 20 66 6f 72 20 74 68 69 73 |rmation for this| 000017c0 20 70 61 63 6b 65 74 2e 20 20 54 68 69 73 20 72 | packet. This r| 000017d0 65 74 75 72 6e 73 3c 2f 73 70 61 6e 3e 0a 20 20 |eturns. | 000017e0 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 63 | // a poi| 00001800 6e 74 65 72 20 74 6f 20 74 68 65 20 70 61 63 6b |nter to the pack| 00001810 65 74 26 23 33 39 3b 73 20 73 74 72 75 63 74 2c |et's struct,| 00001820 20 73 6f 20 69 74 20 63 61 6e 20 62 65 20 75 73 | so it can be us| 00001830 65 64 20 62 6f 74 68 20 66 6f 72 20 72 65 61 64 |ed both for read| 00001840 69 6e 67 20 61 6e 64 3c 2f 73 70 61 6e 3e 0a 20 |ing and. | 00001850 20 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 | // writ| 00001870 69 6e 67 20 74 68 65 20 69 6e 66 6f 72 6d 61 74 |ing the informat| 00001880 69 6f 6e 2e 3c 2f 73 70 61 6e 3e 0a 20 20 20 20 |ion.. | 00001890 43 61 70 74 75 72 65 49 6e 66 6f 28 29 20 2a 43 |CaptureInfo() *C| 000018a0 61 70 74 75 72 65 49 6e 66 6f 0a 0a 20 20 20 20 |aptureInfo.. | 000018b0 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 63 6f 6d |// LinkLay| 000018d0 65 72 20 72 65 74 75 72 6e 73 20 74 68 65 20 66 |er returns the f| 000018e0 69 72 73 74 20 6c 69 6e 6b 20 6c 61 79 65 72 20 |irst link layer | 000018f0 69 6e 20 74 68 65 20 70 61 63 6b 65 74 3c 2f 73 |in the packet. LinkLay| 00001910 65 72 28 29 20 4c 69 6e 6b 4c 61 79 65 72 0a 20 |er() LinkLayer. | 00001920 20 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 | // Netw| 00001940 6f 72 6b 4c 61 79 65 72 20 72 65 74 75 72 6e 73 |orkLayer returns| 00001950 20 74 68 65 20 66 69 72 73 74 20 6e 65 74 77 6f | the first netwo| 00001960 72 6b 20 6c 61 79 65 72 20 69 6e 20 74 68 65 20 |rk layer in the | 00001970 70 61 63 6b 65 74 3c 2f 73 70 61 6e 3e 0a 20 20 |packet. | 00001980 20 20 4e 65 74 77 6f 72 6b 4c 61 79 65 72 28 29 | NetworkLayer()| 00001990 20 4e 65 74 77 6f 72 6b 4c 61 79 65 72 0a 20 20 | NetworkLayer. | 000019a0 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 63 | // Trans| 000019c0 70 6f 72 74 4c 61 79 65 72 20 72 65 74 75 72 6e |portLayer return| 000019d0 73 20 74 68 65 20 66 69 72 73 74 20 74 72 61 6e |s the first tran| 000019e0 73 70 6f 72 74 20 6c 61 79 65 72 20 69 6e 20 74 |sport layer in t| 000019f0 68 65 20 70 61 63 6b 65 74 3c 2f 73 70 61 6e 3e |he packet| 00001a00 0a 20 20 20 20 54 72 61 6e 73 70 6f 72 74 4c 61 |. TransportLa| 00001a10 79 65 72 28 29 20 54 72 61 6e 73 70 6f 72 74 4c |yer() TransportL| 00001a20 61 79 65 72 0a 20 20 20 20 3c 73 70 61 6e 20 63 |ayer. /| 00001a40 2f 20 41 70 70 6c 69 63 61 74 69 6f 6e 4c 61 79 |/ ApplicationLay| 00001a50 65 72 20 72 65 74 75 72 6e 73 20 74 68 65 20 66 |er returns the f| 00001a60 69 72 73 74 20 61 70 70 6c 69 63 61 74 69 6f 6e |irst application| 00001a70 20 6c 61 79 65 72 20 69 6e 20 74 68 65 20 70 61 | layer in the pa| 00001a80 63 6b 65 74 3c 2f 73 70 61 6e 3e 0a 20 20 20 20 |cket. | 00001a90 41 70 70 6c 69 63 61 74 69 6f 6e 4c 61 79 65 72 |ApplicationLayer| 00001aa0 28 29 20 41 70 70 6c 69 63 61 74 69 6f 6e 4c 61 |() ApplicationLa| 00001ab0 79 65 72 0a 20 20 20 20 3c 73 70 61 6e 20 63 6c |yer. //| 00001ad0 20 45 72 72 6f 72 4c 61 79 65 72 20 69 73 20 70 | ErrorLayer is p| 00001ae0 61 72 74 69 63 75 6c 61 72 6c 79 20 75 73 65 66 |articularly usef| 00001af0 75 6c 2c 20 73 69 6e 63 65 20 69 74 20 72 65 74 |ul, since it ret| 00001b00 75 72 6e 73 20 6e 69 6c 20 69 66 20 74 68 65 20 |urns nil if the | 00001b10 70 61 63 6b 65 74 3c 2f 73 70 61 6e 3e 0a 20 20 |packet. | 00001b20 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 63 | // was f| 00001b40 75 6c 6c 79 20 64 65 63 6f 64 65 64 20 73 75 63 |ully decoded suc| 00001b50 63 65 73 73 66 75 6c 6c 79 2c 20 61 6e 64 20 6e |cessfully, and n| 00001b60 6f 6e 2d 6e 69 6c 20 69 66 20 61 6e 20 65 72 72 |on-nil if an err| 00001b70 6f 72 20 77 61 73 20 65 6e 63 6f 75 6e 74 65 72 |or was encounter| 00001b80 65 64 3c 2f 73 70 61 6e 3e 0a 20 20 20 20 3c 73 |ed. // in decodi| 00001bb0 6e 67 20 61 6e 64 20 74 68 65 20 70 61 63 6b 65 |ng and the packe| 00001bc0 74 20 77 61 73 20 6f 6e 6c 79 20 70 61 72 74 69 |t was only parti| 00001bd0 61 6c 6c 79 20 64 65 63 6f 64 65 64 2e 20 20 54 |ally decoded. T| 00001be0 68 75 73 2c 20 69 74 73 20 6f 75 74 70 75 74 3c |hus, its output<| 00001bf0 2f 73 70 61 6e 3e 0a 20 20 20 20 3c 73 70 61 6e |/span>. // can be used | 00001c20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 69 66 20 |to determine if | 00001c30 74 68 65 20 65 6e 74 69 72 65 20 70 61 63 6b 65 |the entire packe| 00001c40 74 20 77 61 73 20 61 62 6c 65 20 74 6f 20 62 65 |t was able to be| 00001c50 20 64 65 63 6f 64 65 64 2e 3c 2f 73 70 61 6e 3e | decoded.| 00001c60 0a 20 20 20 20 45 72 72 6f 72 4c 61 79 65 72 28 |. ErrorLayer(| 00001c70 29 20 45 72 72 6f 72 4c 61 79 65 72 0a 7d 3c 2f |) ErrorLayer.}....

.Pack| 00001c90 65 74 20 69 73 20 74 68 65 20 70 72 69 6d 61 72 |et is the primar| 00001ca0 79 20 6f 62 6a 65 63 74 20 75 73 65 64 20 62 79 |y object used by| 00001cb0 20 67 6f 70 61 63 6b 65 74 2e 20 20 50 61 63 6b | gopacket. Pack| 00001cc0 65 74 73 20 61 72 65 20 63 72 65 61 74 65 64 20 |ets are created | 00001cd0 62 79 20 61 0a 44 65 63 6f 64 65 72 26 23 33 39 |by a.Decoder'| 00001ce0 3b 73 20 44 65 63 6f 64 65 20 63 61 6c 6c 2e 20 |;s Decode call. | 00001cf0 20 41 20 70 61 63 6b 65 74 20 69 73 20 6d 61 64 | A packet is mad| 00001d00 65 20 75 70 20 6f 66 20 61 20 73 65 74 20 6f 66 |e up of a set of| 00001d10 20 44 61 74 61 2c 20 77 68 69 63 68 0a 69 73 20 | Data, which.is | 00001d20 62 72 6f 6b 65 6e 20 69 6e 74 6f 20 61 20 6e 75 |broken into a nu| 00001d30 6d 62 65 72 20 6f 66 20 4c 61 79 65 72 73 20 61 |mber of Layers a| 00001d40 73 20 69 74 20 69 73 20 64 65 63 6f 64 65 64 2e |s it is decoded.| 00001d50 0a 3c 2f 70 3e 0a 0a 0a 09 09 09 0a 0a 09 09 09 |.

...........| 00001d60 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 0a |................| 00001d70 09 09 09 09 3c 68 33 20 69 64 3d 22 4e 65 77 50 |....

func NewPacke| 00001de0 74 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c |t

.....<| 00001df0 70 72 65 3e 66 75 6e 63 20 4e 65 77 50 61 63 6b |pre>func NewPack| 00001e00 65 74 28 64 61 74 61 20 5b 5d 62 79 74 65 2c 20 |et(data []byte, | 00001e10 66 69 72 73 74 4c 61 79 65 72 44 65 63 6f 64 65 |firstLayerDecode| 00001e20 72 20 44 65 63 6f 64 65 72 2c 20 6f 70 74 69 6f |r Decoder, optio| 00001e30 6e 73 20 44 65 63 6f 64 65 4f 70 74 69 6f 6e 73 |ns DecodeOptions| 00001e40 29 20 50 61 63 6b 65 74 3c 2f 70 72 65 3e 0a 09 |) Packet
..| 00001e50 09 09 09 3c 70 3e 0a 4e 65 77 50 61 63 6b 65 74 |...

.NewPacket| 00001e60 20 63 72 65 61 74 65 73 20 61 20 6e 65 77 20 50 | creates a new P| 00001e70 61 63 6b 65 74 20 6f 62 6a 65 63 74 20 66 72 6f |acket object fro| 00001e80 6d 20 61 20 73 65 74 20 6f 66 20 62 79 74 65 73 |m a set of bytes| 00001e90 2e 20 20 54 68 65 0a 66 69 72 73 74 4c 61 79 65 |. The.firstLaye| 00001ea0 72 44 65 63 6f 64 65 72 20 74 65 6c 6c 73 20 69 |rDecoder tells i| 00001eb0 74 20 68 6f 77 20 74 6f 20 69 6e 74 65 72 70 72 |t how to interpr| 00001ec0 65 74 20 74 68 65 20 66 69 72 73 74 20 6c 61 79 |et the first lay| 00001ed0 65 72 20 66 72 6f 6d 20 74 68 65 20 62 79 74 65 |er from the byte| 00001ee0 73 2c 0a 66 75 74 75 72 65 20 6c 61 79 65 72 73 |s,.future layers| 00001ef0 20 77 69 6c 6c 20 62 65 20 67 65 6e 65 72 61 74 | will be generat| 00001f00 65 64 20 66 72 6f 6d 20 74 68 61 74 20 66 69 72 |ed from that fir| 00001f10 73 74 20 6c 61 79 65 72 20 61 75 74 6f 6d 61 74 |st layer automat| 00001f20 69 63 61 6c 6c 79 2e 0a 3c 2f 70 3e 0a 0a 09 09 |ically..

....| 00001f30 09 09 0a 09 09 09 0a 0a 09 09 09 0a 09 09 0a 09 |................| 00001f40 09 09 0a 09 09 09 0a 09 09 09 3c 68 32 20 69 64 |..........

type P| 00001fb0 61 63 6b 65 74 42 75 69 6c 64 65 72 3c 2f 61 3e |acketBuilder| 00001fc0 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 65 3e 74 79 |

....
ty|
        00001fd0  70 65 20 50 61 63 6b 65  74 42 75 69 6c 64 65 72  |pe PacketBuilder|
        00001fe0  20 69 6e 74 65 72 66 61  63 65 20 7b 0a 20 20 20  | interface {.   |
        00001ff0  20 3c 73 70 61 6e 20 63  6c 61 73 73 3d 22 63 6f  | // AddLay|
        00002010  65 72 20 73 68 6f 75 6c  64 20 62 65 20 63 61 6c  |er should be cal|
        00002020  6c 65 64 20 62 79 20 61  20 64 65 63 6f 64 65 72  |led by a decoder|
        00002030  20 69 6d 6d 65 64 69 61  74 65 6c 79 20 75 70 6f  | immediately upo|
        00002040  6e 20 73 75 63 63 65 73  73 66 75 6c 3c 2f 73 70  |n successful.    //|
        00002070  20 64 65 63 6f 64 69 6e  67 20 6f 66 20 61 20 6c  | decoding of a l|
        00002080  61 79 65 72 2e 3c 2f 73  70 61 6e 3e 0a 20 20 20  |ayer..   |
        00002090  20 41 64 64 4c 61 79 65  72 28 6c 20 4c 61 79 65  | AddLayer(l Laye|
        000020a0  72 29 0a 20 20 20 20 3c  73 70 61 6e 20 63 6c 61  |r).    // |
        000020c0  54 68 65 20 66 6f 6c 6c  6f 77 69 6e 67 20 66 75  |The following fu|
        000020d0  6e 63 74 69 6f 6e 73 20  73 65 74 20 74 68 65 20  |nctions set the |
        000020e0  76 61 72 69 6f 75 73 20  73 70 65 63 69 66 69 63  |various specific|
        000020f0  20 6c 61 79 65 72 73 20  69 6e 20 74 68 65 20 66  | layers in the f|
        00002100  69 6e 61 6c 3c 2f 73 70  61 6e 3e 0a 20 20 20 20  |inal.    |
        00002110  3c 73 70 61 6e 20 63 6c  61 73 73 3d 22 63 6f 6d  |// packet.|
        00002130  20 20 4e 6f 74 65 20 74  68 61 74 20 69 66 20 6d  |  Note that if m|
        00002140  61 6e 79 20 6c 61 79 65  72 73 20 63 61 6c 6c 20  |any layers call |
        00002150  53 65 74 58 2c 20 74 68  65 20 66 69 72 73 74 20  |SetX, the first |
        00002160  63 61 6c 6c 20 69 73 20  6b 65 70 74 20 61 6e 64  |call is kept and|
        00002170  20 61 6c 6c 3c 2f 73 70  61 6e 3e 0a 20 20 20 20  | all.    |
        00002180  3c 73 70 61 6e 20 63 6c  61 73 73 3d 22 63 6f 6d  |// other c|
        000021a0  61 6c 6c 73 20 61 72 65  20 69 67 6e 6f 72 65 64  |alls are ignored|
        000021b0  2e 3c 2f 73 70 61 6e 3e  0a 20 20 20 20 53 65 74  |..    Set|
        000021c0  4c 69 6e 6b 4c 61 79 65  72 28 4c 69 6e 6b 4c 61  |LinkLayer(LinkLa|
        000021d0  79 65 72 29 0a 20 20 20  20 53 65 74 4e 65 74 77  |yer).    SetNetw|
        000021e0  6f 72 6b 4c 61 79 65 72  28 4e 65 74 77 6f 72 6b  |orkLayer(Network|
        000021f0  4c 61 79 65 72 29 0a 20  20 20 20 53 65 74 54 72  |Layer).    SetTr|
        00002200  61 6e 73 70 6f 72 74 4c  61 79 65 72 28 54 72 61  |ansportLayer(Tra|
        00002210  6e 73 70 6f 72 74 4c 61  79 65 72 29 0a 20 20 20  |nsportLayer).   |
        00002220  20 53 65 74 41 70 70 6c  69 63 61 74 69 6f 6e 4c  | SetApplicationL|
        00002230  61 79 65 72 28 41 70 70  6c 69 63 61 74 69 6f 6e  |ayer(Application|
        00002240  4c 61 79 65 72 29 0a 20  20 20 20 53 65 74 45 72  |Layer).    SetEr|
        00002250  72 6f 72 4c 61 79 65 72  28 45 72 72 6f 72 4c 61  |rorLayer(ErrorLa|
        00002260  79 65 72 29 0a 20 20 20  20 3c 73 70 61 6e 20 63  |yer).    /|
        00002280  2f 20 4e 65 78 74 44 65  63 6f 64 65 72 20 73 68  |/ NextDecoder sh|
        00002290  6f 75 6c 64 20 62 65 20  63 61 6c 6c 65 64 20 62  |ould be called b|
        000022a0  79 20 61 20 64 65 63 6f  64 65 72 20 77 68 65 6e  |y a decoder when|
        000022b0  20 74 68 65 79 26 23 33  39 3b 72 65 20 64 6f 6e  | they're don|
        000022c0  65 20 64 65 63 6f 64 69  6e 67 20 61 3c 2f 73 70  |e decoding a.    //|
        000022f0  20 70 61 63 6b 65 74 20  6c 61 79 65 72 20 62 75  | packet layer bu|
        00002300  74 20 6e 6f 74 20 64 6f  6e 65 20 77 69 74 68 20  |t not done with |
        00002310  64 65 63 6f 64 69 6e 67  20 74 68 65 20 65 6e 74  |decoding the ent|
        00002320  69 72 65 20 70 61 63 6b  65 74 2e 20 20 54 68 65  |ire packet.  The|
        00002330  20 6e 65 78 74 3c 2f 73  70 61 6e 3e 0a 20 20 20  | next.   |
        00002340  20 3c 73 70 61 6e 20 63  6c 61 73 73 3d 22 63 6f  | // decode|
        00002360  72 20 77 69 6c 6c 20 62  65 20 63 61 6c 6c 65 64  |r will be called|
        00002370  20 74 6f 20 64 65 63 6f  64 65 20 74 68 65 20 6c  | to decode the l|
        00002380  61 73 74 20 41 64 64 4c  61 79 65 72 26 23 33 39  |ast AddLayer'|
        00002390  3b 73 20 4c 61 79 65 72  50 61 79 6c 6f 61 64 2e  |;s LayerPayload.|
        000023a0  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 3c 73 70 61  |.    // Because of |
        000023d0  74 68 69 73 2c 20 4e 65  78 74 44 65 63 6f 64 65  |this, NextDecode|
        000023e0  72 20 6d 75 73 74 20 6f  6e 6c 79 20 62 65 20 63  |r must only be c|
        000023f0  61 6c 6c 65 64 20 6f 6e  63 65 20 61 6c 6c 20 6f  |alled once all o|
        00002400  74 68 65 72 3c 2f 73 70  61 6e 3e 0a 20 20 20 20  |ther.    |
        00002410  3c 73 70 61 6e 20 63 6c  61 73 73 3d 22 63 6f 6d  |// PacketB|
        00002430  75 69 6c 64 65 72 20 63  61 6c 6c 73 20 68 61 76  |uilder calls hav|
        00002440  65 20 62 65 65 6e 20 6d  61 64 65 2e 20 20 53 65  |e been made.  Se|
        00002450  74 2a 4c 61 79 65 72 20  61 6e 64 20 41 64 64 4c  |t*Layer and AddL|
        00002460  61 79 65 72 20 63 61 6c  6c 73 20 61 66 74 65 72  |ayer calls after|
        00002470  3c 2f 73 70 61 6e 3e 0a  20 20 20 20 3c 73 70 61  |.    // NextDecoder|
        000024a0  20 63 61 6c 6c 73 20 77  69 6c 6c 20 62 65 68 61  | calls will beha|
        000024b0  76 65 20 69 6e 63 6f 72  72 65 63 74 6c 79 2e 3c  |ve incorrectly.<|
        000024c0  2f 73 70 61 6e 3e 0a 20  20 20 20 4e 65 78 74 44  |/span>.    NextD|
        000024d0  65 63 6f 64 65 72 28 6e  65 78 74 20 44 65 63 6f  |ecoder(next Deco|
        000024e0  64 65 72 29 20 65 72 72  6f 72 0a 7d 3c 2f 70 72  |der) error.}....

.Packet| 00002500 42 75 69 6c 64 65 72 20 69 73 20 75 73 65 64 20 |Builder is used | 00002510 62 79 20 6c 61 79 65 72 20 64 65 63 6f 64 65 72 |by layer decoder| 00002520 73 20 74 6f 20 73 74 6f 72 65 20 74 68 65 20 6c |s to store the l| 00002530 61 79 65 72 73 20 74 68 65 79 26 23 33 39 3b 76 |ayers they'v| 00002540 65 20 64 65 63 6f 64 65 64 2c 0a 61 6e 64 20 74 |e decoded,.and t| 00002550 6f 20 64 65 66 65 72 20 66 75 74 75 72 65 20 64 |o defer future d| 00002560 65 63 6f 64 69 6e 67 20 76 69 61 20 4e 65 78 74 |ecoding via Next| 00002570 44 65 63 6f 64 65 72 2e 0a 54 79 70 69 63 61 6c |Decoder..Typical| 00002580 6c 79 2c 20 74 68 65 20 70 61 74 74 65 72 6e 20 |ly, the pattern | 00002590 66 6f 72 20 75 73 65 20 69 73 3a 0a 3c 2f 70 3e |for use is:.

| 000025a0 0a 3c 70 72 65 3e 66 75 6e 63 20 28 6d 20 2a 6d |.
func (m *m|
        000025b0  79 44 65 63 6f 64 65 72  29 20 44 65 63 6f 64 65  |yDecoder) Decode|
        000025c0  28 64 61 74 61 20 5b 5d  62 79 74 65 2c 20 70 20  |(data []byte, p |
        000025d0  50 61 63 6b 65 74 42 75  69 6c 64 65 72 29 20 65  |PacketBuilder) e|
        000025e0  72 72 6f 72 20 7b 0a 20  20 69 66 20 6d 79 4c 61  |rror {.  if myLa|
        000025f0  79 65 72 2c 20 65 72 72  20 3a 3d 20 6d 79 44 65  |yer, err := myDe|
        00002600  63 6f 64 69 6e 67 4c 6f  67 69 63 28 64 61 74 61  |codingLogic(data|
        00002610  29 3b 20 65 72 72 20 21  3d 20 6e 69 6c 20 7b 0a  |); err != nil {.|
        00002620  20 20 20 20 72 65 74 75  72 6e 20 65 72 72 0a 20  |    return err. |
        00002630  20 7d 20 65 6c 73 65 20  7b 0a 20 20 20 20 70 2e  | } else {.    p.|
        00002640  41 64 64 4c 61 79 65 72  28 6d 79 4c 61 79 65 72  |AddLayer(myLayer|
        00002650  29 0a 20 20 7d 0a 20 20  2f 2f 20 6d 61 79 62 65  |).  }.  // maybe|
        00002660  20 64 6f 20 74 68 69 73  2c 20 69 66 20 6d 79 4c  | do this, if myL|
        00002670  61 79 65 72 20 69 73 20  61 20 4c 69 6e 6b 4c 61  |ayer is a LinkLa|
        00002680  79 65 72 0a 20 20 70 2e  53 65 74 4c 69 6e 6b 4c  |yer.  p.SetLinkL|
        00002690  61 79 65 72 28 6d 79 4c  61 79 65 72 29 0a 20 20  |ayer(myLayer).  |
        000026a0  72 65 74 75 72 6e 20 70  2e 4e 65 78 74 44 65 63  |return p.NextDec|
        000026b0  6f 64 65 72 28 6e 65 78  74 44 65 63 6f 64 65 72  |oder(nextDecoder|
        000026c0  29 0a 7d 0a 3c 2f 70 72  65 3e 0a 0a 0a 09 09 09  |).}.
......| 000026d0 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a |................| 000026e0 0a 09 09 09 0a 09 09 0a 09 09 09 0a 09 09 09 0a |................| 000026f0 09 09 09 3c 68 32 20 69 64 3d 22 50 61 63 6b 65 |...

typ| 00002710 65 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f |e P| 00002760 61 63 6b 65 74 44 61 74 61 53 6f 75 72 63 65 3c |acketDataSource<| 00002770 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 65 |/a>

....type PacketData| 00002790 53 6f 75 72 63 65 20 69 6e 74 65 72 66 61 63 65 |Source interface| 000027a0 20 7b 0a 20 20 20 20 3c 73 70 61 6e 20 63 6c 61 | {. // | 000027c0 52 65 61 64 50 61 63 6b 65 74 44 61 74 61 20 72 |ReadPacketData r| 000027d0 65 74 75 72 6e 73 20 74 68 65 20 6e 65 78 74 20 |eturns the next | 000027e0 70 61 63 6b 65 74 20 61 76 61 69 6c 61 62 6c 65 |packet available| 000027f0 20 66 72 6f 6d 20 74 68 69 73 20 64 61 74 61 20 | from this data | 00002800 73 6f 75 72 63 65 2e 3c 2f 73 70 61 6e 3e 0a 20 |source.. | 00002810 20 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 | // It r| 00002830 65 74 75 72 6e 73 3a 3c 2f 73 70 61 6e 3e 0a 20 |eturns:. | 00002840 20 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 | // dat| 00002860 61 3a 20 20 54 68 65 20 62 79 74 65 73 20 6f 66 |a: The bytes of| 00002870 20 61 6e 20 69 6e 64 69 76 69 64 75 61 6c 20 70 | an individual p| 00002880 61 63 6b 65 74 2e 3c 2f 73 70 61 6e 3e 0a 20 20 |acket.. | 00002890 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 63 | // ci: | 000028b0 20 4d 65 74 61 64 61 74 61 20 61 62 6f 75 74 20 | Metadata about | 000028c0 74 68 65 20 63 61 70 74 75 72 65 3c 2f 73 70 61 |the capture
. // | 000028f0 20 65 72 72 3a 20 20 41 6e 20 65 72 72 6f 72 20 | err: An error | 00002900 65 6e 63 6f 75 6e 74 65 72 65 64 20 77 68 69 6c |encountered whil| 00002910 65 20 72 65 61 64 69 6e 67 20 70 61 63 6b 65 74 |e reading packet| 00002920 20 64 61 74 61 2e 20 20 49 66 20 65 72 72 20 21 | data. If err !| 00002930 3d 20 6e 69 6c 2c 3c 2f 73 70 61 6e 3e 0a 20 20 |= nil,. | 00002940 20 20 3c 73 70 61 6e 20 63 6c 61 73 73 3d 22 63 | // th| 00002960 65 6e 20 64 61 74 61 2f 63 69 20 77 69 6c 6c 20 |en data/ci will | 00002970 62 65 20 69 67 6e 6f 72 65 64 2e 3c 2f 73 70 61 |be ignored.. ReadPacke| 00002990 74 44 61 74 61 28 29 20 28 64 61 74 61 20 5b 5d |tData() (data []| 000029a0 62 79 74 65 2c 20 63 69 20 43 61 70 74 75 72 65 |byte, ci Capture| 000029b0 49 6e 66 6f 2c 20 65 72 72 20 65 72 72 6f 72 29 |Info, err error)| 000029c0 0a 7d 3c 2f 70 72 65 3e 0a 09 09 09 3c 70 3e 0a |.}
....

.| 000029d0 50 61 63 6b 65 74 44 61 74 61 53 6f 75 72 63 65 |PacketDataSource| 000029e0 20 69 73 20 61 6e 20 69 6e 74 65 72 66 61 63 65 | is an interface| 000029f0 20 66 6f 72 20 73 6f 6d 65 20 73 6f 75 72 63 65 | for some source| 00002a00 20 6f 66 20 70 61 63 6b 65 74 20 64 61 74 61 2e | of packet data.| 00002a10 20 20 55 73 65 72 73 20 6d 61 79 0a 63 72 65 61 | Users may.crea| 00002a20 74 65 20 74 68 65 69 72 20 6f 77 6e 20 69 6d 70 |te their own imp| 00002a30 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2c 20 6f 72 |lementations, or| 00002a40 20 75 73 65 20 74 68 65 20 65 78 69 73 74 69 6e | use the existin| 00002a50 67 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e |g implementation| 00002a60 73 20 69 6e 0a 67 6f 70 61 63 6b 65 74 2f 70 63 |s in.gopacket/pc| 00002a70 61 70 20 28 6c 69 62 70 63 61 70 2c 20 61 6c 6c |ap (libpcap, all| 00002a80 6f 77 73 20 72 65 61 64 69 6e 67 20 66 72 6f 6d |ows reading from| 00002a90 20 6c 69 76 65 20 69 6e 74 65 72 66 61 63 65 73 | live interfaces| 00002aa0 20 6f 72 20 66 72 6f 6d 0a 70 63 61 70 20 66 69 | or from.pcap fi| 00002ab0 6c 65 73 29 20 6f 72 20 67 6f 70 61 63 6b 65 74 |les) or gopacket| 00002ac0 2f 70 66 72 69 6e 67 20 28 50 46 5f 52 49 4e 47 |/pfring (PF_RING| 00002ad0 2c 20 61 6c 6c 6f 77 73 20 72 65 61 64 69 6e 67 |, allows reading| 00002ae0 20 66 72 6f 6d 20 6c 69 76 65 0a 69 6e 74 65 72 | from live.inter| 00002af0 66 61 63 65 73 29 2e 0a 3c 2f 70 3e 0a 0a 0a 09 |faces)..

....| 00002b00 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 |................| 00002b10 09 0a 0a 09 09 09 0a 09 09 0a 09 09 09 0a 09 09 |................| 00002b20 09 0a 09 09 09 3c 68 32 20 69 64 3d 22 50 61 63 |.....

type | 00002b40 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b |Pac| 00002b90 6b 65 74 53 6f 75 72 63 65 3c 2f 61 3e 3c 2f 68 |ketSource....
type |
        00002bb0  50 61 63 6b 65 74 53 6f  75 72 63 65 20 73 74 72  |PacketSource str|
        00002bc0  75 63 74 20 7b 0a 0a 20  20 20 20 3c 73 70 61 6e  |uct {..    // DecodeOption|
        00002bf0  73 20 69 73 20 74 68 65  20 73 65 74 20 6f 66 20  |s is the set of |
        00002c00  6f 70 74 69 6f 6e 73 20  74 6f 20 75 73 65 20 66  |options to use f|
        00002c10  6f 72 20 64 65 63 6f 64  69 6e 67 20 65 61 63 68  |or decoding each|
        00002c20  20 70 69 65 63 65 3c 2f  73 70 61 6e 3e 0a 20 20  | piece.  |
        00002c30  20 20 3c 73 70 61 6e 20  63 6c 61 73 73 3d 22 63  |  // of pa|
        00002c50  63 6b 65 74 20 64 61 74  61 2e 20 20 54 68 69 73  |cket data.  This|
        00002c60  20 63 61 6e 2f 73 68 6f  75 6c 64 20 62 65 20 63  | can/should be c|
        00002c70  68 61 6e 67 65 64 20 62  79 20 74 68 65 20 75 73  |hanged by the us|
        00002c80  65 72 20 74 6f 20 72 65  66 6c 65 63 74 20 74 68  |er to reflect th|
        00002c90  65 3c 2f 73 70 61 6e 3e  0a 20 20 20 20 3c 73 70  |e.    // way packet|
        00002cc0  73 20 73 68 6f 75 6c 64  20 62 65 20 64 65 63 6f  |s should be deco|
        00002cd0  64 65 64 2e 3c 2f 73 70  61 6e 3e 0a 20 20 20 20  |ded..    |
        00002ce0  44 65 63 6f 64 65 4f 70  74 69 6f 6e 73 0a 20 20  |DecodeOptions.  |
        00002cf0  20 20 3c 73 70 61 6e 20  63 6c 61 73 73 3d 22 63  |  // conta|
        00002d10  69 6e 73 20 66 69 6c 74  65 72 65 64 20 6f 72 20  |ins filtered or |
        00002d20  75 6e 65 78 70 6f 72 74  65 64 20 66 69 65 6c 64  |unexported field|
        00002d30  73 3c 2f 73 70 61 6e 3e  0a 7d 3c 2f 70 72 65 3e  |s.}
| 00002d40 0a 09 09 09 3c 70 3e 0a 50 61 63 6b 65 74 53 6f |....

.PacketSo| 00002d50 75 72 63 65 20 72 65 61 64 73 20 69 6e 20 70 61 |urce reads in pa| 00002d60 63 6b 65 74 73 20 66 72 6f 6d 20 61 20 50 61 63 |ckets from a Pac| 00002d70 6b 65 74 44 61 74 61 53 6f 75 72 63 65 2c 20 64 |ketDataSource, d| 00002d80 65 63 6f 64 65 73 20 74 68 65 6d 2c 20 61 6e 64 |ecodes them, and| 00002d90 0a 72 65 74 75 72 6e 73 20 74 68 65 6d 2e 0a 3c |.returns them..<| 00002da0 2f 70 3e 0a 3c 70 3e 0a 54 68 65 72 65 20 61 72 |/p>.

.There ar| 00002db0 65 20 63 75 72 72 65 6e 74 6c 79 20 74 77 6f 20 |e currently two | 00002dc0 64 69 66 66 65 72 65 6e 74 20 6d 65 74 68 6f 64 |different method| 00002dd0 73 20 66 6f 72 20 72 65 61 64 69 6e 67 20 70 61 |s for reading pa| 00002de0 63 6b 65 74 73 20 69 6e 20 74 68 72 6f 75 67 68 |ckets in through| 00002df0 0a 61 20 50 61 63 6b 65 74 53 6f 75 72 63 65 3a |.a PacketSource:| 00002e00 0a 3c 2f 70 3e 0a 3c 68 33 20 69 64 3d 22 52 65 |.

.

Rea| 00002e30 64 69 6e 67 20 57 69 74 68 20 50 61 63 6b 65 74 |ding With Packet| 00002e40 73 20 46 75 6e 63 74 69 6f 6e 3c 2f 68 33 3e 0a |s Function

.| 00002e50 3c 70 3e 0a 54 68 69 73 20 6d 65 74 68 6f 64 20 |

.This method | 00002e60 69 73 20 74 68 65 20 6d 6f 73 74 20 63 6f 6e 76 |is the most conv| 00002e70 65 6e 69 65 6e 74 20 61 6e 64 20 65 61 73 69 65 |enient and easie| 00002e80 73 74 20 74 6f 20 63 6f 64 65 2c 20 62 75 74 20 |st to code, but | 00002e90 6c 61 63 6b 73 0a 66 6c 65 78 69 62 69 6c 69 74 |lacks.flexibilit| 00002ea0 79 2e 20 20 50 61 63 6b 65 74 73 20 72 65 74 75 |y. Packets retu| 00002eb0 72 6e 73 20 61 20 26 23 33 39 3b 63 68 61 6e 20 |rns a 'chan | 00002ec0 50 61 63 6b 65 74 26 23 33 39 3b 2c 20 74 68 65 |Packet', the| 00002ed0 6e 20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 6c 79 |n asynchronously| 00002ee0 20 77 72 69 74 65 73 0a 70 61 63 6b 65 74 73 20 | writes.packets | 00002ef0 69 6e 74 6f 20 74 68 61 74 20 63 68 61 6e 6e 65 |into that channe| 00002f00 6c 2e 20 20 50 61 63 6b 65 74 73 20 75 73 65 73 |l. Packets uses| 00002f10 20 61 20 62 6c 6f 63 6b 69 6e 67 20 63 68 61 6e | a blocking chan| 00002f20 6e 65 6c 2c 20 61 6e 64 20 63 6c 6f 73 65 73 0a |nel, and closes.| 00002f30 69 74 20 69 66 20 61 6e 20 69 6f 2e 45 4f 46 20 |it if an io.EOF | 00002f40 69 73 20 72 65 74 75 72 6e 65 64 20 62 79 20 74 |is returned by t| 00002f50 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 50 61 |he underlying Pa| 00002f60 63 6b 65 74 44 61 74 61 53 6f 75 72 63 65 2e 20 |cketDataSource. | 00002f70 20 41 6c 6c 20 6f 74 68 65 72 0a 50 61 63 6b 65 | All other.Packe| 00002f80 74 44 61 74 61 53 6f 75 72 63 65 20 65 72 72 6f |tDataSource erro| 00002f90 72 73 20 61 72 65 20 69 67 6e 6f 72 65 64 20 61 |rs are ignored a| 00002fa0 6e 64 20 64 69 73 63 61 72 64 65 64 2e 0a 3c 2f |nd discarded...

for pack|
        00002fc0  65 74 20 3a 3d 20 72 61  6e 67 65 20 70 61 63 6b  |et := range pack|
        00002fd0  65 74 53 6f 75 72 63 65  2e 50 61 63 6b 65 74 73  |etSource.Packets|
        00002fe0  28 29 20 7b 0a 20 20 2e  2e 2e 0a 7d 0a 3c 2f 70  |() {.  ....}..

Re| 00003020 61 64 69 6e 67 20 57 69 74 68 20 4e 65 78 74 50 |ading With NextP| 00003030 61 63 6b 65 74 20 46 75 6e 63 74 69 6f 6e 3c 2f |acket Function.

.This met| 00003050 68 6f 64 20 69 73 20 74 68 65 20 6d 6f 73 74 20 |hod is the most | 00003060 66 6c 65 78 69 62 6c 65 2c 20 61 6e 64 20 65 78 |flexible, and ex| 00003070 70 6f 73 65 73 20 65 72 72 6f 72 73 20 74 68 61 |poses errors tha| 00003080 74 20 6d 61 79 20 62 65 0a 65 6e 63 6f 75 6e 74 |t may be.encount| 00003090 65 72 65 64 20 62 79 20 74 68 65 20 75 6e 64 65 |ered by the unde| 000030a0 72 6c 79 69 6e 67 20 50 61 63 6b 65 74 44 61 74 |rlying PacketDat| 000030b0 61 53 6f 75 72 63 65 2e 20 20 49 74 26 23 33 39 |aSource. It'| 000030c0 3b 73 20 61 6c 73 6f 20 74 68 65 20 66 61 73 74 |;s also the fast| 000030d0 65 73 74 0a 69 6e 20 61 20 74 69 67 68 74 20 6c |est.in a tight l| 000030e0 6f 6f 70 2c 20 73 69 6e 63 65 20 69 74 20 64 6f |oop, since it do| 000030f0 65 73 6e 26 23 33 39 3b 74 20 68 61 76 65 20 74 |esn't have t| 00003100 68 65 20 6f 76 65 72 68 65 61 64 20 6f 66 20 61 |he overhead of a| 00003110 20 63 68 61 6e 6e 65 6c 0a 72 65 61 64 2f 77 72 | channel.read/wr| 00003120 69 74 65 2e 20 20 48 6f 77 65 76 65 72 2c 20 69 |ite. However, i| 00003130 74 20 72 65 71 75 69 72 65 73 20 74 68 65 20 75 |t requires the u| 00003140 73 65 72 20 74 6f 20 68 61 6e 64 6c 65 20 65 72 |ser to handle er| 00003150 72 6f 72 73 2c 20 6d 6f 73 74 0a 69 6d 70 6f 72 |rors, most.impor| 00003160 74 61 6e 74 6c 79 20 74 68 65 20 69 6f 2e 45 4f |tantly the io.EO| 00003170 46 20 65 72 72 6f 72 20 69 6e 20 63 61 73 65 73 |F error in cases| 00003180 20 77 68 65 72 65 20 70 61 63 6b 65 74 73 20 61 | where packets a| 00003190 72 65 20 62 65 69 6e 67 20 72 65 61 64 20 66 72 |re being read fr| 000031a0 6f 6d 0a 61 20 66 69 6c 65 2e 0a 3c 2f 70 3e 0a |om.a file..

.| 000031b0 3c 70 72 65 3e 66 6f 72 20 7b 0a 20 20 70 61 63 |
for {.  pac|
        000031c0  6b 65 74 2c 20 65 72 72  20 3a 3d 20 70 61 63 6b  |ket, err := pack|
        000031d0  65 74 53 6f 75 72 63 65  2e 4e 65 78 74 50 61 63  |etSource.NextPac|
        000031e0  6b 65 74 28 29 20 7b 0a  20 20 69 66 20 65 72 72  |ket() {.  if err|
        000031f0  20 3d 3d 20 69 6f 2e 45  4f 46 20 7b 0a 20 20 20  | == io.EOF {.   |
        00003200  20 62 72 65 61 6b 0a 20  20 7d 20 65 6c 73 65 20  | break.  } else |
        00003210  69 66 20 65 72 72 20 21  3d 20 6e 69 6c 20 7b 0a  |if err != nil {.|
        00003220  20 20 20 20 6c 6f 67 2e  50 72 69 6e 74 6c 6e 28  |    log.Println(|
        00003230  26 23 33 34 3b 45 72 72  6f 72 3a 26 23 33 34 3b  |"Error:"|
        00003240  2c 20 65 72 72 29 0a 20  20 20 20 63 6f 6e 74 69  |, err).    conti|
        00003250  6e 75 65 0a 20 20 7d 0a  20 20 68 61 6e 64 6c 65  |nue.  }.  handle|
        00003260  50 61 63 6b 65 74 28 70  61 63 6b 65 74 29 20 20  |Packet(packet)  |
        00003270  2f 2f 20 44 6f 20 73 6f  6d 65 74 68 69 6e 67 20  |// Do something |
        00003280  77 69 74 68 20 65 61 63  68 20 70 61 63 6b 65 74  |with each packet|
        00003290  2e 0a 7d 0a 3c 2f 70 72  65 3e 0a 0a 0a 09 09 09  |..}.
......| 000032a0 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a |................| 000032b0 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 3d |.........

func NewPacketSou| 00003330 72 63 65 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 |rce

....| 00003340 09 3c 70 72 65 3e 66 75 6e 63 20 4e 65 77 50 61 |.
func NewPa|
        00003350  63 6b 65 74 53 6f 75 72  63 65 28 73 6f 75 72 63  |cketSource(sourc|
        00003360  65 20 50 61 63 6b 65 74  44 61 74 61 53 6f 75 72  |e PacketDataSour|
        00003370  63 65 2c 20 64 65 63 6f  64 65 72 20 44 65 63 6f  |ce, decoder Deco|
        00003380  64 65 72 29 20 2a 50 61  63 6b 65 74 53 6f 75 72  |der) *PacketSour|
        00003390  63 65 3c 2f 70 72 65 3e  0a 09 09 09 09 3c 70 3e  |ce
.....

| 000033a0 0a 4e 65 77 50 61 63 6b 65 74 53 6f 75 72 63 65 |.NewPacketSource| 000033b0 20 63 72 65 61 74 65 73 20 61 20 70 61 63 6b 65 | creates a packe| 000033c0 74 20 64 61 74 61 20 73 6f 75 72 63 65 2e 0a 3c |t data source..<| 000033d0 2f 70 3e 0a 0a 09 09 09 09 0a 09 09 09 0a 0a 09 |/p>.............| 000033e0 09 09 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 |............

fun| 00003410 63 20 28 2a 50 61 63 6b 65 74 53 6f 75 72 63 65 |c (*PacketSource| 00003420 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f |) N| 00003470 65 78 74 50 61 63 6b 65 74 3c 2f 61 3e 3c 2f 68 |extPacket.....
func|
        00003490  20 28 70 20 2a 50 61 63  6b 65 74 53 6f 75 72 63  | (p *PacketSourc|
        000034a0  65 29 20 4e 65 78 74 50  61 63 6b 65 74 28 29 20  |e) NextPacket() |
        000034b0  28 50 61 63 6b 65 74 2c  20 65 72 72 6f 72 29 3c  |(Packet, error)<|
        000034c0  2f 70 72 65 3e 0a 09 09  09 09 3c 70 3e 0a 4e 65  |/pre>.....

.Ne| 000034d0 78 74 50 61 63 6b 65 74 20 72 65 74 75 72 6e 73 |xtPacket returns| 000034e0 20 74 68 65 20 6e 65 78 74 20 64 65 63 6f 64 65 | the next decode| 000034f0 64 20 70 61 63 6b 65 74 20 66 72 6f 6d 20 74 68 |d packet from th| 00003500 65 20 50 61 63 6b 65 74 53 6f 75 72 63 65 2e 20 |e PacketSource. | 00003510 20 4f 6e 20 65 72 72 6f 72 2c 0a 69 74 20 72 65 | On error,.it re| 00003520 74 75 72 6e 73 20 61 20 6e 69 6c 20 70 61 63 6b |turns a nil pack| 00003530 65 74 20 61 6e 64 20 61 20 6e 6f 6e 2d 6e 69 6c |et and a non-nil| 00003540 20 65 72 72 6f 72 2e 0a 3c 2f 70 3e 0a 0a 09 09 | error..

....| 00003550 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 |................| 00003560 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 50 61 63 |.....

func (*Packet| 00003590 53 6f 75 72 63 65 29 20 3c 61 20 68 72 65 66 3d |Source) Packets| 000035f0 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 72 65 3e 66 |

.....
f|
        00003600  75 6e 63 20 28 70 20 2a  50 61 63 6b 65 74 53 6f  |unc (p *PacketSo|
        00003610  75 72 63 65 29 20 50 61  63 6b 65 74 73 28 29 20  |urce) Packets() |
        00003620  63 68 61 6e 20 50 61 63  6b 65 74 3c 2f 70 72 65  |chan Packet.....

.Packet| 00003640 73 20 72 65 74 75 72 6e 73 20 61 20 62 6c 6f 63 |s returns a bloc| 00003650 6b 69 6e 67 20 63 68 61 6e 6e 65 6c 20 6f 66 20 |king channel of | 00003660 70 61 63 6b 65 74 73 2c 20 61 6c 6c 6f 77 69 6e |packets, allowin| 00003670 67 20 65 61 73 79 20 69 74 65 72 61 74 69 6e 67 |g easy iterating| 00003680 20 6f 76 65 72 0a 70 61 63 6b 65 74 73 2e 20 20 | over.packets. | 00003690 50 61 63 6b 65 74 73 20 77 69 6c 6c 20 62 65 20 |Packets will be | 000036a0 61 73 79 6e 63 68 72 6f 6e 6f 75 73 6c 79 20 72 |asynchronously r| 000036b0 65 61 64 20 69 6e 20 66 72 6f 6d 20 74 68 65 20 |ead in from the | 000036c0 75 6e 64 65 72 6c 79 69 6e 67 0a 50 61 63 6b 65 |underlying.Packe| 000036d0 74 44 61 74 61 53 6f 75 72 63 65 20 61 6e 64 20 |tDataSource and | 000036e0 77 72 69 74 74 65 6e 20 74 6f 20 74 68 65 20 72 |written to the r| 000036f0 65 74 75 72 6e 65 64 20 63 68 61 6e 6e 65 6c 2e |eturned channel.| 00003700 20 20 49 66 20 74 68 65 20 75 6e 64 65 72 6c 79 | If the underly| 00003710 69 6e 67 0a 50 61 63 6b 65 74 44 61 74 61 53 6f |ing.PacketDataSo| 00003720 75 72 63 65 20 72 65 74 75 72 6e 73 20 61 6e 20 |urce returns an | 00003730 69 6f 2e 45 4f 46 20 65 72 72 6f 72 2c 20 74 68 |io.EOF error, th| 00003740 65 20 63 68 61 6e 6e 65 6c 20 77 69 6c 6c 20 62 |e channel will b| 00003750 65 20 63 6c 6f 73 65 64 2e 0a 49 66 20 61 6e 79 |e closed..If any| 00003760 20 6f 74 68 65 72 20 65 72 72 6f 72 20 69 73 20 | other error is | 00003770 65 6e 63 6f 75 6e 74 65 72 65 64 2c 20 69 74 20 |encountered, it | 00003780 69 73 20 69 67 6e 6f 72 65 64 2e 0a 3c 2f 70 3e |is ignored..

| 00003790 0a 3c 70 72 65 3e 66 6f 72 20 70 61 63 6b 65 74 |.
for packet|
        000037a0  20 3a 3d 20 72 61 6e 67  65 20 70 61 63 6b 65 74  | := range packet|
        000037b0  53 6f 75 72 63 65 2e 50  61 63 6b 65 74 73 28 29  |Source.Packets()|
        000037c0  20 7b 0a 20 20 68 61 6e  64 6c 65 50 61 63 6b 65  | {.  handlePacke|
        000037d0  74 28 70 61 63 6b 65 74  29 20 20 2f 2f 20 44 6f  |t(packet)  // Do|
        000037e0  20 73 6f 6d 65 74 68 69  6e 67 20 77 69 74 68 20  | something with |
        000037f0  65 61 63 68 20 70 61 63  6b 65 74 2e 0a 7d 0a 3c  |each packet..}.<|
        00003800  2f 70 72 65 3e 0a 0a 09  09 09 09 0a 09 09 09 09  |/pre>...........|
        00003810  0a 09 09 09 0a 09 09 0a  09 09 09 0a 09 09 09 0a  |................|
        00003820  09 09 09 3c 68 32 20 69  64 3d 22 50 61 79 6c 6f  |...

type Payload....
type P|
        000038a0  61 79 6c 6f 61 64 20 73  74 72 75 63 74 20 7b 0a  |ayload struct {.|
        000038b0  20 20 20 20 44 61 74 61  20 5b 5d 62 79 74 65 0a  |    Data []byte.|
        000038c0  7d 3c 2f 70 72 65 3e 0a  09 09 09 3c 70 3e 0a 50  |}
....

.P| 000038d0 61 79 6c 6f 61 64 20 69 73 20 61 20 4c 61 79 65 |ayload is a Laye| 000038e0 72 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 |r containing the| 000038f0 20 70 61 79 6c 6f 61 64 20 6f 66 20 61 20 70 61 | payload of a pa| 00003900 63 6b 65 74 2e 20 20 54 68 65 20 64 65 66 69 6e |cket. The defin| 00003910 69 74 69 6f 6e 20 6f 66 0a 77 68 61 74 20 63 6f |ition of.what co| 00003920 6e 73 74 69 74 75 74 65 73 20 74 68 65 20 70 61 |nstitutes the pa| 00003930 79 6c 6f 61 64 20 6f 66 20 61 20 70 61 63 6b 65 |yload of a packe| 00003940 74 20 64 65 70 65 6e 64 73 20 6f 6e 20 70 72 65 |t depends on pre| 00003950 76 69 6f 75 73 20 6c 61 79 65 72 73 3b 20 66 6f |vious layers; fo| 00003960 72 0a 54 43 50 20 61 6e 64 20 55 44 50 2c 20 77 |r.TCP and UDP, w| 00003970 65 20 73 74 6f 70 20 64 65 63 6f 64 69 6e 67 20 |e stop decoding | 00003980 61 62 6f 76 65 20 6c 61 79 65 72 20 34 20 61 6e |above layer 4 an| 00003990 64 20 72 65 74 75 72 6e 20 74 68 65 20 72 65 6d |d return the rem| 000039a0 61 69 6e 69 6e 67 0a 62 79 74 65 73 20 61 73 20 |aining.bytes as | 000039b0 61 20 50 61 79 6c 6f 61 64 2e 20 20 50 61 79 6c |a Payload. Payl| 000039c0 6f 61 64 20 69 73 20 61 6e 20 41 70 70 6c 69 63 |oad is an Applic| 000039d0 61 74 69 6f 6e 4c 61 79 65 72 2e 0a 3c 2f 70 3e |ationLayer..

| 000039e0 0a 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 |................| 000039f0 0a 0a 09 09 09 0a 0a 09 09 09 0a 09 09 09 09 0a |................| 00003a00 09 09 09 09 3c 68 33 20 69 64 3d 22 50 61 79 6c |....

func (*Payloa| 00003a30 64 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |d) Layer| 00003a80 43 6f 6e 74 65 6e 74 73 3c 2f 61 3e 3c 2f 68 33 |Contents.....
func |
        00003aa0  28 70 20 2a 50 61 79 6c  6f 61 64 29 20 4c 61 79  |(p *Payload) Lay|
        00003ab0  65 72 43 6f 6e 74 65 6e  74 73 28 29 20 5b 5d 62  |erContents() []b|
        00003ac0  79 74 65 3c 2f 70 72 65  3e 0a 09 09 09 09 0a 09  |yte
.......| 00003ad0 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 |................| 00003ae0 09 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 50 61 |......

func (*Paylo| 00003b10 61 64 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 |ad) Laye| 00003b60 72 50 61 79 6c 6f 61 64 3c 2f 61 3e 3c 2f 68 33 |rPayload.....
func |
        00003b80  28 70 20 2a 50 61 79 6c  6f 61 64 29 20 4c 61 79  |(p *Payload) Lay|
        00003b90  65 72 50 61 79 6c 6f 61  64 28 29 20 5b 5d 62 79  |erPayload() []by|
        00003ba0  74 65 3c 2f 70 72 65 3e  0a 09 09 09 09 0a 09 09  |te
........| 00003bb0 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 09 09 |................| 00003bc0 0a 09 09 09 09 3c 68 33 20 69 64 3d 22 50 61 79 |.....

| 00003be0 66 75 6e 63 20 28 2a 50 61 79 6c 6f 61 64 29 20 |func (*Payload) | 00003bf0 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f 70 6b |LayerTyp| 00003c40 65 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c |e

.....<| 00003c50 70 72 65 3e 66 75 6e 63 20 28 70 20 2a 50 61 79 |pre>func (p *Pay| 00003c60 6c 6f 61 64 29 20 4c 61 79 65 72 54 79 70 65 28 |load) LayerType(| 00003c70 29 20 4c 61 79 65 72 54 79 70 65 3c 2f 70 72 65 |) LayerType.....

.LayerT| 00003c90 79 70 65 20 72 65 74 75 72 6e 73 20 4c 61 79 65 |ype returns Laye| 00003ca0 72 54 79 70 65 50 61 79 6c 6f 61 64 0a 3c 2f 70 |rTypePayload................| 00003cc0 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 |..........

func (*Payloa| 00003cf0 64 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 |d) Paylo| 00003d40 61 64 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 |ad

.....| 00003d50 3c 70 72 65 3e 66 75 6e 63 20 28 70 20 2a 50 61 |
func (p *Pa|
        00003d60  79 6c 6f 61 64 29 20 50  61 79 6c 6f 61 64 28 29  |yload) Payload()|
        00003d70  20 5b 5d 62 79 74 65 3c  2f 70 72 65 3e 0a 09 09  | []byte
...| 00003d80 09 09 0a 09 09 09 09 0a 09 09 09 09 0a 09 09 09 |................| 00003d90 0a 09 09 09 09 0a 09 09 09 09 3c 68 33 20 69 64 |..........

func (*Payload| 00003dc0 29 20 3c 61 20 68 72 65 66 3d 22 2f 73 72 63 2f |) String| 00003e10 3c 2f 61 3e 3c 2f 68 33 3e 0a 09 09 09 09 3c 70 |

.....func (p *Payl| 00003e30 6f 61 64 29 20 53 74 72 69 6e 67 28 29 20 73 74 |oad) String() st| 00003e40 72 69 6e 67 3c 2f 70 72 65 3e 0a 09 09 09 09 0a |ring
......| 00003e50 09 09 09 09 0a 09 09 09 09 0a 09 09 09 0a 09 09 |................| 00003e60 0a 09 09 09 0a 09 09 09 0a 09 09 09 3c 68 32 20 |............

type TransportLayer<| 00003ee0 2f 61 3e 3c 2f 68 32 3e 0a 09 09 09 3c 70 72 65 |/a>

....type TransportL| 00003f00 61 79 65 72 20 69 6e 74 65 72 66 61 63 65 20 7b |ayer interface {| 00003f10 0a 20 20 20 20 4c 61 79 65 72 0a 20 20 20 20 54 |. Layer. T| 00003f20 72 61 6e 73 70 6f 72 74 46 6c 6f 77 28 29 20 46 |ransportFlow() F| 00003f30 6c 6f 77 0a 7d 3c 2f 70 72 65 3e 0a 09 09 09 3c |low.}
....<| 00003f40 70 3e 0a 54 72 61 6e 73 70 6f 72 74 4c 61 79 65 |p>.TransportLaye| 00003f50 72 20 69 73 20 74 68 65 20 70 61 63 6b 65 74 20 |r is the packet | 00003f60 6c 61 79 65 72 20 63 6f 72 72 65 73 70 6f 6e 64 |layer correspond| 00003f70 69 6e 67 20 74 6f 20 74 68 65 20 54 43 50 2f 49 |ing to the TCP/I| 00003f80 50 20 6c 61 79 65 72 20 33 20 28 4f 53 49 0a 6c |P layer 3 (OSI.l| 00003f90 61 79 65 72 20 34 29 0a 3c 2f 70 3e 0a 0a 0a 09 |ayer 4).

....| 00003fa0 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 09 |................| 00003fb0 09 0a 0a 09 09 09 0a 09 |........| pcap_test.go:110: -- FULL PACKET DATA (1006 bytes) ------------------------------------ 00000000 1e 00 00 00 60 01 88 91 03 c2 06 40 00 00 00 00 |....`......@....| 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 01 1f 90 e5 af |................| 00000030 0a 66 36 17 08 97 18 4a 80 18 23 02 03 ca 00 00 |.f6....J..#.....| 00000040 01 01 08 0a 05 c0 8d b6 05 c0 8c fc 09 0a 09 09 |................| 00000050 3c 2f 64 69 76 3e 0a 09 0a 0a 09 0a 0a 0a 0a 0a |..........| 00000060 0a 0a 0a 09 0a 09 0a 09 09 3c 68 32 20 69 64 3d |.........

Subdirector| 00000090 69 65 73 3c 2f 68 32 3e 0a 09 0a 09 3c 74 61 62 |ies

.....| 000000b0 09 3c 74 72 3e 0a 09 3c 74 68 3e 4e 61 6d 65 3c |...Name<| 000000c0 2f 74 68 3e 0a 09 3c 74 68 3e 26 6e 62 73 70 3b |/th>.. | 000000d0 26 6e 62 73 70 3b 26 6e 62 73 70 3b 26 6e 62 73 |  &nbs| 000000e0 70 3b 3c 2f 74 68 3e 0a 09 3c 74 68 20 73 74 79 |p;..Synopsis| 00000120 0a 09 3c 2f 74 72 3e 0a 09 0a 09 09 3c 74 72 3e |.......| 00000130 0a 09 09 3c 74 64 3e 3c 61 20 68 72 65 66 3d 22 |...
...| 00000150 09 09 3c 2f 74 72 3e 0a 09 0a 09 0a 09 09 0a 09 |...........| 00000160 09 09 3c 74 72 3e 0a 09 09 09 3c 74 64 20 63 6c |......lay| 00000190 65 72 73 3c 2f 61 3e 3c 2f 74 64 3e 0a 09 09 09 |ers....| 000001a0 3c 74 64 3e 26 6e 62 73 70 3b 26 6e 62 73 70 3b |  | 000001b0 26 6e 62 73 70 3b 26 6e 62 73 70 3b 3c 2f 74 64 |  ....Pac| 000001e0 6b 61 67 65 20 6c 61 79 65 72 73 20 70 72 6f 76 |kage layers prov| 000001f0 69 64 65 73 20 64 65 63 6f 64 69 6e 67 20 6c 61 |ides decoding la| 00000200 79 65 72 73 20 66 6f 72 20 6d 61 6e 79 20 63 6f |yers for many co| 00000210 6d 6d 6f 6e 20 70 72 6f 74 6f 63 6f 6c 73 2e 3c |mmon protocols.<| 00000220 2f 74 64 3e 0a 09 09 09 3c 2f 74 72 3e 0a 09 09 |/td>.......| 00000230 0a 09 0a 09 09 0a 09 09 09 3c 74 72 3e 0a 09 09 |............| 00000240 09 3c 74 64 20 63 6c 61 73 73 3d 22 6e 61 6d 65 |.pcap.| 00000270 09 09 09 3c 74 64 3e 26 6e 62 73 70 3b 26 6e 62 |... &nb| 00000280 73 70 3b 26 6e 62 73 70 3b 26 6e 62 73 70 3b 3c |sp;  <| 00000290 2f 74 64 3e 0a 09 09 09 3c 74 64 20 73 74 79 6c |/td>....| 000002b0 50 61 63 6b 61 67 65 20 70 63 61 70 20 61 6c 6c |Package pcap all| 000002c0 6f 77 73 20 75 73 65 72 73 20 6f 66 20 67 6f 70 |ows users of gop| 000002d0 61 63 6b 65 74 20 74 6f 20 72 65 61 64 20 70 61 |acket to read pa| 000002e0 63 6b 65 74 73 20 6f 66 66 20 74 68 65 20 77 69 |ckets off the wi| 000002f0 72 65 20 6f 72 20 66 72 6f 6d 20 70 63 61 70 20 |re or from pcap | 00000300 66 69 6c 65 73 2e 3c 2f 74 64 3e 0a 09 09 09 3c |files.....<| 00000310 2f 74 72 3e 0a 09 09 0a 09 0a 09 09 0a 09 09 09 |/tr>............| 00000320 3c 74 72 3e 0a 09 09 09 3c 74 64 20 63 6c 61 73 |....pfrin| 00000350 67 3c 2f 61 3e 3c 2f 74 64 3e 0a 09 09 09 3c 74 |g....  &n| 00000370 62 73 70 3b 26 6e 62 73 70 3b 3c 2f 74 64 3e 0a |bsp; .| 00000380 09 09 09 3c 74 64 20 73 74 79 6c 65 3d 22 77 69 |...Packa| 000003a0 67 65 20 70 66 72 69 6e 67 20 77 72 61 70 73 20 |ge pfring wraps | 000003b0 74 68 65 20 50 46 5f 52 49 4e 47 20 43 20 6c 69 |the PF_RING C li| 000003c0 62 72 61 72 79 20 66 6f 72 20 47 6f 2e 3c 2f 74 |brary for Go..........| 000003e0 0a 09 3c 2f 74 61 62 6c 65 3e 0a 09 0a 0a |......| --- Layer 1 --- Loopback {Contents=[30, 0, 0, 0] Payload=[..1002..] Family=IPv6} 00000000 1e 00 00 00 |....| --- Layer 2 --- IPv6 {Contents=[..40..] Payload=[..962..] Version=6 TrafficClass=0 FlowLabel=100497 Length=962 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 00000000 60 01 88 91 03 c2 06 40 00 00 00 00 00 00 00 00 |`......@........| 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 01 |........| --- Layer 3 --- TCP {Contents=[..32..] Payload=[..930..] SrcPort=8080(http-alt) DstPort=58799 Seq=174470679 Ack=144119882 DataOffset=8 FIN=false SYN=false RST=false PSH=true ACK=true URG=false ECE=false CWR=false NS=false Window=8962 Checksum=970 Urgent=0 Options=[TCPOption(NOP:), TCPOption(NOP:), TCPOption(Timestamps:96505270/96505084 0x05c08db605c08cfc)] Padding=[]} 00000000 1f 90 e5 af 0a 66 36 17 08 97 18 4a 80 18 23 02 |.....f6....J..#.| 00000010 03 ca 00 00 01 01 08 0a 05 c0 8d b6 05 c0 8c fc |................| --- Layer 4 --- Payload 930 byte(s) 00000000 09 0a 09 09 3c 2f 64 69 76 3e 0a 09 0a 0a 09 0a |..........| 00000010 0a 0a 0a 0a 0a 0a 0a 09 0a 09 0a 09 09 3c 68 32 |.............Subdire| 00000040 63 74 6f 72 69 65 73 3c 2f 68 32 3e 0a 09 0a 09 |ctories

....| 00000050 3c 74 61 62 6c 65 20 63 6c 61 73 73 3d 22 64 69 |........Synopsis<| 000000d0 2f 74 68 3e 0a 09 3c 2f 74 72 3e 0a 09 0a 09 09 |/th>.......| 000000e0 3c 74 72 3e 0a 09 09 3c 74 64 3e 3c 61 20 68 72 |........| 00000110 09 09 0a 09 09 09 3c 74 72 3e 0a 09 09 09 3c 74 |..........<| 00000130 61 20 68 72 65 66 3d 22 6c 61 79 65 72 73 2f 22 |a href="layers/"| 00000140 3e 6c 61 79 65 72 73 3c 2f 61 3e 3c 2f 74 64 3e |>layers| 00000150 0a 09 09 09 3c 74 64 3e 26 6e 62 73 70 3b 26 6e |.................................| 000002c0 09 09 09 3c 2f 74 72 3e 0a 09 09 0a 09 0a 09 09 |...........| 000002d0 0a 09 09 09 3c 74 72 3e 0a 09 09 09 3c 74 64 20 |..........| 00000310 09 09 3c 74 64 3e 26 6e 62 73 70 3b 26 6e 62 73 |.......| 00000390 09 09 0a 09 0a 09 3c 2f 74 61 62 6c 65 3e 0a 09 |......
N| 00000070 61 6d 65 3c 2f 74 68 3e 0a 09 3c 74 68 3e 26 6e |ame&n| 00000080 62 73 70 3b 26 6e 62 73 70 3b 26 6e 62 73 70 3b |bsp;  | 00000090 26 6e 62 73 70 3b 3c 2f 74 68 3e 0a 09 3c 74 68 | 
.....
 &n| 00000160 62 73 70 3b 26 6e 62 73 70 3b 26 6e 62 73 70 3b |bsp;  | 00000170 3c 2f 74 64 3e 0a 09 09 09 3c 74 64 20 73 74 79 |Package layers | 000001a0 70 72 6f 76 69 64 65 73 20 64 65 63 6f 64 69 6e |provides decodin| 000001b0 67 20 6c 61 79 65 72 73 20 66 6f 72 20 6d 61 6e |g layers for man| 000001c0 79 20 63 6f 6d 6d 6f 6e 20 70 72 6f 74 6f 63 6f |y common protoco| 000001d0 6c 73 2e 3c 2f 74 64 3e 0a 09 09 09 3c 2f 74 72 |ls.pcap.... | 00000230 3b 26 6e 62 73 70 3b 26 6e 62 73 70 3b 26 6e 62 |;  &nb| 00000240 73 70 3b 3c 2f 74 64 3e 0a 09 09 09 3c 74 64 20 |sp;Package pcap| 00000270 20 61 6c 6c 6f 77 73 20 75 73 65 72 73 20 6f 66 | allows users of| 00000280 20 67 6f 70 61 63 6b 65 74 20 74 6f 20 72 65 61 | gopacket to rea| 00000290 64 20 70 61 63 6b 65 74 73 20 6f 66 66 20 74 68 |d packets off th| 000002a0 65 20 77 69 72 65 20 6f 72 20 66 72 6f 6d 20 70 |e wire or from p| 000002b0 63 61 70 20 66 69 6c 65 73 2e 3c 2f 74 64 3e 0a |cap files.
p| 00000300 66 72 69 6e 67 3c 2f 61 3e 3c 2f 74 64 3e 0a 09 |fring &nbs| 00000320 70 3b 26 6e 62 73 70 3b 26 6e 62 73 70 3b 3c 2f |p;  ....P| 00000350 61 63 6b 61 67 65 20 70 66 72 69 6e 67 20 77 72 |ackage pfring wr| 00000360 61 70 73 20 74 68 65 20 50 46 5f 52 49 4e 47 20 |aps the PF_RING | 00000370 43 20 6c 69 62 72 61 72 79 20 66 6f 72 20 47 6f |C library for Go| 00000380 2e 3c 2f 74 64 3e 0a 09 09 09 3c 2f 74 72 3e 0a |.
..| 000003a0 0a 0a |..| pcap_test.go:110: -- FULL PACKET DATA (76 bytes) ------------------------------------ 00000000 1e 00 00 00 60 00 00 00 00 20 06 40 00 00 00 00 |....`.... .@....| 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 01 e5 af 1f 90 |................| 00000030 08 97 18 4a 0a 65 76 ef 80 10 27 e9 00 28 00 00 |...J.ev...'..(..| 00000040 01 01 08 0a 05 c0 8d b6 05 c0 8d b6 |............| --- Layer 1 --- Loopback {Contents=[30, 0, 0, 0] Payload=[..72..] Family=IPv6} 00000000 1e 00 00 00 |....| --- Layer 2 --- IPv6 {Contents=[..40..] Payload=[..32..] Version=6 TrafficClass=0 FlowLabel=0 Length=32 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 00000000 60 00 00 00 00 20 06 40 00 00 00 00 00 00 00 00 |`.... .@........| 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 01 |........| --- Layer 3 --- TCP {Contents=[..32..] Payload=[] SrcPort=58799 DstPort=8080(http-alt) Seq=144119882 Ack=174421743 DataOffset=8 FIN=false SYN=false RST=false PSH=false ACK=true URG=false ECE=false CWR=false NS=false Window=10217 Checksum=40 Urgent=0 Options=[TCPOption(NOP:), TCPOption(NOP:), TCPOption(Timestamps:96505270/96505270 0x05c08db605c08db6)] Padding=[]} 00000000 e5 af 1f 90 08 97 18 4a 0a 65 76 ef 80 10 27 e9 |.......J.ev...'.| 00000010 00 28 00 00 01 01 08 0a 05 c0 8d b6 05 c0 8d b6 |.(..............| pcap_test.go:110: -- FULL PACKET DATA (848 bytes) ------------------------------------ 00000000 1e 00 00 00 60 01 88 91 03 24 06 40 00 00 00 00 |....`....$.@....| 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 00 00 00 00 01 1f 90 e5 af |................| 00000030 0a 66 39 b9 08 97 18 4a 80 18 23 02 03 2c 00 00 |.f9....J..#..,..| 00000040 01 01 08 0a 05 c0 8d b6 05 c0 8c fc 0d 0a 32 61 |..............2a| 00000050 0d 0a 0a 0a 3c 2f 64 69 76 3e 0a 0a 3c 64 69 76 |.......Bu| 00000070 69 6c 64 20 76 65 72 73 69 6f 6e 20 0d 0a 37 0d |ild version ..7.| 00000080 0a 67 6f 31 2e 30 2e 33 0d 0a 32 62 61 0d 0a 2e |.go1.0.3..2ba...| 00000090 3c 62 72 3e 0a 45 78 63 65 70 74 20 61 73 20 3c |
.Except as <| 000000a0 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 63 |a href="http://c| 000000b0 6f 64 65 2e 67 6f 6f 67 6c 65 2e 63 6f 6d 2f 70 |ode.google.com/p| 000000c0 6f 6c 69 63 69 65 73 2e 68 74 6d 6c 23 72 65 73 |olicies.html#res| 000000d0 74 72 69 63 74 69 6f 6e 73 22 3e 6e 6f 74 65 64 |trictions">noted| 000000e0 3c 2f 61 3e 2c 0a 74 68 65 20 63 6f 6e 74 65 6e |,.the conten| 000000f0 74 20 6f 66 20 74 68 69 73 20 70 61 67 65 20 69 |t of this page i| 00000100 73 20 6c 69 63 65 6e 73 65 64 20 75 6e 64 65 72 |s licensed under| 00000110 20 74 68 65 0a 43 72 65 61 74 69 76 65 20 43 6f | the.Creative Co| 00000120 6d 6d 6f 6e 73 20 41 74 74 72 69 62 75 74 69 6f |mmons Attributio| 00000130 6e 20 33 2e 30 20 4c 69 63 65 6e 73 65 2c 0a 61 |n 3.0 License,.a| 00000140 6e 64 20 63 6f 64 65 20 69 73 20 6c 69 63 65 6e |nd code is licen| 00000150 73 65 64 20 75 6e 64 65 72 20 61 20 3c 61 20 68 |sed under a B| 00000170 53 44 20 6c 69 63 65 6e 73 65 3c 2f 61 3e 2e 3c |SD license.<| 00000180 62 72 3e 0a 3c 61 20 68 72 65 66 3d 22 2f 64 6f |br>.Term| 000001a0 73 20 6f 66 20 53 65 72 76 69 63 65 3c 2f 61 3e |s of Service| 000001b0 20 7c 20 0a 3c 61 20 68 72 65 66 3d 22 68 74 74 | | .Pr| 000001f0 69 76 61 63 79 20 50 6f 6c 69 63 79 3c 2f 61 3e |ivacy Policy| 00000200 0a 3c 2f 64 69 76 3e 0a 0a 3c 2f 62 6f 64 79 3e |...| 00000210 0a 3c 73 63 72 69 70 74 20 74 79 70 65 3d 22 74 |..| 00000340 3c 2f 68 74 6d 6c 3e 0a 0a 0d 0a 30 0d 0a 0d 0a |....0....| --- Layer 1 --- Loopback {Contents=[30, 0, 0, 0] Payload=[..844..] Family=IPv6} 00000000 1e 00 00 00 |....| --- Layer 2 --- IPv6 {Contents=[..40..] Payload=[..804..] Version=6 TrafficClass=0 FlowLabel=100497 Length=804 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 00000000 60 01 88 91 03 24 06 40 00 00 00 00 00 00 00 00 |`....$.@........| 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 00000020 00 00 00 00 00 00 00 01 |........| --- Layer 3 --- TCP {Contents=[..32..] Payload=[..772..] SrcPort=8080(http-alt) DstPort=58799 Seq=174471609 Ack=144119882 DataOffset=8 FIN=false SYN=false RST=false PSH=true ACK=true URG=false ECE=false CWR=false NS=false Window=8962 Checksum=812 Urgent=0 Options=[TCPOption(NOP:), TCPOption(NOP:), TCPOption(Timestamps:96505270/96505084 0x05c08db605c08cfc)] Padding=[]} 00000000 1f 90 e5 af 0a 66 39 b9 08 97 18 4a 80 18 23 02 |.....f9....J..#.| 00000010 03 2c 00 00 01 01 08 0a 05 c0 8d b6 05 c0 8c fc |.,..............| --- Layer 4 --- Payload 772 byte(s) 00000000 0d 0a 32 61 0d 0a 0a 0a 3c 2f 64 69 76 3e 0a 0a |..2a......| 00000010 3c 64 69 76 20 69 64 3d 22 66 6f 6f 74 65 72 22 |...