0s autopkgtest [17:30:08]: starting date and time: 2024-03-14 17:30:08+0000 0s autopkgtest [17:30:08]: git checkout: b506e79c ssh-setup/nova: fix ARCH having two lines of data 0s autopkgtest [17:30:08]: host juju-7f2275-prod-proposed-migration-environment-3; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.fesgqny3/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:gopacket --apt-upgrade gopacket --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=gopacket/1.1.19-4build1 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-3@bos03-arm64-19.secgroup --name adt-noble-arm64-gopacket-20240314-173007-juju-7f2275-prod-proposed-migration-environment-3 --image adt/ubuntu-noble-arm64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-3 --net-id=net_prod-proposed-migration -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com'"'"'' --mirror=http://ftpmaster.internal/ubuntu/ 91s autopkgtest [17:31:39]: testbed dpkg architecture: arm64 92s autopkgtest [17:31:40]: testbed apt version: 2.7.12 92s autopkgtest [17:31:40]: @@@@@@@@@@@@@@@@@@@@ test bed setup 92s Get:1 http://ftpmaster.internal/ubuntu noble-proposed InRelease [117 kB] 93s Get:2 http://ftpmaster.internal/ubuntu noble-proposed/main Sources [456 kB] 93s Get:3 http://ftpmaster.internal/ubuntu noble-proposed/multiverse Sources [47.8 kB] 93s Get:4 http://ftpmaster.internal/ubuntu noble-proposed/universe Sources [2966 kB] 93s Get:5 http://ftpmaster.internal/ubuntu noble-proposed/restricted Sources [4812 B] 93s Get:6 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 Packages [611 kB] 93s Get:7 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 c-n-f Metadata [3144 B] 93s Get:8 http://ftpmaster.internal/ubuntu noble-proposed/restricted arm64 Packages [20.3 kB] 93s Get:9 http://ftpmaster.internal/ubuntu noble-proposed/restricted arm64 c-n-f Metadata [116 B] 93s Get:10 http://ftpmaster.internal/ubuntu noble-proposed/universe arm64 Packages [3338 kB] 93s Get:11 http://ftpmaster.internal/ubuntu noble-proposed/universe arm64 c-n-f Metadata [8528 B] 93s Get:12 http://ftpmaster.internal/ubuntu noble-proposed/multiverse arm64 Packages [43.3 kB] 93s Get:13 http://ftpmaster.internal/ubuntu noble-proposed/multiverse arm64 c-n-f Metadata [116 B] 95s Fetched 7616 kB in 2s (4046 kB/s) 95s Reading package lists... 99s Reading package lists... 99s Building dependency tree... 99s Reading state information... 100s Calculating upgrade... 100s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 101s Reading package lists... 101s Building dependency tree... 101s Reading state information... 102s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 103s Hit:1 http://ftpmaster.internal/ubuntu noble InRelease 103s Hit:2 http://ftpmaster.internal/ubuntu noble-updates InRelease 103s Hit:3 http://ftpmaster.internal/ubuntu noble-security InRelease 103s Hit:4 http://ftpmaster.internal/ubuntu noble-proposed InRelease 105s Reading package lists... 105s Reading package lists... 105s Building dependency tree... 105s Reading state information... 106s Calculating upgrade... 106s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 106s Reading package lists... 106s Building dependency tree... 106s Reading state information... 107s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 110s autopkgtest [17:31:58]: testbed running kernel: Linux 6.8.0-11-generic #11-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 14 02:53:31 UTC 2024 110s autopkgtest [17:31:58]: @@@@@@@@@@@@@@@@@@@@ apt-source gopacket 112s Get:1 http://ftpmaster.internal/ubuntu noble-proposed/universe gopacket 1.1.19-4build1 (dsc) [2179 B] 112s Get:2 http://ftpmaster.internal/ubuntu noble-proposed/universe gopacket 1.1.19-4build1 (tar) [951 kB] 112s Get:3 http://ftpmaster.internal/ubuntu noble-proposed/universe gopacket 1.1.19-4build1 (diff) [4148 B] 113s gpgv: Signature made Thu Mar 14 13:10:58 2024 UTC 113s gpgv: using RSA key 568BF22A66337CBFC9A6B9B72C83DBC8E9BD0E37 113s gpgv: Can't check signature: No public key 113s dpkg-source: warning: cannot verify inline signature for ./gopacket_1.1.19-4build1.dsc: no acceptable signature found 113s autopkgtest [17:32:01]: testing package gopacket version 1.1.19-4build1 113s autopkgtest [17:32:01]: build not needed 114s autopkgtest [17:32:02]: test dh-golang-autopkgtest: preparing testbed 115s Reading package lists... 116s Building dependency tree... 116s Reading state information... 116s Starting pkgProblemResolver with broken count: 0 116s Starting 2 pkgProblemResolver with broken count: 0 116s Done 117s The following additional packages will be installed: 117s autoconf automake autopoint autotools-dev build-essential cpp cpp-13 117s cpp-13-aarch64-linux-gnu cpp-aarch64-linux-gnu debhelper debugedit 117s dh-autoreconf dh-golang dh-strip-nondeterminism dwz g++ g++-13 117s g++-13-aarch64-linux-gnu g++-aarch64-linux-gnu gcc gcc-13 117s gcc-13-aarch64-linux-gnu gcc-aarch64-linux-gnu gettext golang-1.22-go 117s golang-1.22-src golang-github-google-gopacket-dev golang-go 117s golang-golang-x-crypto-dev golang-golang-x-net-dev golang-golang-x-sys-dev 117s golang-golang-x-term-dev golang-golang-x-text-dev golang-src intltool-debian 117s libarchive-zip-perl libasan8 libatomic1 libc-dev-bin libc6-dev libcc1-0 117s libcrypt-dev libdbus-1-dev libdebhelper-perl libdw1 117s libfile-stripnondeterminism-perl libgcc-13-dev libgomp1 libhwasan0 libisl23 117s libitm1 liblsan0 libmpc3 libnsl-dev libpcap0.8-dev libpkgconf3 117s libstdc++-13-dev libsub-override-perl libtirpc-dev libtool libtsan2 117s libubsan1 linux-libc-dev m4 pkgconf pkgconf-bin po-debconf rpcsvc-proto 117s sgml-base xml-core 117s Suggested packages: 117s autoconf-archive gnu-standards autoconf-doc cpp-doc gcc-13-locales 117s cpp-13-doc dh-make gcc-13-doc gcc-multilib manpages-dev flex bison gdb 117s gcc-doc gdb-aarch64-linux-gnu gettext-doc libasprintf-dev libgettextpo-dev 117s bzr | brz git mercurial subversion glibc-doc libstdc++-13-doc libtool-doc 117s gfortran | fortran95-compiler gcj-jdk m4-doc libmail-box-perl sgml-base-doc 117s Recommended packages: 117s manpages manpages-dev libc-devtools libarchive-cpio-perl libltdl-dev 117s libmail-sendmail-perl 117s The following NEW packages will be installed: 117s autoconf automake autopkgtest-satdep autopoint autotools-dev build-essential 117s cpp cpp-13 cpp-13-aarch64-linux-gnu cpp-aarch64-linux-gnu debhelper 117s debugedit dh-autoreconf dh-golang dh-strip-nondeterminism dwz g++ g++-13 117s g++-13-aarch64-linux-gnu g++-aarch64-linux-gnu gcc gcc-13 117s gcc-13-aarch64-linux-gnu gcc-aarch64-linux-gnu gettext golang-1.22-go 117s golang-1.22-src golang-github-google-gopacket-dev golang-go 117s golang-golang-x-crypto-dev golang-golang-x-net-dev golang-golang-x-sys-dev 117s golang-golang-x-term-dev golang-golang-x-text-dev golang-src intltool-debian 117s libarchive-zip-perl libasan8 libatomic1 libc-dev-bin libc6-dev libcc1-0 117s libcrypt-dev libdbus-1-dev libdebhelper-perl libdw1 117s libfile-stripnondeterminism-perl libgcc-13-dev libgomp1 libhwasan0 libisl23 117s libitm1 liblsan0 libmpc3 libnsl-dev libpcap0.8-dev libpkgconf3 117s libstdc++-13-dev libsub-override-perl libtirpc-dev libtool libtsan2 117s libubsan1 linux-libc-dev m4 pkgconf pkgconf-bin po-debconf rpcsvc-proto 117s sgml-base xml-core 117s 0 upgraded, 71 newly installed, 0 to remove and 0 not upgraded. 117s Need to get 118 MB/118 MB of archives. 117s After this operation, 527 MB of additional disk space will be used. 117s Get:1 /tmp/autopkgtest.qk0xqw/1-autopkgtest-satdep.deb autopkgtest-satdep arm64 0 [804 B] 117s Get:2 http://ftpmaster.internal/ubuntu noble/main arm64 sgml-base all 1.31 [11.4 kB] 117s Get:3 http://ftpmaster.internal/ubuntu noble/main arm64 m4 arm64 1.4.19-4 [240 kB] 118s Get:4 http://ftpmaster.internal/ubuntu noble/main arm64 autoconf all 2.71-3 [339 kB] 118s Get:5 http://ftpmaster.internal/ubuntu noble/main arm64 autotools-dev all 20220109.1 [44.9 kB] 118s Get:6 http://ftpmaster.internal/ubuntu noble/main arm64 automake all 1:1.16.5-1.3ubuntu1 [558 kB] 118s Get:7 http://ftpmaster.internal/ubuntu noble/main arm64 autopoint all 0.21-14ubuntu1 [422 kB] 118s Get:8 http://ftpmaster.internal/ubuntu noble/main arm64 libc-dev-bin arm64 2.39-0ubuntu2 [19.7 kB] 118s Get:9 http://ftpmaster.internal/ubuntu noble/main arm64 linux-libc-dev arm64 6.8.0-11.11 [1569 kB] 118s Get:10 http://ftpmaster.internal/ubuntu noble/main arm64 libcrypt-dev arm64 1:4.4.36-4 [136 kB] 118s Get:11 http://ftpmaster.internal/ubuntu noble/main arm64 libtirpc-dev arm64 1.3.4+ds-1build1 [232 kB] 118s Get:12 http://ftpmaster.internal/ubuntu noble/main arm64 libnsl-dev arm64 1.3.0-3 [71.9 kB] 118s Get:13 http://ftpmaster.internal/ubuntu noble/main arm64 rpcsvc-proto arm64 1.4.2-0ubuntu6 [65.4 kB] 118s Get:14 http://ftpmaster.internal/ubuntu noble/main arm64 libc6-dev arm64 2.39-0ubuntu2 [1596 kB] 118s Get:15 http://ftpmaster.internal/ubuntu noble/main arm64 libisl23 arm64 0.26-3 [713 kB] 118s Get:16 http://ftpmaster.internal/ubuntu noble/main arm64 libmpc3 arm64 1.3.1-1 [55.3 kB] 118s Get:17 http://ftpmaster.internal/ubuntu noble/main arm64 cpp-13-aarch64-linux-gnu arm64 13.2.0-17ubuntu2 [10.3 MB] 118s Get:18 http://ftpmaster.internal/ubuntu noble/main arm64 cpp-13 arm64 13.2.0-17ubuntu2 [1028 B] 118s Get:19 http://ftpmaster.internal/ubuntu noble/main arm64 cpp-aarch64-linux-gnu arm64 4:13.2.0-7ubuntu1 [5316 B] 118s Get:20 http://ftpmaster.internal/ubuntu noble/main arm64 cpp arm64 4:13.2.0-7ubuntu1 [22.4 kB] 118s Get:21 http://ftpmaster.internal/ubuntu noble/main arm64 libcc1-0 arm64 14-20240303-1ubuntu1 [44.7 kB] 118s Get:22 http://ftpmaster.internal/ubuntu noble/main arm64 libgomp1 arm64 14-20240303-1ubuntu1 [144 kB] 118s Get:23 http://ftpmaster.internal/ubuntu noble/main arm64 libitm1 arm64 14-20240303-1ubuntu1 [27.7 kB] 118s Get:24 http://ftpmaster.internal/ubuntu noble/main arm64 libatomic1 arm64 14-20240303-1ubuntu1 [11.4 kB] 118s Get:25 http://ftpmaster.internal/ubuntu noble/main arm64 libasan8 arm64 14-20240303-1ubuntu1 [2919 kB] 118s Get:26 http://ftpmaster.internal/ubuntu noble/main arm64 liblsan0 arm64 14-20240303-1ubuntu1 [1282 kB] 118s Get:27 http://ftpmaster.internal/ubuntu noble/main arm64 libtsan2 arm64 14-20240303-1ubuntu1 [2687 kB] 118s Get:28 http://ftpmaster.internal/ubuntu noble/main arm64 libubsan1 arm64 14-20240303-1ubuntu1 [1151 kB] 118s Get:29 http://ftpmaster.internal/ubuntu noble/main arm64 libhwasan0 arm64 14-20240303-1ubuntu1 [1597 kB] 118s Get:30 http://ftpmaster.internal/ubuntu noble/main arm64 libgcc-13-dev arm64 13.2.0-17ubuntu2 [2464 kB] 118s Get:31 http://ftpmaster.internal/ubuntu noble/main arm64 gcc-13-aarch64-linux-gnu arm64 13.2.0-17ubuntu2 [20.1 MB] 119s Get:32 http://ftpmaster.internal/ubuntu noble/main arm64 gcc-13 arm64 13.2.0-17ubuntu2 [467 kB] 119s Get:33 http://ftpmaster.internal/ubuntu noble/main arm64 gcc-aarch64-linux-gnu arm64 4:13.2.0-7ubuntu1 [1198 B] 119s Get:34 http://ftpmaster.internal/ubuntu noble/main arm64 gcc arm64 4:13.2.0-7ubuntu1 [5018 B] 119s Get:35 http://ftpmaster.internal/ubuntu noble/main arm64 libstdc++-13-dev arm64 13.2.0-17ubuntu2 [2322 kB] 119s Get:36 http://ftpmaster.internal/ubuntu noble/main arm64 g++-13-aarch64-linux-gnu arm64 13.2.0-17ubuntu2 [11.7 MB] 119s Get:37 http://ftpmaster.internal/ubuntu noble/main arm64 g++-13 arm64 13.2.0-17ubuntu2 [14.4 kB] 119s Get:38 http://ftpmaster.internal/ubuntu noble/main arm64 g++-aarch64-linux-gnu arm64 4:13.2.0-7ubuntu1 [962 B] 119s Get:39 http://ftpmaster.internal/ubuntu noble/main arm64 g++ arm64 4:13.2.0-7ubuntu1 [1082 B] 119s Get:40 http://ftpmaster.internal/ubuntu noble/main arm64 build-essential arm64 12.10ubuntu1 [4932 B] 119s Get:41 http://ftpmaster.internal/ubuntu noble/main arm64 libdebhelper-perl all 13.14.1ubuntu1 [89.5 kB] 119s Get:42 http://ftpmaster.internal/ubuntu noble/main arm64 libtool all 2.4.7-7 [166 kB] 119s Get:43 http://ftpmaster.internal/ubuntu noble/main arm64 dh-autoreconf all 20 [16.1 kB] 119s Get:44 http://ftpmaster.internal/ubuntu noble/main arm64 libarchive-zip-perl all 1.68-1 [90.2 kB] 119s Get:45 http://ftpmaster.internal/ubuntu noble/main arm64 libsub-override-perl all 0.10-1 [10.0 kB] 119s Get:46 http://ftpmaster.internal/ubuntu noble/main arm64 libfile-stripnondeterminism-perl all 1.13.1-1 [18.1 kB] 119s Get:47 http://ftpmaster.internal/ubuntu noble/main arm64 dh-strip-nondeterminism all 1.13.1-1 [5362 B] 119s Get:48 http://ftpmaster.internal/ubuntu noble/main arm64 libdw1 arm64 0.190-1 [254 kB] 119s Get:49 http://ftpmaster.internal/ubuntu noble/main arm64 debugedit arm64 1:5.0-5 [45.9 kB] 119s Get:50 http://ftpmaster.internal/ubuntu noble/main arm64 dwz arm64 0.15-1 [110 kB] 119s Get:51 http://ftpmaster.internal/ubuntu noble/main arm64 gettext arm64 0.21-14ubuntu1 [846 kB] 119s Get:52 http://ftpmaster.internal/ubuntu noble/main arm64 intltool-debian all 0.35.0+20060710.6 [23.2 kB] 119s Get:53 http://ftpmaster.internal/ubuntu noble/main arm64 po-debconf all 1.0.21+nmu1 [233 kB] 119s Get:54 http://ftpmaster.internal/ubuntu noble/main arm64 debhelper all 13.14.1ubuntu1 [869 kB] 119s Get:55 http://ftpmaster.internal/ubuntu noble/main arm64 golang-1.22-src all 1.22.1-1 [19.7 MB] 120s Get:56 http://ftpmaster.internal/ubuntu noble/main arm64 golang-1.22-go arm64 1.22.1-1 [23.6 MB] 120s Get:57 http://ftpmaster.internal/ubuntu noble/universe arm64 golang-golang-x-sys-dev all 0.17.0-1 [424 kB] 120s Get:58 http://ftpmaster.internal/ubuntu noble/universe arm64 golang-golang-x-term-dev all 0.17.0-1 [14.7 kB] 120s Get:59 http://ftpmaster.internal/ubuntu noble/universe arm64 golang-golang-x-text-dev all 0.14.0-1 [4646 kB] 120s Get:60 http://ftpmaster.internal/ubuntu noble/universe arm64 golang-golang-x-crypto-dev all 1:0.19.0-1 [1712 kB] 121s Get:61 http://ftpmaster.internal/ubuntu noble/universe arm64 golang-golang-x-net-dev all 1:0.21.0+dfsg-1 [918 kB] 121s Get:62 http://ftpmaster.internal/ubuntu noble/main arm64 libpkgconf3 arm64 1.8.1-2 [31.2 kB] 121s Get:63 http://ftpmaster.internal/ubuntu noble/main arm64 pkgconf-bin arm64 1.8.1-2 [20.4 kB] 121s Get:64 http://ftpmaster.internal/ubuntu noble/main arm64 pkgconf arm64 1.8.1-2 [16.7 kB] 121s Get:65 http://ftpmaster.internal/ubuntu noble/main arm64 xml-core all 0.19 [20.3 kB] 121s Get:66 http://ftpmaster.internal/ubuntu noble/main arm64 libdbus-1-dev arm64 1.14.10-4ubuntu1 [200 kB] 121s Get:67 http://ftpmaster.internal/ubuntu noble/main arm64 libpcap0.8-dev arm64 1.10.4-4ubuntu3 [265 kB] 121s Get:68 http://ftpmaster.internal/ubuntu noble-proposed/universe arm64 golang-github-google-gopacket-dev all 1.1.19-4build1 [667 kB] 121s Get:69 http://ftpmaster.internal/ubuntu noble/main arm64 golang-src all 2:1.22~2 [4992 B] 121s Get:70 http://ftpmaster.internal/ubuntu noble/main arm64 golang-go arm64 2:1.22~2 [43.9 kB] 121s Get:71 http://ftpmaster.internal/ubuntu noble/main arm64 dh-golang all 1.62 [25.2 kB] 122s Fetched 118 MB in 4s (33.4 MB/s) 122s Selecting previously unselected package sgml-base. 122s (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 ... 74758 files and directories currently installed.) 122s Preparing to unpack .../00-sgml-base_1.31_all.deb ... 122s Unpacking sgml-base (1.31) ... 122s Selecting previously unselected package m4. 122s Preparing to unpack .../01-m4_1.4.19-4_arm64.deb ... 122s Unpacking m4 (1.4.19-4) ... 122s Selecting previously unselected package autoconf. 122s Preparing to unpack .../02-autoconf_2.71-3_all.deb ... 122s Unpacking autoconf (2.71-3) ... 122s Selecting previously unselected package autotools-dev. 122s Preparing to unpack .../03-autotools-dev_20220109.1_all.deb ... 122s Unpacking autotools-dev (20220109.1) ... 122s Selecting previously unselected package automake. 122s Preparing to unpack .../04-automake_1%3a1.16.5-1.3ubuntu1_all.deb ... 122s Unpacking automake (1:1.16.5-1.3ubuntu1) ... 122s Selecting previously unselected package autopoint. 122s Preparing to unpack .../05-autopoint_0.21-14ubuntu1_all.deb ... 122s Unpacking autopoint (0.21-14ubuntu1) ... 122s Selecting previously unselected package libc-dev-bin. 123s Preparing to unpack .../06-libc-dev-bin_2.39-0ubuntu2_arm64.deb ... 123s Unpacking libc-dev-bin (2.39-0ubuntu2) ... 123s Selecting previously unselected package linux-libc-dev:arm64. 123s Preparing to unpack .../07-linux-libc-dev_6.8.0-11.11_arm64.deb ... 123s Unpacking linux-libc-dev:arm64 (6.8.0-11.11) ... 123s Selecting previously unselected package libcrypt-dev:arm64. 123s Preparing to unpack .../08-libcrypt-dev_1%3a4.4.36-4_arm64.deb ... 123s Unpacking libcrypt-dev:arm64 (1:4.4.36-4) ... 123s Selecting previously unselected package libtirpc-dev:arm64. 123s Preparing to unpack .../09-libtirpc-dev_1.3.4+ds-1build1_arm64.deb ... 123s Unpacking libtirpc-dev:arm64 (1.3.4+ds-1build1) ... 123s Selecting previously unselected package libnsl-dev:arm64. 123s Preparing to unpack .../10-libnsl-dev_1.3.0-3_arm64.deb ... 123s Unpacking libnsl-dev:arm64 (1.3.0-3) ... 123s Selecting previously unselected package rpcsvc-proto. 123s Preparing to unpack .../11-rpcsvc-proto_1.4.2-0ubuntu6_arm64.deb ... 123s Unpacking rpcsvc-proto (1.4.2-0ubuntu6) ... 123s Selecting previously unselected package libc6-dev:arm64. 123s Preparing to unpack .../12-libc6-dev_2.39-0ubuntu2_arm64.deb ... 123s Unpacking libc6-dev:arm64 (2.39-0ubuntu2) ... 123s Selecting previously unselected package libisl23:arm64. 123s Preparing to unpack .../13-libisl23_0.26-3_arm64.deb ... 123s Unpacking libisl23:arm64 (0.26-3) ... 123s Selecting previously unselected package libmpc3:arm64. 123s Preparing to unpack .../14-libmpc3_1.3.1-1_arm64.deb ... 123s Unpacking libmpc3:arm64 (1.3.1-1) ... 123s Selecting previously unselected package cpp-13-aarch64-linux-gnu. 123s Preparing to unpack .../15-cpp-13-aarch64-linux-gnu_13.2.0-17ubuntu2_arm64.deb ... 123s Unpacking cpp-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 123s Selecting previously unselected package cpp-13. 123s Preparing to unpack .../16-cpp-13_13.2.0-17ubuntu2_arm64.deb ... 123s Unpacking cpp-13 (13.2.0-17ubuntu2) ... 123s Selecting previously unselected package cpp-aarch64-linux-gnu. 124s Preparing to unpack .../17-cpp-aarch64-linux-gnu_4%3a13.2.0-7ubuntu1_arm64.deb ... 124s Unpacking cpp-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 124s Selecting previously unselected package cpp. 124s Preparing to unpack .../18-cpp_4%3a13.2.0-7ubuntu1_arm64.deb ... 124s Unpacking cpp (4:13.2.0-7ubuntu1) ... 124s Selecting previously unselected package libcc1-0:arm64. 124s Preparing to unpack .../19-libcc1-0_14-20240303-1ubuntu1_arm64.deb ... 124s Unpacking libcc1-0:arm64 (14-20240303-1ubuntu1) ... 124s Selecting previously unselected package libgomp1:arm64. 124s Preparing to unpack .../20-libgomp1_14-20240303-1ubuntu1_arm64.deb ... 124s Unpacking libgomp1:arm64 (14-20240303-1ubuntu1) ... 124s Selecting previously unselected package libitm1:arm64. 124s Preparing to unpack .../21-libitm1_14-20240303-1ubuntu1_arm64.deb ... 124s Unpacking libitm1:arm64 (14-20240303-1ubuntu1) ... 124s Selecting previously unselected package libatomic1:arm64. 124s Preparing to unpack .../22-libatomic1_14-20240303-1ubuntu1_arm64.deb ... 124s Unpacking libatomic1:arm64 (14-20240303-1ubuntu1) ... 124s Selecting previously unselected package libasan8:arm64. 124s Preparing to unpack .../23-libasan8_14-20240303-1ubuntu1_arm64.deb ... 124s Unpacking libasan8:arm64 (14-20240303-1ubuntu1) ... 124s Selecting previously unselected package liblsan0:arm64. 124s Preparing to unpack .../24-liblsan0_14-20240303-1ubuntu1_arm64.deb ... 124s Unpacking liblsan0:arm64 (14-20240303-1ubuntu1) ... 124s Selecting previously unselected package libtsan2:arm64. 124s Preparing to unpack .../25-libtsan2_14-20240303-1ubuntu1_arm64.deb ... 124s Unpacking libtsan2:arm64 (14-20240303-1ubuntu1) ... 124s Selecting previously unselected package libubsan1:arm64. 124s Preparing to unpack .../26-libubsan1_14-20240303-1ubuntu1_arm64.deb ... 124s Unpacking libubsan1:arm64 (14-20240303-1ubuntu1) ... 124s Selecting previously unselected package libhwasan0:arm64. 124s Preparing to unpack .../27-libhwasan0_14-20240303-1ubuntu1_arm64.deb ... 124s Unpacking libhwasan0:arm64 (14-20240303-1ubuntu1) ... 124s Selecting previously unselected package libgcc-13-dev:arm64. 124s Preparing to unpack .../28-libgcc-13-dev_13.2.0-17ubuntu2_arm64.deb ... 124s Unpacking libgcc-13-dev:arm64 (13.2.0-17ubuntu2) ... 124s Selecting previously unselected package gcc-13-aarch64-linux-gnu. 124s Preparing to unpack .../29-gcc-13-aarch64-linux-gnu_13.2.0-17ubuntu2_arm64.deb ... 124s Unpacking gcc-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 125s Selecting previously unselected package gcc-13. 125s Preparing to unpack .../30-gcc-13_13.2.0-17ubuntu2_arm64.deb ... 125s Unpacking gcc-13 (13.2.0-17ubuntu2) ... 125s Selecting previously unselected package gcc-aarch64-linux-gnu. 125s Preparing to unpack .../31-gcc-aarch64-linux-gnu_4%3a13.2.0-7ubuntu1_arm64.deb ... 125s Unpacking gcc-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 125s Selecting previously unselected package gcc. 125s Preparing to unpack .../32-gcc_4%3a13.2.0-7ubuntu1_arm64.deb ... 125s Unpacking gcc (4:13.2.0-7ubuntu1) ... 125s Selecting previously unselected package libstdc++-13-dev:arm64. 125s Preparing to unpack .../33-libstdc++-13-dev_13.2.0-17ubuntu2_arm64.deb ... 125s Unpacking libstdc++-13-dev:arm64 (13.2.0-17ubuntu2) ... 125s Selecting previously unselected package g++-13-aarch64-linux-gnu. 125s Preparing to unpack .../34-g++-13-aarch64-linux-gnu_13.2.0-17ubuntu2_arm64.deb ... 125s Unpacking g++-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 126s Selecting previously unselected package g++-13. 126s Preparing to unpack .../35-g++-13_13.2.0-17ubuntu2_arm64.deb ... 126s Unpacking g++-13 (13.2.0-17ubuntu2) ... 126s Selecting previously unselected package g++-aarch64-linux-gnu. 126s Preparing to unpack .../36-g++-aarch64-linux-gnu_4%3a13.2.0-7ubuntu1_arm64.deb ... 126s Unpacking g++-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 126s Selecting previously unselected package g++. 126s Preparing to unpack .../37-g++_4%3a13.2.0-7ubuntu1_arm64.deb ... 126s Unpacking g++ (4:13.2.0-7ubuntu1) ... 126s Selecting previously unselected package build-essential. 126s Preparing to unpack .../38-build-essential_12.10ubuntu1_arm64.deb ... 126s Unpacking build-essential (12.10ubuntu1) ... 126s Selecting previously unselected package libdebhelper-perl. 126s Preparing to unpack .../39-libdebhelper-perl_13.14.1ubuntu1_all.deb ... 126s Unpacking libdebhelper-perl (13.14.1ubuntu1) ... 126s Selecting previously unselected package libtool. 126s Preparing to unpack .../40-libtool_2.4.7-7_all.deb ... 126s Unpacking libtool (2.4.7-7) ... 126s Selecting previously unselected package dh-autoreconf. 126s Preparing to unpack .../41-dh-autoreconf_20_all.deb ... 126s Unpacking dh-autoreconf (20) ... 126s Selecting previously unselected package libarchive-zip-perl. 126s Preparing to unpack .../42-libarchive-zip-perl_1.68-1_all.deb ... 126s Unpacking libarchive-zip-perl (1.68-1) ... 126s Selecting previously unselected package libsub-override-perl. 126s Preparing to unpack .../43-libsub-override-perl_0.10-1_all.deb ... 126s Unpacking libsub-override-perl (0.10-1) ... 126s Selecting previously unselected package libfile-stripnondeterminism-perl. 126s Preparing to unpack .../44-libfile-stripnondeterminism-perl_1.13.1-1_all.deb ... 126s Unpacking libfile-stripnondeterminism-perl (1.13.1-1) ... 126s Selecting previously unselected package dh-strip-nondeterminism. 126s Preparing to unpack .../45-dh-strip-nondeterminism_1.13.1-1_all.deb ... 126s Unpacking dh-strip-nondeterminism (1.13.1-1) ... 126s Selecting previously unselected package libdw1:arm64. 126s Preparing to unpack .../46-libdw1_0.190-1_arm64.deb ... 126s Unpacking libdw1:arm64 (0.190-1) ... 126s Selecting previously unselected package debugedit. 126s Preparing to unpack .../47-debugedit_1%3a5.0-5_arm64.deb ... 126s Unpacking debugedit (1:5.0-5) ... 126s Selecting previously unselected package dwz. 126s Preparing to unpack .../48-dwz_0.15-1_arm64.deb ... 126s Unpacking dwz (0.15-1) ... 126s Selecting previously unselected package gettext. 126s Preparing to unpack .../49-gettext_0.21-14ubuntu1_arm64.deb ... 126s Unpacking gettext (0.21-14ubuntu1) ... 126s Selecting previously unselected package intltool-debian. 126s Preparing to unpack .../50-intltool-debian_0.35.0+20060710.6_all.deb ... 126s Unpacking intltool-debian (0.35.0+20060710.6) ... 126s Selecting previously unselected package po-debconf. 126s Preparing to unpack .../51-po-debconf_1.0.21+nmu1_all.deb ... 126s Unpacking po-debconf (1.0.21+nmu1) ... 126s Selecting previously unselected package debhelper. 127s Preparing to unpack .../52-debhelper_13.14.1ubuntu1_all.deb ... 127s Unpacking debhelper (13.14.1ubuntu1) ... 127s Selecting previously unselected package golang-1.22-src. 127s Preparing to unpack .../53-golang-1.22-src_1.22.1-1_all.deb ... 127s Unpacking golang-1.22-src (1.22.1-1) ... 128s Selecting previously unselected package golang-1.22-go. 128s Preparing to unpack .../54-golang-1.22-go_1.22.1-1_arm64.deb ... 128s Unpacking golang-1.22-go (1.22.1-1) ... 129s Selecting previously unselected package golang-golang-x-sys-dev. 129s Preparing to unpack .../55-golang-golang-x-sys-dev_0.17.0-1_all.deb ... 129s Unpacking golang-golang-x-sys-dev (0.17.0-1) ... 129s Selecting previously unselected package golang-golang-x-term-dev. 129s Preparing to unpack .../56-golang-golang-x-term-dev_0.17.0-1_all.deb ... 129s Unpacking golang-golang-x-term-dev (0.17.0-1) ... 129s Selecting previously unselected package golang-golang-x-text-dev. 129s Preparing to unpack .../57-golang-golang-x-text-dev_0.14.0-1_all.deb ... 129s Unpacking golang-golang-x-text-dev (0.14.0-1) ... 129s Selecting previously unselected package golang-golang-x-crypto-dev. 130s Preparing to unpack .../58-golang-golang-x-crypto-dev_1%3a0.19.0-1_all.deb ... 130s Unpacking golang-golang-x-crypto-dev (1:0.19.0-1) ... 130s Selecting previously unselected package golang-golang-x-net-dev. 130s Preparing to unpack .../59-golang-golang-x-net-dev_1%3a0.21.0+dfsg-1_all.deb ... 130s Unpacking golang-golang-x-net-dev (1:0.21.0+dfsg-1) ... 130s Selecting previously unselected package libpkgconf3:arm64. 130s Preparing to unpack .../60-libpkgconf3_1.8.1-2_arm64.deb ... 130s Unpacking libpkgconf3:arm64 (1.8.1-2) ... 130s Selecting previously unselected package pkgconf-bin. 130s Preparing to unpack .../61-pkgconf-bin_1.8.1-2_arm64.deb ... 130s Unpacking pkgconf-bin (1.8.1-2) ... 130s Selecting previously unselected package pkgconf:arm64. 130s Preparing to unpack .../62-pkgconf_1.8.1-2_arm64.deb ... 130s Unpacking pkgconf:arm64 (1.8.1-2) ... 130s Selecting previously unselected package xml-core. 130s Preparing to unpack .../63-xml-core_0.19_all.deb ... 130s Unpacking xml-core (0.19) ... 130s Selecting previously unselected package libdbus-1-dev:arm64. 130s Preparing to unpack .../64-libdbus-1-dev_1.14.10-4ubuntu1_arm64.deb ... 130s Unpacking libdbus-1-dev:arm64 (1.14.10-4ubuntu1) ... 130s Selecting previously unselected package libpcap0.8-dev:arm64. 130s Preparing to unpack .../65-libpcap0.8-dev_1.10.4-4ubuntu3_arm64.deb ... 130s Unpacking libpcap0.8-dev:arm64 (1.10.4-4ubuntu3) ... 130s Selecting previously unselected package golang-github-google-gopacket-dev. 130s Preparing to unpack .../66-golang-github-google-gopacket-dev_1.1.19-4build1_all.deb ... 130s Unpacking golang-github-google-gopacket-dev (1.1.19-4build1) ... 131s Selecting previously unselected package golang-src. 131s Preparing to unpack .../67-golang-src_2%3a1.22~2_all.deb ... 131s Unpacking golang-src (2:1.22~2) ... 131s Selecting previously unselected package golang-go:arm64. 131s Preparing to unpack .../68-golang-go_2%3a1.22~2_arm64.deb ... 131s Unpacking golang-go:arm64 (2:1.22~2) ... 131s Selecting previously unselected package dh-golang. 131s Preparing to unpack .../69-dh-golang_1.62_all.deb ... 131s Unpacking dh-golang (1.62) ... 131s Selecting previously unselected package autopkgtest-satdep. 131s Preparing to unpack .../70-1-autopkgtest-satdep.deb ... 131s Unpacking autopkgtest-satdep (0) ... 131s Setting up libdw1:arm64 (0.190-1) ... 131s Setting up libarchive-zip-perl (1.68-1) ... 131s Setting up libdebhelper-perl (13.14.1ubuntu1) ... 131s Setting up golang-golang-x-sys-dev (0.17.0-1) ... 131s Setting up linux-libc-dev:arm64 (6.8.0-11.11) ... 131s Setting up m4 (1.4.19-4) ... 131s Setting up golang-golang-x-term-dev (0.17.0-1) ... 131s Setting up libgomp1:arm64 (14-20240303-1ubuntu1) ... 131s Setting up autotools-dev (20220109.1) ... 131s Setting up libtirpc-dev:arm64 (1.3.4+ds-1build1) ... 131s Setting up libpkgconf3:arm64 (1.8.1-2) ... 131s Setting up rpcsvc-proto (1.4.2-0ubuntu6) ... 131s Setting up golang-1.22-src (1.22.1-1) ... 131s Setting up libmpc3:arm64 (1.3.1-1) ... 131s Setting up libatomic1:arm64 (14-20240303-1ubuntu1) ... 131s Setting up autopoint (0.21-14ubuntu1) ... 131s Setting up pkgconf-bin (1.8.1-2) ... 131s Setting up autoconf (2.71-3) ... 131s Setting up libubsan1:arm64 (14-20240303-1ubuntu1) ... 131s Setting up dwz (0.15-1) ... 131s Setting up libnsl-dev:arm64 (1.3.0-3) ... 131s Setting up golang-golang-x-text-dev (0.14.0-1) ... 131s Setting up libhwasan0:arm64 (14-20240303-1ubuntu1) ... 131s Setting up libcrypt-dev:arm64 (1:4.4.36-4) ... 131s Setting up libasan8:arm64 (14-20240303-1ubuntu1) ... 131s Setting up debugedit (1:5.0-5) ... 131s Setting up libsub-override-perl (0.10-1) ... 131s Setting up sgml-base (1.31) ... 131s Setting up golang-golang-x-crypto-dev (1:0.19.0-1) ... 131s Setting up libtsan2:arm64 (14-20240303-1ubuntu1) ... 131s Setting up libisl23:arm64 (0.26-3) ... 131s Setting up libc-dev-bin (2.39-0ubuntu2) ... 131s Setting up golang-src (2:1.22~2) ... 131s Setting up libcc1-0:arm64 (14-20240303-1ubuntu1) ... 131s Setting up liblsan0:arm64 (14-20240303-1ubuntu1) ... 131s Setting up libitm1:arm64 (14-20240303-1ubuntu1) ... 131s Setting up automake (1:1.16.5-1.3ubuntu1) ... 131s update-alternatives: using /usr/bin/automake-1.16 to provide /usr/bin/automake (automake) in auto mode 131s Setting up libfile-stripnondeterminism-perl (1.13.1-1) ... 131s Setting up gettext (0.21-14ubuntu1) ... 131s Setting up cpp-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 131s Setting up golang-1.22-go (1.22.1-1) ... 131s Setting up pkgconf:arm64 (1.8.1-2) ... 131s Setting up intltool-debian (0.35.0+20060710.6) ... 131s Setting up cpp-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 131s Setting up golang-golang-x-net-dev (1:0.21.0+dfsg-1) ... 131s Setting up dh-strip-nondeterminism (1.13.1-1) ... 131s Setting up libgcc-13-dev:arm64 (13.2.0-17ubuntu2) ... 131s Setting up xml-core (0.19) ... 131s Setting up libc6-dev:arm64 (2.39-0ubuntu2) ... 131s Setting up libstdc++-13-dev:arm64 (13.2.0-17ubuntu2) ... 131s Setting up cpp-13 (13.2.0-17ubuntu2) ... 131s Setting up golang-go:arm64 (2:1.22~2) ... 131s Setting up po-debconf (1.0.21+nmu1) ... 131s Setting up gcc-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 131s Setting up gcc-13 (13.2.0-17ubuntu2) ... 131s Setting up cpp (4:13.2.0-7ubuntu1) ... 131s Setting up g++-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 131s Setting up gcc-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 131s Setting up g++-13 (13.2.0-17ubuntu2) ... 131s Setting up libtool (2.4.7-7) ... 131s Setting up gcc (4:13.2.0-7ubuntu1) ... 131s Setting up dh-autoreconf (20) ... 131s Setting up g++-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 131s Setting up debhelper (13.14.1ubuntu1) ... 131s Setting up g++ (4:13.2.0-7ubuntu1) ... 131s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 131s Setting up build-essential (12.10ubuntu1) ... 131s Setting up dh-golang (1.62) ... 131s Processing triggers for libc-bin (2.39-0ubuntu2) ... 131s Processing triggers for man-db (2.12.0-3) ... 133s Processing triggers for install-info (7.1-3) ... 133s Processing triggers for sgml-base (1.31) ... 133s Setting up libdbus-1-dev:arm64 (1.14.10-4ubuntu1) ... 133s Setting up libpcap0.8-dev:arm64 (1.10.4-4ubuntu3) ... 133s Setting up golang-github-google-gopacket-dev (1.1.19-4build1) ... 133s Setting up autopkgtest-satdep (0) ... 138s (Reading database ... 95800 files and directories currently installed.) 138s Removing autopkgtest-satdep (0) ... 139s autopkgtest [17:32:27]: test dh-golang-autopkgtest: /usr/bin/dh_golang_autopkgtest 139s autopkgtest [17:32:27]: test dh-golang-autopkgtest: [----------------------- 140s [info] Testing github.com/google/gopacket... 140s [info] Source code installed by binary package, overriding dh_auto_configure... 140s dh build --buildsystem=golang 140s -e: warning: LTO optimize is enable in buildflags. But cgo doesn't support it. LTO flags will be stripped in cgo. 140s dh_update_autotools_config -O--buildsystem=golang 140s dh_autoreconf -O--buildsystem=golang 140s debian/rules override_dh_auto_configure 140s make[1]: Entering directory '/tmp/autopkgtest.qk0xqw/autopkgtest_tmp' 140s -e: warning: LTO optimize is enable in buildflags. But cgo doesn't support it. LTO flags will be stripped in cgo. 140s mkdir -p "obj-aarch64-linux-gnu" 140s # remove existing symlinks, since "cp -a" won't convert them 140s find "obj-aarch64-linux-gnu" -type l -exec rm "{}" \; 140s cp -a /usr/share/gocode/src "obj-aarch64-linux-gnu" 140s make[1]: Leaving directory '/tmp/autopkgtest.qk0xqw/autopkgtest_tmp' 140s dh_auto_build -O--buildsystem=golang 141s dh_auto_build: warning: LTO optimize is enable in buildflags. But cgo doesn't support it. LTO flags will be stripped in cgo. 141s cd obj-aarch64-linux-gnu && go install -trimpath -v -p 2 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 141s internal/goarch 141s internal/unsafeheader 141s internal/cpu 141s internal/abi 141s internal/bytealg 141s internal/chacha8rand 141s internal/coverage/rtcov 141s internal/godebugs 141s internal/goexperiment 141s internal/goos 141s runtime/internal/atomic 142s runtime/internal/math 142s runtime/internal/sys 142s runtime/internal/syscall 142s internal/race 142s sync/atomic 142s runtime 142s unicode 142s unicode/utf8 142s internal/itoa 142s math/bits 142s math 142s cmp 142s slices 142s internal/nettrace 142s encoding 142s container/list 142s log/internal 142s github.com/google/gopacket/macs 146s internal/reflectlite 146s sync 147s internal/testlog 147s internal/bisect 147s errors 147s sort 147s io 147s bytes 147s strconv 147s internal/oserror 147s syscall 147s reflect 148s internal/syscall/unix 148s time 149s internal/fmtsort 149s internal/poll 149s internal/safefilepath 149s internal/syscall/execenv 149s path 149s io/fs 149s strings 149s os 150s context 150s vendor/golang.org/x/net/dns/dnsmessage 150s fmt 150s internal/godebug 150s encoding/hex 150s internal/singleflight 150s internal/intern 150s net/netip 150s runtime/cgo 151s runtime/debug 151s encoding/binary 153s golang.org/x/net/bpf 154s golang.org/x/sys/unix 155s github.com/google/gopacket/bytediff 155s hash 155s hash/crc32 155s flag 155s log 155s bufio 155s net 155s compress/flate 156s compress/gzip 158s github.com/google/gopacket/routing 158s github.com/google/gopacket 158s github.com/google/gopacket/afpacket 158s github.com/google/gopacket/layers 161s github.com/google/gopacket/defrag/lcmdefrag 161s github.com/google/gopacket/ip4defrag 161s github.com/google/gopacket/pcap 161s github.com/google/gopacket/dumpcommand 161s github.com/google/gopacket/pcapgo 161s github.com/google/gopacket/reassembly 161s github.com/google/gopacket/tcpassembly 161s github.com/google/gopacket/tcpassembly/tcpreader 162s dh_auto_test -O--buildsystem=golang 163s dh_auto_test: warning: LTO optimize is enable in buildflags. But cgo doesn't support it. LTO flags will be stripped in cgo. 163s cd obj-aarch64-linux-gnu && go test -vet=off -v -p 2 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 177s === RUN TestDumpEmbedded 177s --- PASS: TestDumpEmbedded (0.01s) 177s === RUN TestConcatPacketSources 177s --- PASS: TestConcatPacketSources (0.00s) 177s === RUN TestToDuration 177s --- PASS: TestToDuration (0.00s) 177s === RUN TestExponentialSizeIncreasePrepend 177s --- PASS: TestExponentialSizeIncreasePrepend (0.00s) 177s === RUN TestExponentialSizeIncreaseAppend 177s --- PASS: TestExponentialSizeIncreaseAppend (0.00s) 177s === RUN ExampleSerializeBuffer 177s --- PASS: ExampleSerializeBuffer (0.00s) 177s PASS 177s ok github.com/google/gopacket 0.393s 178s === RUN TestParseOptions 178s 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:""} 178s err: block size 2 must be divisible by page size 4096 178s 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:""} 178s err: block size 524288 must be divisible by frame size 333 178s 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:""} 178s err: tpacket version InvalidVersion is invalid 178s 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:""} 178s err: tpacket version InvalidVersion is invalid 178s 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:""} 178s err: 178s --- PASS: TestParseOptions (0.01s) 178s PASS 178s ok github.com/google/gopacket/afpacket 0.238s 178s === RUN TestLCS 178s --- PASS: TestLCS (0.00s) 178s === RUN TestDiff 178s --- PASS: TestDiff (0.02s) 178s PASS 178s ok github.com/google/gopacket/bytediff 0.185s 182s === RUN TestOrderedLCMDefrag 182s --- PASS: TestOrderedLCMDefrag (0.00s) 182s === RUN TestUnorderedLCMDefrag 182s --- PASS: TestUnorderedLCMDefrag (0.00s) 182s === RUN TestNonLCMDefrag 182s --- PASS: TestNonLCMDefrag (0.00s) 182s PASS 182s ok github.com/google/gopacket/defrag/lcmdefrag 0.062s 182s ? github.com/google/gopacket/dumpcommand [no test files] 182s === RUN TestNotFrag 182s --- PASS: TestNotFrag (0.00s) 182s === RUN TestDefragPingMultipleFrags 182s --- PASS: TestDefragPingMultipleFrags (0.00s) 182s === RUN TestDefragPing1 182s --- PASS: TestDefragPing1 (0.00s) 182s === RUN TestDefragPing1and2 182s --- PASS: TestDefragPing1and2 (0.00s) 182s === RUN TestDefragTooSmall 182s --- PASS: TestDefragTooSmall (0.00s) 182s === RUN TestDefragFragmentOffset 182s --- PASS: TestDefragFragmentOffset (0.00s) 182s === RUN TestDefragDiscard 182s --- PASS: TestDefragDiscard (0.00s) 182s === RUN TestDefragMaxSize 182s --- PASS: TestDefragMaxSize (0.00s) 182s === RUN TestDefragIDField 182s --- PASS: TestDefragIDField (0.00s) 182s PASS 182s ok github.com/google/gopacket/ip4defrag 0.055s 186s === RUN TestASFPresencePongDecodeFromBytes 186s --- PASS: TestASFPresencePongDecodeFromBytes (0.00s) 186s === RUN TestASFPresencePongSupportsDCMI 186s --- PASS: TestASFPresencePongSupportsDCMI (0.00s) 186s === RUN TestASFPresencePongSerializeTo 186s --- PASS: TestASFPresencePongSerializeTo (0.00s) 186s === RUN TestASFDecodeFromBytes 186s --- PASS: TestASFDecodeFromBytes (0.00s) 186s === RUN TestASFSerializeTo 186s --- PASS: TestASFSerializeTo (0.00s) 186s === RUN TestBFDNoAuth 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP BFD] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 57 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 37 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 24 bytes 186s base_test.go:21: Got layer BFD, 24 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 71 bytes, truncated 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..24..] SrcPort=49152 DstPort=3784(bfd-control) Length=32 Checksum=29233} 186s - 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} 186s 186s --- PASS: TestBFDNoAuth (0.03s) 186s === RUN TestBFDAuthTypePassword 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP BFD] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 65 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 41 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 33 bytes 186s base_test.go:21: Got layer BFD, 33 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 79 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..33..] SrcPort=49152 DstPort=3784(bfd-control) Length=41 Checksum=29233} 186s - 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..]}} 186s 186s --- PASS: TestBFDAuthTypePassword (0.00s) 186s === RUN TestBFDAuthTypeKeyedMD5 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP BFD] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 80 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 56 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 48 bytes 186s base_test.go:21: Got layer BFD, 48 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 94 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..48..] SrcPort=1024 DstPort=3784(bfd-control) Length=56 Checksum=27340} 186s - 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..]}} 186s 186s --- PASS: TestBFDAuthTypeKeyedMD5 (0.00s) 186s === RUN TestBFDAuthTypeMeticulousKeyedSHA1 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP BFD] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 60 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 52 bytes 186s base_test.go:21: Got layer BFD, 52 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 98 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..52..] SrcPort=1024 DstPort=3784(bfd-control) Length=60 Checksum=14218} 186s - 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..]}} 186s 186s --- PASS: TestBFDAuthTypeMeticulousKeyedSHA1 (0.00s) 186s === RUN TestFlowMapKey 186s --- PASS: TestFlowMapKey (0.00s) 186s === RUN TestDecodeSimpleTCPPacket 186s --- PASS: TestDecodeSimpleTCPPacket (0.00s) 186s === RUN TestDecodeSmallTCPPacketHasEmptyPayload 186s --- PASS: TestDecodeSmallTCPPacketHasEmptyPayload (0.00s) 186s === RUN TestDecodeVLANPacket 186s 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} 186s 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} 186s 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)} 186s 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)}} 186s base_test.go:19: Checking packet layers, want [Ethernet Dot1Q IPv4 TCP] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 50 bytes 186s base_test.go:21: Got layer Dot1Q, 4 bytes, payload of 46 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 20 bytes 186s base_test.go:21: Got layer TCP, 20 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 64 bytes 186s - 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} 186s - Layer 2 (04 bytes) = Dot1Q {Contents=[1, 247, 8, 0] Payload=[..46..] Priority=0 DropEligible=false VLANIdentifier=503 Type=IPv4} 186s - 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=[]} 186s - 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=[]} 186s 186s --- PASS: TestDecodeVLANPacket (0.00s) 186s === RUN TestDecodeSCTPPackets 186s --- PASS: TestDecodeSCTPPackets (0.00s) 186s === RUN TestDecodeCiscoDiscovery 186s base_test.go:19: Checking packet layers, want [Ethernet LLC SNAP CiscoDiscovery CiscoDiscoveryInfo] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 451 bytes 186s base_test.go:21: Got layer LLC, 3 bytes, payload of 448 bytes 186s base_test.go:21: Got layer SNAP, 5 bytes, payload of 443 bytes 186s base_test.go:21: Got layer CiscoDiscovery, 4 bytes, payload of 439 bytes 186s base_test.go:21: Got layer CiscoDiscoveryInfo, 439 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 465 bytes 186s - 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} 186s - Layer 2 (03 bytes) = LLC {Contents=[170, 170, 3] Payload=[..448..] DSAP=170 IG=false SSAP=170 CR=false Control=3} 186s - Layer 3 (05 bytes) = SNAP {Contents=[..5..] Payload=[..443..] OrganizationalCode=[0, 0, 12] Type=CiscoDiscovery} 186s - Layer 4 (04 bytes) = CiscoDiscovery {Contents=[2, 180, 9, 160] Payload=[..439..] Version=2 TTL=180 Checksum=2464 Values=[..13..]} 186s - 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 186s IOS (tm) C2950 Software (C2950-I6K2L2Q4-M), Version 12.1(22)EA14, RELEASE SOFTWARE (fc1) 186s Technical Support: http://www.cisco.com/techsupport 186s Copyright (c) 1986-2010 by cisco Systems, Inc. 186s 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=[]} 186s 186s --- PASS: TestDecodeCiscoDiscovery (0.00s) 186s === RUN TestDecodeLinkLayerDiscovery 186s base_test.go:19: Checking packet layers, want [Ethernet LinkLayerDiscovery LinkLayerDiscoveryInfo] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 249 bytes 186s base_test.go:21: Got layer LinkLayerDiscovery, 249 bytes, payload of 0 bytes 186s base_test.go:21: Got layer LinkLayerDiscoveryInfo, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 263 bytes 186s - 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} 186s - 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..]} 186s - Layer 3 (00 bytes) = LinkLayerDiscoveryInfo {Contents=[] Payload=[] PortDescription=Summit300-48-Port 1001 186s base_test.go:19: Checking packet layers, want [Ethernet LinkLayerDiscovery LinkLayerDiscoveryInfo] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 254 bytes 186s base_test.go:21: Got layer LinkLayerDiscovery, 254 bytes, payload of 0 bytes 186s base_test.go:21: Got layer LinkLayerDiscoveryInfo, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 268 bytes 186s - 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} 186s - Layer 2 (254 bytes) = LinkLayerDiscovery {Contents=[..254..] Payload=[] ChassisID={ Subtype=MAC Address ID=[..6..]} PortID={ Subtype=Local ID=[49]} TTL=120 Values=[..10..]} 186s - 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=[]} 186s 186s --- PASS: TestDecodeLinkLayerDiscovery (0.00s) 186s === RUN TestDecodeNortelDiscovery 186s base_test.go:19: Checking packet layers, want [Ethernet LLC SNAP NortelDiscovery] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 19 bytes 186s base_test.go:21: Got layer LLC, 3 bytes, payload of 16 bytes 186s base_test.go:21: Got layer SNAP, 5 bytes, payload of 11 bytes 186s base_test.go:21: Got layer NortelDiscovery, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 60 bytes 186s - 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} 186s - Layer 2 (03 bytes) = LLC {Contents=[170, 170, 3] Payload=[..16..] DSAP=170 IG=false SSAP=170 CR=false Control=3} 186s - Layer 3 (05 bytes) = SNAP {Contents=[..5..] Payload=[..11..] OrganizationalCode=[0, 0, 129] Type=NortelDiscovery} 186s - 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} 186s 186s --- PASS: TestDecodeNortelDiscovery (0.00s) 186s === RUN TestDecodeIPv6Jumbogram 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop TCP Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 70040 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 70000 bytes 186s base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 69992 bytes 186s base_test.go:21: Got layer TCP, 20 bytes, payload of 69972 bytes 186s base_test.go:21: Got layer Payload, 69972 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 70054 bytes 186s - 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} 186s - 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]}]}} 186s - 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]}]} 186s - 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=[]} 186s - Layer 5 (69972 bytes) = Payload 69972 byte(s) 186s 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop TCP Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 70039 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 69999 bytes 186s base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 69991 bytes 186s base_test.go:21: Got layer TCP, 20 bytes, payload of 69971 bytes 186s base_test.go:21: Got layer Payload, 69971 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 70053 bytes, truncated 186s - 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} 186s - 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]}]}} 186s - 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]}]} 186s - 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=[]} 186s - Layer 5 (69971 bytes) = Payload 69971 byte(s) 186s 186s --- PASS: TestDecodeIPv6Jumbogram (0.00s) 186s === RUN TestDecodeUDPPacketTooSmall 186s base_test.go:19: Checking packet layers, want [Ethernet Dot1Q IPv4 UDP Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Dot1Q, 4 bytes, payload of 52 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 32 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 24 bytes 186s base_test.go:21: Got layer Payload, 24 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 70 bytes, truncated 186s - 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} 186s - Layer 2 (04 bytes) = Dot1Q {Contents=[1, 247, 8, 0] Payload=[..52..] Priority=0 DropEligible=false VLANIdentifier=503 Type=IPv4} 186s - 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=[]} 186s - Layer 4 (08 bytes) = UDP {Contents=[..8..] Payload=[..24..] SrcPort=80(http) DstPort=80(http) Length=40 Checksum=19885} 186s - Layer 5 (24 bytes) = Payload 24 byte(s) 186s 186s --- PASS: TestDecodeUDPPacketTooSmall (0.00s) 186s === RUN TestDecodingLayerParserFullTCPPacket 186s --- PASS: TestDecodingLayerParserFullTCPPacket (0.00s) 186s === RUN TestDecodingLayerMap 186s --- PASS: TestDecodingLayerMap (0.00s) 186s === RUN TestDecodingLayerSparse 186s --- PASS: TestDecodingLayerSparse (0.00s) 186s === RUN TestDecodingLayerArray 186s --- PASS: TestDecodingLayerArray (0.00s) 186s === RUN TestICMP 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 56 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 36 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 28 bytes 186s base_test.go:21: Got layer Payload, 28 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 70 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..28..] TypeCode=DestinationUnreachable(CommAdminProhibited) Checksum=37998 Id=0 Seq=0} 186s - Layer 4 (28 bytes) = Payload 28 byte(s) 186s 186s --- PASS: TestICMP (0.00s) 186s === RUN TestICMP6 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 ICMPv6 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 72 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 32 bytes 186s base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 28 bytes 186s base_test.go:21: Got layer ICMPv6NeighborSolicitation, 28 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 86 bytes 186s - 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} 186s - 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} 186s - Layer 3 (04 bytes) = ICMPv6 {Contents=[135, 0, 30, 186] Payload=[..28..] TypeCode=NeighborSolicitation Checksum=7866 TypeBytes=[]} 186s - 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)]} 186s 186s --- PASS: TestICMP6 (0.00s) 186s === RUN TestMPLS 186s base_test.go:19: Checking packet layers, want [Ethernet MPLS IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 104 bytes 186s base_test.go:21: Got layer MPLS, 4 bytes, payload of 100 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 80 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 72 bytes 186s base_test.go:21: Got layer Payload, 72 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 118 bytes 186s - 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} 186s - Layer 2 (04 bytes) = MPLS {Contents=[0, 1, 209, 255] Payload=[..100..] Label=29 TrafficClass=0 StackBottom=true TTL=255} 186s - 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=[]} 186s - Layer 4 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..72..] TypeCode=EchoRequest Checksum=14966 Id=2618 Seq=1579} 186s - Layer 5 (72 bytes) = Payload 72 byte(s) 186s 186s --- PASS: TestMPLS (0.00s) 186s === RUN TestPPPGREIPv4IPv6VLAN 186s base_test.go:19: Checking packet layers, want [Ethernet Dot1Q IPv6 IPv4 GRE PPP IPv4 UDP DNS] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 183 bytes 186s base_test.go:21: Got layer Dot1Q, 4 bytes, payload of 179 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 139 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 119 bytes 186s base_test.go:21: Got layer GRE, 16 bytes, payload of 103 bytes 186s base_test.go:21: Got layer PPP, 2 bytes, payload of 99 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 79 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 71 bytes 186s base_test.go:21: Got layer DNS, 71 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 197 bytes 186s - 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} 186s - Layer 2 (04 bytes) = Dot1Q {Contents=[0, 100, 134, 221] Payload=[..179..] Priority=0 DropEligible=false VLANIdentifier=100 Type=IPv6} 186s - 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} 186s - 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=[]} 186s - 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} 186s - Layer 6 (02 bytes) = PPP {Contents=[0, 33] Payload=[..99..] PPPType=IPv4 HasPPTPHeader=true} 186s - 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=[]} 186s - Layer 8 (08 bytes) = UDP {Contents=[..8..] Payload=[..71..] SrcPort=40768 DstPort=53(domain) Length=79 Checksum=64415} 186s - 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=[]} 186s 186s --- PASS: TestPPPGREIPv4IPv6VLAN (0.01s) 186s === RUN TestPPPoEICMPv6 186s base_test.go:19: Checking packet layers, want [Ethernet PPPoE PPP IPv6 ICMPv6 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 72 bytes 186s base_test.go:21: Got layer PPPoE, 6 bytes, payload of 66 bytes 186s base_test.go:21: Got layer PPP, 2 bytes, payload of 64 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes 186s base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes 186s base_test.go:21: Got layer ICMPv6NeighborAdvertisement, 20 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 86 bytes 186s - 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} 186s - Layer 2 (06 bytes) = PPPoE {Contents=[..6..] Payload=[..66..] Version=1 Type=1 Code=PPP SessionId=17 Length=66} 186s - Layer 3 (02 bytes) = PPP {Contents=[0, 87] Payload=[..64..] PPPType=IPv6 HasPPTPHeader=false} 186s - 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} 186s - Layer 5 (04 bytes) = ICMPv6 {Contents=[136, 0, 80, 131] Payload=[..20..] TypeCode=NeighborAdvertisement Checksum=20611 TypeBytes=[]} 186s - Layer 6 (20 bytes) = ICMPv6NeighborAdvertisement {Contents=[..20..] Payload=[] Flags=128 TargetAddress=fe80::c801:eff:fe88:8 Options=[]} 186s 186s --- PASS: TestPPPoEICMPv6 (0.00s) 186s === RUN TestPFLogUDP 186s base_test.go:19: Checking packet layers, want [PFLog IPv4 UDP Payload] 186s base_test.go:21: Got layer PFLog, 64 bytes, payload of 44 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 24 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 16 bytes 186s base_test.go:21: Got layer Payload, 16 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 108 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..16..] SrcPort=61695 DstPort=8612(canon-bjnp2) Length=24 Checksum=10789} 186s - Layer 4 (16 bytes) = Payload 16 byte(s) 186s 186s --- PASS: TestPFLogUDP (0.00s) 186s === RUN TestRegressionDot1QPriority 186s --- PASS: TestRegressionDot1QPriority (0.00s) 186s === RUN TestPacketMPLSInMPLS 186s base_test.go:19: Checking packet layers, want [Ethernet MPLS MPLS IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 108 bytes 186s base_test.go:21: Got layer MPLS, 4 bytes, payload of 104 bytes 186s base_test.go:21: Got layer MPLS, 4 bytes, payload of 100 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 80 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 72 bytes 186s base_test.go:21: Got layer Payload, 72 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 122 bytes 186s - 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} 186s - Layer 2 (04 bytes) = MPLS {Contents=[0, 1, 32, 255] Payload=[..104..] Label=18 TrafficClass=0 StackBottom=false TTL=255} 186s - Layer 3 (04 bytes) = MPLS {Contents=[0, 1, 1, 255] Payload=[..100..] Label=16 TrafficClass=0 StackBottom=true TTL=255} 186s - 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=[]} 186s - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..72..] TypeCode=EchoRequest Checksum=48401 Id=3941 Seq=4768} 186s - Layer 6 (72 bytes) = Payload 72 byte(s) 186s 186s --- PASS: TestPacketMPLSInMPLS (0.00s) 186s === RUN TestPacketIPv4Fragmented 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 Fragment] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 56 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 36 bytes 186s base_test.go:21: Got layer Fragment, 36 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 70 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (36 bytes) = Fragment 36 byte(s) 186s 186s --- PASS: TestPacketIPv4Fragmented (0.00s) 186s === RUN TestSCTPChunkBadLength 186s --- PASS: TestSCTPChunkBadLength (0.00s) 186s === RUN TestSTP 186s base_test.go:19: Checking packet layers, want [Ethernet LLC STP] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 38 bytes 186s base_test.go:21: Got layer LLC, 3 bytes, payload of 35 bytes 186s base_test.go:21: Got layer STP, 35 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 60 bytes 186s - 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} 186s - Layer 2 (03 bytes) = LLC {Contents=[66, 66, 3] Payload=[..35..] DSAP=66 IG=false SSAP=66 CR=false Control=3} 186s - Layer 3 (35 bytes) = STP {Contents=[..35..] Payload=[]} 186s 186s --- PASS: TestSTP (0.00s) 186s === RUN TestDHCPv4EncodeRequest 186s --- PASS: TestDHCPv4EncodeRequest (0.00s) 186s === RUN TestDHCPv4EncodeResponse 186s --- PASS: TestDHCPv4EncodeResponse (0.00s) 186s === RUN TestDHCPv4DecodeOption 186s --- PASS: TestDHCPv4DecodeOption (0.00s) 186s === RUN TestDHCPv6EncodeRequest 186s --- PASS: TestDHCPv6EncodeRequest (0.00s) 186s === RUN TestDHCPv6EncodeReply 186s --- PASS: TestDHCPv6EncodeReply (0.00s) 186s === RUN TestPacketDNSRegression 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 68 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 48 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 40 bytes 186s base_test.go:21: Got layer DNS, 40 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 82 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..40..] SrcPort=57766 DstPort=53(domain) Length=48 Checksum=42391} 186s - 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=[]}]} 186s 186s --- PASS: TestPacketDNSRegression (0.01s) 186s === RUN TestParseDNSTypeTXT 186s base_test.go:19: Checking packet layers, want [Loopback IPv4 UDP DNS] 186s base_test.go:21: Got layer Loopback, 4 bytes, payload of 115 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 95 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 87 bytes 186s base_test.go:21: Got layer DNS, 87 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 119 bytes 186s - Layer 1 (04 bytes) = Loopback {Contents=[2, 0, 0, 0] Payload=[..115..] Family=IPv4} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..87..] SrcPort=53(domain) DstPort=33202 Length=95 Checksum=56501} 186s - 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=[]}]} 186s 186s --- PASS: TestParseDNSTypeTXT (0.00s) 186s === RUN TestParseDNSBadVers 186s base_test.go:19: Checking packet layers, want [Loopback IPv4 UDP DNS] 186s base_test.go:21: Got layer Loopback, 4 bytes, payload of 56 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 36 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 28 bytes 186s base_test.go:21: Got layer DNS, 28 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 60 bytes 186s - Layer 1 (04 bytes) = Loopback {Contents=[2, 0, 0, 0] Payload=[..56..] Family=IPv4} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..28..] SrcPort=53(domain) DstPort=64888 Length=36 Checksum=16577} 186s - 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=[]}]} 186s 186s --- PASS: TestParseDNSBadVers (0.00s) 186s === RUN TestParseDNSBadCookie 186s base_test.go:19: Checking packet layers, want [Loopback IPv4 UDP DNS] 186s base_test.go:21: Got layer Loopback, 4 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer DNS, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 88 bytes 186s - Layer 1 (04 bytes) = Loopback {Contents=[2, 0, 0, 0] Payload=[..84..] Family=IPv4} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..56..] SrcPort=53(domain) DstPort=54954 Length=64 Checksum=65107} 186s - 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=[]}]} 186s 186s --- PASS: TestParseDNSBadCookie (0.00s) 186s === RUN TestParseDNSTypeURI 186s base_test.go:19: Checking packet layers, want [Loopback IPv4 UDP DNS] 186s base_test.go:21: Got layer Loopback, 4 bytes, payload of 111 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 91 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 83 bytes 186s base_test.go:21: Got layer DNS, 83 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 115 bytes 186s - Layer 1 (04 bytes) = Loopback {Contents=[2, 0, 0, 0] Payload=[..111..] Family=IPv4} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..83..] SrcPort=53(domain) DstPort=59347 Length=91 Checksum=65134} 186s - 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=[]}]} 186s 186s --- PASS: TestParseDNSTypeURI (0.00s) 186s === RUN TestParseDNSTypeOPT 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 88 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 68 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 60 bytes 186s base_test.go:21: Got layer DNS, 60 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 102 bytes, truncated 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..60..] SrcPort=54784 DstPort=53(domain) Length=70 Checksum=17584} 186s - 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=[]}]} 186s 186s --- PASS: TestParseDNSTypeOPT (0.00s) 186s === RUN TestDNSEncodeQuery 186s --- PASS: TestDNSEncodeQuery (0.00s) 186s === RUN TestDNSEncodeQueryWithOPT 186s --- PASS: TestDNSEncodeQueryWithOPT (0.00s) 186s === RUN TestDNSEncodeResponse 186s --- PASS: TestDNSEncodeResponse (0.00s) 186s === RUN TestDNSMalformedPacket 186s --- PASS: TestDNSMalformedPacket (0.00s) 186s === RUN TestDNSMalformedPacket2 186s --- PASS: TestDNSMalformedPacket2 (0.00s) 186s === RUN TestBlankNameRootQuery 186s --- PASS: TestBlankNameRootQuery (0.00s) 186s === RUN TestAnotherMalformedDNS 186s --- PASS: TestAnotherMalformedDNS (0.00s) 186s === RUN TestMalformedDNSAgain 186s --- PASS: TestMalformedDNSAgain (0.00s) 186s === RUN TestMalformedDNSOhGodMakeItStop 186s --- PASS: TestMalformedDNSOhGodMakeItStop (0.00s) 186s === RUN TestMalformedDNSOPT 186s --- PASS: TestMalformedDNSOPT (0.00s) 186s === RUN TestPacketDNSPanic7 186s --- PASS: TestPacketDNSPanic7 (0.00s) 186s === RUN TestDNSPacketWriteAnswer 186s 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=[]} 186s --- PASS: TestDNSPacketWriteAnswer (0.00s) 186s === RUN TestPacketDot11CtrlCTS 186s base_test.go:19: Checking packet layers, want [RadioTap Dot11] 186s base_test.go:21: Got layer RadioTap, 25 bytes, payload of 14 bytes 186s base_test.go:21: Got layer Dot11, 10 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 39 bytes 186s - 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=} 186s - 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} 186s 186s --- PASS: TestPacketDot11CtrlCTS (0.01s) 186s === RUN TestPacketDot11MgmtBeacon 186s base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11MgmtBeacon Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement Dot11InformationElement] 186s base_test.go:21: Got layer RadioTap, 18 bytes, payload of 221 bytes 186s base_test.go:21: Got layer Dot11, 24 bytes, payload of 193 bytes 186s base_test.go:21: Got layer Dot11MgmtBeacon, 193 bytes, payload of 181 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 5 bytes, payload of 176 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 10 bytes, payload of 166 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 3 bytes, payload of 163 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 6 bytes, payload of 157 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 3 bytes, payload of 154 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 26 bytes, payload of 128 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 32 bytes, payload of 96 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 28 bytes, payload of 68 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 28 bytes, payload of 40 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 24 bytes, payload of 16 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 6 bytes, payload of 10 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 10 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 239 bytes 186s - 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=} 186s - 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} 186s - Layer 3 (193 bytes) = Dot11MgmtBeacon {Contents=[..193..] Payload=[..181..] Timestamp=84761702784 Interval=100 Flags=1057} 186s - Layer 4 (05 bytes) = Dot11InformationElement 802.11 Information Element (ID: SSID parameter set, Length: 3, SSID: Wi2) 186s - 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) 186s - Layer 6 (03 bytes) = Dot11InformationElement 802.11 Information Element (ID: DS Parameter set, Length: 1, Info: 01) 186s - Layer 7 (06 bytes) = Dot11InformationElement 802.11 Information Element (ID: Traffic Indication Map (TIM), Length: 4, Info: 00010000) 186s - Layer 8 (03 bytes) = Dot11InformationElement 802.11 Information Element (ID: ERP Information, Length: 1, Info: 00) 186s - Layer 9 (26 bytes) = Dot11InformationElement 802.11 Information Element (ID: Vendor, Length: 24, OUI: 0050F202, Info: 0101810007A4000023A4000042435E0062322F00) 186s - Layer 10 (32 bytes) = Dot11InformationElement 802.11 Information Element (ID: Vendor, Length: 30, OUI: 00904C33, Info: 8C011BFFFF000000000000000000001000000000000000000000) 186s - Layer 11 (28 bytes) = Dot11InformationElement 802.11 Information Element (ID: HT Capabilities (802.11n D1.10), Length: 26, Info: 8C011BFFFF000000000000000000001000000000000000000000) 186s - Layer 12 (28 bytes) = Dot11InformationElement 802.11 Information Element (ID: Vendor, Length: 26, OUI: 00904C34, Info: 01000000000000000000000000000000000000000000) 186s - Layer 13 (24 bytes) = Dot11InformationElement 802.11 Information Element (ID: HT Information (802.11n D1.10), Length: 22, Info: 01000000000000000000000000000000000000000000) 186s - Layer 14 (06 bytes) = Dot11InformationElement 802.11 Information Element (ID: Extended Capabilities, Length: 4, Info: 00000000) 186s - Layer 15 (10 bytes) = Dot11InformationElement 802.11 Information Element (ID: Vendor, Length: 8, OUI: 00139201, Info: 00018500) 186s 186s --- PASS: TestPacketDot11MgmtBeacon (0.00s) 186s === RUN TestPacketDot11DataQOSData 186s base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11DataQOSData Dot11Data LLC SNAP ARP] 186s base_test.go:21: Got layer RadioTap, 32 bytes, payload of 66 bytes 186s base_test.go:21: Got layer Dot11, 26 bytes, payload of 36 bytes 186s base_test.go:21: Got layer Dot11DataQOSData, 0 bytes, payload of 36 bytes 186s base_test.go:21: Got layer Dot11Data, 0 bytes, payload of 36 bytes 186s base_test.go:21: Got layer LLC, 3 bytes, payload of 33 bytes 186s base_test.go:21: Got layer SNAP, 5 bytes, payload of 28 bytes 186s base_test.go:21: Got layer ARP, 28 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 96 bytes 186s - 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=} 186s - 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..]}} 186s - Layer 3 (00 bytes) = Dot11DataQOSData {Contents=[] Payload=[..36..]} 186s - Layer 4 (00 bytes) = Dot11Data {Contents=[] Payload=[..36..]} 186s - Layer 5 (03 bytes) = LLC {Contents=[170, 170, 3] Payload=[..33..] DSAP=170 IG=false SSAP=170 CR=false Control=3} 186s - Layer 6 (05 bytes) = SNAP {Contents=[..5..] Payload=[..28..] OrganizationalCode=[0, 0, 0] Type=ARP} 186s - 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]} 186s 186s --- PASS: TestPacketDot11DataQOSData (0.00s) 186s === RUN TestPacketDot11MgmtAction 186s base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11MgmtAction] 186s base_test.go:21: Got layer RadioTap, 18 bytes, payload of 35 bytes 186s base_test.go:21: Got layer Dot11, 24 bytes, payload of 7 bytes 186s base_test.go:21: Got layer Dot11MgmtAction, 7 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 53 bytes 186s - 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=} 186s - 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} 186s - Layer 3 (07 bytes) = Dot11MgmtAction {Contents=[..7..] Payload=[]} 186s 186s --- PASS: TestPacketDot11MgmtAction (0.00s) 186s === RUN TestPacketDot11CtrlAck 186s base_test.go:19: Checking packet layers, want [RadioTap Dot11] 186s base_test.go:21: Got layer RadioTap, 32 bytes, payload of 14 bytes 186s base_test.go:21: Got layer Dot11, 10 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 46 bytes 186s - 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=} 186s - 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} 186s 186s --- PASS: TestPacketDot11CtrlAck (0.00s) 186s === RUN TestPacketDot11DataARP 186s base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11Data LLC SNAP ARP] 186s base_test.go:21: Got layer RadioTap, 32 bytes, payload of 64 bytes 186s base_test.go:21: Got layer Dot11, 24 bytes, payload of 36 bytes 186s base_test.go:21: Got layer Dot11Data, 0 bytes, payload of 36 bytes 186s base_test.go:21: Got layer LLC, 3 bytes, payload of 33 bytes 186s base_test.go:21: Got layer SNAP, 5 bytes, payload of 28 bytes 186s base_test.go:21: Got layer ARP, 28 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 92 bytes 186s - 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=} 186s - 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..]}} 186s - Layer 3 (00 bytes) = Dot11Data {Contents=[] Payload=[..36..]} 186s - Layer 4 (03 bytes) = LLC {Contents=[170, 170, 3] Payload=[..33..] DSAP=170 IG=false SSAP=170 CR=false Control=3} 186s - Layer 5 (05 bytes) = SNAP {Contents=[..5..] Payload=[..28..] OrganizationalCode=[0, 0, 0] Type=ARP} 186s - 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]} 186s 186s --- PASS: TestPacketDot11DataARP (0.00s) 186s === RUN TestPacketDot11DataIP 186s base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11Data LLC SNAP IPv4 UDP DHCPv4] 186s base_test.go:21: Got layer RadioTap, 32 bytes, payload of 364 bytes 186s base_test.go:21: Got layer Dot11, 24 bytes, payload of 336 bytes 186s base_test.go:21: Got layer Dot11Data, 0 bytes, payload of 336 bytes 186s base_test.go:21: Got layer LLC, 3 bytes, payload of 333 bytes 186s base_test.go:21: Got layer SNAP, 5 bytes, payload of 328 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 308 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 300 bytes 186s base_test.go:21: Got layer DHCPv4, 300 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 392 bytes 186s - 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=} 186s - 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..]}} 186s - Layer 3 (00 bytes) = Dot11Data {Contents=[] Payload=[..336..]} 186s - Layer 4 (03 bytes) = LLC {Contents=[170, 170, 3] Payload=[..333..] DSAP=170 IG=false SSAP=170 CR=false Control=3} 186s - Layer 5 (05 bytes) = SNAP {Contents=[..5..] Payload=[..328..] OrganizationalCode=[0, 0, 0] Type=IPv4} 186s - 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=[]} 186s - Layer 7 (08 bytes) = UDP {Contents=[..8..] Payload=[..300..] SrcPort=68(bootpc) DstPort=67(bootps) Length=308 Checksum=11065} 186s - 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)]} 186s 186s --- PASS: TestPacketDot11DataIP (0.00s) 186s === RUN TestPacketP6196 186s base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11DataQOSData Dot11WEP] 186s base_test.go:21: Got layer RadioTap, 48 bytes, payload of 143 bytes 186s base_test.go:21: Got layer Dot11, 26 bytes, payload of 113 bytes 186s base_test.go:21: Got layer Dot11DataQOSData, 0 bytes, payload of 113 bytes 186s base_test.go:21: Got layer Dot11WEP, 113 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 191 bytes 186s - 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=} 186s - 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..]}} 186s - Layer 3 (00 bytes) = Dot11DataQOSData {Contents=[] Payload=[..113..]} 186s - Layer 4 (113 bytes) = Dot11WEP {Contents=[..113..] Payload=[]} 186s 186s --- PASS: TestPacketP6196 (0.00s) 186s === RUN TestPacketDot11HTControl 186s base_test.go:19: Checking packet layers, want [RadioTap Dot11 Dot11DataQOSData Dot11WEP] 186s base_test.go:21: Got layer RadioTap, 38 bytes, payload of 106 bytes 186s base_test.go:21: Got layer Dot11, 30 bytes, payload of 72 bytes 186s base_test.go:21: Got layer Dot11DataQOSData, 0 bytes, payload of 72 bytes 186s base_test.go:21: Got layer Dot11WEP, 72 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 140 bytes 186s - 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)} 186s - 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..]}} 186s - Layer 3 (00 bytes) = Dot11DataQOSData {Contents=[] Payload=[..72..]} 186s - Layer 4 (72 bytes) = Dot11WEP {Contents=[..72..] Payload=[]} 186s 186s --- PASS: TestPacketDot11HTControl (0.00s) 186s === RUN TestInformationElement 186s --- PASS: TestInformationElement (0.00s) 186s === RUN TestEncodeDecodeDot1Q 186s --- PASS: TestEncodeDecodeDot1Q (0.00s) 186s === RUN TestPacketEAPOLKey 186s base_test.go:19: Checking packet layers, want [EAPOL EAPOLKey Dot11InformationElement] 186s base_test.go:21: Got layer EAPOL, 4 bytes, payload of 117 bytes 186s base_test.go:21: Got layer EAPOLKey, 95 bytes, payload of 22 bytes 186s base_test.go:21: Got layer Dot11InformationElement, 22 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 121 bytes 186s - Layer 1 (04 bytes) = EAPOL {Contents=[2, 3, 0, 117] Payload=[..117..] Version=2 Type=EAPOLKey Length=117} 186s - 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=[]} 186s - Layer 3 (22 bytes) = Dot11InformationElement 802.11 Information Element (ID: Vendor, Length: 20, OUI: 000FAC04, Info: 592DA88096C461DA246C69001E877F3D) 186s 186s --- PASS: TestPacketEAPOLKey (0.00s) 186s === RUN TestNewIPEndpoint 186s --- PASS: TestNewIPEndpoint (0.00s) 186s === RUN TestDecodeAndEncode 186s --- PASS: TestDecodeAndEncode (0.00s) 186s === RUN TestDecodeGeneve1 186s base_test.go:19: Checking packet layers, want [Linux SLL IPv4 UDP Geneve Ethernet IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Linux SLL, 16 bytes, payload of 134 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 114 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 106 bytes 186s base_test.go:21: Got layer Geneve, 8 bytes, payload of 98 bytes 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 150 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..106..] SrcPort=12631 DstPort=6081(geneve) Length=114 Checksum=0} 186s - Layer 4 (08 bytes) = Geneve {Contents=[..8..] Payload=[..98..] Version=0 OptionsLength=0 OAMPacket=false CriticalOption=false Protocol=TransparentEthernetBridging VNI=0 Options=[]} 186s - 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} 186s - 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=[]} 186s - Layer 7 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=31199 Id=3322 Seq=25540} 186s - Layer 8 (56 bytes) = Payload 56 byte(s) 186s 186s --- PASS: TestDecodeGeneve1 (0.00s) 186s === RUN TestDecodeGeneve2 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP Geneve Ethernet IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 134 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 114 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 106 bytes 186s base_test.go:21: Got layer Geneve, 8 bytes, payload of 98 bytes 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 148 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..106..] SrcPort=16550 DstPort=6081(geneve) Length=114 Checksum=0} 186s - Layer 4 (08 bytes) = Geneve {Contents=[..8..] Payload=[..98..] Version=0 OptionsLength=0 OAMPacket=false CriticalOption=false Protocol=TransparentEthernetBridging VNI=10 Options=[]} 186s - 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} 186s - 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=[]} 186s - Layer 7 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=56733 Id=32478 Seq=707} 186s - Layer 8 (56 bytes) = Payload 56 byte(s) 186s 186s --- PASS: TestDecodeGeneve2 (0.00s) 186s === RUN TestDecodeGeneve3 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP Geneve Ethernet IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 142 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 122 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 114 bytes 186s base_test.go:21: Got layer Geneve, 16 bytes, payload of 98 bytes 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 156 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..114..] SrcPort=12618 DstPort=6081(geneve) Length=122 Checksum=0} 186s - 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]}]} 186s - 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} 186s - 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=[]} 186s - Layer 7 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=11348 Id=10578 Seq=23} 186s - Layer 8 (56 bytes) = Payload 56 byte(s) 186s 186s --- PASS: TestDecodeGeneve3 (0.00s) 186s === RUN TestPacketGRE 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 GRE IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 108 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 88 bytes 186s base_test.go:21: Got layer GRE, 4 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 122 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s - 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=[]} 186s - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=33476 Id=4724 Seq=1} 186s - Layer 6 (56 bytes) = Payload 56 byte(s) 186s 186s --- PASS: TestPacketGRE (0.00s) 186s === RUN TestIPv4OverGREEncode 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 GRE IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 108 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 88 bytes 186s base_test.go:21: Got layer GRE, 4 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 122 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s - 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=[]} 186s - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=33476 Id=4724 Seq=1} 186s - Layer 6 (56 bytes) = Payload 56 byte(s) 186s 186s --- PASS: TestIPv4OverGREEncode (0.00s) 186s === RUN TestPacketEthernetOverGRE 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 GRE Ethernet IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 122 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 102 bytes 186s base_test.go:21: Got layer GRE, 4 bytes, payload of 98 bytes 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 136 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s - 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} 186s - 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=[]} 186s - Layer 6 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=16149 Id=3842 Seq=1} 186s - Layer 7 (56 bytes) = Payload 56 byte(s) 186s 186s --- PASS: TestPacketEthernetOverGRE (0.00s) 186s === RUN TestEthernetOverGREEncode 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 GRE Ethernet IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 122 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 102 bytes 186s base_test.go:21: Got layer GRE, 4 bytes, payload of 98 bytes 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 136 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s - 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} 186s - 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=[]} 186s - Layer 6 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=16149 Id=3842 Seq=1} 186s - Layer 7 (56 bytes) = Payload 56 byte(s) 186s 186s --- PASS: TestEthernetOverGREEncode (0.00s) 186s === RUN TestGREChecksum 186s gre_test.go:357: PACKET: 142 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s - 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=[]} 186s - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..72..] TypeCode=EchoRequest Checksum=49108 Id=2 Seq=0} 186s - Layer 6 (72 bytes) = Payload 72 byte(s) 186s 186s gre_test.go:357: PACKET: 102 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s - 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=[]} 186s - Layer 5 (08 bytes) = UDP {Contents=[..8..] Payload=[..32..] SrcPort=41781 DstPort=33434(traceroute) Length=40 Checksum=55436} 186s - Layer 6 (32 bytes) = Payload 32 byte(s) 186s 186s --- PASS: TestGREChecksum (0.00s) 186s === RUN TestGTPPacket 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP GTPv1U IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 124 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 104 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 96 bytes 186s base_test.go:21: Got layer GTPv1U, 12 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 138 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..96..] SrcPort=2152(gtp-user) DstPort=2152(gtp-user) Length=104 Checksum=49604} 186s - 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=[]} 186s - 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=[]} 186s - Layer 6 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoReply Checksum=14825 Id=0 Seq=10365} 186s - Layer 7 (56 bytes) = Payload 56 byte(s) 186s 186s --- PASS: TestGTPPacket (0.00s) 186s === RUN TestGTPPacketWithEH 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP GTPv1U IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 128 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 108 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 100 bytes 186s base_test.go:21: Got layer GTPv1U, 16 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 142 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..100..] SrcPort=2152(gtp-user) DstPort=2152(gtp-user) Length=108 Checksum=49557} 186s - 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]}]} 186s - 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=[]} 186s - Layer 6 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoReply Checksum=58294 Id=0 Seq=10412} 186s - Layer 7 (56 bytes) = Payload 56 byte(s) 186s 186s --- PASS: TestGTPPacketWithEH (0.00s) 186s === RUN TestPacketICMPv6NeighborAnnouncementFlags 186s --- PASS: TestPacketICMPv6NeighborAnnouncementFlags (0.00s) 186s === RUN TestPacketICMPv6RouterAnnouncementFlags 186s --- PASS: TestPacketICMPv6RouterAnnouncementFlags (0.00s) 186s === RUN TestPacketICMPv6 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 ICMPv6 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 64 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes 186s base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes 186s base_test.go:21: Got layer ICMPv6NeighborAdvertisement, 20 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 78 bytes 186s - 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} 186s - 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} 186s - Layer 3 (04 bytes) = ICMPv6 {Contents=[136, 0, 30, 214] Payload=[..20..] TypeCode=NeighborAdvertisement Checksum=7894 TypeBytes=[]} 186s - Layer 4 (20 bytes) = ICMPv6NeighborAdvertisement {Contents=[..20..] Payload=[] Flags=64 TargetAddress=2620:0:1005:0:26be:5ff:fe27:b17 Options=[]} 186s 186s --- PASS: TestPacketICMPv6 (0.00s) 186s === RUN TestPacketICMPv6WithHopByHop 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 176 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 128 bytes 186s base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 128 bytes 186s base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 124 bytes 186s base_test.go:21: Got layer MLDv2MulticastListenerReport, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 190 bytes, truncated 186s - 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} 186s - 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]}]}} 186s - 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]}]} 186s - Layer 4 (04 bytes) = ICMPv6 {Contents=[143, 0, 158, 237] Payload=[..124..] TypeCode=143(0) Checksum=40685 TypeBytes=[]} 186s - 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:[]}] 186s 186s --- PASS: TestPacketICMPv6WithHopByHop (0.00s) 186s === RUN TestPacketICMPv6RouterAdvertisement 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 ICMPv6 ICMPv6RouterAdvertisement] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 104 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 60 bytes 186s base_test.go:21: Got layer ICMPv6RouterAdvertisement, 60 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 118 bytes 186s - 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} 186s - 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} 186s - Layer 3 (04 bytes) = ICMPv6 {Contents=[134, 0, 196, 254] Payload=[..60..] TypeCode=RouterAdvertisement Checksum=50430 TypeBytes=[]} 186s - 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)]} 186s 186s --- PASS: TestPacketICMPv6RouterAdvertisement (0.00s) 186s === RUN TestPacketICMPv6NeighborSolicitation 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 ICMPv6 ICMPv6NeighborSolicitation] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 64 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes 186s base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes 186s base_test.go:21: Got layer ICMPv6NeighborSolicitation, 20 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 78 bytes 186s - 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} 186s - 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} 186s - Layer 3 (04 bytes) = ICMPv6 {Contents=[135, 0, 185, 48] Payload=[..20..] TypeCode=NeighborSolicitation Checksum=47408 TypeBytes=[]} 186s - Layer 4 (20 bytes) = ICMPv6NeighborSolicitation {Contents=[..20..] Payload=[] TargetAddress=fe80::20c:29ff:fe0e:4c67 Options=[]} 186s 186s --- PASS: TestPacketICMPv6NeighborSolicitation (0.00s) 186s === RUN TestIGMPv1MembershipReportPacket 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 IGMP] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 46 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 8 bytes 186s base_test.go:21: Got layer IGMP, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 60 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (00 bytes) = IGMP {Contents=[] Payload=[] Type=IGMPv1 Membership Report MaxResponseTime=0s Checksum=3267 GroupAddress=224.0.1.60 Version=1} 186s 186s --- PASS: TestIGMPv1MembershipReportPacket (0.00s) 186s === RUN TestIGMPv2MembershipQuery 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 IGMP] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 46 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 8 bytes 186s base_test.go:21: Got layer IGMP, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 60 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (00 bytes) = IGMP {Contents=[] Payload=[] Type=IGMP Membership Query MaxResponseTime=10s Checksum=61083 GroupAddress=0.0.0.0 Version=2} 186s 186s --- PASS: TestIGMPv2MembershipQuery (0.00s) 186s === RUN TestIGMPv2MembershipReport 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 IGMP] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 46 bytes 186s base_test.go:21: Got layer IPv4, 24 bytes, payload of 8 bytes 186s base_test.go:21: Got layer IGMP, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 60 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (00 bytes) = IGMP {Contents=[] Payload=[] Type=IGMPv2 Membership Report MaxResponseTime=0s Checksum=64001 GroupAddress=239.255.255.253 Version=2} 186s 186s --- PASS: TestIGMPv2MembershipReport (0.00s) 186s === RUN TestIGMPv3MembershipQuery 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 IGMP] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 46 bytes 186s base_test.go:21: Got layer IPv4, 24 bytes, payload of 12 bytes 186s base_test.go:21: Got layer IGMP, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 60 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s 186s --- PASS: TestIGMPv3MembershipQuery (0.00s) 186s === RUN TestIGMPv3MembershipReport2Records 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 IGMP] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 48 bytes 186s base_test.go:21: Got layer IPv4, 24 bytes, payload of 24 bytes 186s base_test.go:21: Got layer IGMP, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 62 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s 186s --- PASS: TestIGMPv3MembershipReport2Records (0.00s) 186s === RUN TestGetIPOptLengthNoOpt 186s --- PASS: TestGetIPOptLengthNoOpt (0.00s) 186s === RUN TestGetIPOptLengthEndOfList 186s --- PASS: TestGetIPOptLengthEndOfList (0.00s) 186s === RUN TestGetIPOptLengthPaddingEndOfList 186s --- PASS: TestGetIPOptLengthPaddingEndOfList (0.00s) 186s === RUN TestGetIPOptLengthOptionEndOfList 186s --- PASS: TestGetIPOptLengthOptionEndOfList (0.00s) 186s === RUN TestIPOptResetDuringDecoding 186s --- PASS: TestIPOptResetDuringDecoding (0.00s) 186s === RUN TestChecksum 186s --- PASS: TestChecksum (0.00s) 186s === RUN TestIPv4InvalidOptionLength 186s --- PASS: TestIPv4InvalidOptionLength (0.00s) 186s === RUN TestIPv4Options 186s --- PASS: TestIPv4Options (0.00s) 186s === RUN TestSerializeIPv6HeaderTLVOptions 186s --- PASS: TestSerializeIPv6HeaderTLVOptions (0.00s) 186s === RUN TestPacketIPv6HopByHop0Serialize 186s --- PASS: TestPacketIPv6HopByHop0Serialize (0.00s) 186s === RUN TestPacketIPv6HopByHop0Decode 186s base_test.go:19: Checking packet layers, want [IPv6 IPv6HopByHop] 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 0 bytes 186s base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 48 bytes, truncated 186s - 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]}]}} 186s - 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]}]} 186s 186s --- PASS: TestPacketIPv6HopByHop0Decode (0.00s) 186s === RUN TestPacketIPv6Destination0Serialize 186s --- PASS: TestPacketIPv6Destination0Serialize (0.00s) 186s === RUN TestPacketIPv6Destination0Decode 186s base_test.go:19: Checking packet layers, want [IPv6 IPv6Destination] 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 8 bytes 186s base_test.go:21: Got layer IPv6Destination, 8 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 48 bytes 186s - 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} 186s - 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]}]} 186s 186s --- PASS: TestPacketIPv6Destination0Decode (0.00s) 186s === RUN TestIPv6JumbogramSerialize 186s --- PASS: TestIPv6JumbogramSerialize (0.00s) 186s === RUN TestIPv6JumbogramDecode 186s base_test.go:19: Checking packet layers, want [IPv6 IPv6HopByHop Payload] 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 65544 bytes 186s base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 65536 bytes 186s base_test.go:21: Got layer Payload, 65536 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 65584 bytes 186s - 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]}]}} 186s - 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]}]} 186s - Layer 3 (65536 bytes) = Payload 65536 byte(s) 186s 186s --- PASS: TestIPv6JumbogramDecode (0.00s) 186s === RUN TestPacketIPSecAHTransport 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 IPSecAH ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 108 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 88 bytes 186s base_test.go:21: Got layer IPSecAH, 24 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 122 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (24 bytes) = IPSecAH {Contents=[..24..] Payload=[..64..] NextHeader=ICMPv4 HeaderLength=4 ActualLength=24 Reserved=0 SPI=257 Seq=1 AuthenticationData=[..12..]} 186s - Layer 4 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=64485 Id=1560 Seq=1} 186s - Layer 5 (56 bytes) = Payload 56 byte(s) 186s 186s --- PASS: TestPacketIPSecAHTransport (0.00s) 186s === RUN TestPacketIPSecAHTunnel 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 IPSecAH IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 128 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 108 bytes 186s base_test.go:21: Got layer IPSecAH, 24 bytes, payload of 84 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 186s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 142 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (24 bytes) = IPSecAH {Contents=[..24..] Payload=[..84..] NextHeader=IPv4 HeaderLength=4 ActualLength=24 Reserved=0 SPI=257 Seq=1 AuthenticationData=[..12..]} 186s - 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=[]} 186s - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=55135 Id=31322 Seq=1} 186s - Layer 6 (56 bytes) = Payload 56 byte(s) 186s 186s --- PASS: TestPacketIPSecAHTunnel (0.00s) 186s === RUN TestPacketIPSecESP 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 IPSecESP] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 136 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 116 bytes 186s base_test.go:21: Got layer IPSecESP, 116 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 150 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (116 bytes) = IPSecESP {Contents=[..116..] Payload=[] SPI=110 Seq=19 Encrypted=[..108..]} 186s 186s --- PASS: TestPacketIPSecESP (0.00s) 186s === RUN TestLCMDecode 186s --- PASS: TestLCMDecode (0.00s) 186s === RUN TestPacketLLDP 186s base_test.go:19: Checking packet layers, want [Ethernet LinkLayerDiscovery LinkLayerDiscoveryInfo] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 222 bytes 186s base_test.go:21: Got layer LinkLayerDiscovery, 222 bytes, payload of 0 bytes 186s base_test.go:21: Got layer LinkLayerDiscoveryInfo, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 236 bytes 186s - 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} 186s - Layer 2 (222 bytes) = LinkLayerDiscovery {Contents=[..222..] Payload=[] ChassisID={ Subtype=Local ID=[..7..]} PortID={ Subtype=Local ID=[..8..]} TTL=20 Values=[..8..]} 186s - 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=[]} 186s 186s --- PASS: TestPacketLLDP (0.00s) 186s === RUN TestPacketMulticastListenerQueryMessageV1 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6 MLDv1MulticastListenerQuery] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 72 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes 186s base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 24 bytes 186s base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes 186s base_test.go:21: Got layer MLDv1MulticastListenerQuery, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 86 bytes, truncated 186s - 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} 186s - 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]}]}} 186s - 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]}]} 186s - Layer 4 (04 bytes) = ICMPv6 {Contents=[130, 0, 98, 58] Payload=[..20..] TypeCode=130(0) Checksum=25146 TypeBytes=[]} 186s - Layer 5 (00 bytes) = MLDv1MulticastListenerQuery Maximum Response Delay: 10000ms, Multicast Address: :: 186s 186s --- PASS: TestPacketMulticastListenerQueryMessageV1 (0.00s) 186s === RUN TestPacketMulticastListenerReportMessageV1 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6 MLDv1MulticastListenerReport] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 72 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes 186s base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 24 bytes 186s base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes 186s base_test.go:21: Got layer MLDv1MulticastListenerReport, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 86 bytes, truncated 186s - 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} 186s - 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]}]}} 186s - 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]}]} 186s - Layer 4 (04 bytes) = ICMPv6 {Contents=[131, 0, 98, 58] Payload=[..20..] TypeCode=131(0) Checksum=25146 TypeBytes=[]} 186s - Layer 5 (00 bytes) = MLDv1MulticastListenerReport Maximum Response Delay: 10000ms, Multicast Address: ff02::db8:1122:3344 186s 186s --- PASS: TestPacketMulticastListenerReportMessageV1 (0.00s) 186s === RUN TestPacketMulticastListenerDoneMessageV1 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6 MLDv1MulticastListenerDone] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 72 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 24 bytes 186s base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 24 bytes 186s base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 20 bytes 186s base_test.go:21: Got layer MLDv1MulticastListenerDone, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 86 bytes, truncated 186s - 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} 186s - 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]}]}} 186s - 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]}]} 186s - Layer 4 (04 bytes) = ICMPv6 {Contents=[132, 0, 98, 58] Payload=[..20..] TypeCode=132(0) Checksum=25146 TypeBytes=[]} 186s - Layer 5 (00 bytes) = MLDv1MulticastListenerDone Maximum Response Delay: 10000ms, Multicast Address: ff02::db8:1122:3344 186s 186s --- PASS: TestPacketMulticastListenerDoneMessageV1 (0.00s) 186s === RUN TestPacketMulticastListenerQueryMessageV2 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6 MLDv2MulticastListenerQuery] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 76 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 28 bytes 186s base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 28 bytes 186s base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 24 bytes 186s base_test.go:21: Got layer MLDv2MulticastListenerQuery, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 90 bytes, truncated 186s - 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} 186s - 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]}]}} 186s - 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]}]} 186s - Layer 4 (04 bytes) = ICMPv6 {Contents=[130, 0, 98, 58] Payload=[..24..] TypeCode=130(0) Checksum=25146 TypeBytes=[]} 186s - 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: [] 186s 186s --- PASS: TestPacketMulticastListenerQueryMessageV2 (0.00s) 186s === RUN TestPacketMulticastListenerReportMessageV2 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 IPv6HopByHop ICMPv6 MLDv2MulticastListenerReport] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 136 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 88 bytes 186s base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 88 bytes 186s base_test.go:21: Got layer ICMPv6, 4 bytes, payload of 84 bytes 186s base_test.go:21: Got layer MLDv2MulticastListenerReport, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 150 bytes, truncated 186s - 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} 186s - 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]}]}} 186s - 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]}]} 186s - Layer 4 (04 bytes) = ICMPv6 {Contents=[143, 0, 42, 14] Payload=[..84..] TypeCode=143(0) Checksum=10766 TypeBytes=[]} 186s - 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:[]}] 186s 186s --- PASS: TestPacketMulticastListenerReportMessageV2 (0.00s) 186s === RUN TestPacketMPLS 186s base_test.go:19: Checking packet layers, want [Ethernet MPLS MPLS IPv4 ICMPv4 Payload] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 108 bytes 186s base_test.go:21: Got layer MPLS, 4 bytes, payload of 104 bytes 186s base_test.go:21: Got layer MPLS, 4 bytes, payload of 100 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 80 bytes 186s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 72 bytes 186s base_test.go:21: Got layer Payload, 72 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 122 bytes 186s - 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} 186s - Layer 2 (04 bytes) = MPLS {Contents=[0, 1, 16, 254] Payload=[..104..] Label=17 TrafficClass=0 StackBottom=false TTL=254} 186s - Layer 3 (04 bytes) = MPLS {Contents=[0, 1, 49, 254] Payload=[..100..] Label=19 TrafficClass=0 StackBottom=true TTL=254} 186s - 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=[]} 186s - Layer 5 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..72..] TypeCode=EchoRequest Checksum=14955 Id=11 Seq=2} 186s - Layer 6 (72 bytes) = Payload 72 byte(s) 186s 186s --- PASS: TestPacketMPLS (0.00s) 186s === RUN TestNTPOne 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP NTP] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 76 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 56 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 48 bytes 186s base_test.go:21: Got layer NTP, 48 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 90 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..48..] SrcPort=123(ntp) DstPort=123(ntp) Length=56 Checksum=63698} 186s - 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=[]} 186s 186s --- PASS: TestNTPOne (0.00s) 186s === RUN TestNTPTwo 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP NTP] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 76 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 56 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 48 bytes 186s base_test.go:21: Got layer NTP, 48 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 90 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..48..] SrcPort=123(ntp) DstPort=123(ntp) Length=56 Checksum=2392} 186s - 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=[]} 186s 186s --- PASS: TestNTPTwo (0.00s) 186s === RUN TestNTPThree 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP NTP] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 76 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 56 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 48 bytes 186s base_test.go:21: Got layer NTP, 48 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 90 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..48..] SrcPort=123(ntp) DstPort=123(ntp) Length=56 Checksum=17413} 186s - 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=[]} 186s 186s --- PASS: TestNTPThree (0.00s) 186s === RUN TestNTPIsomorphism 186s --- PASS: TestNTPIsomorphism (0.00s) 186s === RUN TestPacketOSPF2Hello 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 64 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 44 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 78 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s 186s --- PASS: TestPacketOSPF2Hello (0.00s) 186s === RUN TestPacketOSPF3Hello 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 76 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 36 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 90 bytes 186s - 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} 186s - 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} 186s - 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} 186s 186s --- PASS: TestPacketOSPF3Hello (0.00s) 186s === RUN TestPacketOSPF2DBDesc 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 52 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 32 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 66 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s 186s --- PASS: TestPacketOSPF2DBDesc (0.00s) 186s === RUN TestPacketOSPF3DBDesc 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 68 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 28 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 82 bytes 186s - 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} 186s - 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} 186s - 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} 186s 186s --- PASS: TestPacketOSPF3DBDesc (0.00s) 186s === RUN TestPacketOSPF2LSRequest 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 56 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 36 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 70 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s 186s --- PASS: TestPacketOSPF2LSRequest (0.00s) 186s === RUN TestPacketOSPF3LSRequest 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 140 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 100 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 154 bytes 186s - 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} 186s - 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} 186s - 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} 186s 186s --- PASS: TestPacketOSPF3LSRequest (0.00s) 186s === RUN TestPacketOSPF2LSUpdate 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 312 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 292 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 326 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s 186s --- PASS: TestPacketOSPF2LSUpdate (0.00s) 186s === RUN TestPacketOSPF2LSUpdateLSA2 186s base_test.go:19: Checking packet layers, want [Ethernet Dot1Q IPv4 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 128 bytes 186s base_test.go:21: Got layer Dot1Q, 4 bytes, payload of 124 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 104 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 142 bytes, truncated 186s - 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} 186s - Layer 2 (04 bytes) = Dot1Q {Contents=[1, 127, 8, 0] Payload=[..124..] Priority=0 DropEligible=false VLANIdentifier=383 Type=IPv4} 186s - 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=[]} 186s - 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} 186s 186s --- PASS: TestPacketOSPF2LSUpdateLSA2 (0.00s) 186s === RUN TestPacketOSPF2LSUpdateLSA7 186s base_test.go:19: Checking packet layers, want [Ethernet Dot1Q IPv4 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 124 bytes 186s base_test.go:21: Got layer Dot1Q, 4 bytes, payload of 120 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 100 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 138 bytes, truncated 186s - 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} 186s - Layer 2 (04 bytes) = Dot1Q {Contents=[1, 127, 8, 0] Payload=[..120..] Priority=0 DropEligible=false VLANIdentifier=383 Type=IPv4} 186s - 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=[]} 186s - 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} 186s 186s --- PASS: TestPacketOSPF2LSUpdateLSA7 (0.00s) 186s === RUN TestPacketOSPF3LSUpdate 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 328 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 288 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 342 bytes 186s - 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} 186s - 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} 186s - 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} 186s 186s --- PASS: TestPacketOSPF3LSUpdate (0.00s) 186s === RUN TestPacketOSPF2LSAck 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 64 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 44 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 78 bytes 186s - 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} 186s - 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=[]} 186s - 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} 186s 186s --- PASS: TestPacketOSPF2LSAck (0.00s) 186s === RUN TestPacketOSPF3LSAck 186s base_test.go:19: Checking packet layers, want [Ethernet IPv6 OSPF] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 176 bytes 186s base_test.go:21: Got layer IPv6, 40 bytes, payload of 136 bytes 186s base_test.go:21: Got layer OSPF, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 190 bytes 186s - 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} 186s - 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} 186s - 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} 186s 186s --- PASS: TestPacketOSPF3LSAck (0.00s) 186s === RUN TestPacketOSPFInvalidLSA 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 DecodeFailure] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 83 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 63 bytes 186s base_test.go:21: Got layer DecodeFailure, 63 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 97 bytes, truncated 186s - 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} 186s - 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=[]} 186s - Layer 3 (63 bytes) = DecodeFailure Packet decoding error: Cannot parse Link State Update packet: Could not extract Link State type. 186s 186s --- PASS: TestPacketOSPFInvalidLSA (0.00s) 186s === RUN TestPacketPrism 186s base_test.go:19: Checking packet layers, want [Prism monitor mode header Dot11 Dot11MgmtProbeReq] 186s base_test.go:21: Got layer Prism monitor mode header, 144 bytes, payload of 126 bytes 186s base_test.go:21: Got layer Dot11, 24 bytes, payload of 98 bytes 186s base_test.go:21: Got layer Dot11MgmtProbeReq, 98 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 270 bytes 186s - Layer 1 (144 bytes) = Prism monitor mode header {Contents=[..144..] Payload=[..126..] Code=68 Length=144 DeviceName=ra0 - 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} 186s - Layer 3 (98 bytes) = Dot11MgmtProbeReq {Contents=[..98..] Payload=[]} 186s 186s --- PASS: TestPacketPrism (0.00s) 186s === RUN TestPacketRadiotap0 186s base_test.go:19: Checking packet layers, want [RadioTap Dot11] 186s base_test.go:21: Got layer RadioTap, 18 bytes, payload of 14 bytes 186s base_test.go:21: Got layer Dot11, 10 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 32 bytes 186s - 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=} 186s - 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} 186s 186s --- PASS: TestPacketRadiotap0 (0.00s) 186s === RUN TestPacketRadiotap1 186s base_test.go:19: Checking packet layers, want [RadioTap Dot11] 186s base_test.go:21: Got layer RadioTap, 21 bytes, payload of 28 bytes 186s base_test.go:21: Got layer Dot11, 24 bytes, payload of 0 bytes 186s base_test.go:21: Got layer Dot11DataNull, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 49 bytes 186s - 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=} 186s - 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=[]}} 186s - Layer 3 (00 bytes) = Dot11DataNull {Contents=[] Payload=[]} 186s 186s --- PASS: TestPacketRadiotap1 (0.00s) 186s === RUN TestRADIUSCode 186s === RUN TestRADIUSCode/Unknown(0) 186s === RUN TestRADIUSCode/Access-Request 186s === RUN TestRADIUSCode/Access-Accept 186s === RUN TestRADIUSCode/Access-Reject 186s === RUN TestRADIUSCode/Accounting-Request 186s === RUN TestRADIUSCode/Accounting-Response 186s === RUN TestRADIUSCode/Access-Challenge 186s === RUN TestRADIUSCode/Status-Server 186s === RUN TestRADIUSCode/Status-Client 186s === RUN TestRADIUSCode/Reserved 186s --- PASS: TestRADIUSCode (0.00s) 186s --- PASS: TestRADIUSCode/Unknown(0) (0.00s) 186s --- PASS: TestRADIUSCode/Access-Request (0.00s) 186s --- PASS: TestRADIUSCode/Access-Accept (0.00s) 186s --- PASS: TestRADIUSCode/Access-Reject (0.00s) 186s --- PASS: TestRADIUSCode/Accounting-Request (0.00s) 186s --- PASS: TestRADIUSCode/Accounting-Response (0.00s) 186s --- PASS: TestRADIUSCode/Access-Challenge (0.00s) 186s --- PASS: TestRADIUSCode/Status-Server (0.00s) 186s --- PASS: TestRADIUSCode/Status-Client (0.00s) 186s --- PASS: TestRADIUSCode/Reserved (0.00s) 186s === RUN TestRADIUSAttributeType 186s === RUN TestRADIUSAttributeType/Unknown(0) 186s === RUN TestRADIUSAttributeType/User-Name 186s === RUN TestRADIUSAttributeType/User-Password 186s === RUN TestRADIUSAttributeType/CHAP-Password 186s === RUN TestRADIUSAttributeType/NAS-IP-Address 186s === RUN TestRADIUSAttributeType/NAS-Port 186s === RUN TestRADIUSAttributeType/Service-Type 186s === RUN TestRADIUSAttributeType/Framed-Protocol 186s === RUN TestRADIUSAttributeType/Framed-IP-Address 186s === RUN TestRADIUSAttributeType/Framed-IP-Netmask 186s === RUN TestRADIUSAttributeType/Framed-Routing 186s === RUN TestRADIUSAttributeType/Filter-Id 186s === RUN TestRADIUSAttributeType/Framed-MTU 186s === RUN TestRADIUSAttributeType/Framed-Compression 186s === RUN TestRADIUSAttributeType/Login-IP-Host 186s === RUN TestRADIUSAttributeType/Login-Service 186s === RUN TestRADIUSAttributeType/Login-TCP-Port 186s === RUN TestRADIUSAttributeType/Reply-Message 186s === RUN TestRADIUSAttributeType/Callback-Number 186s === RUN TestRADIUSAttributeType/Callback-Id 186s === RUN TestRADIUSAttributeType/Framed-Route 186s === RUN TestRADIUSAttributeType/Framed-IPX-Network 186s === RUN TestRADIUSAttributeType/State 186s === RUN TestRADIUSAttributeType/Class 186s === RUN TestRADIUSAttributeType/Vendor-Specific 186s === RUN TestRADIUSAttributeType/Session-Timeout 186s === RUN TestRADIUSAttributeType/Idle-Timeout 186s === RUN TestRADIUSAttributeType/Termination-Action 186s === RUN TestRADIUSAttributeType/Called-Station-Id 186s === RUN TestRADIUSAttributeType/Calling-Station-Id 186s === RUN TestRADIUSAttributeType/NAS-Identifier 186s === RUN TestRADIUSAttributeType/Proxy-State 186s === RUN TestRADIUSAttributeType/Login-LAT-Service 186s === RUN TestRADIUSAttributeType/Login-LAT-Node 186s === RUN TestRADIUSAttributeType/Login-LAT-Group 186s === RUN TestRADIUSAttributeType/Framed-AppleTalk-Link 186s === RUN TestRADIUSAttributeType/Framed-AppleTalk-Network 186s === RUN TestRADIUSAttributeType/Framed-AppleTalk-Zone 186s === RUN TestRADIUSAttributeType/Acct-Status-Type 186s === RUN TestRADIUSAttributeType/Acct-Delay-Time 186s === RUN TestRADIUSAttributeType/Acct-Input-Octets 186s === RUN TestRADIUSAttributeType/Acct-Output-Octets 186s === RUN TestRADIUSAttributeType/Acct-Session-Id 186s === RUN TestRADIUSAttributeType/Acct-Authentic 186s === RUN TestRADIUSAttributeType/Acct-Session-Time 186s === RUN TestRADIUSAttributeType/Acct-Input-Packets 186s === RUN TestRADIUSAttributeType/Acct-Output-Packets 186s === RUN TestRADIUSAttributeType/Acct-Terminate-Cause 186s === RUN TestRADIUSAttributeType/Acct-Multi-Session-Id 186s === RUN TestRADIUSAttributeType/Acct-Link-Count 186s === RUN TestRADIUSAttributeType/Acct-Input-Gigawords 186s === RUN TestRADIUSAttributeType/Acct-Output-Gigawords 186s === RUN TestRADIUSAttributeType/Event-Timestamp 186s === RUN TestRADIUSAttributeType/CHAP-Challenge 186s === RUN TestRADIUSAttributeType/NAS-Port-Type 186s === RUN TestRADIUSAttributeType/Port-Limit 186s === RUN TestRADIUSAttributeType/Login-LAT-Port 186s === RUN TestRADIUSAttributeType/Tunnel-Type 186s === RUN TestRADIUSAttributeType/Tunnel-Medium-Type 186s === RUN TestRADIUSAttributeType/Tunnel-Client-Endpoint 186s === RUN TestRADIUSAttributeType/Tunnel-Server-Endpoint 186s === RUN TestRADIUSAttributeType/Acct-Tunnel-Connection 186s === RUN TestRADIUSAttributeType/Tunnel-Password 186s === RUN TestRADIUSAttributeType/ARAP-Password 186s === RUN TestRADIUSAttributeType/ARAP-Features 186s === RUN TestRADIUSAttributeType/ARAP-Zone-Access 186s === RUN TestRADIUSAttributeType/ARAP-Security 186s === RUN TestRADIUSAttributeType/ARAP-Security-Data 186s === RUN TestRADIUSAttributeType/Password-Retry 186s === RUN TestRADIUSAttributeType/Prompt 186s === RUN TestRADIUSAttributeType/Connect-Info 186s === RUN TestRADIUSAttributeType/Configuration-Token 186s === RUN TestRADIUSAttributeType/EAP-Message 186s === RUN TestRADIUSAttributeType/Message-Authenticator 186s === RUN TestRADIUSAttributeType/Tunnel-Private-Group-ID 186s === RUN TestRADIUSAttributeType/Tunnel-Assignment-ID 186s === RUN TestRADIUSAttributeType/Tunnel-Preference 186s === RUN TestRADIUSAttributeType/ARAP-Challenge-Response 186s === RUN TestRADIUSAttributeType/Acct-Interim-Interval 186s === RUN TestRADIUSAttributeType/Acct-Tunnel-Packets-Lost 186s === RUN TestRADIUSAttributeType/NAS-Port-Id 186s === RUN TestRADIUSAttributeType/Framed-Pool 186s === RUN TestRADIUSAttributeType/Tunnel-Client-Auth-ID 186s === RUN TestRADIUSAttributeType/Tunnel-Server-Auth-ID 186s --- PASS: TestRADIUSAttributeType (0.00s) 186s --- PASS: TestRADIUSAttributeType/Unknown(0) (0.00s) 186s --- PASS: TestRADIUSAttributeType/User-Name (0.00s) 186s --- PASS: TestRADIUSAttributeType/User-Password (0.00s) 186s --- PASS: TestRADIUSAttributeType/CHAP-Password (0.00s) 186s --- PASS: TestRADIUSAttributeType/NAS-IP-Address (0.00s) 186s --- PASS: TestRADIUSAttributeType/NAS-Port (0.00s) 186s --- PASS: TestRADIUSAttributeType/Service-Type (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-Protocol (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-IP-Address (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-IP-Netmask (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-Routing (0.00s) 186s --- PASS: TestRADIUSAttributeType/Filter-Id (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-MTU (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-Compression (0.00s) 186s --- PASS: TestRADIUSAttributeType/Login-IP-Host (0.00s) 186s --- PASS: TestRADIUSAttributeType/Login-Service (0.00s) 186s --- PASS: TestRADIUSAttributeType/Login-TCP-Port (0.00s) 186s --- PASS: TestRADIUSAttributeType/Reply-Message (0.00s) 186s --- PASS: TestRADIUSAttributeType/Callback-Number (0.00s) 186s --- PASS: TestRADIUSAttributeType/Callback-Id (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-Route (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-IPX-Network (0.00s) 186s --- PASS: TestRADIUSAttributeType/State (0.00s) 186s --- PASS: TestRADIUSAttributeType/Class (0.00s) 186s --- PASS: TestRADIUSAttributeType/Vendor-Specific (0.00s) 186s --- PASS: TestRADIUSAttributeType/Session-Timeout (0.00s) 186s --- PASS: TestRADIUSAttributeType/Idle-Timeout (0.00s) 186s --- PASS: TestRADIUSAttributeType/Termination-Action (0.00s) 186s --- PASS: TestRADIUSAttributeType/Called-Station-Id (0.00s) 186s --- PASS: TestRADIUSAttributeType/Calling-Station-Id (0.00s) 186s --- PASS: TestRADIUSAttributeType/NAS-Identifier (0.00s) 186s --- PASS: TestRADIUSAttributeType/Proxy-State (0.00s) 186s --- PASS: TestRADIUSAttributeType/Login-LAT-Service (0.00s) 186s --- PASS: TestRADIUSAttributeType/Login-LAT-Node (0.00s) 186s --- PASS: TestRADIUSAttributeType/Login-LAT-Group (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-AppleTalk-Link (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-AppleTalk-Network (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-AppleTalk-Zone (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Status-Type (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Delay-Time (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Input-Octets (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Output-Octets (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Session-Id (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Authentic (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Session-Time (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Input-Packets (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Output-Packets (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Terminate-Cause (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Multi-Session-Id (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Link-Count (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Input-Gigawords (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Output-Gigawords (0.00s) 186s --- PASS: TestRADIUSAttributeType/Event-Timestamp (0.00s) 186s --- PASS: TestRADIUSAttributeType/CHAP-Challenge (0.00s) 186s --- PASS: TestRADIUSAttributeType/NAS-Port-Type (0.00s) 186s --- PASS: TestRADIUSAttributeType/Port-Limit (0.00s) 186s --- PASS: TestRADIUSAttributeType/Login-LAT-Port (0.00s) 186s --- PASS: TestRADIUSAttributeType/Tunnel-Type (0.00s) 186s --- PASS: TestRADIUSAttributeType/Tunnel-Medium-Type (0.00s) 186s --- PASS: TestRADIUSAttributeType/Tunnel-Client-Endpoint (0.00s) 186s --- PASS: TestRADIUSAttributeType/Tunnel-Server-Endpoint (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Tunnel-Connection (0.00s) 186s --- PASS: TestRADIUSAttributeType/Tunnel-Password (0.00s) 186s --- PASS: TestRADIUSAttributeType/ARAP-Password (0.00s) 186s --- PASS: TestRADIUSAttributeType/ARAP-Features (0.00s) 186s --- PASS: TestRADIUSAttributeType/ARAP-Zone-Access (0.00s) 186s --- PASS: TestRADIUSAttributeType/ARAP-Security (0.00s) 186s --- PASS: TestRADIUSAttributeType/ARAP-Security-Data (0.00s) 186s --- PASS: TestRADIUSAttributeType/Password-Retry (0.00s) 186s --- PASS: TestRADIUSAttributeType/Prompt (0.00s) 186s --- PASS: TestRADIUSAttributeType/Connect-Info (0.00s) 186s --- PASS: TestRADIUSAttributeType/Configuration-Token (0.00s) 186s --- PASS: TestRADIUSAttributeType/EAP-Message (0.00s) 186s --- PASS: TestRADIUSAttributeType/Message-Authenticator (0.00s) 186s --- PASS: TestRADIUSAttributeType/Tunnel-Private-Group-ID (0.00s) 186s --- PASS: TestRADIUSAttributeType/Tunnel-Assignment-ID (0.00s) 186s --- PASS: TestRADIUSAttributeType/Tunnel-Preference (0.00s) 186s --- PASS: TestRADIUSAttributeType/ARAP-Challenge-Response (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Interim-Interval (0.00s) 186s --- PASS: TestRADIUSAttributeType/Acct-Tunnel-Packets-Lost (0.00s) 186s --- PASS: TestRADIUSAttributeType/NAS-Port-Id (0.00s) 186s --- PASS: TestRADIUSAttributeType/Framed-Pool (0.00s) 186s --- PASS: TestRADIUSAttributeType/Tunnel-Client-Auth-ID (0.00s) 186s --- PASS: TestRADIUSAttributeType/Tunnel-Server-Auth-ID (0.00s) 186s === RUN TestRADIUSRecordSize 186s === RUN TestRADIUSRecordSize/Minimum-1 186s === RUN TestRADIUSRecordSize/Maximum+1 186s --- PASS: TestRADIUSRecordSize (0.00s) 186s --- PASS: TestRADIUSRecordSize/Minimum-1 (0.00s) 186s --- PASS: TestRADIUSRecordSize/Maximum+1 (0.00s) 186s === RUN TestRADIUSLengthField 186s === RUN TestRADIUSLengthField/Minimum-1 186s === RUN TestRADIUSLengthField/Minimum+1 186s === RUN TestRADIUSLengthField/Maximum-1 186s === RUN TestRADIUSLengthField/Maximum+1 186s --- PASS: TestRADIUSLengthField (0.00s) 186s --- PASS: TestRADIUSLengthField/Minimum-1 (0.00s) 186s --- PASS: TestRADIUSLengthField/Minimum+1 (0.00s) 186s --- PASS: TestRADIUSLengthField/Maximum-1 (0.00s) 186s --- PASS: TestRADIUSLengthField/Maximum+1 (0.00s) 186s === RUN TestRADIUSAttributesLengthField 186s === RUN TestRADIUSAttributesLengthField/Minimum-1 186s === RUN TestRADIUSAttributesLengthField/Minimum-1#01 186s === RUN TestRADIUSAttributesLengthField/Minimum+1 186s === RUN TestRADIUSAttributesLengthField/Minimum+1#01 186s --- PASS: TestRADIUSAttributesLengthField (0.00s) 186s --- PASS: TestRADIUSAttributesLengthField/Minimum-1 (0.00s) 186s --- PASS: TestRADIUSAttributesLengthField/Minimum-1#01 (0.00s) 186s --- PASS: TestRADIUSAttributesLengthField/Minimum+1 (0.00s) 186s --- PASS: TestRADIUSAttributesLengthField/Minimum+1#01 (0.00s) 186s === RUN TestRADIUSAccessRequest 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP RADIUS] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 103 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 83 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 75 bytes 186s base_test.go:21: Got layer RADIUS, 75 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 117 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..75..] SrcPort=55337 DstPort=1812(radius) Length=83 Checksum=22672} 186s - 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..]} 186s 186s --- PASS: TestRADIUSAccessRequest (0.00s) 186s === RUN TestRADIUSAccessAccept 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP RADIUS] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 48 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 28 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 20 bytes 186s base_test.go:21: Got layer RADIUS, 20 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 62 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..20..] SrcPort=1812(radius) DstPort=55337 Length=28 Checksum=22617} 186s - 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=[]} 186s 186s --- PASS: TestRADIUSAccessAccept (0.00s) 186s === RUN TestRMCPDecodeFromBytes 186s --- PASS: TestRMCPDecodeFromBytes (0.00s) 186s === RUN TestRMCPTestSerializeTo 186s --- PASS: TestRMCPTestSerializeTo (0.00s) 186s === RUN TestDecodeUDPSFlow 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP SFlow] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 1468 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 1448 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 1440 bytes 186s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 1482 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..1440..] SrcPort=51031 DstPort=6343(sflow) Length=1448 Checksum=8763} 186s - 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}]}]} 186s 186s --- PASS: TestDecodeUDPSFlow (0.00s) 186s === RUN TestDecodeSFlowDatagram 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP SFlow] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 1468 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 1448 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 1440 bytes 186s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 1482 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..1440..] SrcPort=51031 DstPort=6343(sflow) Length=1448 Checksum=8763} 186s - 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}]}]} 186s 186s --- PASS: TestDecodeSFlowDatagram (0.00s) 186s === RUN TestPacketPacket0 186s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP SFlow] 186s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 1160 bytes 186s base_test.go:21: Got layer IPv4, 20 bytes, payload of 1140 bytes 186s base_test.go:21: Got layer UDP, 8 bytes, payload of 1132 bytes 186s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 1174 bytes 186s - 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} 186s - 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=[]} 186s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..1132..] SrcPort=56504 DstPort=6343(sflow) Length=1140 Checksum=648} 186s - 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 186s - 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} 186s - 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=[]} 186s - 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=[]} 186s }]}, {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 186s - 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} 186s - 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=[]} 186s - 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=[]} 186s - Layer 4 (62 bytes) = Payload 62 byte(s) 186s }]}, {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 186s - 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} 186s - 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=[]} 186s - 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=[]} 186s }]}] CounterSamples=[]} 186s 186s --- PASS: TestPacketPacket0 (0.00s) 186s === RUN TestDecodeProcessorCounter 186s base_test.go:19: Checking packet layers, want [SFlow] 186s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 88 bytes 186s - 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}]}]} 186s 186s --- PASS: TestDecodeProcessorCounter (0.00s) 186s === RUN TestDecodeExtendedSwitchFlow 186s base_test.go:19: Checking packet layers, want [SFlow] 186s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 92 bytes 186s - 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=[]} 186s 186s --- PASS: TestDecodeExtendedSwitchFlow (0.00s) 186s === RUN TestDecodeExtendedRouterFlow 186s base_test.go:19: Checking packet layers, want [SFlow] 186s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 92 bytes 186s - 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=[]} 186s 186s --- PASS: TestDecodeExtendedRouterFlow (0.00s) 186s === RUN TestDecodeExtendedRouterFlowIPv6 186s base_test.go:19: Checking packet layers, want [SFlow] 186s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 104 bytes 186s - 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=[]} 186s 186s --- PASS: TestDecodeExtendedRouterFlowIPv6 (0.00s) 186s === RUN TestDecodeExtendedIpv4TunnelIngressFlow 186s base_test.go:19: Checking packet layers, want [SFlow] 186s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 108 bytes 186s - 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=[]} 186s 186s --- PASS: TestDecodeExtendedIpv4TunnelIngressFlow (0.00s) 186s === RUN TestDecodeExtendedIpv4TunnelEgressFlow 186s base_test.go:19: Checking packet layers, want [SFlow] 186s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 108 bytes 186s - 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=[]} 186s 186s --- PASS: TestDecodeExtendedIpv4TunnelEgressFlow (0.00s) 186s === RUN TestDecodeEthernetFrameFlow 186s base_test.go:19: Checking packet layers, want [SFlow] 186s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 532 bytes 186s - 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=[]} 186s 186s --- PASS: TestDecodeEthernetFrameFlow (0.00s) 186s === RUN TestDecodePortnameCounter 186s base_test.go:19: Checking packet layers, want [SFlow] 186s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 186s base_test.go:24: PACKET: 252 bytes 187s - 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}]}]} 187s 187s --- PASS: TestDecodePortnameCounter (0.00s) 187s === RUN TestDecodeVLANCounter 187s base_test.go:19: Checking packet layers, want [SFlow] 187s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 88 bytes 187s - 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}]}]} 187s 187s --- PASS: TestDecodeVLANCounter (0.00s) 187s === RUN TestDecodeLACPCounter 187s base_test.go:19: Checking packet layers, want [SFlow] 187s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 112 bytes 187s - 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}]}]} 187s 187s --- PASS: TestDecodeLACPCounter (0.00s) 187s === RUN TestDecodeOpenflowCounter 187s base_test.go:19: Checking packet layers, want [SFlow] 187s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 244 bytes 187s - 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}]}]} 187s 187s --- PASS: TestDecodeOpenflowCounter (0.00s) 187s === RUN TestDecodeAppResourcesOvsdbCounter 187s base_test.go:19: Checking packet layers, want [SFlow] 187s base_test.go:21: Got layer SFlow, 0 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 128 bytes 187s - 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}]}]} 187s 187s --- PASS: TestDecodeAppResourcesOvsdbCounter (0.00s) 187s === RUN TestSIPMain 187s --- PASS: TestSIPMain (0.00s) 187s === RUN TestTCPOptionKindString 187s --- PASS: TestTCPOptionKindString (0.00s) 187s === RUN TestTCPSerializePadding 187s --- PASS: TestTCPSerializePadding (0.00s) 187s === RUN TestPacketTCPOptionDecode 187s --- PASS: TestPacketTCPOptionDecode (0.00s) 187s === RUN TestIPv4UDPChecksum 187s base_test.go:19: Checking packet layers, want [IPv4 UDP] 187s base_test.go:21: Got layer IPv4, 20 bytes, payload of 8 bytes 187s base_test.go:21: Got layer UDP, 8 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 28 bytes 187s - 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=[]} 187s - Layer 2 (08 bytes) = UDP {Contents=[..8..] Payload=[] SrcPort=12345(italk) DstPort=9999(distinct) Length=8 Checksum=48223} 187s 187s --- PASS: TestIPv4UDPChecksum (0.00s) 187s === RUN TestIPv6UDPChecksumWithIPv6DstOpts 187s base_test.go:19: Checking packet layers, want [IPv6 IPv6Destination UDP] 187s base_test.go:21: Got layer IPv6, 40 bytes, payload of 16 bytes 187s base_test.go:21: Got layer IPv6Destination, 8 bytes, payload of 8 bytes 187s base_test.go:21: Got layer UDP, 8 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 56 bytes 187s - 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} 187s - 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]}]} 187s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[] SrcPort=12345(italk) DstPort=9999(distinct) Length=8 Checksum=19745} 187s 187s --- PASS: TestIPv6UDPChecksumWithIPv6DstOpts (0.00s) 187s === RUN TestIPv6JumbogramUDPChecksum 187s base_test.go:19: Checking packet layers, want [IPv6 IPv6HopByHop UDP Payload] 187s base_test.go:21: Got layer IPv6, 40 bytes, payload of 65552 bytes 187s base_test.go:21: Got layer IPv6HopByHop, 8 bytes, payload of 65544 bytes 187s base_test.go:21: Got layer UDP, 8 bytes, payload of 65536 bytes 187s base_test.go:21: Got layer Payload, 65536 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 65592 bytes 187s - 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]}]}} 187s - 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]}]} 187s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..65536..] SrcPort=12345(italk) DstPort=9999(distinct) Length=0 Checksum=52648} 187s - Layer 4 (65536 bytes) = Payload 65536 byte(s) 187s 187s --- PASS: TestIPv6JumbogramUDPChecksum (0.00s) 187s === RUN TestParseTLSClientHello 187s base_test.go:19: Checking packet layers, want [Ethernet IPv4 TCP TLS] 187s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 254 bytes 187s base_test.go:21: Got layer IPv4, 20 bytes, payload of 234 bytes 187s base_test.go:21: Got layer TCP, 20 bytes, payload of 214 bytes 187s base_test.go:21: Got layer TLS, 214 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 268 bytes 187s - 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} 187s - 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=[]} 187s - 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=[]} 187s - Layer 4 (214 bytes) = TLS {Contents=[..214..] Payload=[] ChangeCipherSpec=[] Handshake=[{ContentType=Handshake Version=TLS 1.0 Length=209}] AppData=[] Alert=[]} 187s 187s --- PASS: TestParseTLSClientHello (0.00s) 187s === RUN TestTLSClientHelloDecodeFromBytes 187s --- PASS: TestTLSClientHelloDecodeFromBytes (0.00s) 187s === RUN TestParseTLSChangeCipherSpec 187s base_test.go:19: Checking packet layers, want [TLS] 187s base_test.go:21: Got layer TLS, 53 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 134 bytes 187s - 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=[]} 187s 187s --- PASS: TestParseTLSChangeCipherSpec (0.00s) 187s === RUN TestParseTLSAppData 187s base_test.go:19: Checking packet layers, want [TLS] 187s base_test.go:21: Got layer TLS, 37 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 74 bytes 187s - 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=[]} 187s 187s --- PASS: TestParseTLSAppData (0.00s) 187s === RUN TestSerializeTLSAppData 187s base_test.go:19: Checking packet layers, want [TLS] 187s base_test.go:21: Got layer TLS, 37 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 74 bytes 187s - 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=[]} 187s 187s --- PASS: TestSerializeTLSAppData (0.00s) 187s === RUN TestParseTLSMalformed 187s --- PASS: TestParseTLSMalformed (0.00s) 187s === RUN TestParseTLSTooShort 187s --- PASS: TestParseTLSTooShort (0.00s) 187s === RUN TestParseTLSLengthMismatch 187s --- PASS: TestParseTLSLengthMismatch (0.00s) 187s === RUN TestParseTLSAlertEncrypted 187s base_test.go:19: Checking packet layers, want [TLS] 187s base_test.go:21: Got layer TLS, 37 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 37 bytes 187s - 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..]}]} 187s 187s --- PASS: TestParseTLSAlertEncrypted (0.00s) 187s === RUN TestSerializeTLSAlertEncrypted 187s base_test.go:19: Checking packet layers, want [TLS] 187s base_test.go:21: Got layer TLS, 37 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 37 bytes 187s - 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..]}]} 187s 187s --- PASS: TestSerializeTLSAlertEncrypted (0.00s) 187s === RUN TestUDPPacketDNS 187s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] 187s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 230 bytes 187s base_test.go:21: Got layer IPv4, 20 bytes, payload of 210 bytes 187s base_test.go:21: Got layer UDP, 8 bytes, payload of 202 bytes 187s base_test.go:21: Got layer DNS, 202 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 244 bytes 187s - 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} 187s - 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=[]} 187s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..202..] SrcPort=53(domain) DstPort=35181 Length=210 Checksum=30026} 187s - 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=[]} 187s 187s --- PASS: TestUDPPacketDNS (0.00s) 187s === RUN TestDNSQueryA 187s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] 187s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 60 bytes 187s base_test.go:21: Got layer IPv4, 20 bytes, payload of 40 bytes 187s base_test.go:21: Got layer UDP, 8 bytes, payload of 32 bytes 187s base_test.go:21: Got layer DNS, 32 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 74 bytes 187s - 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} 187s - 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=[]} 187s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..32..] SrcPort=49973 DstPort=53(domain) Length=40 Checksum=30162} 187s - 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=[]} 187s 187s --- PASS: TestDNSQueryA (0.00s) 187s === RUN TestDNSRRA 187s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] 187s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 292 bytes 187s base_test.go:21: Got layer IPv4, 20 bytes, payload of 272 bytes 187s base_test.go:21: Got layer UDP, 8 bytes, payload of 264 bytes 187s base_test.go:21: Got layer DNS, 264 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 306 bytes 187s - 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} 187s - 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=[]} 187s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..264..] SrcPort=53(domain) DstPort=49973 Length=272 Checksum=30394} 187s - 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=[]}]} 187s 187s --- PASS: TestDNSRRA (0.00s) 187s === RUN TestDNSAAAA 187s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] 187s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 224 bytes 187s base_test.go:21: Got layer IPv4, 20 bytes, payload of 204 bytes 187s base_test.go:21: Got layer UDP, 8 bytes, payload of 196 bytes 187s base_test.go:21: Got layer DNS, 196 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 238 bytes 187s - 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} 187s - 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=[]} 187s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..196..] SrcPort=53(domain) DstPort=56083 Length=204 Checksum=30326} 187s - 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=[]}]} 187s 187s --- PASS: TestDNSAAAA (0.00s) 187s === RUN TestDNSMXSOA 187s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP DNS] 187s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 110 bytes 187s base_test.go:21: Got layer IPv4, 20 bytes, payload of 90 bytes 187s base_test.go:21: Got layer UDP, 8 bytes, payload of 82 bytes 187s base_test.go:21: Got layer DNS, 82 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 124 bytes 187s - 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} 187s - 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=[]} 187s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..82..] SrcPort=53(domain) DstPort=40032 Length=90 Checksum=30212} 187s - 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=[]} 187s 187s --- PASS: TestDNSMXSOA (0.00s) 187s === RUN TestDNSDoesNotMalloc 187s --- PASS: TestDNSDoesNotMalloc (0.00s) 187s === RUN TestPacketUSB0 187s base_test.go:19: Checking packet layers, want [USB USBInterrupt] 187s base_test.go:21: Got layer USB, 40 bytes, payload of 1 bytes 187s base_test.go:21: Got layer USBInterrupt, 1 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 65 bytes 187s - 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} 187s - Layer 2 (01 bytes) = USBInterrupt {Contents=[4] Payload=[]} 187s 187s --- PASS: TestPacketUSB0 (0.00s) 187s === RUN TestVRRPPacketPacket0 187s base_test.go:19: Checking packet layers, want [Ethernet IPv4 VRRP] 187s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 46 bytes 187s base_test.go:21: Got layer IPv4, 20 bytes, payload of 20 bytes 187s base_test.go:21: Got layer VRRP, 20 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 60 bytes 187s - 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} 187s - 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=[]} 187s - 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]} 187s 187s --- PASS: TestVRRPPacketPacket0 (0.00s) 187s === RUN TestPacketVXLAN 187s base_test.go:19: Checking packet layers, want [Ethernet IPv4 UDP VXLAN Ethernet IPv4 ICMPv4 Payload] 187s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 134 bytes 187s base_test.go:21: Got layer IPv4, 20 bytes, payload of 114 bytes 187s base_test.go:21: Got layer UDP, 8 bytes, payload of 106 bytes 187s base_test.go:21: Got layer VXLAN, 8 bytes, payload of 98 bytes 187s base_test.go:21: Got layer Ethernet, 14 bytes, payload of 84 bytes 187s base_test.go:21: Got layer IPv4, 20 bytes, payload of 64 bytes 187s base_test.go:21: Got layer ICMPv4, 8 bytes, payload of 56 bytes 187s base_test.go:21: Got layer Payload, 56 bytes, payload of 0 bytes 187s base_test.go:24: PACKET: 148 bytes 187s - 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} 187s - 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=[]} 187s - Layer 3 (08 bytes) = UDP {Contents=[..8..] Payload=[..106..] SrcPort=45149 DstPort=4789(vxlan) Length=114 Checksum=0} 187s - Layer 4 (08 bytes) = VXLAN {Contents=[..8..] Payload=[..98..] ValidIDFlag=true VNI=255 GBPExtension=false GBPDontLearn=false GBPApplied=false GBPGroupPolicyID=0} 187s - 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} 187s - 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=[]} 187s - Layer 7 (08 bytes) = ICMPv4 {Contents=[..8..] Payload=[..56..] TypeCode=EchoRequest Checksum=63218 Id=1292 Seq=1} 187s - Layer 8 (56 bytes) = Payload 56 byte(s) 187s 187s --- PASS: TestPacketVXLAN (0.00s) 187s === RUN TestIsomorphicPacketVXLAN 187s --- PASS: TestIsomorphicPacketVXLAN (0.00s) 187s PASS 187s ok github.com/google/gopacket/layers 0.272s 187s testing: warning: no tests to run 187s PASS 187s ok github.com/google/gopacket/macs 0.037s [no tests to run] 188s === RUN TestPcapNonexistentFile 188s pcap_test.go:26: Error returned for nonexistent file: /path/to/nonexistent/file: No such file or directory 188s --- PASS: TestPcapNonexistentFile (0.02s) 188s === RUN TestPcapFileRead 188s pcap_test.go:86: 188s 188s 188s 188s Processing file test_loopback.pcap 188s 188s 188s 188s pcap_test.go:110: -- FULL PACKET DATA (560 bytes) ------------------------------------ 188s 00000000 1e 00 00 00 60 00 00 00 02 04 06 40 00 00 00 00 |....`......@....| 188s 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 |................| 188s 00000020 00 00 00 00 00 00 00 00 00 00 00 01 e5 af 1f 90 |................| 188s 00000030 08 97 16 66 0a 65 66 ef 80 18 28 e9 02 0c 00 00 |...f.ef...(.....| 188s 00000040 01 01 08 0a 05 c0 8c fc 05 c0 38 8c 47 45 54 20 |..........8.GET | 188s 00000050 2f 70 6b 67 2f 67 69 74 68 75 62 2e 63 6f 6d 2f |/pkg/github.com/| 188s 00000060 67 63 6f 6e 6e 65 6c 6c 2f 67 6f 70 61 63 6b 65 |gconnell/gopacke| 188s 00000070 74 2f 20 48 54 54 50 2f 31 2e 31 0d 0a 48 6f 73 |t/ HTTP/1.1..Hos| 188s 00000080 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 3a 38 30 38 |t: localhost:808| 188s 00000090 30 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b |0..Connection: k| 188s 000000a0 65 65 70 2d 61 6c 69 76 65 0d 0a 43 61 63 68 65 |eep-alive..Cache| 188s 000000b0 2d 43 6f 6e 74 72 6f 6c 3a 20 6d 61 78 2d 61 67 |-Control: max-ag| 188s 000000c0 65 3d 30 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a |e=0..User-Agent:| 188s 000000d0 20 4d 6f 7a 69 6c 6c 61 2f 35 2e 30 20 28 4d 61 | Mozilla/5.0 (Ma| 188s 000000e0 63 69 6e 74 6f 73 68 3b 20 49 6e 74 65 6c 20 4d |cintosh; Intel M| 188s 000000f0 61 63 20 4f 53 20 58 20 31 30 5f 38 5f 32 29 20 |ac OS X 10_8_2) | 188s 00000100 41 70 70 6c 65 57 65 62 4b 69 74 2f 35 33 37 2e |AppleWebKit/537.| 188s 00000110 31 31 20 28 4b 48 54 4d 4c 2c 20 6c 69 6b 65 20 |11 (KHTML, like | 188s 00000120 47 65 63 6b 6f 29 20 43 68 72 6f 6d 65 2f 32 33 |Gecko) Chrome/23| 188s 00000130 2e 30 2e 31 32 37 31 2e 31 30 31 20 53 61 66 61 |.0.1271.101 Safa| 188s 00000140 72 69 2f 35 33 37 2e 31 31 0d 0a 41 63 63 65 70 |ri/537.11..Accep| 188s 00000150 74 3a 20 74 65 78 74 2f 68 74 6d 6c 2c 61 70 70 |t: text/html,app| 188s 00000160 6c 69 63 61 74 69 6f 6e 2f 78 68 74 6d 6c 2b 78 |lication/xhtml+x| 188s 00000170 6d 6c 2c 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 |ml,application/x| 188s 00000180 6d 6c 3b 71 3d 30 2e 39 2c 2a 2f 2a 3b 71 3d 30 |ml;q=0.9,*/*;q=0| 188s 00000190 2e 38 0d 0a 52 65 66 65 72 65 72 3a 20 68 74 74 |.8..Referer: htt| 188s 000001a0 70 3a 2f 2f 6c 6f 63 61 6c 68 6f 73 74 3a 38 30 |p://localhost:80| 188s 000001b0 38 30 2f 70 6b 67 2f 0d 0a 41 63 63 65 70 74 2d |80/pkg/..Accept-| 188s 000001c0 45 6e 63 6f 64 69 6e 67 3a 20 67 7a 69 70 2c 64 |Encoding: gzip,d| 188s 000001d0 65 66 6c 61 74 65 2c 73 64 63 68 0d 0a 41 63 63 |eflate,sdch..Acc| 188s 000001e0 65 70 74 2d 4c 61 6e 67 75 61 67 65 3a 20 65 6e |ept-Language: en| 188s 000001f0 2d 55 53 2c 65 6e 3b 71 3d 30 2e 38 0d 0a 41 63 |-US,en;q=0.8..Ac| 188s 00000200 63 65 70 74 2d 43 68 61 72 73 65 74 3a 20 49 53 |cept-Charset: IS| 188s 00000210 4f 2d 38 38 35 39 2d 31 2c 75 74 66 2d 38 3b 71 |O-8859-1,utf-8;q| 188s 00000220 3d 30 2e 37 2c 2a 3b 71 3d 30 2e 33 0d 0a 0d 0a |=0.7,*;q=0.3....| 188s --- Layer 1 --- 188s Loopback {Contents=[30, 0, 0, 0] Payload=[..556..] Family=IPv6} 188s 00000000 1e 00 00 00 |....| 188s --- Layer 2 --- 188s IPv6 {Contents=[..40..] Payload=[..516..] Version=6 TrafficClass=0 FlowLabel=0 Length=516 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 188s 00000000 60 00 00 00 02 04 06 40 00 00 00 00 00 00 00 00 |`......@........| 188s 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 188s 00000020 00 00 00 00 00 00 00 01 |........| 188s --- Layer 3 --- 188s 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=[]} 188s 00000000 e5 af 1f 90 08 97 16 66 0a 65 66 ef 80 18 28 e9 |.......f.ef...(.| 188s 00000010 02 0c 00 00 01 01 08 0a 05 c0 8c fc 05 c0 38 8c |..............8.| 188s --- Layer 4 --- 188s Payload 484 byte(s) 188s 00000000 47 45 54 20 2f 70 6b 67 2f 67 69 74 68 75 62 2e |GET /pkg/github.| 188s 00000010 63 6f 6d 2f 67 63 6f 6e 6e 65 6c 6c 2f 67 6f 70 |com/gconnell/gop| 188s 00000020 61 63 6b 65 74 2f 20 48 54 54 50 2f 31 2e 31 0d |acket/ HTTP/1.1.| 188s 00000030 0a 48 6f 73 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 |.Host: localhost| 188s 00000040 3a 38 30 38 30 0d 0a 43 6f 6e 6e 65 63 74 69 6f |:8080..Connectio| 188s 00000050 6e 3a 20 6b 65 65 70 2d 61 6c 69 76 65 0d 0a 43 |n: keep-alive..C| 188s 00000060 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 6d 61 |ache-Control: ma| 188s 00000070 78 2d 61 67 65 3d 30 0d 0a 55 73 65 72 2d 41 67 |x-age=0..User-Ag| 188s 00000080 65 6e 74 3a 20 4d 6f 7a 69 6c 6c 61 2f 35 2e 30 |ent: Mozilla/5.0| 188s 00000090 20 28 4d 61 63 69 6e 74 6f 73 68 3b 20 49 6e 74 | (Macintosh; Int| 188s 000000a0 65 6c 20 4d 61 63 20 4f 53 20 58 20 31 30 5f 38 |el Mac OS X 10_8| 188s 000000b0 5f 32 29 20 41 70 70 6c 65 57 65 62 4b 69 74 2f |_2) AppleWebKit/| 188s 000000c0 35 33 37 2e 31 31 20 28 4b 48 54 4d 4c 2c 20 6c |537.11 (KHTML, l| 188s 000000d0 69 6b 65 20 47 65 63 6b 6f 29 20 43 68 72 6f 6d |ike Gecko) Chrom| 188s 000000e0 65 2f 32 33 2e 30 2e 31 32 37 31 2e 31 30 31 20 |e/23.0.1271.101 | 188s 000000f0 53 61 66 61 72 69 2f 35 33 37 2e 31 31 0d 0a 41 |Safari/537.11..A| 188s 00000100 63 63 65 70 74 3a 20 74 65 78 74 2f 68 74 6d 6c |ccept: text/html| 188s 00000110 2c 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 68 74 |,application/xht| 188s 00000120 6d 6c 2b 78 6d 6c 2c 61 70 70 6c 69 63 61 74 69 |ml+xml,applicati| 188s 00000130 6f 6e 2f 78 6d 6c 3b 71 3d 30 2e 39 2c 2a 2f 2a |on/xml;q=0.9,*/*| 188s 00000140 3b 71 3d 30 2e 38 0d 0a 52 65 66 65 72 65 72 3a |;q=0.8..Referer:| 188s 00000150 20 68 74 74 70 3a 2f 2f 6c 6f 63 61 6c 68 6f 73 | http://localhos| 188s 00000160 74 3a 38 30 38 30 2f 70 6b 67 2f 0d 0a 41 63 63 |t:8080/pkg/..Acc| 188s 00000170 65 70 74 2d 45 6e 63 6f 64 69 6e 67 3a 20 67 7a |ept-Encoding: gz| 188s 00000180 69 70 2c 64 65 66 6c 61 74 65 2c 73 64 63 68 0d |ip,deflate,sdch.| 188s 00000190 0a 41 63 63 65 70 74 2d 4c 61 6e 67 75 61 67 65 |.Accept-Language| 188s 000001a0 3a 20 65 6e 2d 55 53 2c 65 6e 3b 71 3d 30 2e 38 |: en-US,en;q=0.8| 188s 000001b0 0d 0a 41 63 63 65 70 74 2d 43 68 61 72 73 65 74 |..Accept-Charset| 188s 000001c0 3a 20 49 53 4f 2d 38 38 35 39 2d 31 2c 75 74 66 |: ISO-8859-1,utf| 188s 000001d0 2d 38 3b 71 3d 30 2e 37 2c 2a 3b 71 3d 30 2e 33 |-8;q=0.7,*;q=0.3| 188s 000001e0 0d 0a 0d 0a |....| 188s 188s pcap_test.go:110: -- FULL PACKET DATA (76 bytes) ------------------------------------ 188s 00000000 1e 00 00 00 60 01 88 91 00 20 06 40 00 00 00 00 |....`.... .@....| 188s 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 |................| 188s 00000020 00 00 00 00 00 00 00 00 00 00 00 01 1f 90 e5 af |................| 188s 00000030 0a 65 66 ef 08 97 18 4a 80 10 23 02 00 28 00 00 |.ef....J..#..(..| 188s 00000040 01 01 08 0a 05 c0 8c fc 05 c0 8c fc |............| 188s --- Layer 1 --- 188s Loopback {Contents=[30, 0, 0, 0] Payload=[..72..] Family=IPv6} 188s 00000000 1e 00 00 00 |....| 188s --- Layer 2 --- 188s IPv6 {Contents=[..40..] Payload=[..32..] Version=6 TrafficClass=0 FlowLabel=100497 Length=32 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 188s 00000000 60 01 88 91 00 20 06 40 00 00 00 00 00 00 00 00 |`.... .@........| 188s 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 188s 00000020 00 00 00 00 00 00 00 01 |........| 188s --- Layer 3 --- 188s 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=[]} 188s 00000000 1f 90 e5 af 0a 65 66 ef 08 97 18 4a 80 10 23 02 |.....ef....J..#.| 188s 00000010 00 28 00 00 01 01 08 0a 05 c0 8c fc 05 c0 8c fc |.(..............| 188s 188s pcap_test.go:110: -- FULL PACKET DATA (4172 bytes) ------------------------------------ 188s 00000000 1e 00 00 00 60 01 88 91 10 20 06 40 00 00 00 00 |....`.... .@....| 188s 00000010 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 |................| 188s 00000020 00 00 00 00 00 00 00 00 00 00 00 01 1f 90 e5 af |................| 188s 00000030 0a 65 66 ef 08 97 18 4a 80 18 23 02 10 28 00 00 |.ef....J..#..(..| 188s 00000040 01 01 08 0a 05 c0 8d b6 05 c0 8c fc 48 54 54 50 |............HTTP| 188s 00000050 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 44 61 74 |/1.1 200 OK..Dat| 188s 00000060 65 3a 20 53 75 6e 2c 20 30 36 20 4a 61 6e 20 32 |e: Sun, 06 Jan 2| 188s 00000070 30 31 33 20 31 37 3a 32 32 3a 33 32 20 47 4d 54 |013 17:22:32 GMT| 188s 00000080 0d 0a 54 72 61 6e 73 66 65 72 2d 45 6e 63 6f 64 |..Transfer-Encod| 188s 00000090 69 6e 67 3a 20 63 68 75 6e 6b 65 64 0d 0a 43 6f |ing: chunked..Co| 188s 000000a0 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 |ntent-Type: text| 188s 000000b0 2f 68 74 6d 6c 3b 20 63 68 61 72 73 65 74 3d 75 |/html; charset=u| 188s 000000c0 74 66 2d 38 0d 0a 0d 0a 32 30 30 0d 0a 3c 21 44 |tf-8....200.......| 188s 00000130 20 20 3c 74 69 74 6c 65 3e 67 6f 70 61 63 6b 65 | gopacke| 188s 00000140 74 20 2d 20 54 68 65 20 47 6f 20 50 72 6f 67 72 |t - The Go Progr| 188s 00000150 61 6d 6d 69 6e 67 20 4c 61 6e 67 75 61 67 65 3c |amming Language<| 188s 00000160 2f 74 69 74 6c 65 3e 0a 0a 3c 6c 69 6e 6b 20 74 |/title>..<link t| 188s 00000170 79 70 65 3d 22 74 65 78 74 2f 63 73 73 22 20 72 |ype="text/css" r| 188s 00000180 65 6c 3d 22 73 74 79 6c 65 73 68 65 65 74 22 20 |el="stylesheet" | 188s 00000190 68 72 65 66 3d 22 2f 64 6f 63 2f 73 74 79 6c 65 |href="/doc/style| 188s 000001a0 2e 63 73 73 22 3e 0a 3c 73 63 72 69 70 74 20 74 |.css">.<script t| 188s 000001b0 79 70 65 3d 22 74 65 78 74 2f 6a 61 76 61 73 63 |ype="text/javasc| 188s 000001c0 72 69 70 74 22 20 73 72 63 3d 22 2f 64 6f 63 2f |ript" src="/doc/| 188s 000001d0 67 6f 64 6f 63 73 2e 6a 73 22 3e 3c 2f 73 63 72 |godocs.js"></scr| 188s 000001e0 69 70 74 3e 0a 0a 3c 2f 68 65 61 64 3e 0a 3c 62 |ipt>..</head>.<b| 188s 000001f0 6f 64 79 3e 0a 0a 3c 64 69 76 20 69 64 3d 22 74 |ody>..<div id="t| 188s 00000200 6f 70 62 61 72 22 3e 3c 64 69 76 20 63 6c 61 73 |opbar"><div clas| 188s 00000210 73 3d 22 63 6f 6e 74 61 69 6e 65 72 20 77 69 64 |s="container wid| 188s 00000220 65 22 3e 0a 0a 3c 66 6f 72 6d 20 6d 65 74 68 6f |e">..<form metho| 188s 00000230 64 3d 22 47 45 54 22 20 61 63 74 69 6f 6e 3d 22 |d="GET" action="| 188s 00000240 2f 73 65 61 72 63 68 22 3e 0a 3c 64 69 76 20 69 |/search">.<div i| 188s 00000250 64 3d 22 6d 65 6e 75 22 3e 0a 3c 61 20 68 72 65 |d="menu">.<a hre| 188s 00000260 66 3d 22 2f 64 6f 63 2f 22 3e 44 6f 63 75 6d 65 |f="/doc/">Docume| 188s 00000270 6e 74 73 3c 2f 61 3e 0a 3c 61 20 68 72 65 66 3d |nts</a>.<a href=| 188s 00000280 22 2f 72 65 66 2f 22 3e 52 65 66 65 72 65 6e 63 |"/ref/">Referenc| 188s 00000290 65 73 3c 2f 61 3e 0a 3c 61 20 68 72 65 66 3d 22 |es</a>.<a href="| 188s 000002a0 2f 70 6b 67 2f 22 3e 50 61 63 6b 61 67 65 73 3c |/pkg/">Packages<| 188s 000002b0 2f 61 3e 0a 3c 61 20 68 72 65 66 3d 22 2f 70 72 |/a>.<a href="/pr| 188s 000002c0 6f 6a 65 63 74 2f 22 3e 54 68 65 20 50 0d 0a 64 |oject/">The P..d| 188s 000002d0 65 0d 0a 72 6f 6a 65 63 74 3c 2f 61 3e 0a 3c 61 |e..roject</a>.<a| 188s 000002e0 20 68 72 65 66 3d 22 2f 68 65 6c 70 2f 22 3e 48 | href="/help/">H| 188s 000002f0 65 6c 70 3c 2f 61 3e 0a 3c 69 6e 70 75 74 20 74 |elp</a>.<input t| 188s 00000300 79 70 65 3d 22 74 65 78 74 22 20 69 64 3d 22 73 |ype="text" id="s| 188s 00000310 65 61 72 63 68 22 20 6e 61 6d 65 3d 22 71 22 20 |earch" name="q" | 188s 00000320 63 6c 61 73 73 3d 22 69 6e 61 63 74 69 76 65 22 |class="inactive"| 188s 00000330 20 76 61 6c 75 65 3d 22 53 65 61 72 63 68 22 3e | value="Search">| 188s 00000340 0a 3c 2f 64 69 76 3e 0a 3c 64 69 76 20 69 64 3d |.</div>.<div id=| 188s 00000350 22 68 65 61 64 69 6e 67 22 3e 3c 61 20 68 72 65 |"heading"><a hre| 188s 00000360 66 3d 22 2f 22 3e 54 68 65 20 47 6f 20 50 72 6f |f="/">The Go Pro| 188s 00000370 67 72 61 6d 6d 69 6e 67 20 4c 61 6e 67 75 61 67 |gramming Languag| 188s 00000380 65 3c 2f 61 3e 3c 2f 64 69 76 3e 0a 3c 2f 66 6f |e</a></div>.</fo| 188s 00000390 72 6d 3e 0a 0a 3c 2f 64 69 76 3e 3c 2f 64 69 76 |rm>..</div></div| 188s 000003a0 3e 0a 0a 3c 64 69 76 20 69 64 3d 22 70 61 67 65 |>..<div id="page| 188s 000003b0 22 0d 0a 64 0d 0a 20 63 6c 61 73 73 3d 22 77 69 |"..d.. class="wi| 188s 000003c0 64 65 22 0d 0a 33 0d 0a 3e 0a 0a 0d 0a 35 38 0d |de"..3..>....58.| 188s 000003d0 0a 0a 20 20 3c 64 69 76 20 69 64 3d 22 70 6c 75 |.. <div id="plu| 188s 000003e0 73 6f 6e 65 22 3e 3c 67 3a 70 6c 75 73 6f 6e 65 |sone"><g:plusone| 188s 000003f0 20 73 69 7a 65 3d 22 73 6d 61 6c 6c 22 20 61 6e | size="small" an| 188s 00000400 6e 6f 74 61 74 69 6f 6e 3d 22 6e 6f 6e 65 22 3e |notation="none">| 188s 00000410 3c 2f 67 3a 70 6c 75 73 6f 6e 65 3e 3c 2f 64 69 |</g:plusone></di| 188s 00000420 76 3e 0a 20 20 3c 68 31 3e 0d 0a 31 30 0d 0a 50 |v>. <h1>..10..P| 188s 00000430 61 63 6b 61 67 65 20 67 6f 70 61 63 6b 65 74 0d |ackage gopacket.| 188s 00000440 0a 36 0d 0a 3c 2f 68 31 3e 0a 0d 0a 31 0d 0a 0a |.6..</h1>...1...| 188s 00000450 0d 0a 32 0d 0a 0a 0a 0d 0a 31 37 0d 0a 0a 3c 64 |..2......17...<d| 188s 00000460 69 76 20 69 64 3d 22 6e 61 76 22 3e 3c 2f 64 69 |iv id="nav"></di| 188s 00000470 76 3e 0a 0a 0d 0a 31 0d 0a 0a 0d 0a 63 65 39 34 |v>....1.....ce94| 188s 00000480 0d 0a 3c 21 2d 2d 0a 09 43 6f 70 79 72 69 67 68 |..<!--..Copyrigh| 188s 00000490 74 20 32 30 30 39 20 54 68 65 20 47 6f 20 41 75 |t 2009 The Go Au| 188s 000004a0 74 68 6f 72 73 2e 20 41 6c 6c 20 72 69 67 68 74 |thors. All right| 188s 000004b0 73 20 72 65 73 65 72 76 65 64 2e 0a 09 55 73 65 |s reserved...Use| 188s 000004c0 20 6f 66 20 74 68 69 73 20 73 6f 75 72 63 65 20 | of this source | 188s 000004d0 63 6f 64 65 20 69 73 20 67 6f 76 65 72 6e 65 64 |code is governed| 188s 000004e0 20 62 79 20 61 20 42 53 44 2d 73 74 79 6c 65 0a | by a BSD-style.| 188s 000004f0 09 6c 69 63 65 6e 73 65 20 74 68 61 74 20 63 61 |.license that ca| 188s 00000500 6e 20 62 65 20 66 6f 75 6e 64 20 69 6e 20 74 68 |n be found in th| 188s 00000510 65 20 4c 49 43 45 4e 53 45 20 66 69 6c 65 2e 0a |e LICENSE file..| 188s 00000520 2d 2d 3e 0a 3c 21 2d 2d 0a 09 4e 6f 74 65 3a 20 |-->.<!--..Note: | 188s 00000530 53 74 61 74 69 63 20 28 69 2e 65 2e 2c 20 6e 6f |Static (i.e., no| 188s 00000540 74 20 74 65 6d 70 6c 61 74 65 2d 67 65 6e 65 72 |t template-gener| 188s 00000550 61 74 65 64 29 20 68 72 65 66 20 61 6e 64 20 69 |ated) href and i| 188s 00000560 64 0a 09 61 74 74 72 69 62 75 74 65 73 20 73 74 |d..attributes st| 188s 00000570 61 72 74 20 77 69 74 68 20 22 70 6b 67 2d 22 20 |art with "pkg-" | 188s 00000580 74 6f 20 6d 61 6b 65 20 69 74 20 69 6d 70 6f 73 |to make it impos| 188s 00000590 73 69 62 6c 65 20 66 6f 72 0a 09 74 68 65 6d 20 |sible for..them | 188s 000005a0 74 6f 20 63 6f 6e 66 6c 69 63 74 20 77 69 74 68 |to conflict with| 188s 000005b0 20 67 65 6e 65 72 61 74 65 64 20 61 74 74 72 69 | generated attri| 188s 000005c0 62 75 74 65 73 20 28 73 6f 6d 65 20 6f 66 20 77 |butes (some of w| 188s 000005d0 68 69 63 68 0a 09 63 6f 72 72 65 73 70 6f 6e 64 |hich..correspond| 188s 000005e0 20 74 6f 20 47 6f 20 69 64 65 6e 74 69 66 69 65 | to Go identifie| 188s 000005f0 72 73 29 2e 0a 2d 2d 3e 0a 0a 09 0a 09 09 3c 64 |rs)..-->......<d| 188s 00000600 69 76 20 69 64 3d 22 73 68 6f 72 74 2d 6e 61 76 |iv id="short-nav| 188s 00000610 22 3e 0a 09 09 09 3c 64 6c 3e 0a 09 09 09 3c 64 |">....<dl>....<d| 188s 00000620 64 3e 3c 63 6f 64 65 3e 69 6d 70 6f 72 74 20 22 |d><code>import "| 188s 00000630 67 69 74 68 75 62 2e 63 6f 6d 2f 67 63 6f 6e 6e |github.com/gconn| 188s 00000640 65 6c 6c 2f 67 6f 70 61 63 6b 65 74 22 3c 2f 63 |ell/gopacket"</c| 188s 00000650 6f 64 65 3e 3c 2f 64 64 3e 0a 09 09 09 3c 2f 64 |ode></dd>....</d| 188s 00000660 6c 3e 0a 09 09 09 3c 64 6c 3e 0a 09 09 09 3c 64 |l>....<dl>....<d| 188s 00000670 64 3e 3c 61 20 68 72 65 66 3d 22 23 70 6b 67 2d |d><a href="#pkg-| 188s 00000680 6f 76 65 72 76 69 65 77 22 20 63 6c 61 73 73 3d |overview" class=| 188s 00000690 22 6f 76 65 72 76 69 65 77 4c 69 6e 6b 22 3e 4f |"overviewLink">O| 188s 000006a0 76 65 72 76 69 65 77 3c 2f 61 3e 3c 2f 64 64 3e |verview</a></dd>| 188s 000006b0 0a 09 09 09 3c 64 64 3e 3c 61 20 68 72 65 66 3d |....<dd><a href=| 188s 000006c0 22 23 70 6b 67 2d 69 6e 64 65 78 22 3e 49 6e 64 |"#pkg-index">Ind| 188s 000006d0 65 78 3c 2f 61 3e 3c 2f 64 64 3e 0a 09 09 09 0a |ex</a></dd>.....| 188s 000006e0 09 09 09 0a 09 09 09 0a 09 09 09 09 3c 64 64 3e |............<dd>| 188s 000006f0 3c 61 20 68 72 65 66 3d 22 23 70 6b 67 2d 73 75 |<a href="#pkg-su| 188s 00000700 62 64 69 72 65 63 74 6f 72 69 65 73 22 3e 53 75 |bdirectories">Su| 188s 00000710 62 64 69 72 65 63 74 6f 72 69 65 73 3c 2f 61 3e |bdirectories</a>| 188s 00000720 3c 2f 64 64 3e 0a 09 09 09 0a 09 09 09 3c 2f 64 |</dd>........</d| 188s 00000730 6c 3e 0a 09 09 3c 2f 64 69 76 3e 0a 09 09 3c 21 |l>...</div>...<!| 188s 00000740 2d 2d 20 54 68 65 20 70 61 63 6b 61 67 65 27 73 |-- The package's| 188s 00000750 20 4e 61 6d 65 20 69 73 20 70 72 69 6e 74 65 64 | Name is printed| 188s 00000760 20 61 73 20 74 69 74 6c 65 20 62 79 20 74 68 65 | as title by the| 188s 00000770 20 74 6f 70 2d 6c 65 76 65 6c 20 74 65 6d 70 6c | top-level templ| 188s 00000780 61 74 65 20 2d 2d 3e 0a 09 09 3c 64 69 76 20 69 |ate -->...<div i| 188s 00000790 64 3d 22 70 6b 67 2d 6f 76 65 72 76 69 65 77 22 |d="pkg-overview"| 188s 000007a0 20 63 6c 61 73 73 3d 22 74 6f 67 67 6c 65 56 69 | class="toggleVi| 188s 000007b0 73 69 62 6c 65 22 3e 0a 09 09 09 3c 64 69 76 20 |sible">....<div | 188s 000007c0 63 6c 61 73 73 3d 22 63 6f 6c 6c 61 70 73 65 64 |class="collapsed| 188s 000007d0 22 3e 0a 09 09 09 09 3c 68 32 20 63 6c 61 73 73 |">.....<h2 class| 188s 000007e0 3d 22 74 6f 67 67 6c 65 42 75 74 74 6f 6e 22 20 |="toggleButton" | 188s 000007f0 74 69 74 6c 65 3d 22 43 6c 69 63 6b 20 74 6f 20 |title="Click to | 188s 00000800 73 68 6f 77 20 4f 76 65 72 76 69 65 77 20 73 65 |show Overview se| 188s 00000810 63 74 69 6f 6e 22 3e 4f 76 65 72 76 69 65 77 20 |ction">Overview | 188s 00000820 e2 96 b9 3c 2f 68 32 3e 0a 09 09 09 3c 2f 64 69 |...</h2>....</di| 188s 00000830 76 3e 0a 09 09 09 3c 64 69 76 20 63 6c 61 73 73 |v>....<div class| 188s 00000840 3d 22 65 78 70 61 6e 64 65 64 22 3e 0a 09 09 09 |="expanded">....| 188s 00000850 09 3c 68 32 20 63 6c 61 73 73 3d 22 74 6f 67 67 |.<h2 class="togg| 188s 00000860 6c 65 42 75 74 74 6f 6e 22 20 74 69 74 6c 65 3d |leButton" title=| 188s 00000870 22 43 6c 69 63 6b 20 74 6f 20 68 69 64 65 20 4f |"Click to hide O| 188s 00000880 76 65 72 76 69 65 77 20 73 65 63 74 69 6f 6e 22 |verview section"| 188s 00000890 3e 4f 76 65 72 76 69 65 77 20 e2 96 be 3c 2f 68 |>Overview ...</h| 188s 000008a0 32 3e 0a 09 09 09 09 3c 70 3e 0a 50 61 63 6b 61 |2>.....<p>.Packa| 188s 000008b0 67 65 20 67 6f 70 61 63 6b 65 74 20 70 72 6f 76 |ge gopacket prov| 188s 000008c0 69 64 65 73 20 70 61 63 6b 65 74 20 64 65 63 6f |ides packet deco| 188s 000008d0 64 69 6e 67 20 66 6f 72 20 74 68 65 20 47 6f 20 |ding for the Go | 188s 000008e0 6c 61 6e 67 75 61 67 65 2e 0a 3c 2f 70 3e 0a 3c |language..</p>.<| 188s 000008f0 70 3e 0a 67 6f 70 61 63 6b 65 74 20 63 6f 6e 74 |p>.gopacket cont| 188s 00000900 61 69 6e 73 20 33 20 73 75 62 2d 70 61 63 6b 61 |ains 3 sub-packa| 188s 00000910 67 65 73 20 77 69 74 68 20 61 64 64 69 74 69 6f |ges with additio| 188s 00000920 6e 61 6c 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 |nal functionalit| 188s 00000930 79 20 79 6f 75 20 6d 61 79 20 66 69 6e 64 0a 75 |y you may find.u| 188s 00000940 73 65 66 75 6c 3a 0a 3c 2f 70 3e 0a 3c 70 72 65 |seful:.</p>.<pre| 188s 00000950 3e 2a 20 6c 61 79 65 72 73 3a 20 59 6f 75 26 23 |>* layers: You&#| 188s 00000960 33 39 3b 6c 6c 20 70 72 6f 62 61 62 6c 79 20 75 |39;ll probably u| 188s 00000970 73 65 20 74 68 69 73 20 65 76 65 72 79 20 74 69 |se this every ti| 188s 00000980 6d 65 2e 20 20 54 68 69 73 20 63 6f 6e 74 61 69 |me. This contai| 188s 00000990 6e 73 20 6f 66 20 74 68 65 20 6c 6f 67 69 63 0a |ns of the logic.| 188s 000009a0 20 20 20 20 62 75 69 6c 74 20 69 6e 74 6f 20 67 | built into g| 188s 000009b0 6f 70 61 63 6b 65 74 20 66 6f 72 20 64 65 63 6f |opacket for deco| 188s 000009c0 64 69 6e 67 20 70 61 63 6b 65 74 20 70 72 6f 74 |ding packet prot| 188s 000009d0 6f 63 6f 6c 73 2e 20 20 4e 6f 74 65 20 74 68 61 |ocols. Note tha| 188s 000009e0 74 20 61 6c 6c 20 65 78 61 6d 70 6c 65 0a 20 20 |t all example. | 188s 000009f0 20 20 63 6f 64 65 20 62 65 6c 6f 77 20 61 73 73 | code below ass| 188s 00000a00 75 6d 65 73 20 74 68 61 74 20 79 6f 75 20 68 61 |umes that you ha| 188s 00000a10 76 65 20 69 6d 70 6f 72 74 65 64 20 62 6f 74 68 |ve imported both| 188s 00000a20 20 67 6f 70 61 63 6b 65 74 20 61 6e 64 0a 20 20 | gopacket and. | 188s 00000a30 20 20 67 6f 70 61 63 6b 65 74 2f 6c 61 79 65 72 | gopacket/layer| 188s 00000a40 73 2e 0a 2a 20 70 63 61 70 3a 20 43 20 62 69 6e |s..* pcap: C bin| 188s 00000a50 64 69 6e 67 73 20 74 6f 20 75 73 65 20 6c 69 62 |dings to use lib| 188s 00000a60 70 63 61 70 20 74 6f 20 70 75 6c 6c 20 70 61 63 |pcap to pull pac| 188s 00000a70 6b 65 74 73 20 6f 66 66 20 74 68 65 20 77 69 72 |kets off the wir| 188s 00000a80 65 2e 0a 2a 20 70 66 72 69 6e 67 3a 20 43 20 62 |e..* pfring: C b| 188s 00000a90 69 6e 64 69 6e 67 73 20 74 6f 20 75 73 65 20 50 |indings to use P| 188s 00000aa0 46 5f 52 49 4e 47 20 74 6f 20 70 75 6c 6c 20 70 |F_RING to pull p| 188s 00000ab0 61 63 6b 65 74 73 20 6f 66 66 20 74 68 65 20 77 |ackets off the w| 188s 00000ac0 69 72 65 2e 0a 3c 2f 70 72 65 3e 0a 3c 68 33 20 |ire..</pre>.<h3 | 188s 00000ad0 69 64 3d 22 42 61 73 69 63 5f 55 73 61 67 65 22 |id="Basic_Usage"| 188s 00000ae0 3e 42 61 73 69 63 20 55 73 61 67 65 3c 2f 68 33 |>Basic Usage</h3| 188s 00000af0 3e 0a 3c 70 3e 0a 67 6f 70 61 63 6b 65 74 20 74 |>.<p>.gopacket t| 188s 00000b00 61 6b 65 73 20 69 6e 20 70 61 63 6b 65 74 20 64 |akes in packet d| 188s 00000b10 61 74 61 20 61 73 20 61 20 5b 5d 62 79 74 65 20 |ata as a []byte | 188s 00000b20 61 6e 64 20 64 65 63 6f 64 65 73 20 69 74 20 69 |and decodes it i| 188s 00000b30 6e 74 6f 20 61 20 70 61 63 6b 65 74 20 77 69 74 |nto a packet wit| 188s 00000b40 68 0a 61 20 6e 6f 6e 2d 7a 65 72 6f 20 6e 75 6d |h.a non-zero num| 188s 00000b50 62 65 72 20 6f 66 20 26 23 33 34 3b 6c 61 79 65 |ber of "laye| 188s 00000b60 72 73 26 23 33 34 3b 2e 20 20 45 61 63 68 20 6c |rs". Each l| 188s 00000b70 61 79 65 72 20 63 6f 72 72 65 73 70 6f 6e 64 73 |ayer corresponds| 188s 00000b80 20 74 6f 20 61 20 70 72 6f 74 6f 63 6f 6c 0a 77 | to a protocol.w| 188s 00000b90 69 74 68 69 6e 20 74 68 65 20 62 79 74 65 73 2e |ithin the bytes.| 188s 00000ba0 20 20 4f 6e 63 65 20 61 20 70 61 63 6b 65 74 20 | Once a packet | 188s 00000bb0 68 61 73 20 62 65 65 6e 20 64 65 63 6f 64 65 64 |has been decoded| 188s 00000bc0 2c 20 74 68 65 20 6c 61 79 65 72 73 20 6f 66 20 |, the layers of | 188s 00000bd0 74 68 65 20 70 61 63 6b 65 74 0a 63 61 6e 20 62 |the packet.can b| 188s 00000be0 65 20 72 65 71 75 65 73 74 65 64 20 66 72 6f 6d |e requested from| 188s 00000bf0 20 74 68 65 20 70 61 63 6b 65 74 2e 0a 3c 2f 70 | the packet..</p| 188s 00000c00 3e 0a 3c 70 72 65 3e 2f 2f 20 44 65 63 6f 64 65 |>.<pre>// Decode| 188s 00000c10 20 61 20 70 61 63 6b 65 74 0a 70 61 63 6b 65 74 | a packet.packet| 188s 00000c20 20 3a 3d 20 67 6f 70 61 63 6b 65 74 2e 4e 65 77 | := gopacket.New| 188s 00000c30 50 61 63 6b 65 74 28 6d 79 50 61 63 6b 65 74 44 |Packet(myPacketD| 188s 00000c40 61 74 61 2c 20 6c 61 79 65 72 73 2e 4c 61 79 65 |ata, layers.Laye| 188s 00000c50 72 54 79 70 65 45 74 68 65 72 6e 65 74 2c 20 67 |rTypeEthernet, g| 188s 00000c60 6f 70 61 63 6b 65 74 2e 44 65 66 61 75 6c 74 29 |opacket.Default)| 188s 00000c70 0a 2f 2f 20 47 65 74 20 74 68 65 20 54 43 50 20 |.// Get the TCP | 188s 00000c80 6c 61 79 65 72 20 66 72 6f 6d 20 74 68 69 73 20 |layer from this | 188s 00000c90 70 61 63 6b 65 74 0a 69 66 20 74 63 70 4c 61 79 |packet.if tcpLay| 188s 00000ca0 65 72 20 3a 3d 20 70 61 63 6b 65 74 2e 4c 61 79 |er := packet.Lay| 188s 00000cb0 65 72 28 6c 61 79 65 72 73 2e 4c 61 79 65 72 54 |er(layers.LayerT| 188s 00000cc0 79 70 65 54 43 50 29 3b 20 74 63 70 4c 61 79 65 |ypeTCP); tcpLaye| 188s 00000cd0 72 20 21 3d 20 6e 69 6c 20 7b 0a 20 20 66 6d 74 |r != nil {. fmt| 188s 00000ce0 2e 50 72 69 6e 74 6c 6e 28 26 23 33 34 3b 54 68 |.Println("Th| 188s 00000cf0 69 73 20 69 73 20 61 20 54 43 50 20 70 61 63 6b |is is a TCP pack| 188s 00000d00 65 74 21 26 23 33 34 3b 29 0a 20 20 2f 2f 20 47 |et!"). // G| 188s 00000d10 65 74 20 61 63 74 75 61 6c 20 54 43 50 20 64 61 |et actual TCP da| 188s 00000d20 74 61 20 66 72 6f 6d 20 74 68 69 73 20 6c 61 79 |ta from this lay| 188s 00000d30 65 72 0a 20 20 74 63 70 2c 20 5f 20 3a 3d 20 74 |er. tcp, _ := t| 188s 00000d40 63 70 4c 61 79 65 72 2e 28 2a 6c 61 79 65 72 73 |cpLayer.(*layers| 188s 00000d50 2e 54 43 50 29 0a 20 20 66 6d 74 2e 50 72 69 6e |.TCP). fmt.Prin| 188s 00000d60 74 66 28 26 23 33 34 3b 46 72 6f 6d 20 73 72 63 |tf("From src| 188s 00000d70 20 70 6f 72 74 20 25 64 20 74 6f 20 64 73 74 20 | port %d to dst | 188s 00000d80 70 6f 72 74 20 25 64 5c 6e 26 23 33 34 3b 2c 20 |port %d\n", | 188s 00000d90 74 63 70 2e 53 72 63 50 6f 72 74 2c 20 74 63 70 |tcp.SrcPort, tcp| 188s 00000da0 2e 44 73 74 50 6f 72 74 29 0a 7d 0a 2f 2f 20 49 |.DstPort).}.// I| 188s 00000db0 74 65 72 61 74 65 20 6f 76 65 72 20 61 6c 6c 20 |terate over all | 188s 00000dc0 6c 61 79 65 72 73 2c 20 70 72 69 6e 74 69 6e 67 |layers, printing| 188s 00000dd0 20 6f 75 74 20 65 61 63 68 20 6c 61 79 65 72 20 | out each layer | 188s 00000de0 74 79 70 65 0a 66 6f 72 20 6c 61 79 65 72 20 3a |type.for layer :| 188s 00000df0 3d 20 72 61 6e 67 65 20 70 61 63 6b 65 74 2e 4c |= range packet.L| 188s 00000e00 61 79 65 72 73 28 29 20 7b 0a 20 20 66 6d 74 2e |ayers() {. fmt.| 188s 00000e10 50 72 69 6e 74 6c 6e 28 26 23 33 34 3b 50 41 43 |Println("PAC| 188s 00000e20 4b 45 54 20 4c 41 59 45 52 3a 26 23 33 34 3b 2c |KET LAYER:",| 188s 00000e30 20 6c 61 79 65 72 2e 4c 61 79 65 72 54 79 70 65 | layer.LayerType| 188s 00000e40 28 29 29 0a 7d 0a 3c 2f 70 72 65 3e 0a 3c 70 3e |()).}.</pre>.<p>| 188s 00000e50 0a 50 61 63 6b 65 74 73 20 63 61 6e 20 62 65 20 |.Packets can be | 188s 00000e60 64 65 63 6f 64 65 64 20 66 72 6f 6d 20 61 20 6e |decoded from a n| 188s 00000e70 75 6d 62 65 72 20 6f 66 20 73 74 61 72 74 69 6e |umber of startin| 188s 00000e80 67 20 70 6f 69 6e 74 73 2e 20 20 4d 61 6e 79 20 |g points. Many | 188s 00000e90 6f 66 20 6f 75 72 20 62 61 73 65 0a 74 79 70 65 |of our base.type| 188s 00000ea0 73 20 69 6d 70 6c 65 6d 65 6e 74 20 44 65 63 6f |s implement Deco| 188s 00000eb0 64 65 72 2c 20 77 68 69 63 68 20 61 6c 6c 6f 77 |der, which allow| 188s 00000ec0 20 75 73 20 74 6f 20 64 65 63 6f 64 65 20 70 61 | us to decode pa| 188s 00000ed0 63 6b 65 74 73 20 66 6f 72 20 77 68 69 63 68 0a |ckets for which.| 188s 00000ee0 77 65 20 64 6f 6e 26 23 33 39 3b 74 20 68 61 76 |we don't hav| 188s 00000ef0 65 20 66 75 6c 6c 20 64 61 74 61 2e 0a 3c 2f 70 |e full data..</p| 188s 00000f00 3e 0a 3c 70 72 65 3e 2f 2f 20 44 65 63 6f 64 65 |>.<pre>// Decode| 188s 00000f10 20 61 6e 20 65 74 68 65 72 6e 65 74 20 70 61 63 | an ethernet pac| 188s 00000f20 6b 65 74 0a 65 74 68 50 20 3a 3d 20 67 6f 70 61 |ket.ethP := gopa| 188s 00000f30 63 6b 65 74 2e 4e 65 77 50 61 63 6b 65 74 28 70 |cket.NewPacket(p| 188s 00000f40 31 2c 20 6c 61 79 65 72 73 2e 4c 61 79 65 72 54 |1, layers.LayerT| 188s 00000f50 79 70 65 45 74 68 65 72 6e 65 74 2c 20 67 6f 70 |ypeEthernet, gop| 188s 00000f60 61 63 6b 65 74 2e 44 65 66 61 75 6c 74 29 0a 2f |acket.Default)./| 188s 00000f70 2f 20 44 65 63 6f 64 65 20 61 6e 20 49 50 76 36 |/ Decode an IPv6| 188s 00000f80 20 68 65 61 64 65 72 20 61 6e 64 20 65 76 65 72 | header and ever| 188s 00000f90 79 74 68 69 6e 67 20 69 74 20 63 6f 6e 74 61 69 |ything it contai| 188s 00000fa0 6e 73 0a 69 70 50 20 3a 3d 20 67 6f 70 61 63 6b |ns.ipP := gopack| 188s 00000fb0 65 74 2e 4e 65 77 50 61 63 6b 65 74 28 70 32 2c |et.NewPacket(p2,| 188s 00000fc0 20 6c 61 79 65 72 73 2e 4c 61 79 65 72 54 79 70 | layers.LayerTyp| 188s 00000fd0 65 49 50 76 36 2c 20 67 6f 70 61 63 6b 65 74 2e |eIPv6, gopacket.| 188s 00000fe0 44 65 66 61 75 6c 74 29 0a 2f 2f 20 44 65 63 6f |Default).// Deco| 188s 00000ff0 64 65 20 61 20 54 43 50 20 68 65 61 64 65 72 20 |de a TCP header | 188s 00001000 61 6e 64 20 69 74 73 20 70 61 79 6c 6f 61 64 0a |and its payload.| 188s 00001010 74 63 70 50 20 3a 3d 20 67 6f 70 61 63 6b 65 74 |tcpP := gopacket| 188s 00001020 2e 4e 65 77 50 61 63 6b 65 74 28 70 33 2c 20 6c |.NewPacket(p3, l| 188s 00001030 61 79 65 72 73 2e 4c 61 79 65 72 54 79 70 65 54 |ayers.LayerTypeT| 188s 00001040 43 50 2c 20 67 6f 70 61 63 6b 65 74 |CP, gopacket| 188s --- Layer 1 --- 188s Loopback {Contents=[30, 0, 0, 0] Payload=[..4168..] Family=IPv6} 188s 00000000 1e 00 00 00 |....| 188s --- Layer 2 --- 188s IPv6 {Contents=[..40..] Payload=[..4128..] Version=6 TrafficClass=0 FlowLabel=100497 Length=4128 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 188s 00000000 60 01 88 91 10 20 06 40 00 00 00 00 00 00 00 00 |`.... .@........| 188s 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 188s 00000020 00 00 00 00 00 00 00 01 |........| 188s --- Layer 3 --- 188s 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=[]} 188s 00000000 1f 90 e5 af 0a 65 66 ef 08 97 18 4a 80 18 23 02 |.....ef....J..#.| 188s 00000010 10 28 00 00 01 01 08 0a 05 c0 8d b6 05 c0 8c fc |.(..............| 188s --- Layer 4 --- 188s Payload 4096 byte(s) 188s 00000000 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d |HTTP/1.1 200 OK.| 188s 00000010 0a 44 61 74 65 3a 20 53 75 6e 2c 20 30 36 20 4a |.Date: Sun, 06 J| 188s 00000020 61 6e 20 32 30 31 33 20 31 37 3a 32 32 3a 33 32 |an 2013 17:22:32| 188s 00000030 20 47 4d 54 0d 0a 54 72 61 6e 73 66 65 72 2d 45 | GMT..Transfer-E| 188s 00000040 6e 63 6f 64 69 6e 67 3a 20 63 68 75 6e 6b 65 64 |ncoding: chunked| 188s 00000050 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 |..Content-Type: | 188s 00000060 74 65 78 74 2f 68 74 6d 6c 3b 20 63 68 61 72 73 |text/html; chars| 188s 00000070 65 74 3d 75 74 66 2d 38 0d 0a 0d 0a 32 30 30 0d |et=utf-8....200.| 188s 00000080 0a 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e |.<!DOCTYPE html>| 188s 00000090 0a 3c 68 74 6d 6c 3e 0a 3c 68 65 61 64 3e 0a 3c |.<html>.<head>.<| 188s 000000a0 6d 65 74 61 20 68 74 74 70 2d 65 71 75 69 76 3d |meta http-equiv=| 188s 000000b0 22 43 6f 6e 74 65 6e 74 2d 54 79 70 65 22 20 63 |"Content-Type" c| 188s 000000c0 6f 6e 74 65 6e 74 3d 22 74 65 78 74 2f 68 74 6d |ontent="text/htm| 188s 000000d0 6c 3b 20 63 68 61 72 73 65 74 3d 75 74 66 2d 38 |l; charset=utf-8| 188s 000000e0 22 3e 0a 0a 20 20 3c 74 69 74 6c 65 3e 67 6f 70 |">.. <title>gop| 188s 000000f0 61 63 6b 65 74 20 2d 20 54 68 65 20 47 6f 20 50 |acket - The Go P| 188s 00000100 72 6f 67 72 61 6d 6d 69 6e 67 20 4c 61 6e 67 75 |rogramming Langu| 188s 00000110 61 67 65 3c 2f 74 69 74 6c 65 3e 0a 0a 3c 6c 69 |age...<| 188s 00000190 2f 73 63 72 69 70 74 3e 0a 0a 3c 2f 68 65 61 64 |/script>.....
.The Go| 188s 00000320 20 50 72 6f 67 72 61 6d 6d 69 6e 67 20 4c 61 6e | Programming Lan| 188s 00000330 67 75 61 67 65 3c 2f 61 3e 3c 2f 64 69 76 3e 0a |guage
.| 188s 00000340 3c 2f 66 6f 72 6d 3e 0a 0a 3c 2f 64 69 76 3e 3c |..<| 188s 00000350 2f 64 69 76 3e 0a 0a 3c 64 69 76 20 69 64 3d 22 |/div>..
...| 188s 00000380 0a 35 38 0d 0a 0a 20 20 3c 64 69 76 20 69 64 3d |.58...
| 188s 000003d0 3c 2f 64 69 76 3e 0a 20 20 3c 68 31 3e 0d 0a 31 |
.

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

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

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

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

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

