Commit 3c662c5f authored by suyanlong's avatar suyanlong

update mod and Add pluginID field for config file

parent 4a632a93
Pipeline #8625 failed with stages
...@@ -10,19 +10,18 @@ require ( ...@@ -10,19 +10,18 @@ require (
github.com/bits-and-blooms/bloom/v3 v3.1.0 github.com/bits-and-blooms/bloom/v3 v3.1.0
github.com/btcsuite/btcd v0.21.0-beta github.com/btcsuite/btcd v0.21.0-beta
github.com/bxcodec/faker/v3 v3.6.0 github.com/bxcodec/faker/v3 v3.6.0
github.com/casbin/casbin v1.9.1 github.com/casbin/casbin/v2 v2.37.0
github.com/cbergoon/merkletree v0.2.0 github.com/cbergoon/merkletree v0.2.0
github.com/creasty/defaults v1.5.2 github.com/creasty/defaults v1.5.2
github.com/deckarep/golang-set v1.7.2-0.20201129021324-03b572015f8e github.com/deckarep/golang-set v1.7.2-0.20201129021324-03b572015f8e
github.com/devfeel/mapper v0.7.5 github.com/devfeel/mapper v0.7.5
github.com/elliotchance/orderedmap v1.4.0 github.com/elliotchance/orderedmap v1.4.0
github.com/fatih/color v1.12.0 github.com/fatih/color v1.13.0
github.com/fsnotify/fsnotify v1.4.9 github.com/fsnotify/fsnotify v1.4.9
github.com/gammazero/deque v0.1.0 github.com/gammazero/deque v0.1.0
github.com/gin-contrib/authz v0.0.0-20211106112157-2a70df09d207 github.com/gin-contrib/authz v0.0.0-20211106112157-2a70df09d207
github.com/gin-contrib/gzip v0.0.3 github.com/gin-contrib/gzip v0.0.3
github.com/gin-contrib/requestid v0.0.1 github.com/gin-contrib/requestid v0.0.1
github.com/gin-contrib/timeout v0.0.2
github.com/gin-gonic/gin v1.7.7 github.com/gin-gonic/gin v1.7.7
github.com/gobuffalo/packd v1.0.0 github.com/gobuffalo/packd v1.0.0
github.com/gobuffalo/packr v1.30.1 github.com/gobuffalo/packr v1.30.1
...@@ -33,9 +32,9 @@ require ( ...@@ -33,9 +32,9 @@ require (
github.com/google/go-cmp v0.5.5 github.com/google/go-cmp v0.5.5
github.com/gookit/goutil v0.3.15 github.com/gookit/goutil v0.3.15
github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd github.com/hashicorp/go-hclog v1.2.0
github.com/hashicorp/go-multierror v1.1.0 github.com/hashicorp/go-multierror v1.1.0
github.com/hashicorp/go-plugin v1.3.0 github.com/hashicorp/go-plugin v1.4.3
github.com/herumi/bls-eth-go-binary v0.0.0-20211108015406-b5186ba08dc7 github.com/herumi/bls-eth-go-binary v0.0.0-20211108015406-b5186ba08dc7
github.com/huandu/skiplist v1.2.0 github.com/huandu/skiplist v1.2.0
github.com/huandu/xstrings v1.3.2 github.com/huandu/xstrings v1.3.2
...@@ -43,10 +42,11 @@ require ( ...@@ -43,10 +42,11 @@ require (
github.com/hyperledger/fabric-protos-go v0.0.0-20200330074707-cfe579e86986 github.com/hyperledger/fabric-protos-go v0.0.0-20200330074707-cfe579e86986
github.com/imdario/mergo v0.3.12 github.com/imdario/mergo v0.3.12
github.com/ipfs/go-cid v0.0.7 github.com/ipfs/go-cid v0.0.7
github.com/jinzhu/copier v0.3.2 github.com/jinzhu/copier v0.3.5
github.com/jinzhu/now v1.1.2 github.com/jinzhu/now v1.1.2
github.com/juju/errors v0.0.0-20210818161939-5560c4c073ff github.com/juju/errors v0.0.0-20210818161939-5560c4c073ff
github.com/lestrrat-go/file-rotatelogs v2.2.0+incompatible github.com/lestrrat-go/file-rotatelogs v2.2.0+incompatible
github.com/libp2p/go-libp2p v0.9.2
github.com/libp2p/go-libp2p-core v0.6.1 github.com/libp2p/go-libp2p-core v0.6.1
github.com/magiconair/properties v1.8.1 github.com/magiconair/properties v1.8.1
github.com/meshplus/bitxhub-core v1.3.1-0.20210524071255-789fd9ab501c github.com/meshplus/bitxhub-core v1.3.1-0.20210524071255-789fd9ab501c
...@@ -68,14 +68,13 @@ require ( ...@@ -68,14 +68,13 @@ require (
github.com/vmihailenco/msgpack/v5 v5.3.4 github.com/vmihailenco/msgpack/v5 v5.3.4
github.com/wangjia184/sortedset v0.0.0-20210325043434-64dd27e173e2 github.com/wangjia184/sortedset v0.0.0-20210325043434-64dd27e173e2
github.com/wasmerio/go-ext-wasm v0.3.1 github.com/wasmerio/go-ext-wasm v0.3.1
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 google.golang.org/genproto v0.0.0-20220405205423-9d709892a2bf
google.golang.org/grpc v1.33.1 google.golang.org/grpc v1.45.0
) )
require ( require (
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect
github.com/benbjohnson/clock v1.0.1 // indirect github.com/benbjohnson/clock v1.0.1 // indirect
github.com/casbin/casbin/v2 v2.37.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
...@@ -93,7 +92,7 @@ require ( ...@@ -93,7 +92,7 @@ require (
github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect
github.com/huin/goupnp v1.0.0 // indirect github.com/huin/goupnp v1.0.0 // indirect
github.com/hyperledger/fabric-amcl v0.0.0-20200424173818-327c9e2cf77a // indirect github.com/hyperledger/fabric-amcl v0.0.0-20200424173818-327c9e2cf77a // indirect
github.com/ipfs/go-datastore v0.4.4 // indirect github.com/ipfs/go-datastore v0.4.4 // indirect
...@@ -115,7 +114,6 @@ require ( ...@@ -115,7 +114,6 @@ require (
github.com/libp2p/go-conn-security-multistream v0.2.0 // indirect github.com/libp2p/go-conn-security-multistream v0.2.0 // indirect
github.com/libp2p/go-eventbus v0.1.0 // indirect github.com/libp2p/go-eventbus v0.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.0.3 // indirect github.com/libp2p/go-flow-metrics v0.0.3 // indirect
github.com/libp2p/go-libp2p v0.9.2 // indirect
github.com/libp2p/go-libp2p-autonat v0.2.3 // indirect github.com/libp2p/go-libp2p-autonat v0.2.3 // indirect
github.com/libp2p/go-libp2p-blankhost v0.1.6 // indirect github.com/libp2p/go-libp2p-blankhost v0.1.6 // indirect
github.com/libp2p/go-libp2p-circuit v0.2.2 // indirect github.com/libp2p/go-libp2p-circuit v0.2.2 // indirect
...@@ -149,12 +147,12 @@ require ( ...@@ -149,12 +147,12 @@ require (
github.com/libp2p/go-ws-transport v0.3.1 // indirect github.com/libp2p/go-ws-transport v0.3.1 // indirect
github.com/libp2p/go-yamux v1.3.6 // indirect github.com/libp2p/go-yamux v1.3.6 // indirect
github.com/looplab/fsm v0.2.0 // indirect github.com/looplab/fsm v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect github.com/mattn/go-isatty v0.0.14 // indirect
github.com/miekg/pkcs11 v1.0.3 // indirect github.com/miekg/pkcs11 v1.0.3 // indirect
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
github.com/minio/sha256-simd v0.1.1 // indirect github.com/minio/sha256-simd v0.1.1 // indirect
github.com/mitchellh/go-testing-interface v1.0.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mr-tron/base58 v1.1.3 // indirect github.com/mr-tron/base58 v1.1.3 // indirect
...@@ -167,7 +165,7 @@ require ( ...@@ -167,7 +165,7 @@ require (
github.com/multiformats/go-multihash v0.0.14 // indirect github.com/multiformats/go-multihash v0.0.14 // indirect
github.com/multiformats/go-multistream v0.1.1 // indirect github.com/multiformats/go-multistream v0.1.1 // indirect
github.com/multiformats/go-varint v0.0.6 // indirect github.com/multiformats/go-varint v0.0.6 // indirect
github.com/oklog/run v1.0.0 // indirect github.com/oklog/run v1.1.0 // indirect
github.com/opentracing/opentracing-go v1.1.0 // indirect github.com/opentracing/opentracing-go v1.1.0 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
...@@ -194,10 +192,10 @@ require ( ...@@ -194,10 +192,10 @@ require (
go.uber.org/multierr v1.5.0 // indirect go.uber.org/multierr v1.5.0 // indirect
go.uber.org/zap v1.15.0 // indirect go.uber.org/zap v1.15.0 // indirect
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect golang.org/x/net v0.0.0-20220403103023-749bd193bc2b // indirect
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 // indirect golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12 // indirect
golang.org/x/text v0.3.7 // indirect golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
......
This diff is collapsed.
...@@ -3,6 +3,9 @@ package peermgr ...@@ -3,6 +3,9 @@ package peermgr
import ( import (
"context" "context"
"fmt" "fmt"
"sync"
"time"
"github.com/Rican7/retry" "github.com/Rican7/retry"
"github.com/Rican7/retry/strategy" "github.com/Rican7/retry/strategy"
cid "github.com/ipfs/go-cid" cid "github.com/ipfs/go-cid"
...@@ -10,8 +13,6 @@ import ( ...@@ -10,8 +13,6 @@ import (
"github.com/meshplus/bitxhub-kit/crypto" "github.com/meshplus/bitxhub-kit/crypto"
network "github.com/meshplus/go-lightp2p" network "github.com/meshplus/go-lightp2p"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"sync"
"time"
"gitlab.33.cn/link33/sidecar/internal/port" "gitlab.33.cn/link33/sidecar/internal/port"
"gitlab.33.cn/link33/sidecar/internal/repo" "gitlab.33.cn/link33/sidecar/internal/repo"
......
...@@ -77,11 +77,12 @@ type LogModule struct { ...@@ -77,11 +77,12 @@ type LogModule struct {
// Appchain are configs about appchain // Appchain are configs about appchain
type Appchain struct { type Appchain struct {
Enable bool `toml:"enable" json:"enable"` Enable bool `toml:"enable" json:"enable"`
Type string `toml:"type" json:"type"` Type string `toml:"type" json:"type"`
DID string `toml:"did" json:"did"` DID string `toml:"did" json:"did"`
Config string `toml:"config" json:"config"` Config string `toml:"config" json:"config"`
Plugin string `toml:"plugin" json:"plugin"` Plugin string `toml:"plugin" json:"plugin"`
PluginID string `toml:"plugin_id" json:"plugin_id"`
} }
// DefaultConfig returns config with default value // DefaultConfig returns config with default value
......
...@@ -88,7 +88,7 @@ func CreateClients(appchainConfigs []repo.Appchain, extra []byte) []Client { ...@@ -88,7 +88,7 @@ func CreateClients(appchainConfigs []repo.Appchain, extra []byte) []Client {
kernel := plugin.NewClient(&plugin.ClientConfig{ kernel := plugin.NewClient(&plugin.ClientConfig{
HandshakeConfig: Handshake, HandshakeConfig: Handshake,
Plugins: map[string]plugin.Plugin{ Plugins: map[string]plugin.Plugin{
appchainConfig.Plugin: &AppchainGRPCPlugin{}, // 宿主机进程的插件集 appchainConfig.PluginID: &AppchainGRPCPlugin{}, // 宿主机进程的插件集
}, },
Cmd: exec.Command("sh", "-c", pluginPath), Cmd: exec.Command("sh", "-c", pluginPath),
Logger: logger, Logger: logger,
...@@ -100,7 +100,7 @@ func CreateClients(appchainConfigs []repo.Appchain, extra []byte) []Client { ...@@ -100,7 +100,7 @@ func CreateClients(appchainConfigs []repo.Appchain, extra []byte) []Client {
rpcClient, err := kernel.Client() rpcClient, err := kernel.Client()
tool.Asset(err) tool.Asset(err)
// Request the plugin // Request the plugin
raw, err := rpcClient.Dispense(appchainConfig.Plugin) raw, err := rpcClient.Dispense(appchainConfig.PluginID)
tool.Asset(err) tool.Asset(err)
var client *GRPCClient var client *GRPCClient
switch raw.(type) { switch raw.(type) {
...@@ -111,8 +111,8 @@ func CreateClients(appchainConfigs []repo.Appchain, extra []byte) []Client { ...@@ -111,8 +111,8 @@ func CreateClients(appchainConfigs []repo.Appchain, extra []byte) []Client {
} }
// initialize our kernel plugin // initialize our kernel plugin
err = client.Initialize(pluginConfigPath, appchainConfig.DID, extra) err = client.Initialize(pluginConfigPath, appchainConfig.DID, extra)
client.TypeName = appchainConfig.Type //TODO
tool.Asset(err) tool.Asset(err)
client.TypeName = appchainConfig.Type //TODO
client.Bind(kernel) client.Bind(kernel)
clients = append(clients, client) clients = append(clients, client)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment