Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bugfix] Fix packet direction logic and bump slimcap dependency #105

Merged
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/els0r/goProbe

require (
github.com/els0r/status v1.0.0
github.com/fako1024/slimcap v0.0.0-20230312144344-ffc7db30268a
github.com/fako1024/slimcap v0.0.0-20230321123248-08a876d268b3
github.com/go-chi/chi/v5 v5.0.7
github.com/json-iterator/go v1.1.12
github.com/jsternberg/zap-logfmt v1.3.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ github.com/els0r/status v1.0.0 h1:j2G+Iq4nZK8yNXfJqkRwBEHzHl/SReUBMg0z6SV6vqU=
github.com/els0r/status v1.0.0/go.mod h1:O/aG4Ny1gNwOU82pIRTT1GQ1+upMDX+FA6QKwwgfSY4=
github.com/fako1024/slimcap v0.0.0-20230312144344-ffc7db30268a h1:0bYpopxNOnp/lwGDke4ASBbFKoPGSEUcVdM8Hy9Q9pE=
github.com/fako1024/slimcap v0.0.0-20230312144344-ffc7db30268a/go.mod h1:VlwHE/gr+4hUMKDHTFULSmi4rEQ6UcjGJkpGre//cOE=
github.com/fako1024/slimcap v0.0.0-20230321123248-08a876d268b3 h1:NQSD6OqOp9D5XUeUF7w+/KM3oSmMA4h2cmBjzn2cqDo=
github.com/fako1024/slimcap v0.0.0-20230321123248-08a876d268b3/go.mod h1:BuEYAF14Gp3ioid/4nI0eJ+XpeTMqVdNCyhuktXiWfo=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/go-chi/chi/v5 v5.0.7 h1:rDTPXLDHGATaeHvVlLcR4Qe0zftYethFucbjVQ1PxU8=
Expand Down
4 changes: 2 additions & 2 deletions pkg/capture/GPPacket.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ func (p *GPPacket) Populate(pkt capture.Packet) error {
// Extract the IP layer of the packet
srcPacket := pkt.IPLayer()

// read the direction from which the packet entered the interface
p.dirInbound = pkt.Type() == 0
// Ascertain the direction from which the packet entered the interface
p.dirInbound = pkt.IsInbound()
p.numBytes = pkt.TotalLen()
var protocol byte

Expand Down
3 changes: 3 additions & 0 deletions pkg/capture/capture_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ func newMockCaptureSource(maxPkts int) *mockCapture {
func (c *mockCapture) NewPacket() capture.Packet {
panic("not implemented") // TODO: Implement
}
func (c *mockCapture) NextIPPacket(pBuf capture.IPLayer) (capture.IPLayer, capture.PacketType, uint32, error) {
panic("not implemented") // TODO: Implement
}

// NextPacket receives the next packet from the wire and returns it. The operation is blocking. In
// case a non-nil "buffer" Packet is provided it will be populated with the data (and returned). The
Expand Down