Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/pr.yaml → .github/workflows/push_pr.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
on: [pull_request]
name: push_pr_test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
Expand Down
7 changes: 0 additions & 7 deletions .travis.gofmt.sh

This file was deleted.

28 changes: 0 additions & 28 deletions .travis.golint.sh

This file was deleted.

10 changes: 0 additions & 10 deletions .travis.govet.sh

This file was deleted.

9 changes: 0 additions & 9 deletions .travis.install.sh

This file was deleted.

11 changes: 0 additions & 11 deletions .travis.script.sh

This file was deleted.

57 changes: 0 additions & 57 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ runs a local set of checks, which should give you relatively high confidence
that your pull won't fail github pull checks.

```sh
go get github.com/google/gopacket
cd $GOROOT/src/pkg/github.com/google/gopacket
go get github.com/gopacket/gopacket
cd $GOROOT/src/pkg/github.com/gopacket/gopacket
git checkout -b <mynewfeature> # create a new branch to work from
... code code code ...
./gc # Run this to do local commits, it performs a number of checks
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# GoPacket

This library provides packet decoding capabilities for Go.
See [godoc](https://godoc.org/github.com/google/gopacket) for more details.
This library provides packet decoding capabilities for Go. Forked from [Google's repo](https://godoc.org/github.com/google/gopacket).

See [godoc](https://godoc.org/github.com/gopacket/gopacket) for more details.

![Build Status](https://github.com/gopacket/gopacket/workflows/push_pr_test/badge.svg?style=flat-square)
![Go Version](https://img.shields.io/github/go-mod/go-version/gopacket/gopacket/main?filename=go.mod&style=flat-square)
![Latest Version](https://img.shields.io/github/v/tag/gopacket/gopacket?label=latest&style=flat-square)
![License](https://img.shields.io/github/license/gopacket/gopacket?style=flat-square)
![Open Issues](https://img.shields.io/github/issues/gopacket/gopacket?style=flat-square)
[![GoDoc](https://godoc.org/github.com/gopacket/gopacket?status.svg)](https://godoc.org/github.com/gopacket/gopacket)

[![Build Status](https://travis-ci.org/google/gopacket.svg?branch=master)](https://travis-ci.org/google/gopacket)
[![GoDoc](https://godoc.org/github.com/google/gopacket?status.svg)](https://godoc.org/github.com/google/gopacket)

Minimum Go version required is 1.5 except for pcapgo/EthernetHandle, afpacket, and bsdbpf which need at least 1.9 due to x/sys/unix dependencies.

Expand Down
11 changes: 6 additions & 5 deletions afpacket/afpacket.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"golang.org/x/net/bpf"
"golang.org/x/sys/unix"

"github.com/google/gopacket"
"github.com/gopacket/gopacket"
)

/*
Expand Down Expand Up @@ -293,10 +293,11 @@ func (h *TPacket) releaseCurrentPacket() error {
// to old bytes when using ZeroCopyReadPacketData... if you need to keep data past
// the next time you call ZeroCopyReadPacketData, use ReadPacketData, which copies
// the bytes into a new buffer for you.
// tp, _ := NewTPacket(...)
// data1, _, _ := tp.ZeroCopyReadPacketData()
// // do everything you want with data1 here, copying bytes out of it if you'd like to keep them around.
// data2, _, _ := tp.ZeroCopyReadPacketData() // invalidates bytes in data1
//
// tp, _ := NewTPacket(...)
// data1, _, _ := tp.ZeroCopyReadPacketData()
// // do everything you want with data1 here, copying bytes out of it if you'd like to keep them around.
// data2, _, _ := tp.ZeroCopyReadPacketData() // invalidates bytes in data1
func (h *TPacket) ZeroCopyReadPacketData() (data []byte, ci gopacket.CaptureInfo, err error) {
h.mu.Lock()
retry:
Expand Down
1 change: 1 addition & 0 deletions afpacket/afpacket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// that can be found in the LICENSE file in the root of the source
// tree.

//go:build linux
// +build linux

package afpacket
Expand Down
1 change: 1 addition & 0 deletions afpacket/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// that can be found in the LICENSE file in the root of the source
// tree.

//go:build linux
// +build linux

package afpacket
Expand Down
1 change: 1 addition & 0 deletions afpacket/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// that can be found in the LICENSE file in the root of the source
// tree.

//go:build linux
// +build linux

package afpacket
Expand Down
1 change: 1 addition & 0 deletions afpacket/sockopt_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// that can be found in the LICENSE file in the root of the source
// tree.

//go:build linux
// +build linux

package afpacket
Expand Down
3 changes: 2 additions & 1 deletion bsdbpf/bsd_bpf_sniffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// that can be found in the LICENSE file in the root of the source
// tree.

//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd

package bsdbpf
Expand All @@ -15,7 +16,7 @@ import (
"time"
"unsafe"

"github.com/google/gopacket"
"github.com/gopacket/gopacket"
"golang.org/x/sys/unix"
)

Expand Down
9 changes: 5 additions & 4 deletions bytediff/bytediff.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ func longestCommonSubstring(strA, strB []byte) (indexA, indexB, length int) {
// Difference represents a single part of the data being diffed, containing
// information about both the original and new values.
// From and To are the sets of bytes in the original and the new byte slice.
// !Replace implies From == To (no change)
// len(To) == 0 implies From is being deleted
// len(From) == 0 implies To is being inserted
// else implies From is being replaced by To
//
// !Replace implies From == To (no change)
// len(To) == 0 implies From is being deleted
// len(From) == 0 implies To is being inserted
// else implies From is being replaced by To
type Difference struct {
Replace bool
From, To []byte
Expand Down
21 changes: 11 additions & 10 deletions decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ var NilDecodeFeedback DecodeFeedback = nilDecodeFeedback{}
// PacketBuilder is used by layer decoders to store the layers they've decoded,
// and to defer future decoding via NextDecoder.
// Typically, the pattern for use is:
// func (m *myDecoder) Decode(data []byte, p PacketBuilder) error {
// if myLayer, err := myDecodingLogic(data); err != nil {
// return err
// } else {
// p.AddLayer(myLayer)
// }
// // maybe do this, if myLayer is a LinkLayer
// p.SetLinkLayer(myLayer)
// return p.NextDecoder(nextDecoder)
// }
//
// func (m *myDecoder) Decode(data []byte, p PacketBuilder) error {
// if myLayer, err := myDecodingLogic(data); err != nil {
// return err
// } else {
// p.AddLayer(myLayer)
// }
// // maybe do this, if myLayer is a LinkLayer
// p.SetLinkLayer(myLayer)
// return p.NextDecoder(nextDecoder)
// }
type PacketBuilder interface {
DecodeFeedback
// AddLayer should be called by a decoder immediately upon successful
Expand Down
9 changes: 5 additions & 4 deletions defrag/lcmdefrag/lcmdefrag.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"fmt"
"time"

"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/gopacket/gopacket"
"github.com/gopacket/gopacket/layers"
)

const (
Expand All @@ -32,8 +32,9 @@ type lcmPacket struct {
// LCMDefragmenter supports defragmentation of LCM messages.
//
// References
// https://lcm-proj.github.io/
// https://github.com/lcm-proj/lcm
//
// https://lcm-proj.github.io/
// https://github.com/lcm-proj/lcm
type LCMDefragmenter struct {
packets map[uint32]*lcmPacket
}
Expand Down
4 changes: 2 additions & 2 deletions defrag/lcmdefrag/lcmdefrag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package lcmdefrag
import (
"testing"

"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/gopacket/gopacket"
"github.com/gopacket/gopacket/layers"
)

var (
Expand Down
Loading