From d6c9320781d20b1fcc3be2bd55b7076005bdf502 Mon Sep 17 00:00:00 2001 From: Alexandr Dubovikov Date: Tue, 25 Jun 2024 12:49:05 +0200 Subject: [PATCH] fixed test actions --- go.mod | 2 +- go.sum | 6 ++++++ ip6defrag/defrag.go | 30 ++++++++++++++---------------- main.go | 2 +- sniffer/sniffer.go | 8 ++++---- 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index b1007a3..1f2370a 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,6 @@ require ( github.com/segmentio/asm v1.2.0 // indirect github.com/segmentio/encoding v0.3.6 github.com/sipcapture/golua v0.0.0-20200610090950-538d24098d76 // indirect - github.com/stretchr/testify v1.8.2 + github.com/stretchr/testify v1.9.0 golang.org/x/net v0.18.0 ) diff --git a/go.sum b/go.sum index 69faf17..80ba958 100644 --- a/go.sum +++ b/go.sum @@ -66,6 +66,7 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -246,6 +247,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -254,6 +256,9 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/xhit/go-str2duration v1.2.0/go.mod h1:3cPSlfZlUHVlneIVfePFWcJZsuwf+P1v2SRTV4cUmp4= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -584,6 +589,7 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/ip6defrag/defrag.go b/ip6defrag/defrag.go index 617e5fd..64c4342 100644 --- a/ip6defrag/defrag.go +++ b/ip6defrag/defrag.go @@ -43,24 +43,23 @@ const ( // the packet, a new IPv6 layer will be returned, and will be set to // the entire defragmented packet, // -// It use a map of all the running flows +// # It use a map of all the running flows // // Usage example: // -// func HandlePacket(in *layers.IPv6, inFragment *layers.IPv6Fragment) err { -// defragger := ip6defrag.NewIPv6Defragmenter() -// in, err := defragger.DefragIPv6(in, inFragment) -// if err != nil { -// return err -// } else if in == nil { -// return nil // packet fragment, we don't have whole packet yet. -// } -// // At this point, we know that 'in' is defragmented. -// //It may be the same 'in' passed to -// // HandlePacket, or it may not, but we don't really care :) -// ... do stuff to 'in' ... -//} -// +// func HandlePacket(in *layers.IPv6, inFragment *layers.IPv6Fragment) err { +// defragger := ip6defrag.NewIPv6Defragmenter() +// in, err := defragger.DefragIPv6(in, inFragment) +// if err != nil { +// return err +// } else if in == nil { +// return nil // packet fragment, we don't have whole packet yet. +// } +// // At this point, we know that 'in' is defragmented. +// //It may be the same 'in' passed to +// // HandlePacket, or it may not, but we don't really care :) +// ... do stuff to 'in' ... +// } func (d *IPv6Defragmenter) DefragIPv6(in *layers.IPv6, inFragment *layers.IPv6Fragment) (*layers.IPv6, error) { return d.DefragIPv6WithTimestamp(in, inFragment, time.Now()) } @@ -70,7 +69,6 @@ func (d *IPv6Defragmenter) DefragIPv6(in *layers.IPv6, inFragment *layers.IPv6Fr // old fragments instead of time.Now() // // This is useful when operating on pcap files instead of live captured data -// func (d *IPv6Defragmenter) DefragIPv6WithTimestamp(in *layers.IPv6, inFragment *layers.IPv6Fragment, t time.Time) (*layers.IPv6, error) { // perfom security checks st, err := d.securityChecks(inFragment) diff --git a/main.go b/main.go index 3f7f01f..df7691b 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ import ( "github.com/sipcapture/heplify/sniffer" ) -const version = "heplify 1.66.4" +const version = "heplify 1.66.5" func createFlags() { diff --git a/sniffer/sniffer.go b/sniffer/sniffer.go index bc54741..c335050 100644 --- a/sniffer/sniffer.go +++ b/sniffer/sniffer.go @@ -373,7 +373,7 @@ LOOP: // Listen for an incoming connection. conn, err := sniffer.collectorTCPconn.Accept() if err != nil { - logp.Err("Error accepting tcp connection: ", err.Error()) + logp.Err("Error accepting tcp connection: %s", err.Error()) continue } @@ -714,7 +714,7 @@ func (sniffer *SnifferSetup) handleRequestExtended(conn net.Conn) { // Read the incoming connection into the buffer. n, err := conn.Read(message) if err != nil { - logp.Err("closed tcp connection [1]:", err.Error()) + logp.Err("closed tcp connection [1]: %s", err.Error()) break } @@ -728,7 +728,7 @@ func (sniffer *SnifferSetup) handleRequestExtended(conn net.Conn) { n, err := bufferPool.Read(dataHeader) if err != nil { if err.Error() != "EOF" { - logp.Err("error during read buffer: ", err) + logp.Err("error during read buffer: %s", err.Error()) } break } @@ -776,7 +776,7 @@ func (sniffer *SnifferSetup) handleRequestExtended(conn net.Conn) { // Read the incoming connection into the buffer. n, err := conn.Read(message) if err != nil { - logp.Err("closed tcp connection [2]:", err.Error()) + logp.Err("closed tcp connection [2]: %s", err.Error()) bufferPool.Reset() break }