From 304cd5066db31ee021b911d22db3f7949be804ad Mon Sep 17 00:00:00 2001 From: Denis Tingaikin Date: Tue, 12 Jul 2022 02:59:27 +0300 Subject: [PATCH] update to latest sdk Signed-off-by: Denis Tingaikin --- .golangci.yml | 2 +- go.mod | 10 ++++------ go.sum | 16 ++++++++-------- main.go | 8 +++++++- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index c185881..c734c74 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -37,7 +37,7 @@ linters-settings: threshold: 150 funlen: Lines: 300 - Statements: 120 + Statements: 125 goconst: min-len: 2 min-occurrences: 2 diff --git a/go.mod b/go.mod index 3b6e192..cba8a83 100644 --- a/go.mod +++ b/go.mod @@ -7,9 +7,9 @@ require ( github.com/edwarnicke/grpcfd v1.1.2 github.com/edwarnicke/vpphelper v0.0.0-20210225052320-b4f1f1aff45d github.com/kelseyhightower/envconfig v1.4.0 - github.com/networkservicemesh/api v1.3.2-0.20220516230921-edaa6f46d6ab - github.com/networkservicemesh/sdk v0.5.1-0.20220603191023-6abdf1e0eb19 - github.com/networkservicemesh/sdk-vpp v0.0.0-20220603151507-f38df88434f3 + github.com/networkservicemesh/api v1.4.1-0.20220711153918-a59689088578 + github.com/networkservicemesh/sdk v0.5.1-0.20220711213025-454062d8cea6 + github.com/networkservicemesh/sdk-vpp v0.0.0-20220711213928-fc3a59d6943a github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.8.1 github.com/spiffe/go-spiffe/v2 v2.0.0 @@ -17,8 +17,6 @@ require ( google.golang.org/protobuf v1.27.1 ) -replace github.com/networkservicemesh/sdk => github.com/denis-tingaikin/sdk v0.0.0-20220710232041-6f8a30e5811d - require ( git.fd.io/govpp.git v0.3.6-0.20210927044411-385ccc0d8ba9 // indirect github.com/OneOfOne/xxhash v1.2.3 // indirect @@ -41,7 +39,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/lunixbochs/struc v0.0.0-20200521075829-a4cb8d33dbbe // indirect github.com/miekg/dns v1.1.49 // indirect - github.com/networkservicemesh/sdk-kernel v0.0.0-20220603151005-aa00631f2e0f // indirect + github.com/networkservicemesh/sdk-kernel v0.0.0-20220711213501-f94d71ba3cd2 // indirect github.com/open-policy-agent/opa v0.16.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect diff --git a/go.sum b/go.sum index 89f3be8..66cec83 100644 --- a/go.sum +++ b/go.sum @@ -32,8 +32,6 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH 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/denis-tingaikin/sdk v0.0.0-20220710232041-6f8a30e5811d h1:brJ70rhvOWPAdeYI5BZXBS1NCb6guF/VeV2owWm+7T4= -github.com/denis-tingaikin/sdk v0.0.0-20220710232041-6f8a30e5811d/go.mod h1:FdmGiefBBcj9HlV+poQSEAPOuBVp/hkwjWoDEN2a+jg= github.com/edwarnicke/exechelper v1.0.2 h1:dD49Ui2U0FBFxxhalnKw6vLS0P0TkgnXBRvKL/xmC5w= github.com/edwarnicke/exechelper v1.0.2/go.mod h1:/T271jtNX/ND4De6pa2aRy2+8sNtyCDB1A2pp4M+fUs= github.com/edwarnicke/govpp v0.0.0-20220509171552-731995b8f574 h1:2lYhLBDjflBOPJLd/42txk9QlSkVep6p1vKzlvkCKOI= @@ -136,12 +134,14 @@ github.com/miekg/dns v1.1.49 h1:qe0mQU3Z/XpFeE+AEBo2rqaS1IPBJ3anmqZ4XiZJVG8= github.com/miekg/dns v1.1.49/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME= github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721/go.mod h1:Ickgr2WtCLZ2MDGd4Gr0geeCH5HybhRJbonOgQpvSxc= github.com/mna/pigeon v0.0.0-20180808201053-bb0192cfc2ae/go.mod h1:Iym28+kJVnC1hfQvv5MUtI6AiFFzvQjHcvI4RFTG/04= -github.com/networkservicemesh/api v1.3.2-0.20220516230921-edaa6f46d6ab h1:hV6T7Kvze0qQphqi6g5ZKFoJ0m08OKdWETUINo3tuaA= -github.com/networkservicemesh/api v1.3.2-0.20220516230921-edaa6f46d6ab/go.mod h1:hOF2844BSstH1311oDMDgqqXS+kdc77htZNPRKl9mf8= -github.com/networkservicemesh/sdk-kernel v0.0.0-20220603151005-aa00631f2e0f h1:g1FXEvoiLP220l1faA7JDLOaV56Cq1Vz5K7G8DPiSZ8= -github.com/networkservicemesh/sdk-kernel v0.0.0-20220603151005-aa00631f2e0f/go.mod h1:xukX7XZOUQpnLG9df5bckNk3r9Is9kPXTtkUwuWk7qw= -github.com/networkservicemesh/sdk-vpp v0.0.0-20220603151507-f38df88434f3 h1:YnFjPBeoXJZBbLXU+rOpEjLKEbI5UbZRscfcLjqhY60= -github.com/networkservicemesh/sdk-vpp v0.0.0-20220603151507-f38df88434f3/go.mod h1:lF+eq/4v/WseGyJqIGHep8OOgFUfC3jDRP4+IT70uNc= +github.com/networkservicemesh/api v1.4.1-0.20220711153918-a59689088578 h1:2MZD6SGFULqTgMKA8BFy7F+ldRErAyxsWht7oCwCVRM= +github.com/networkservicemesh/api v1.4.1-0.20220711153918-a59689088578/go.mod h1:hOF2844BSstH1311oDMDgqqXS+kdc77htZNPRKl9mf8= +github.com/networkservicemesh/sdk v0.5.1-0.20220711213025-454062d8cea6 h1:wz6G5+rIqMZqGAII9DdSAuR1LzstTvMpxsaYnHyBjjg= +github.com/networkservicemesh/sdk v0.5.1-0.20220711213025-454062d8cea6/go.mod h1:BF31hkvYPBmpChr4XB2l9pFWK+ySvk2y2h7IdCwqt84= +github.com/networkservicemesh/sdk-kernel v0.0.0-20220711213501-f94d71ba3cd2 h1:3pGNhmYVtIC2PYj56+5PFlUuPEZnVZNVPGP9NXpsSkE= +github.com/networkservicemesh/sdk-kernel v0.0.0-20220711213501-f94d71ba3cd2/go.mod h1:s/izm3ayUk4NuL9E8JivneDaz4PH8AcoFEUykwz5Kv0= +github.com/networkservicemesh/sdk-vpp v0.0.0-20220711213928-fc3a59d6943a h1:ZwWR32glKZXhO/X280hWa8XR2FOVt2IsZ6cfF5j8vfk= +github.com/networkservicemesh/sdk-vpp v0.0.0-20220711213928-fc3a59d6943a/go.mod h1:/Xd8ZjmduIF47UewZCrzGvr+rkk9AS7xCqqDjePK+Fc= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.1.0 h1:e3YP4dN/HYPpGh29X1ZkcxcEICsOls9huyVCRBaxjq8= diff --git a/main.go b/main.go index 037e164..ea2acc8 100644 --- a/main.go +++ b/main.go @@ -387,7 +387,7 @@ func main() { requestCtx, cancelRequest := context.WithTimeout(signalCtx, config.RequestTimeout) defer cancelRequest() - conn, err := nsmClient.Request(ctx, &networkservice.NetworkServiceRequest{ + conn, err := nsmClient.Request(requestCtx, &networkservice.NetworkServiceRequest{ Connection: &networkservice.Connection{ Id: config.Name + "-kernel", NetworkServiceEndpointName: config.Name, @@ -400,6 +400,12 @@ func main() { log.FromContext(ctx).Fatal(err.Error()) } + defer func(conn *networkservice.Connection) { + closeCtx, cancelClose := context.WithTimeout(ctx, config.RequestTimeout) + defer cancelClose() + _, _ = nsmClient.Close(closeCtx, conn) + }(conn) + dnsServerIP.Store(conn.GetContext().GetIpContext().GetSrcIPNets()[0].IP) for i, nse := range nseList {