Skip to content

Commit

Permalink
Use fabric-lib-go for bccsp, metrics, flogging
Browse files Browse the repository at this point in the history
The following packages are being moved from fabric to fabric-lib-go
so that they can be shared across fabric and fabric-ca:

- github.com/hyperledger/fabric/bccsp
- github.com/hyperledger/fabric/common/flogging
- github.com/hyperledger/fabric/common/metrics

This commit updates fabric-ca to use the common code in fabric-lib-go.

The fabric-ca dependency on fabric is no longer needed. That's good!

Also ran goimports to clean up imports.

Signed-off-by: David Enyeart <[email protected]>
  • Loading branch information
denyeart committed Feb 16, 2024
1 parent 7f9dc21 commit b40f1d6
Show file tree
Hide file tree
Showing 404 changed files with 19,972 additions and 7,337 deletions.
9 changes: 6 additions & 3 deletions cmd/fabric-ca-client/command/mocks/Command.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 18 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,25 @@ require (
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/grantae/certinfo v0.0.0-20170412194111-59d56a35515b
github.com/hyperledger/fabric v0.0.0-20240123171006-370ebe56cea8
github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2
github.com/hyperledger/fabric-lib-go v1.0.0
github.com/hyperledger/fabric-lib-go v1.0.1-0.20240216124656-9f79bd087182
github.com/jinzhu/copier v0.3.5
github.com/jmoiron/sqlx v1.2.0
github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46
github.com/lib/pq v1.8.0
github.com/mattn/go-sqlite3 v1.14.18
github.com/mitchellh/mapstructure v1.4.3
github.com/mitchellh/mapstructure v1.5.0
github.com/onsi/ginkgo v1.14.2
github.com/onsi/gomega v1.19.0
github.com/onsi/gomega v1.31.0
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
github.com/pkg/errors v0.9.1
github.com/pkg/profile v1.5.0
github.com/prometheus/client_golang v1.11.1
github.com/spf13/cobra v1.5.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.8.2
golang.org/x/crypto v0.17.0
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.18.0
gopkg.in/ldap.v2 v2.5.1
)