.....

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

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

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

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

.

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

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

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

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

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

.

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

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

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

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

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

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

.

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

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

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

.

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

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

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

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

.

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

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

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

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

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

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

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

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

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

.

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

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

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

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

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

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

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

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

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

....

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

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

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

.

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

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

.

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

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

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

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

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

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

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

.

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

.

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

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

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

.

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

.

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

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

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

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

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

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

.

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

.

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

.

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

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

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

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

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

.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

..| 190s 00004000 09 09 09 3c |...<| 190s --- Layer 1 --- 190s Loopback {Contents=[30, 0, 0, 0] Payload=[..16384..] Family=IPv6} 190s 00000000 1e 00 00 00 |....| 190s --- Layer 2 --- 190s IPv6 {Contents=[..40..] Payload=[..16344..] Version=6 TrafficClass=0 FlowLabel=100497 Length=16344 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 190s 00000000 60 01 88 91 3f d8 06 40 00 00 00 00 00 00 00 00 |`...?..@........| 190s 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 190s 00000020 00 00 00 00 00 00 00 01 |........| 190s --- Layer 3 --- 190s 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=[]} 190s 00000000 1f 90 e5 af 0a 65 b6 a7 08 97 18 4a 80 10 23 02 |.....e.....J..#.| 190s 00000010 3f e0 00 00 01 01 08 0a 05 c0 8d b6 05 c0 8c fc |?...............| 190s --- Layer 4 --- 190s Payload 16312 byte(s) 190s 00000000 3e 56 61 72 69 61 62 6c 65 73 3c 2f 68 32 3e 0a |>Variables

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

type ErrorLayer

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

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

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

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

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

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

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

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

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

func NewFlow

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

func NewPacket

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

........| 190s 00003ff0 09 09 09 0a 0a 09 09 09 0a 0a 09 09 09 0a 0a 09 |................| 190s 00004000 09 09 0a 09 |....| 190s --- Layer 1 --- 190s Loopback {Contents=[30, 0, 0, 0] Payload=[..16384..] Family=IPv6} 190s 00000000 1e 00 00 00 |....| 190s --- Layer 2 --- 190s IPv6 {Contents=[..40..] Payload=[..16344..] Version=6 TrafficClass=0 FlowLabel=100497 Length=16344 NextHeader=TCP HopLimit=64 SrcIP=::1 DstIP=::1 HopByHop=nil} 190s 00000000 60 01 88 91 3f d8 06 40 00 00 00 00 00 00 00 00 |`...?..@........| 190s 00000010 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................| 190s 00000020 00 00 00 00 00 00 00 01 |........| 190s --- Layer 3 --- 190s 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=[]} 190s 00000000 1f 90 e5 af 0a 65 f6 5f 08 97 18 4a 80 10 23 02 |.....e._...J..#.| 190s 00000010 3f e0 00 00 01 01 08 0a 05 c0 8d b6 05 c0 8c fc |?...............| 190s --- Layer 4 --- 190s Payload 16312 byte(s) 190s 00000000 70 72 65 3e 66 75 6e 63 20 4e 65 77 4c 61 79 65 |pre>func NewLaye| 190s 00000010 72 43 6c 61 73 73 4d 61 70 28 74 79 70 65 73 20 |rClassMap(types | 190s 00000020 5b 5d 4c 61 79 65 72 54 79 70 65 29 20 4c 61 79 |[]LayerType) Lay| 190s 00000030 65 72 43 6c 61 73 73 4d 61 70 3c 2f 70 72 65 3e |erClassMap

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

type LinkLayer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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