Skip to content

Commit

Permalink
Update example to use new func RegisterWithErrorFunc
Browse files Browse the repository at this point in the history
Signed-off-by: giuliano <panzironi.giuliano@gmail.com>
  • Loading branch information
giulianopz committed Dec 30, 2023
1 parent f2bdeb0 commit 52b91eb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions example_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//+build linux
//go:build linux
// +build linux

package nfqueue_test

Expand All @@ -10,7 +11,7 @@ import (
nfqueue "github.com/florianl/go-nfqueue"
)

func ExampleNfqueue_Register() {
func ExampleNfqueue_RegisterWithErrorFunc() {
// Send outgoing pings to nfqueue queue 100
// # sudo iptables -I OUTPUT -p icmp -j NFQUEUE --queue-num 100

Expand Down Expand Up @@ -42,7 +43,10 @@ func ExampleNfqueue_Register() {
}

// Register your function to listen on nflqueue queue 100
err = nf.Register(ctx, fn)
err = nf.RegisterWithErrorFunc(ctx, fn, func(e error) int {
fmt.Println(err)
return -1
})
if err != nil {
fmt.Println(err)
return
Expand Down

0 comments on commit 52b91eb

Please sign in to comment.