Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Make the example more idiomatic #270

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 4 additions & 8 deletions pkg/go-netfilter-queue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,22 @@ You can then use go-netfilter-queue to inspect the packets:
package main

import (
"fmt"
"github.com/openshift/geard/pkg/go-netfilter-queue"
"os"
"log"
)

func main() {
var err error

nfq, err := netfilter.NewNFQueue(0, 100, netfilter.NF_DEFAULT_PACKET_SIZE)
if err != nil {
fmt.Println(err)
os.Exit(1)
log.Fatal(err)
}
defer nfq.Close()
packets := nfq.GetPackets()

for true {
for {
select {
case p := <-packets:
fmt.Println(p.Packet)
log.Println(p.Packet)
p.SetVerdict(netfilter.NF_ACCEPT)
}
}
Expand Down