diff --git a/go.mod b/go.mod index 73ef1c3e..7fbcfa5e 100644 --- a/go.mod +++ b/go.mod @@ -4,11 +4,12 @@ go 1.18 require ( github.com/antonfisher/nested-logrus-formatter v1.3.1 + github.com/edwarnicke/genericsync v0.0.0-20220910010113-61a344f9bc29 github.com/edwarnicke/grpcfd v1.1.2 github.com/edwarnicke/serialize v1.0.7 github.com/kelseyhightower/envconfig v1.4.0 github.com/networkservicemesh/api v1.7.2-0.20230123083145-4a6c3ec589e1 - github.com/networkservicemesh/sdk v0.5.1-0.20230213134519-3aa9aa0d5e1b + github.com/networkservicemesh/sdk v0.5.1-0.20230220110548-26b7ec8d44f2 github.com/sirupsen/logrus v1.9.0 github.com/spiffe/go-spiffe/v2 v2.0.0 github.com/stretchr/testify v1.8.0 diff --git a/go.sum b/go.sum index 3c854634..1e75d5a1 100644 --- a/go.sum +++ b/go.sum @@ -76,6 +76,8 @@ github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8 github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= 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/genericsync v0.0.0-20220910010113-61a344f9bc29 h1:4/2wgileNvQB4HfJbq7u4FFLKIfc38a6P0S/51ZGgX8= +github.com/edwarnicke/genericsync v0.0.0-20220910010113-61a344f9bc29/go.mod h1:3m+ZfVq+z0pTLW798jmqnifMsalrVLIKmfXaMFvqSuc= github.com/edwarnicke/grpcfd v1.1.2 h1:2b8kCABQ1+JjSKGDoHadqSW7whCeTXMqtyo6jmB5B8k= github.com/edwarnicke/grpcfd v1.1.2/go.mod h1:rHihB9YvNMixz8rS+ZbwosI2kj65VLkeyYAI2M+/cGA= github.com/edwarnicke/serialize v0.0.0-20200705214914-ebc43080eecf/go.mod h1:XvbCO/QGsl3X8RzjBMoRpkm54FIAZH5ChK2j+aox7pw= @@ -195,8 +197,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182aff github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= github.com/networkservicemesh/api v1.7.2-0.20230123083145-4a6c3ec589e1 h1:RxNKksXsXsnDsEo+Cfn43pdPfML024ad//QcdKfgXK4= github.com/networkservicemesh/api v1.7.2-0.20230123083145-4a6c3ec589e1/go.mod h1:hOF2844BSstH1311oDMDgqqXS+kdc77htZNPRKl9mf8= -github.com/networkservicemesh/sdk v0.5.1-0.20230213134519-3aa9aa0d5e1b h1:0FNADw+V7ZmS1BQ02fIAll8bO45VYVQTeGHDZk/DsbI= -github.com/networkservicemesh/sdk v0.5.1-0.20230213134519-3aa9aa0d5e1b/go.mod h1:0AB74FQa4HEAvazQ0v92E2Cnb7k0E1/gsbp+vFd0ukw= +github.com/networkservicemesh/sdk v0.5.1-0.20230220110548-26b7ec8d44f2 h1:AFS9ygJ6g9Snjbpc0V5JdQLoa4NOJbj0HurXaxvX0Tc= +github.com/networkservicemesh/sdk v0.5.1-0.20230220110548-26b7ec8d44f2/go.mod h1:4w0ue1+jI3lHNdSr+rzSpFIBwoGfM5vRcjVkNKZNRxk= github.com/open-policy-agent/opa v0.44.0 h1:sEZthsrWBqIN+ShTMJ0Hcz6a3GkYsY4FaB2S/ou2hZk= github.com/open-policy-agent/opa v0.44.0/go.mod h1:YpJaFIk5pq89n/k72c1lVvfvR5uopdJft2tMg1CW/yU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/internal/imports/imports_linux.go b/internal/imports/imports_linux.go index ca28e30f..dfa48c46 100644 --- a/internal/imports/imports_linux.go +++ b/internal/imports/imports_linux.go @@ -6,6 +6,7 @@ import ( _ "crypto/tls" _ "fmt" _ "github.com/antonfisher/nested-logrus-formatter" + _ "github.com/edwarnicke/genericsync" _ "github.com/edwarnicke/grpcfd" _ "github.com/edwarnicke/serialize" _ "github.com/kelseyhightower/envconfig" @@ -43,6 +44,7 @@ import ( _ "github.com/networkservicemesh/sdk/pkg/tools/token" _ "github.com/networkservicemesh/sdk/pkg/tools/tracing" _ "github.com/sirupsen/logrus" + _ "github.com/spiffe/go-spiffe/v2/spiffeid" _ "github.com/spiffe/go-spiffe/v2/spiffetls/tlsconfig" _ "github.com/spiffe/go-spiffe/v2/svid/x509svid" _ "github.com/spiffe/go-spiffe/v2/workloadapi" diff --git a/internal/manager/manager.go b/internal/manager/manager.go index f7364b03..f72b5ce5 100644 --- a/internal/manager/manager.go +++ b/internal/manager/manager.go @@ -1,6 +1,9 @@ // Copyright (c) 2020-2022 Doc.ai and/or its affiliates. +// // Copyright (c) 2022 Nordix and/or its affiliates. // +// Copyright (c) 2023 Cisco and/or its affiliates. +// // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,10 +33,11 @@ import ( "github.com/networkservicemesh/sdk/pkg/tools/log/logruslogger" "github.com/networkservicemesh/sdk/pkg/tools/log/spanlogger" - "github.com/networkservicemesh/sdk/pkg/tools/spire" + "github.com/edwarnicke/genericsync" "github.com/edwarnicke/grpcfd" "github.com/sirupsen/logrus" + "github.com/spiffe/go-spiffe/v2/spiffeid" "github.com/spiffe/go-spiffe/v2/spiffetls/tlsconfig" "github.com/spiffe/go-spiffe/v2/svid/x509svid" "github.com/spiffe/go-spiffe/v2/workloadapi" @@ -119,7 +123,7 @@ func RunNsmgr(ctx context.Context, configuration *config.Config) error { tlsClientConfig.MinVersion = tls.VersionTLS12 tlsServerConfig := tlsconfig.MTLSServerConfig(m.source, m.source, tlsconfig.AuthorizeAny()) tlsServerConfig.MinVersion = tls.VersionTLS12 - spiffeIDConnMap := spire.SpiffeIDConnectionMap{} + spiffeIDConnMap := genericsync.Map[spiffeid.ID, *genericsync.Map[string, struct{}]]{} mgrOptions := []nsmgr.Option{ nsmgr.WithName(configuration.Name), nsmgr.WithURL(u.String()),