Expand All @@ -44,14 +43,15 @@ require (
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/google/certificate-transparency-go v1.0.21 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmhodges/clock v0.0.0-20160418191101-880ee4c33548 // indirect
github.com/kilic/bls12-381 v0.1.0 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/miekg/pkcs11 v1.1.1 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
Expand All @@ -61,25 +61,24 @@ require (
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/spf13/afero v1.3.1 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/sykesm/zap-logfmt v0.0.4 // indirect
github.com/weppos/publicsuffix-go v0.5.0 // indirect
github.com/zmap/zcrypto v0.0.0-20190729165852-9051775e6a2e // indirect
github.com/zmap/zlint v0.0.0-20190806154020-fd021b4cfbeb // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.15.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/grpc v1.56.3 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
94 changes: 43 additions & 51 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import (
cadbuser "github.com/hyperledger/fabric-ca/lib/server/user"
"github.com/hyperledger/fabric-ca/lib/tls"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric-lib-go/bccsp"
"github.com/pkg/errors"

"github.com/jinzhu/copier"
Expand Down
2 changes: 1 addition & 1 deletion lib/ca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/hyperledger/fabric-ca/lib/server/db/sqlite"
dbutil "github.com/hyperledger/fabric-ca/lib/server/db/util"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/common/metrics/metricsfakes"
"github.com/hyperledger/fabric-lib-go/common/metrics/metricsfakes"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion lib/caconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/hyperledger/fabric-ca/lib/server/ldap"
"github.com/hyperledger/fabric-ca/lib/tls"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric-lib-go/bccsp/factory"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions lib/capkcs11_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"testing"

dbutil "github.com/hyperledger/fabric-ca/lib/server/db/util"
"github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric/bccsp/pkcs11"
"github.com/hyperledger/fabric-lib-go/bccsp/factory"
"github.com/hyperledger/fabric-lib-go/bccsp/pkcs11"
)

func TestCAInit(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion lib/certdbaccessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
dbutil "github.com/hyperledger/fabric-ca/lib/server/db/util"
cadbuser "github.com/hyperledger/fabric-ca/lib/server/user"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/common/metrics/metricsfakes"
"github.com/hyperledger/fabric-lib-go/common/metrics/metricsfakes"
"github.com/jmoiron/sqlx"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
Expand Down
23 changes: 12 additions & 11 deletions lib/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"io"
"net"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"strconv"
"strings"

idemix "github.com/IBM/idemix/bccsp/schemes/dlog/crypto"
math "github.com/IBM/mathlib"
cfsslapi "github.com/cloudflare/cfssl/api"
Expand All @@ -27,19 +37,10 @@ import (
"github.com/hyperledger/fabric-ca/lib/streamer"
"github.com/hyperledger/fabric-ca/lib/tls"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp"
cspsigner "github.com/hyperledger/fabric/bccsp/signer"
"github.com/hyperledger/fabric-lib-go/bccsp"
cspsigner "github.com/hyperledger/fabric-lib-go/bccsp/signer"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"io"
"net"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"strconv"
"strings"
)

// Client is the fabric-ca client object
Expand Down
2 changes: 1 addition & 1 deletion lib/client/credential/idemix/credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"github.com/hyperledger/fabric-ca/api"
idemix4 "github.com/hyperledger/fabric-ca/lib/common/idemix"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric-lib-go/bccsp"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion lib/client/credential/x509/credential.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/hyperledger/fabric-ca/api"
"github.com/hyperledger/fabric-ca/lib/client/credential"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric-lib-go/bccsp"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion lib/client/credential/x509/credential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
. "github.com/hyperledger/fabric-ca/lib/client/credential/x509"
"github.com/hyperledger/fabric-ca/lib/client/credential/x509/mocks"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric-lib-go/bccsp/factory"
"github.com/stretchr/testify/assert"
)

Expand Down
12 changes: 8 additions & 4 deletions lib/client/credential/x509/mocks/Client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/client/credential/x509/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/hyperledger/fabric-ca/lib/attrmgr"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric-lib-go/bccsp"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion lib/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/hyperledger/fabric-ca/lib/client/credential/x509"
"github.com/hyperledger/fabric-ca/lib/tls"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric-lib-go/bccsp"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
)
Expand Down
6 changes: 3 additions & 3 deletions lib/client_whitebox_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"github.com/cloudflare/cfssl/signer"
"github.com/hyperledger/fabric-ca/api"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric/bccsp/factory"
cspsigner "github.com/hyperledger/fabric/bccsp/signer"
"github.com/hyperledger/fabric-lib-go/bccsp"
"github.com/hyperledger/fabric-lib-go/bccsp/factory"
cspsigner "github.com/hyperledger/fabric-lib-go/bccsp/signer"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion lib/clientconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/hyperledger/fabric-ca/api"
"github.com/hyperledger/fabric-ca/lib/tls"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric-lib-go/bccsp/factory"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion lib/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/hyperledger/fabric-ca/lib/client/credential/idemix"
"github.com/hyperledger/fabric-ca/lib/client/credential/x509"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric-lib-go/bccsp"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion lib/mocks/operations_server.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions lib/mocks/server_request_context.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ import (
"github.com/hyperledger/fabric-ca/lib/server/operations"
stls "github.com/hyperledger/fabric-ca/lib/tls"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric-lib-go/common/metrics"
"github.com/hyperledger/fabric-lib-go/healthz"
"github.com/hyperledger/fabric/common/metrics"
"github.com/pkg/errors"
"github.com/spf13/viper"
)
Expand Down
6 changes: 4 additions & 2 deletions lib/server/certificaterequest/mocks/CertificateRequest.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/server/db/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/hyperledger/fabric-ca/lib/server/db/postgres"
"github.com/hyperledger/fabric-ca/lib/server/db/sqlite"
"github.com/hyperledger/fabric-ca/lib/tls"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric-lib-go/bccsp"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion lib/server/db/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0

package db

import "github.com/hyperledger/fabric/common/metrics"
import "github.com/hyperledger/fabric-lib-go/common/metrics"

var (
// APICounterOpts define the counter opts for database APIs
Expand Down
2 changes: 1 addition & 1 deletion lib/server/db/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package db_test
import (
"github.com/hyperledger/fabric-ca/lib/server/db"
"github.com/hyperledger/fabric-ca/lib/server/db/mocks"
"github.com/hyperledger/fabric/common/metrics/metricsfakes"
"github.com/hyperledger/fabric-lib-go/common/metrics/metricsfakes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
Expand Down
2 changes: 1 addition & 1 deletion lib/server/db/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/hyperledger/fabric-ca/lib/server/db"
"github.com/hyperledger/fabric-ca/lib/server/db/util"
"github.com/hyperledger/fabric-ca/lib/tls"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric-lib-go/bccsp"
"github.com/jmoiron/sqlx"
"github.com/pkg/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion lib/server/idemix/issuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
dbutil "github.com/hyperledger/fabric-ca/lib/server/db/util"
"github.com/hyperledger/fabric-ca/lib/server/user"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric-lib-go/bccsp"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion lib/server/idemix/issuer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/hyperledger/fabric-ca/lib/server/idemix/mocks"
dmocks "github.com/hyperledger/fabric-ca/lib/server/idemix/mocks"
"github.com/hyperledger/fabric-ca/util"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric-lib-go/bccsp"
"github.com/kisielk/sqlstruct"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
Expand Down
Loading

0 comments on commit b40f1d6

Please sign in to comment.