Skip to content

Commit

Permalink
grpc fixes (#54)
Browse files Browse the repository at this point in the history
* update go modules
global fixes for NewGRPCOptionsFromConfig
added grpc config tests

* remove garbage

* fix pkg order

* remove commented code

* fixed imports

Co-authored-by: Dmitry Zhvakin <dm@hostdm.ru>
  • Loading branch information
Dmitry Zhvakin and Dmitry Zhvakin committed Sep 1, 2020
1 parent ef9e53d commit 74b9f77
Show file tree
Hide file tree
Showing 39 changed files with 689 additions and 57 deletions.
2 changes: 2 additions & 0 deletions api/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ type GRPCKeepAliveConfig struct {

type TlsConfig struct {
Enabled bool `yaml:"enabled"`
SkipVerify bool `yaml:"skip_verify"`
HostOverride string `yaml:"host_override"`
CertPath string `yaml:"cert_path"`
KeyPath string `yaml:"key_path"`
CACertPath string `yaml:"ca_cert_path"`
}

Expand Down
2 changes: 1 addition & 1 deletion ca/affiliation.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"net/http"
"net/url"

"github.com/s7techlab/hlf-sdk-go/api/ca"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api/ca"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion ca/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"net/http"
"net/url"

"github.com/s7techlab/hlf-sdk-go/api/ca"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api/ca"
)

const endpointCertificateList = "%s/api/v1/certificates%s"
Expand Down
8 changes: 4 additions & 4 deletions ca/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"io/ioutil"
"net/http"

"github.com/s7techlab/hlf-sdk-go/api"
"github.com/s7techlab/hlf-sdk-go/api/ca"
"github.com/s7techlab/hlf-sdk-go/api/config"
"github.com/s7techlab/hlf-sdk-go/crypto"
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/msp"
mspPb "github.com/hyperledger/fabric/protos/msp"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api"
"github.com/s7techlab/hlf-sdk-go/api/ca"
"github.com/s7techlab/hlf-sdk-go/api/config"
"github.com/s7techlab/hlf-sdk-go/crypto"
)

type core struct {
Expand Down
2 changes: 1 addition & 1 deletion ca/core_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"io/ioutil"
"net/http"

"github.com/s7techlab/hlf-sdk-go/api/config"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api/config"
"gopkg.in/yaml.v2"
)

Expand Down
2 changes: 1 addition & 1 deletion ca/enroll.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"encoding/pem"
"net/http"

"github.com/s7techlab/hlf-sdk-go/api/ca"
"github.com/cloudflare/cfssl/signer"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api/ca"
)

const enrollEndpoint = `/api/v1/enroll`
Expand Down
2 changes: 1 addition & 1 deletion ca/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"net/http"

"github.com/s7techlab/hlf-sdk-go/api/ca"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api/ca"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion ca/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"net/http"

"github.com/s7techlab/hlf-sdk-go/api/ca"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api/ca"
)

func (c *core) CAInfo(ctx context.Context) (*ca.ResponseCAInfo, error) {
Expand Down
2 changes: 1 addition & 1 deletion ca/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"encoding/json"
"net/http"

"github.com/s7techlab/hlf-sdk-go/api/ca"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api/ca"
)

const regEndpoint = `/api/v1/register`
Expand Down
2 changes: 1 addition & 1 deletion ca/revoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"fmt"
"net/http"

"github.com/s7techlab/hlf-sdk-go/api/ca"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api/ca"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion client/chaincode/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/pkg/errors"

"github.com/s7techlab/hlf-sdk-go/api"
"github.com/hyperledger/fabric/msp"
"github.com/s7techlab/hlf-sdk-go/api"
)

type Core struct {
Expand Down
2 changes: 1 addition & 1 deletion client/chaincode/core_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/hyperledger/fabric/protos/utils"
"github.com/pkg/errors"

"github.com/s7techlab/hlf-sdk-go/api"
"github.com/hyperledger/fabric/protos/peer"
"github.com/s7techlab/hlf-sdk-go/api"
)

type corePackage struct {
Expand Down
2 changes: 1 addition & 1 deletion client/chaincode/system/scc.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package system

import (
"github.com/s7techlab/hlf-sdk-go/api"
"github.com/hyperledger/fabric/msp"
"github.com/s7techlab/hlf-sdk-go/api"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions client/channel/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package channel
import (
"context"

"github.com/s7techlab/hlf-sdk-go/client/chaincode/system"
"github.com/s7techlab/hlf-sdk-go/util"
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/protos/common"
"github.com/hyperledger/fabric/protos/orderer"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/client/chaincode/system"
"github.com/s7techlab/hlf-sdk-go/util"
)

func (c *Core) Join(ctx context.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion client/core_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"io/ioutil"

"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api"
"github.com/s7techlab/hlf-sdk-go/api/config"
"github.com/pkg/errors"
"go.uber.org/zap"
"gopkg.in/yaml.v2"
)
Expand Down
2 changes: 1 addition & 1 deletion client/fetcher/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package fetcher
import (
"context"

"github.com/s7techlab/hlf-sdk-go/api"
"github.com/hyperledger/fabric/core/chaincode/platforms"
"github.com/hyperledger/fabric/protos/peer"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api"
)

type localFetcher struct {
Expand Down
2 changes: 1 addition & 1 deletion crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"crypto/rand"
"sync"

"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api"
"github.com/s7techlab/hlf-sdk-go/api/config"
"github.com/pkg/errors"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions crypto/ecdsa/ecdsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (

"crypto/x509"

"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api"
"github.com/s7techlab/hlf-sdk-go/api/config"
"github.com/s7techlab/hlf-sdk-go/crypto"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"golang.org/x/crypto/sha3"
)

Expand Down
2 changes: 1 addition & 1 deletion discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package discovery
import (
"sync"

"github.com/s7techlab/hlf-sdk-go/api"
"github.com/pkg/errors"
"github.com/s7techlab/hlf-sdk-go/api"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion examples/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

"log"

"github.com/hyperledger/fabric/common/util"
"github.com/s7techlab/hlf-sdk-go/api"
"github.com/s7techlab/hlf-sdk-go/client"
_ "github.com/s7techlab/hlf-sdk-go/crypto/ecdsa"
_ "github.com/s7techlab/hlf-sdk-go/discovery/local"
"github.com/s7techlab/hlf-sdk-go/identity"
"github.com/hyperledger/fabric/common/util"
"go.uber.org/zap"
)

Expand Down
15 changes: 9 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/docker/go-units v0.4.0 // indirect
github.com/gogo/protobuf v1.3.0
github.com/golang/mock v1.3.1 // indirect
github.com/golang/protobuf v1.3.2
github.com/golang/protobuf v1.4.2
github.com/google/certificate-transparency-go v1.1.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
github.com/grpc-ecosystem/grpc-gateway v1.11.1 // indirect
Expand All @@ -29,15 +29,18 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.4.0
github.com/tedsuo/ifrit v0.0.0-20191009134036-9a97d0632f00 // indirect
go.opencensus.io v0.22.0
go.uber.org/zap v1.12.0
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413
golang.org/x/net v0.0.0-20190628185345-da137c7871d7 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449 // indirect
google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610 // indirect
google.golang.org/grpc v1.23.0
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a // indirect
golang.org/x/text v0.3.3 // indirect
google.golang.org/genproto v0.0.0-20200831141814-d751682dd103 // indirect
google.golang.org/grpc v1.31.1
google.golang.org/protobuf v1.25.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v2 v2.2.2
)

0 comments on commit 74b9f77

Please sign in to comment.