Skip to content

Commit

Permalink
remove dependency on libpcap
Browse files Browse the repository at this point in the history
  • Loading branch information
satta committed Mar 15, 2021
1 parent 23c89d1 commit 755d69e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pcap_flowtuple_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package gommunityid

import (
"net"
"os"

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

// PcapFlowTuple represents a pair of the FlowTuple for a packet as
Expand All @@ -21,7 +22,11 @@ type PcapFlowTuple struct {
// accordingly.
func PcapFlowTupleSource(file string) (<-chan PcapFlowTuple, error) {
outChan := make(chan PcapFlowTuple)
handle, err := pcap.OpenOffline(file)
f, err := os.Open(file)
if err != nil {
return nil, err
}
handle, err := pcapgo.NewReader(f)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 755d69e

Please sign in to comment.