Skip to content

Commit

Permalink
Rename pcaputil to pcapgo, so we can expand with other Go-native PCAP
Browse files Browse the repository at this point in the history
code.
  • Loading branch information
gconnell committed Apr 25, 2014
1 parent 0f33fad commit 3964bfe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions gc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ gofmt -w gen.go
go build gen.go
go test ./...
popd
pushd pcapgo
go test ./...
go build ./...
popd
if [ -f /usr/include/linux/if_packet.h ]; then
if grep -q TPACKET_V3 /usr/include/linux/if_packet.h; then
pushd afpacket
Expand All @@ -105,10 +109,6 @@ if [ -f /usr/include/linux/if_packet.h ]; then
fi
fi
if [ -f /usr/include/pcap.h ]; then
pushd pcaputil
go test ./...
go build ./...
popd
pushd pcap
go test ./...
go build ./...
Expand Down
12 changes: 5 additions & 7 deletions pcaputil/write.go → pcapgo/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
// that can be found in the LICENSE file in the root of the source
// tree.

// Package pcaputil allows users to write PCAP data to files.
//
// We keep PCAP writing outside of the pcap/ package, since that package
// requires libpcap installation to be compiled, while this does not.
package pcaputil
// Package pcapgo provides some native PCAP support, not requiring
// C libpcap to be installed.
package pcapgo

import (
"code.google.com/p/gopacket"
Expand Down Expand Up @@ -38,13 +36,13 @@ const versionMinor = 4
//
// // Write a new file:
// f, _ := os.Create("/tmp/file.pcap")
// w := pcaputil.NewWriter(f)
// w := pcapgo.NewWriter(f)
// w.WriteFileHeader(65536, layers.LinkTypeEthernet) // new file, must do this.
// w.WritePacket(gopacket.CaptureInfo{...}, data1)
// f.Close()
// // Append to existing file (must have same snaplen and linktype)
// f2, _ := os.OpenFile("/tmp/file.pcap", os.O_APPEND, 0700)
// w2 := pcaputil.NewWriter(f2)
// w2 := pcapgo.NewWriter(f2)
// // no need for file header, it's already written.
// w2.WritePacket(gopacket.CaptureInfo{...}, data2)
// f2.Close()
Expand Down

0 comments on commit 3964bfe

Please sign in to comment.