From df1f7799ea2cecc059acd312d91b01036f58e178 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 19 Nov 2014 09:32:21 +0100 Subject: [PATCH] Make the example more idiomatic --- pkg/go-netfilter-queue/README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pkg/go-netfilter-queue/README.md b/pkg/go-netfilter-queue/README.md index e44b4055..d9202c12 100644 --- a/pkg/go-netfilter-queue/README.md +++ b/pkg/go-netfilter-queue/README.md @@ -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) } }