diff --git a/Dockerfile b/Dockerfile index 42320aaeff591055f1fdcfee66a6c99b31f14c05..344ec004e3b0e4b4de5483cb503dff6548f8ba64 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,4 +44,4 @@ COPY config.default.json /config.json # Copy the Pre-built binary file from the previous stage COPY --from=build /go/bin/goshimmer /run/goshimmer -ENTRYPOINT ["/run/goshimmer", "--config-dir=/", "--valueLayer.snapshot.file=/snapshot.bin", "--database.directory=/tmp/mainnetdb"] +ENTRYPOINT ["/run/goshimmer", "--config=/config.json", "--valueLayer.snapshot.file=/snapshot.bin", "--database.directory=/tmp/mainnetdb"] diff --git a/dapps/valuetransfers/dapp.go b/dapps/valuetransfers/dapp.go index 27ccee4fdd3d5039afcaab3738ba651efb98288b..2f7deffdaa5308ad3e7e6f23c28f89e6e1344d53 100644 --- a/dapps/valuetransfers/dapp.go +++ b/dapps/valuetransfers/dapp.go @@ -112,7 +112,7 @@ func configure(_ *node.Plugin) { ledgerState = valuetangle.NewLedgerState(Tangle()) // read snapshot file - snapshotFilePath := config.Node().GetString(CfgValueLayerSnapshotFile) + snapshotFilePath := config.Node().String(CfgValueLayerSnapshotFile) if len(snapshotFilePath) != 0 { snapshot := valuetangle.Snapshot{} f, err := os.Open(snapshotFilePath) @@ -144,7 +144,7 @@ func configure(_ *node.Plugin) { })) // configure FCOB consensus rules - cfgAvgNetworkDelay := config.Node().GetInt(CfgValueLayerFCOBAverageNetworkDelay) + cfgAvgNetworkDelay := config.Node().Int(CfgValueLayerFCOBAverageNetworkDelay) log.Infof("avg. network delay configured to %d seconds", cfgAvgNetworkDelay) fcob = consensus.NewFCOB(_tangle, time.Duration(cfgAvgNetworkDelay)*time.Second) fcob.Events.Vote.Attach(events.NewClosure(func(id string, initOpn vote.Opinion) { diff --git a/dapps/valuetransfers/fpc.go b/dapps/valuetransfers/fpc.go index bc42c949d59d6d9c240d487a257c51d0c2fcb8ec..f25ba576cef160a897ff62a3ab8508550d70d133 100644 --- a/dapps/valuetransfers/fpc.go +++ b/dapps/valuetransfers/fpc.go @@ -79,7 +79,7 @@ func configureFPC() { log = logger.NewLogger(FpcPluginName) lPeer := local.GetInstance() - bindAddr := config.Node().GetString(CfgFPCBindAddress) + bindAddr := config.Node().String(CfgFPCBindAddress) _, portStr, err := net.SplitHostPort(bindAddr) if err != nil { log.Fatalf("FPC bind address '%s' is invalid: %s", bindAddr, err) @@ -104,7 +104,7 @@ func runFPC() { const ServerWorkerName = "FPCVoterServer" if err := daemon.BackgroundWorker(ServerWorkerName, func(shutdownSignal <-chan struct{}) { stopped := make(chan struct{}) - bindAddr := config.Node().GetString(CfgFPCBindAddress) + bindAddr := config.Node().String(CfgFPCBindAddress) voterServer = votenet.New(Voter(), func(id string) vote.Opinion { branchID, err := branchmanager.BranchIDFromBase58(id) if err != nil { diff --git a/go.mod b/go.mod index 69f61050fe440082f53e2cae34a04ea183efde0a..73e03dc3a5fd50afe124d882993b0c3f1b5698b7 100644 --- a/go.mod +++ b/go.mod @@ -10,18 +10,19 @@ require ( github.com/drand/kyber v1.1.2 github.com/gin-gonic/gin v1.6.3 github.com/go-ole/go-ole v1.2.4 // indirect - github.com/golang/protobuf v1.4.2 + github.com/golang/protobuf v1.4.3 github.com/gorilla/websocket v1.4.2 - github.com/iotaledger/hive.go v0.0.0-20201010155836-c0af5551de50 + github.com/iotaledger/hive.go v0.0.0-20201026194603-90676fed31f9 github.com/labstack/echo v3.3.10+incompatible github.com/labstack/gommon v0.3.0 github.com/magiconair/properties v1.8.1 github.com/markbates/pkger v0.17.1 github.com/mr-tron/base58 v1.2.0 - github.com/panjf2000/ants/v2 v2.4.1 + github.com/panjf2000/ants/v2 v2.4.3 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.7.0 github.com/shirou/gopsutil v2.20.5+incompatible + github.com/spf13/afero v1.3.0 // indirect github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.7.0 github.com/stretchr/testify v1.6.1 @@ -29,9 +30,9 @@ require ( github.com/xdg/stringprep v1.0.0 // indirect go.dedis.ch/kyber/v3 v3.0.13 go.mongodb.org/mongo-driver v1.3.4 - go.uber.org/atomic v1.6.0 - go.uber.org/zap v1.15.0 - golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 + go.uber.org/atomic v1.7.0 + go.uber.org/zap v1.16.0 + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 golang.org/x/tools v0.0.0-20200330040139-fa3cc9eebcfe // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 google.golang.org/grpc v1.30.0 diff --git a/go.sum b/go.sum index 318e742dcabf2f9727e4ade04c88efa9b4f3973c..27120d12e2677d02c404d2a26cab5595b3f61628 100644 --- a/go.sum +++ b/go.sum @@ -91,6 +91,7 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= github.com/cockroachdb/pebble v0.0.0-20200915204653-08b545a1f540/go.mod h1:hU7vhtrqonEphNF+xt8/lHdaBprxmV1h8BOGrd9XwmQ= +github.com/cockroachdb/pebble v0.0.0-20201023120638-f1224da22976/go.mod h1:BbtTitvfmE0eZNcncJgJw5BlQhskTzgZgoISnY+8s6k= github.com/cockroachdb/redact v0.0.0-20200622112456-cd282804bbd3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= @@ -163,6 +164,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ= @@ -170,6 +173,8 @@ github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVB github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -274,6 +279,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -363,6 +370,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/iotaledger/hive.go v0.0.0-20201010155836-c0af5551de50 h1:dHSz9lKA4Cemj+vecCzVeHQNBJrGjzAZ5wNYtX1a/x0= github.com/iotaledger/hive.go v0.0.0-20201010155836-c0af5551de50/go.mod h1:h56kcBj+CYn3UEoCG6RJI5lVdYVJmhmeuIHOUgFCfEg= +github.com/iotaledger/hive.go v0.0.0-20201026194603-90676fed31f9 h1:iRZdsjS3upMCTjZPhdhZkUTq8vqAtwOLHxnyumS3a44= +github.com/iotaledger/hive.go v0.0.0-20201026194603-90676fed31f9/go.mod h1:xqn2tIsuGgEU68fgTiR5SH6tD1hxRwznLfvgR0ZEPUs= github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= @@ -442,6 +451,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.9.5 h1:U+CaK85mrNNb4k8BNOfgJtJ/gr6kswUCFj6miSzVC6M= github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/knadh/koanf v0.14.0 h1:h9XeG4wEiEuxdxqv/SbY7TEK+7vzrg/dOaGB+S6+mPo= +github.com/knadh/koanf v0.14.0/go.mod h1:H5mEFsTeWizwFXHKtsITL5ipsLTuAMQoGuQpp+1JL9U= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -640,6 +651,8 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4= +github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -698,6 +711,8 @@ github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c h1:5bFTChQxSKNwy github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c/go.mod h1:7qN3Y0BvzRUf4LofcoJplQL10lsFDb4PYlePTVwrP28= github.com/oasisprotocol/ed25519 v0.0.0-20200528083105-55566edd6df0 h1:qmiMZ6ZhkeQZkV/Huajj+QBAu1jX0HTGsOwi+eXTGY8= github.com/oasisprotocol/ed25519 v0.0.0-20200528083105-55566edd6df0/go.mod h1:IZbb50w3AB72BVobEF6qG93NNSrTw/V2QlboxqSu3Xw= +github.com/oasisprotocol/ed25519 v0.0.0-20200819094954-65138ca6ec7c h1:/Ydlzrdta1Gegs20RPue2Tpkmh28dMjkwqDyikptskA= +github.com/oasisprotocol/ed25519 v0.0.0-20200819094954-65138ca6ec7c/go.mod h1:IZbb50w3AB72BVobEF6qG93NNSrTw/V2QlboxqSu3Xw= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -731,12 +746,16 @@ github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/panjf2000/ants/v2 v2.4.1 h1:7RtUqj5lGOw0WnZhSKDZ2zzJhaX5490ZW1sUolRXCxY= github.com/panjf2000/ants/v2 v2.4.1/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= +github.com/panjf2000/ants/v2 v2.4.3 h1:wHghL17YKFanB62QjPQ9o+DuM4q7WrQ7zAhoX8+eBXU= +github.com/panjf2000/ants/v2 v2.4.3/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= @@ -788,6 +807,7 @@ github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFB github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rhnvrm/simples3 v0.5.0/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -839,6 +859,8 @@ github.com/spf13/afero v1.3.0 h1:Ysnmjh1Di8EaWaBv40CYR4IdaIsBc5996Gh1oZzCBKk= github.com/spf13/afero v1.3.0/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= @@ -860,6 +882,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= +github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -947,6 +971,8 @@ go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= @@ -960,6 +986,8 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +go.uber.org/zap v1.16.0 h1:uFRZXykJGK9lLY4HtgSw44DnIcAM+kRBP7x5m+NpAOM= +go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -988,6 +1016,8 @@ golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 h1:DZhuSZLsGlFL4CmhA8BcRA0mnthyA/nZ00AqCUo7vHg= golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1007,6 +1037,7 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNT golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367 h1:0IiAsCRByjO2QjX7ZPkw5oU9x+n1YqRL802rjC0c3Aw= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -1058,6 +1089,8 @@ golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1093,6 +1126,7 @@ golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190902133755-9109b7679e13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191025090151-53bf42e6b339/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1105,6 +1139,7 @@ golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1253,6 +1288,8 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/plugins/analysis/client/plugin.go b/plugins/analysis/client/plugin.go index 16d2401cd87dcc74b244ab51cd31b0a935e04f02..122bd8c12f2092ccf0db0ce535e970be6ecdb13a 100644 --- a/plugins/analysis/client/plugin.go +++ b/plugins/analysis/client/plugin.go @@ -49,7 +49,7 @@ func Plugin() *node.Plugin { func run(_ *node.Plugin) { finalized = make(map[string]vote.Opinion) log = logger.NewLogger(PluginName) - conn = NewConnector("tcp", config.Node().GetString(CfgServerAddress)) + conn = NewConnector("tcp", config.Node().String(CfgServerAddress)) if err := daemon.BackgroundWorker(PluginName, func(shutdownSignal <-chan struct{}) { conn.Start() diff --git a/plugins/analysis/dashboard/fpc_livefeed.go b/plugins/analysis/dashboard/fpc_livefeed.go index baef08059b93a453c9ce667afa688526cd0cea81..bed64a91fc7c14312fbc04046d3d4ba931acd47e 100644 --- a/plugins/analysis/dashboard/fpc_livefeed.go +++ b/plugins/analysis/dashboard/fpc_livefeed.go @@ -41,7 +41,7 @@ type FPCUpdate struct { func configureFPCLiveFeed() { - if config.Node().GetBool(CfgMongoDBEnabled) { + if config.Node().Bool(CfgMongoDBEnabled) { mongoDB() } @@ -51,7 +51,7 @@ func configureFPCLiveFeed() { task.Return(nil) }, workerpool.WorkerCount(fpcLiveFeedWorkerCount), workerpool.QueueSize(fpcLiveFeedWorkerQueueSize)) - if config.Node().GetBool(CfgMongoDBEnabled) { + if config.Node().Bool(CfgMongoDBEnabled) { fpcStoreFinalizedWorkerPool = workerpool.New(func(task workerpool.Task) { storeFinalizedVoteContext(task.Param(0).(FPCRecords)) task.Return(nil) @@ -69,7 +69,7 @@ func runFPCLiveFeed() { fpcLiveFeedWorkerPool.Start() defer fpcLiveFeedWorkerPool.Stop() - if config.Node().GetBool(CfgMongoDBEnabled) { + if config.Node().Bool(CfgMongoDBEnabled) { fpcStoreFinalizedWorkerPool.Start() defer fpcStoreFinalizedWorkerPool.Stop() } @@ -150,7 +150,7 @@ func createFPCUpdate(hb *packet.FPCHeartbeat) *FPCUpdate { }) } - if config.Node().GetBool(CfgMongoDBEnabled) { + if config.Node().Bool(CfgMongoDBEnabled) { fpcStoreFinalizedWorkerPool.TrySubmit(finalizedConflicts) } diff --git a/plugins/analysis/dashboard/fpc_storage.go b/plugins/analysis/dashboard/fpc_storage.go index 66506742d89d6f184630889b3fd40a5561acde25..2b2464b250731d3a34a980fff0ba2a9d43918770 100644 --- a/plugins/analysis/dashboard/fpc_storage.go +++ b/plugins/analysis/dashboard/fpc_storage.go @@ -56,9 +56,9 @@ func mongoDB() *mongo.Database { } func newMongoDB() (*mongo.Client, error) { - username := config.Node().GetString(CfgMongoDBUsername) - password := config.Node().GetString(CfgMongoDBPassword) - hostAddr := config.Node().GetString(CfgMongoDBHostAddress) + username := config.Node().String(CfgMongoDBUsername) + password := config.Node().String(CfgMongoDBPassword) + hostAddr := config.Node().String(CfgMongoDBHostAddress) client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://" + username + ":" + password + "@" + hostAddr)) if err != nil { diff --git a/plugins/analysis/dashboard/plugin.go b/plugins/analysis/dashboard/plugin.go index 22ff1475bff4f9eaa0a59dc716ebe05170dc9c55..efb99a9de74fecabce795044df1c3efeb63ad06d 100644 --- a/plugins/analysis/dashboard/plugin.go +++ b/plugins/analysis/dashboard/plugin.go @@ -44,10 +44,10 @@ func configureServer() { server.HidePort = true server.Use(middleware.Recover()) - if config.Node().GetBool(CfgBasicAuthEnabled) { + if config.Node().Bool(CfgBasicAuthEnabled) { server.Use(middleware.BasicAuth(func(username, password string, c echo.Context) (bool, error) { - if username == config.Node().GetString(CfgBasicAuthUsername) && - password == config.Node().GetString(CfgBasicAuthPassword) { + if username == config.Node().String(CfgBasicAuthUsername) && + password == config.Node().String(CfgBasicAuthPassword) { return true, nil } return false, nil @@ -73,7 +73,7 @@ func worker(shutdownSignal <-chan struct{}) { defer log.Infof("Stopping %s ... done", PluginName) stopped := make(chan struct{}) - bindAddr := config.Node().GetString(CfgBindAddress) + bindAddr := config.Node().String(CfgBindAddress) go func() { log.Infof("%s started, bind-address=%s", PluginName, bindAddr) if err := server.Start(bindAddr); err != nil { diff --git a/plugins/analysis/dashboard/routes.go b/plugins/analysis/dashboard/routes.go index 302ab5b90efb5ed0fc14fbe103b1a30a2788b0f8..4f25bae277243178bd2e0ce9249a84c043c0b303 100644 --- a/plugins/analysis/dashboard/routes.go +++ b/plugins/analysis/dashboard/routes.go @@ -31,7 +31,7 @@ const ( ) func indexRoute(e echo.Context) error { - if config.Node().GetBool(CfgDev) { + if config.Node().Bool(CfgDev) { res, err := http.Get("http://127.0.0.1:9090/") if err != nil { return err @@ -57,7 +57,7 @@ func indexRoute(e echo.Context) error { func setupRoutes(e *echo.Echo) { - if config.Node().GetBool("analysis.dashboard.dev") { + if config.Node().Bool("analysis.dashboard.dev") { e.Static("/assets", "./plugins/analysis/dashboard/frontend/src/assets") } else { diff --git a/plugins/analysis/server/plugin.go b/plugins/analysis/server/plugin.go index b2a55e3e5c199d0b5b74d28f8e50edf1568508d4..b23124575cccb7ebd8af74d30ed2053e9e6cbfb9 100644 --- a/plugins/analysis/server/plugin.go +++ b/plugins/analysis/server/plugin.go @@ -67,7 +67,7 @@ func configure(_ *node.Plugin) { } func run(_ *node.Plugin) { - bindAddr := config.Node().GetString(CfgAnalysisServerBindAddress) + bindAddr := config.Node().String(CfgAnalysisServerBindAddress) addr, portStr, err := net.SplitHostPort(bindAddr) if err != nil { log.Fatal("invalid bind address in %s: %s", CfgAnalysisServerBindAddress, err) diff --git a/plugins/autopeering/autopeering.go b/plugins/autopeering/autopeering.go index 38b3003088a9104673afffd69d04aace1e8490b3..17d7ecb751b2604942e502d4cae91aae7125a441 100644 --- a/plugins/autopeering/autopeering.go +++ b/plugins/autopeering/autopeering.go @@ -67,7 +67,7 @@ func Selection() *selection.Protocol { // BindAddress returns the string form of the autopeering bind address. func BindAddress() string { peering := local.GetInstance().Services().Get(service.PeeringKey) - host := config.Node().GetString(local.CfgBind) + host := config.Node().String(local.CfgBind) port := strconv.Itoa(peering.Port()) return net.JoinHostPort(host, port) } @@ -164,7 +164,7 @@ func start(shutdownSignal <-chan struct{}) { } func parseEntryNodes() (result []*peer.Peer, err error) { - for _, entryNodeDefinition := range config.Node().GetStringSlice(CfgEntryNodes) { + for _, entryNodeDefinition := range config.Node().Strings(CfgEntryNodes) { if entryNodeDefinition == "" { continue } diff --git a/plugins/autopeering/local/local.go b/plugins/autopeering/local/local.go index 27da57e5485b98ca9b4e03bdbd1854b429f91204..ba578e9804e21466cbadbfa636d5b64fc127519c 100644 --- a/plugins/autopeering/local/local.go +++ b/plugins/autopeering/local/local.go @@ -26,7 +26,7 @@ func configureLocal() *peer.Local { log := logger.NewLogger("Local") var peeringIP net.IP - if str := config.Node().GetString(CfgExternal); strings.ToLower(str) == "auto" { + if str := config.Node().String(CfgExternal); strings.ToLower(str) == "auto" { // let the autopeering discover the IP peeringIP = net.IPv4zero } else { @@ -39,7 +39,7 @@ func configureLocal() *peer.Local { } } - peeringPort := config.Node().GetInt(CfgPort) + peeringPort := config.Node().Int(CfgPort) if 0 > peeringPort || peeringPort > 65535 { log.Fatalf("Invalid port number (%s): %d", CfgPort, peeringPort) } @@ -50,7 +50,7 @@ func configureLocal() *peer.Local { // set the private key from the seed provided in the config var seed [][]byte - if str := config.Node().GetString(CfgSeed); str != "" { + if str := config.Node().String(CfgSeed); str != "" { var bytes []byte var err error diff --git a/plugins/autopeering/parameters.go b/plugins/autopeering/parameters.go index 85e4736aa59f48166664555ef43376f2a413c22e..c198f2f90d703ebe9f689f378c49d12a2084e539 100644 --- a/plugins/autopeering/parameters.go +++ b/plugins/autopeering/parameters.go @@ -13,5 +13,5 @@ const ( func init() { flag.StringSlice(CfgEntryNodes, []string{"2PV5487xMw5rasGBXXWeqSi4hLz7r19YBt8Y1TGAsQbj@ressims.iota.cafe:15626", "5EDH4uY78EA6wrBkHHAVBWBMDt7EcksRq6pjzipoW15B@entrynode.alphanet.tanglebay.org:14656"}, "list of trusted entry nodes for auto peering") - flag.Uint32(CfgNetworkVersion, 8, "autopeering network version") + flag.Int(CfgNetworkVersion, 8, "autopeering network version") } diff --git a/plugins/autopeering/plugin.go b/plugins/autopeering/plugin.go index 805ca958c03a3d6a8a78a3be130ceeddb0af7f4b..a0abe92e86701277b616081bc9f2781411663ca3 100644 --- a/plugins/autopeering/plugin.go +++ b/plugins/autopeering/plugin.go @@ -35,7 +35,7 @@ func Plugin() *node.Plugin { func configure(*node.Plugin) { log = logger.NewLogger(PluginName) - networkVersion = config.Node().GetUint32(CfgNetworkVersion) + networkVersion = uint32(config.Node().Int(CfgNetworkVersion)) configureEvents() } diff --git a/plugins/clock/plugin.go b/plugins/clock/plugin.go index 7d00e2e7b7ca23d55cfda21412918f79f4e1517e..f54450df8d1fd44347ef02f4ebf19339481b8f84 100644 --- a/plugins/clock/plugin.go +++ b/plugins/clock/plugin.go @@ -51,7 +51,7 @@ func init() { func configure(plugin *node.Plugin) { log = logger.NewLogger(PluginName) - ntpPools = config.Node().GetStringSlice(CfgNTPPools) + ntpPools = config.Node().Strings(CfgNTPPools) if len(ntpPools) == 0 { log.Fatalf("%s needs to provide at least 1 NTP pool to synchronize the local clock.", CfgNTPPools) } diff --git a/plugins/config/plugin.go b/plugins/config/plugin.go index 9e27c41e7b682fbb8bc61f3025fcb2de8df153f0..965c6d2caa173ff0774db42d434b73f25772706c 100644 --- a/plugins/config/plugin.go +++ b/plugins/config/plugin.go @@ -3,14 +3,12 @@ package config import ( "fmt" "os" - "strings" "sync" + "github.com/iotaledger/hive.go/configuration" "github.com/iotaledger/hive.go/events" "github.com/iotaledger/hive.go/node" - "github.com/iotaledger/hive.go/parameter" flag "github.com/spf13/pflag" - "github.com/spf13/viper" ) // PluginName is the name of the config plugin. @@ -22,12 +20,12 @@ var ( pluginOnce sync.Once // flags - configName = flag.StringP("config", "c", "config", "Filename of the config file without the file extension") - configDirPath = flag.StringP("config-dir", "d", ".", "Path to the directory containing the config file") + defaultConfigName = "config.json" + configFilePath = flag.StringP("config", "c", defaultConfigName, "file path of the config file") skipConfigAvailable = flag.Bool("skip-config", false, "Skip config file availability check") // Node is viper - _node *viper.Viper + _node *configuration.Configuration nodeOnce sync.Once ) @@ -45,9 +43,9 @@ func Plugin() *node.Plugin { } // Node gets the node. -func Node() *viper.Viper { +func Node() *configuration.Configuration { nodeOnce.Do(func() { - _node = viper.New() + _node = configuration.New() }) return _node } @@ -72,34 +70,62 @@ func init() { })) } -// fetch fetches config values from a dir defined via CLI flag --config-dir (or the current working dir if not set). +// fetch fetches config values from a configFilePath (or the current working dir if not set). // // It automatically reads in a single config file starting with "config" (can be changed via the --config CLI flag) // and ending with: .json, .toml, .yaml or .yml (in this sequence). func fetch(printConfig bool, ignoreSettingsAtPrint ...[]string) error { - // replace dots with underscores in env - dotReplacer := strings.NewReplacer(".", "_") - _node.SetEnvKeyReplacer(dotReplacer) - // read in ENV variables + flag.Parse() + + if err := _node.LoadFile(*configFilePath); err != nil { + if hasFlag(defaultConfigName) { + // if a file was explicitly specified, raise the error + fmt.Println("config error") + return err + } + fmt.Printf("No config file found via '%s'. Loading default settings.", *configFilePath) + } + + if err := _node.LoadFlagSet(flag.CommandLine); err != nil { + return err + } + // read in ENV variables - _node.AutomaticEnv() + // load the env vars after default values from flags were set (otherwise the env vars are not added because the keys don't exist) + if err := _node.LoadEnvironmentVars(""); err != nil { + return err + } - flag.Parse() - err := parameter.LoadConfigFile(_node, *configDirPath, *configName, flag.CommandLine, *skipConfigAvailable) - if err != nil { + // load the flags again to overwrite env vars that were also set via command line + if err := _node.LoadFlagSet(flag.CommandLine); err != nil { return err } if printConfig { - parameter.PrintConfig(_node, ignoreSettingsAtPrint...) + PrintConfig(ignoreSettingsAtPrint...) } - for _, pluginName := range _node.GetStringSlice(CfgDisablePlugins) { + for _, pluginName := range _node.Strings(CfgDisablePlugins) { node.DisabledPlugins[node.GetPluginIdentifier(pluginName)] = true } - for _, pluginName := range _node.GetStringSlice(CfgEnablePlugins) { + for _, pluginName := range _node.Strings(CfgEnablePlugins) { node.EnabledPlugins[node.GetPluginIdentifier(pluginName)] = true } return nil } + +// PrintConfig prints the config. +func PrintConfig(ignoreSettingsAtPrint ...[]string) { + _node.Print(ignoreSettingsAtPrint...) +} + +func hasFlag(name string) bool { + has := false + flag.Visit(func(f *flag.Flag) { + if f.Name == name { + has = true + } + }) + return has +} diff --git a/plugins/dashboard/faucet_routes.go b/plugins/dashboard/faucet_routes.go index 9e34ce4cfa7a71512c127fa745e24a01f7db0d93..360903f31f888e997025cd7cda81c3900ff8a9f7 100644 --- a/plugins/dashboard/faucet_routes.go +++ b/plugins/dashboard/faucet_routes.go @@ -39,7 +39,7 @@ var fundingReqMu = sync.Mutex{} func sendFaucetReq(addr address.Address) (res *ReqMsg, err error) { fundingReqMu.Lock() defer fundingReqMu.Unlock() - faucetPayload, err := faucet.NewRequest(addr, config.Node().GetInt(faucet.CfgFaucetPoWDifficulty)) + faucetPayload, err := faucet.NewRequest(addr, config.Node().Int(faucet.CfgFaucetPoWDifficulty)) if err != nil { return nil, err } diff --git a/plugins/dashboard/plugin.go b/plugins/dashboard/plugin.go index c91cac0bb43d031fea43ce1a209c52664fd9dc9b..553106469d0fcb11f0eedb4358b3ba2acf35fc5b 100644 --- a/plugins/dashboard/plugin.go +++ b/plugins/dashboard/plugin.go @@ -66,10 +66,10 @@ func configureServer() { server.HidePort = true server.Use(middleware.Recover()) - if config.Node().GetBool(CfgBasicAuthEnabled) { + if config.Node().Bool(CfgBasicAuthEnabled) { server.Use(middleware.BasicAuth(func(username, password string, c echo.Context) (bool, error) { - if username == config.Node().GetString(CfgBasicAuthUsername) && - password == config.Node().GetString(CfgBasicAuthPassword) { + if username == config.Node().String(CfgBasicAuthUsername) && + password == config.Node().String(CfgBasicAuthPassword) { return true, nil } return false, nil @@ -110,9 +110,9 @@ func worker(shutdownSignal <-chan struct{}) { defer metrics.Events.ReceivedMPSUpdated.Detach(notifyStatus) stopped := make(chan struct{}) - bindAddr := config.Node().GetString(CfgBindAddress) + bindAddr := config.Node().String(CfgBindAddress) go func() { - log.Infof("%s started, bind-address=%s, basic-auth=%v", PluginName, bindAddr, config.Node().GetBool(CfgBasicAuthEnabled)) + log.Infof("%s started, bind-address=%s, basic-auth=%v", PluginName, bindAddr, config.Node().Bool(CfgBasicAuthEnabled)) if err := server.Start(bindAddr); err != nil { if !errors.Is(err, http.ErrServerClosed) { log.Errorf("Error serving: %s", err) diff --git a/plugins/dashboard/routes.go b/plugins/dashboard/routes.go index e73cc155d8379677bc68ed6efa42cdc8a7f8d67a..8bac11eb97c4b998b34e3522a6c479da2f58f8dc 100644 --- a/plugins/dashboard/routes.go +++ b/plugins/dashboard/routes.go @@ -30,7 +30,7 @@ const ( ) func indexRoute(e echo.Context) error { - if config.Node().GetBool(CfgDev) { + if config.Node().Bool(CfgDev) { res, err := http.Get("http://127.0.0.1:9090/") if err != nil { return err @@ -57,7 +57,7 @@ func indexRoute(e echo.Context) error { func setupRoutes(e *echo.Echo) { - if config.Node().GetBool("dashboard.dev") { + if config.Node().Bool("dashboard.dev") { e.Static("/assets", "./plugins/dashboard/frontend/src/assets") } else { diff --git a/plugins/database/plugin.go b/plugins/database/plugin.go index 4e82ec6722136edd20e6d665f57cf915d2dd2538..a7087c0aead1f8459ce17d958363b74582e32cb3 100644 --- a/plugins/database/plugin.go +++ b/plugins/database/plugin.go @@ -53,10 +53,10 @@ func createStore() { log = logger.NewLogger(PluginName) var err error - if config.Node().GetBool(CfgDatabaseInMemory) { + if config.Node().Bool(CfgDatabaseInMemory) { db, err = database.NewMemDB() } else { - dbDir := config.Node().GetString(CfgDatabaseDir) + dbDir := config.Node().String(CfgDatabaseDir) db, err = database.NewDB(dbDir) } if err != nil { @@ -78,7 +78,7 @@ func configure(_ *node.Plugin) { log.Fatalf("Failed to check database version: %s", err) } - if str := config.Node().GetString(CfgDatabaseDirty); str != "" { + if str := config.Node().String(CfgDatabaseDirty); str != "" { val, err := strconv.ParseBool(str) if err != nil { log.Warnf("Invalid %s: %s", CfgDatabaseDirty, err) diff --git a/plugins/drng/drng.go b/plugins/drng/drng.go index 520707b31f298170bd2ca8828da4628b5d6709ed..340ef071643fea0fd2af50696ff05fe399d46199 100644 --- a/plugins/drng/drng.go +++ b/plugins/drng/drng.go @@ -31,7 +31,7 @@ func configureDRNG() *drng.DRNG { // Pollen dRNG configuration // parse identities of the committee members - committeeMembers, err := parseCommitteeMembers(config.Node().GetStringSlice(CfgDRNGCommitteeMembers)) + committeeMembers, err := parseCommitteeMembers(config.Node().Strings(CfgDRNGCommitteeMembers)) if err != nil { log.Warnf("Invalid %s: %s", CfgDRNGCommitteeMembers, err) } @@ -45,7 +45,7 @@ func configureDRNG() *drng.DRNG { // configure pollen committee pollenConf := &drng.Committee{ InstanceID: Pollen, - Threshold: uint8(config.Node().GetUint32(CfgDRNGThreshold)), + Threshold: uint8(config.Node().Int(CfgDRNGThreshold)), DistributedPK: dpk, Identities: committeeMembers, } @@ -56,7 +56,7 @@ func configureDRNG() *drng.DRNG { // X-Team dRNG configuration // parse identities of the x-team committee members - committeeMembers, err = parseCommitteeMembers(config.Node().GetStringSlice(CfgDRNGXTeamCommitteeMembers)) + committeeMembers, err = parseCommitteeMembers(config.Node().Strings(CfgDRNGXTeamCommitteeMembers)) if err != nil { log.Warnf("Invalid %s: %s", CfgDRNGXTeamCommitteeMembers, err) } @@ -70,7 +70,7 @@ func configureDRNG() *drng.DRNG { // configure X-Team committee xTeamConf := &drng.Committee{ InstanceID: XTeam, - Threshold: uint8(config.Node().GetUint32(CfgDRNGXTeamThreshold)), + Threshold: uint8(config.Node().Int(CfgDRNGXTeamThreshold)), DistributedPK: dpk, Identities: committeeMembers, } @@ -81,7 +81,7 @@ func configureDRNG() *drng.DRNG { // Custom dRNG configuration // parse identities of the x-team committee members - committeeMembers, err = parseCommitteeMembers(config.Node().GetStringSlice(CfgDRNGCustomCommitteeMembers)) + committeeMembers, err = parseCommitteeMembers(config.Node().Strings(CfgDRNGCustomCommitteeMembers)) if err != nil { log.Warnf("Invalid %s: %s", CfgDRNGCustomCommitteeMembers, err) } @@ -94,8 +94,8 @@ func configureDRNG() *drng.DRNG { // configure Custom committee customConf := &drng.Committee{ - InstanceID: config.Node().GetUint32(CfgDRNGCustomInstanceID), - Threshold: uint8(config.Node().GetUint32(CfgDRNGCustomThreshold)), + InstanceID: uint32(config.Node().Int(CfgDRNGCustomInstanceID)), + Threshold: uint8(config.Node().Int(CfgDRNGCustomThreshold)), DistributedPK: dpk, Identities: committeeMembers, } @@ -139,7 +139,7 @@ func parseCommitteeMembers(committeeMembers []string) (result []ed25519.PublicKe } func parseDistributedPublicKey(pubKey string) (dpk []byte, err error) { - if str := config.Node().GetString(pubKey); str != "" { + if str := config.Node().String(pubKey); str != "" { dpk, err = hex.DecodeString(str) if err != nil { return []byte{}, fmt.Errorf("Invalid %s: %s", pubKey, err) diff --git a/plugins/drng/parameters.go b/plugins/drng/parameters.go index 682b223dd2ecc4b547e757f2c4b7757c35217757..479dc7353d8477abce1a78196afb4a571f76df31 100644 --- a/plugins/drng/parameters.go +++ b/plugins/drng/parameters.go @@ -41,20 +41,20 @@ const ( func init() { // Default parameters of Pollen dRNG committee. - flag.Uint32(CfgDRNGInstanceID, Pollen, "instance ID of the pollen drng instance") - flag.Uint32(CfgDRNGThreshold, 3, "BLS threshold of the pollen drng") + flag.Int(CfgDRNGInstanceID, Pollen, "instance ID of the pollen drng instance") + flag.Int(CfgDRNGThreshold, 3, "BLS threshold of the pollen drng") flag.String(CfgDRNGDistributedPubKey, "", "distributed public key of the pollen committee (hex encoded)") flag.StringSlice(CfgDRNGCommitteeMembers, []string{}, "list of committee members of the pollen drng") // Default parameters of X-Team dRNG committee. - flag.Uint32(CfgDRNGXTeamInstanceID, XTeam, "instance ID of the x-team drng instance") - flag.Uint32(CfgDRNGXTeamThreshold, 3, "BLS threshold of the x-team drng") + flag.Int(CfgDRNGXTeamInstanceID, XTeam, "instance ID of the x-team drng instance") + flag.Int(CfgDRNGXTeamThreshold, 3, "BLS threshold of the x-team drng") flag.String(CfgDRNGXTeamDistributedPubKey, "", "distributed public key of the x-team committee (hex encoded)") flag.StringSlice(CfgDRNGXTeamCommitteeMembers, []string{}, "list of committee members of the x-team drng") // Default parameters of Custom dRNG committee. - flag.Uint32(CfgDRNGCustomInstanceID, 9999, "instance ID of the custom drng instance") - flag.Uint32(CfgDRNGCustomThreshold, 3, "BLS threshold of the custom drng") + flag.Int(CfgDRNGCustomInstanceID, 9999, "instance ID of the custom drng instance") + flag.Int(CfgDRNGCustomThreshold, 3, "BLS threshold of the custom drng") flag.String(CfgDRNGCustomDistributedPubKey, "", "distributed public key of the custom committee (hex encoded)") flag.StringSlice(CfgDRNGCustomCommitteeMembers, []string{}, "list of committee members of the custom drng") } diff --git a/plugins/faucet/plugin.go b/plugins/faucet/plugin.go index 0dee13ffb6a0f15be302b2519eee78b29ce64f8e..b98af42a674e22d186c0cd4a06b2688e4eee8396 100644 --- a/plugins/faucet/plugin.go +++ b/plugins/faucet/plugin.go @@ -70,7 +70,7 @@ func Plugin() *node.Plugin { // Faucet gets the faucet component instance the faucet dApp has initialized. func Faucet() *Component { faucetOnce.Do(func() { - base58Seed := config.Node().GetString(CfgFaucetSeed) + base58Seed := config.Node().String(CfgFaucetSeed) if len(base58Seed) == 0 { log.Fatal("a seed must be defined when enabling the faucet dApp") } @@ -78,15 +78,15 @@ func Faucet() *Component { if err != nil { log.Fatalf("configured seed for the faucet is invalid: %s", err) } - tokensPerRequest := config.Node().GetInt64(CfgFaucetTokensPerRequest) + tokensPerRequest := config.Node().Int64(CfgFaucetTokensPerRequest) if tokensPerRequest <= 0 { log.Fatalf("the amount of tokens to fulfill per request must be above zero") } - maxTxBookedAwaitTime := config.Node().GetInt64(CfgFaucetMaxTransactionBookedAwaitTimeSeconds) + maxTxBookedAwaitTime := config.Node().Int64(CfgFaucetMaxTransactionBookedAwaitTimeSeconds) if maxTxBookedAwaitTime <= 0 { log.Fatalf("the max transaction booked await time must be more than 0") } - blacklistCapacity := config.Node().GetInt(CfgFaucetBlacklistCapacity) + blacklistCapacity := config.Node().Int(CfgFaucetBlacklistCapacity) _faucet = New(seedBytes, tokensPerRequest, blacklistCapacity, time.Duration(maxTxBookedAwaitTime)*time.Second) }) return _faucet @@ -143,7 +143,7 @@ func configureEvents() { log.Warnf("couldn't verify PoW of funding request for address %s", addr) return } - targetPoWDifficulty := config.Node().GetInt(CfgFaucetPoWDifficulty) + targetPoWDifficulty := config.Node().Int(CfgFaucetPoWDifficulty) if leadingZeroes < targetPoWDifficulty { log.Debugf("funding request for address %s doesn't fulfill PoW requirement %d vs. %d", addr, targetPoWDifficulty, leadingZeroes) return diff --git a/plugins/gossip/gossip.go b/plugins/gossip/gossip.go index 300efc999a76783cee776c937902f9c9696a1667..0a4f7e47827b582f705ce3bd79b2e83a30e7dd5f 100644 --- a/plugins/gossip/gossip.go +++ b/plugins/gossip/gossip.go @@ -39,7 +39,7 @@ func createManager() { log := logger.NewLogger(PluginName) // announce the gossip service - gossipPort := config.Node().GetInt(CfgGossipPort) + gossipPort := config.Node().Int(CfgGossipPort) if !netutil.IsValidPort(gossipPort) { log.Fatalf("Invalid port number (%s): %d", CfgGossipPort, gossipPort) } @@ -60,7 +60,7 @@ func start(shutdownSignal <-chan struct{}) { gossipEndpoint := lPeer.Services().Get(service.GossipKey) // resolve the bind address - address := net.JoinHostPort(config.Node().GetString(local.CfgBind), strconv.Itoa(gossipEndpoint.Port())) + address := net.JoinHostPort(config.Node().String(local.CfgBind), strconv.Itoa(gossipEndpoint.Port())) localAddr, err := net.ResolveTCPAddr(gossipEndpoint.Network(), address) if err != nil { log.Fatalf("Error resolving %s: %v", local.CfgBind, err) diff --git a/plugins/gossip/plugin.go b/plugins/gossip/plugin.go index 2bd6423d61d58bd5ddf2a881bb4d26b56dd267d3..3dd6e74a2aeef277f12812f5172c9e165c2eb83c 100644 --- a/plugins/gossip/plugin.go +++ b/plugins/gossip/plugin.go @@ -41,8 +41,8 @@ func Plugin() *node.Plugin { func configure(*node.Plugin) { log = logger.NewLogger(PluginName) - ageThreshold = config.Node().GetDuration(CfgGossipAgeThreshold) - tipsBroadcasterInterval = config.Node().GetDuration(CfgGossipTipsBroadcastInterval) + ageThreshold = config.Node().Duration(CfgGossipAgeThreshold) + tipsBroadcasterInterval = config.Node().Duration(CfgGossipTipsBroadcastInterval) configureLogging() configureMessageLayer() diff --git a/plugins/gracefulshutdown/plugin.go b/plugins/gracefulshutdown/plugin.go index b191f7e3f4ff6e0bc32386119a6f1d9ceb4fd5e1..2f4cd16808e92f15f1d7841defbf2d3f844d4f61 100644 --- a/plugins/gracefulshutdown/plugin.go +++ b/plugins/gracefulshutdown/plugin.go @@ -28,7 +28,7 @@ var ( ) func configure(*node.Plugin) { - waitToKillTimeInSeconds = config.Node().GetInt(CfgWaitToKillTimeInSeconds) + waitToKillTimeInSeconds = config.Node().Int(CfgWaitToKillTimeInSeconds) log = logger.NewLogger(PluginName) gracefulStop = make(chan os.Signal) diff --git a/plugins/metrics/plugin.go b/plugins/metrics/plugin.go index 5fdd58dae1be6debbd8ff35e127b2b11699ffab5..98705b0552720801366c1043cfb0e50c24496335 100644 --- a/plugins/metrics/plugin.go +++ b/plugins/metrics/plugin.go @@ -47,21 +47,21 @@ func configure(_ *node.Plugin) { func run(_ *node.Plugin) { log.Infof("Starting %s ...", PluginName) - if config.Node().GetBool(CfgMetricsLocal) { + if config.Node().Bool(CfgMetricsLocal) { // initial measurement, since we have to know how many messages are there in the db measureInitialDBStats() registerLocalMetrics() } // Events from analysis server - if config.Node().GetBool(CfgMetricsGlobal) { + if config.Node().Bool(CfgMetricsGlobal) { server.Events.MetricHeartbeat.Attach(onMetricHeartbeatReceived) } // create a background worker that update the metrics every second if err := daemon.BackgroundWorker("Metrics Updater", func(shutdownSignal <-chan struct{}) { defer log.Infof("Stopping Metrics Updater ... done") - if config.Node().GetBool(CfgMetricsLocal) { + if config.Node().Bool(CfgMetricsLocal) { timeutil.Ticker(func() { measureCPUUsage() measureMemUsage() @@ -77,7 +77,7 @@ func run(_ *node.Plugin) { gossipCurrentTx.Store(uint64(g.BytesWritten)) }, 1*time.Second, shutdownSignal) } - if config.Node().GetBool(CfgMetricsGlobal) { + if config.Node().Bool(CfgMetricsGlobal) { timeutil.Ticker(calculateNetworkDiameter, 1*time.Minute, shutdownSignal) } log.Infof("Stopping Metrics Updater ...") diff --git a/plugins/networkdelay/plugin.go b/plugins/networkdelay/plugin.go index b72c09f7fc634740e92e62c6251378882ef721cb..d2d29c17b243c5bc13de93a837008fa81bb9b3bf 100644 --- a/plugins/networkdelay/plugin.go +++ b/plugins/networkdelay/plugin.go @@ -61,7 +61,7 @@ func configure(_ *node.Plugin) { } // get origin public key from config - bytes, err := base58.Decode(config.Node().GetString(CfgNetworkDelayOriginPublicKey)) + bytes, err := base58.Decode(config.Node().String(CfgNetworkDelayOriginPublicKey)) if err != nil { log.Fatalf("could not parse %s config entry as base58. %v", CfgNetworkDelayOriginPublicKey, err) } diff --git a/plugins/pow/pow.go b/plugins/pow/pow.go index 69207f5b6792ae48585dcaa3c81e3cd0d6ba7225..4b9b6e2824d4507fd613f76f74ea17fa6d60f636 100644 --- a/plugins/pow/pow.go +++ b/plugins/pow/pow.go @@ -41,9 +41,9 @@ func Worker() *pow.Worker { workerOnce.Do(func() { log = logger.NewLogger(PluginName) // load the parameters - difficulty = config.Node().GetInt(CfgPOWDifficulty) - numWorkers = config.Node().GetInt(CfgPOWNumThreads) - timeout = config.Node().GetDuration(CfgPOWTimeout) + difficulty = config.Node().Int(CfgPOWDifficulty) + numWorkers = config.Node().Int(CfgPOWNumThreads) + timeout = config.Node().Duration(CfgPOWTimeout) // create the worker worker = pow.New(hash, numWorkers) }) diff --git a/plugins/profiling/plugin.go b/plugins/profiling/plugin.go index 4035e2df98bec4c8fb0eb3b51a900f6d69a1a1de..3c6a0b551bd10a4106c26203004b865a71f09a46 100644 --- a/plugins/profiling/plugin.go +++ b/plugins/profiling/plugin.go @@ -44,7 +44,7 @@ func configure(_ *node.Plugin) { } func run(_ *node.Plugin) { - bindAddr := config.Node().GetString(CfgProfilingBindAddress) + bindAddr := config.Node().String(CfgProfilingBindAddress) runtime.SetMutexProfileFraction(5) runtime.SetBlockProfileRate(5) diff --git a/plugins/prometheus/db_size.go b/plugins/prometheus/db_size.go index df6e1372ed97805b0c1a22d3c72d37608ff3eab9..1ba69499afe65f018c8338004dfa3ecf04207eef 100644 --- a/plugins/prometheus/db_size.go +++ b/plugins/prometheus/db_size.go @@ -27,7 +27,7 @@ func registerDBMetrics() { } func collectDBSize() { - size, err := directorySize(config.Node().GetString(database.CfgDatabaseDir)) + size, err := directorySize(config.Node().String(database.CfgDatabaseDir)) if err == nil { dbSize.Set(float64(size)) } diff --git a/plugins/prometheus/plugin.go b/plugins/prometheus/plugin.go index 723e68061e737bab1346c3e56ff2e9cadc217f37..e965736ab32b577951831abec242034c882507d7 100644 --- a/plugins/prometheus/plugin.go +++ b/plugins/prometheus/plugin.go @@ -42,18 +42,18 @@ func Plugin() *node.Plugin { func configure(plugin *node.Plugin) { log = logger.NewLogger(plugin.Name) - if config.Node().GetBool(CfgPrometheusWorkerpoolMetrics) { + if config.Node().Bool(CfgPrometheusWorkerpoolMetrics) { registerWorkerpoolMetrics() } - if config.Node().GetBool(CfgPrometheusGoMetrics) { + if config.Node().Bool(CfgPrometheusGoMetrics) { registry.MustRegister(prometheus.NewGoCollector()) } - if config.Node().GetBool(CfgPrometheusProcessMetrics) { + if config.Node().Bool(CfgPrometheusProcessMetrics) { registry.MustRegister(prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{})) } - if config.Node().GetBool(metrics.CfgMetricsLocal) { + if config.Node().Bool(metrics.CfgMetricsLocal) { registerAutopeeringMetrics() registerDBMetrics() registerFPCMetrics() @@ -63,7 +63,7 @@ func configure(plugin *node.Plugin) { registerTangleMetrics() } - if config.Node().GetBool(metrics.CfgMetricsGlobal) { + if config.Node().Bool(metrics.CfgMetricsGlobal) { registerClientsMetrics() } } @@ -90,13 +90,13 @@ func run(plugin *node.Plugin) { EnableOpenMetrics: true, }, ) - if config.Node().GetBool(CfgPrometheusPromhttpMetrics) { + if config.Node().Bool(CfgPrometheusPromhttpMetrics) { handler = promhttp.InstrumentMetricHandler(registry, handler) } handler.ServeHTTP(c.Writer, c.Request) }) - bindAddr := config.Node().GetString(CfgPrometheusBindAddress) + bindAddr := config.Node().String(CfgPrometheusBindAddress) server = &http.Server{Addr: bindAddr, Handler: engine} go func() { diff --git a/plugins/remotelog/plugin.go b/plugins/remotelog/plugin.go index a7018f70d305b617cf569ea5e70c5c1700fbd692..d45022e2b44c9b6c7136eac4a34b1a7801b9c0e1 100644 --- a/plugins/remotelog/plugin.go +++ b/plugins/remotelog/plugin.go @@ -64,7 +64,7 @@ func init() { func configure(plugin *node.Plugin) { log = logger.NewLogger(PluginName) - if config.Node().GetBool(CfgDisableEvents) { + if config.Node().Bool(CfgDisableEvents) { log.Fatalf("%s in config.json needs to be false so that events can be captured!", CfgDisableEvents) return } @@ -160,7 +160,7 @@ func getGitDir() string { // RemoteLogger represents a connection to our remote log server. func RemoteLogger() *RemoteLoggerConn { remoteLoggerOnce.Do(func() { - r, err := newRemoteLoggerConn(config.Node().GetString(CfgLoggerRemotelogServerAddress)) + r, err := newRemoteLoggerConn(config.Node().String(CfgLoggerRemotelogServerAddress)) if err != nil { log.Fatal(err) return diff --git a/plugins/syncbeacon/plugin.go b/plugins/syncbeacon/plugin.go index 0b1e6e1318a863eb6dd053f4f637b7ed7b88590f..d27d0589b1aeb42878361c47f65247444d0ffe0a 100644 --- a/plugins/syncbeacon/plugin.go +++ b/plugins/syncbeacon/plugin.go @@ -53,7 +53,7 @@ func configure(_ *node.Plugin) { log.Infof("starting node as sync beacon") - if config.Node().GetBool(CfgSyncBeaconStartSynced) { + if config.Node().Bool(CfgSyncBeaconStartSynced) { log.Infof("Retrieving all the tips") messagelayer.TipSelector().Set(messagelayer.Tangle().RetrieveAllTips()...) @@ -78,7 +78,7 @@ func broadcastSyncBeaconPayload() { func run(_ *node.Plugin) { if err := daemon.BackgroundWorker("Sync-Beacon", func(shutdownSignal <-chan struct{}) { - ticker := time.NewTicker(config.Node().GetDuration(CfgSyncBeaconBroadcastIntervalSec) * time.Second) + ticker := time.NewTicker(config.Node().Duration(CfgSyncBeaconBroadcastIntervalSec) * time.Second) defer ticker.Stop() for { select { diff --git a/plugins/syncbeaconfollower/plugin.go b/plugins/syncbeaconfollower/plugin.go index 4e103fae641466f01e92082578a255600beb8801..b1e5c1e0cab98526c46e6b0a36b1e05db9eaed61 100644 --- a/plugins/syncbeaconfollower/plugin.go +++ b/plugins/syncbeaconfollower/plugin.go @@ -129,10 +129,10 @@ func OverwriteSyncedState(syncedOverwrite bool) { func configure(_ *node.Plugin) { log = logger.NewLogger(PluginName) - pubKeys := config.Node().GetStringSlice(CfgSyncBeaconFollowNodes) - beaconMaxTimeOfflineSec = float64(config.Node().GetInt(CfgSyncBeaconMaxTimeOfflineSec)) - beaconMaxTimeWindowSec = float64(config.Node().GetInt(CfgSyncBeaconMaxTimeWindowSec)) - syncPercentage = config.Node().GetFloat64(CfgSyncBeaconSyncPercentage) + pubKeys := config.Node().Strings(CfgSyncBeaconFollowNodes) + beaconMaxTimeOfflineSec = float64(config.Node().Int(CfgSyncBeaconMaxTimeOfflineSec)) + beaconMaxTimeWindowSec = float64(config.Node().Int(CfgSyncBeaconMaxTimeWindowSec)) + syncPercentage = config.Node().Float64(CfgSyncBeaconSyncPercentage) if syncPercentage < 0.5 || syncPercentage > 1.0 { log.Warnf("invalid syncPercentage: %f, syncPercentage has to be in [0.5, 1.0] interval", syncPercentage) // set it to default @@ -251,7 +251,7 @@ func cleanupFollowNodes() { func run(_ *node.Plugin) { if err := daemon.BackgroundWorker("Sync-Beacon-Cleanup", func(shutdownSignal <-chan struct{}) { - ticker := time.NewTicker(config.Node().GetDuration(CfgSyncBeaconCleanupInterval) * time.Second) + ticker := time.NewTicker(config.Node().Duration(CfgSyncBeaconCleanupInterval) * time.Second) defer ticker.Stop() for { select { diff --git a/plugins/webapi/faucet/plugin.go b/plugins/webapi/faucet/plugin.go index 3bbdf78f4ffee89f3436859a3818961a41b33ef4..b45f06be1879bbb557085bae0cbea88f449a4e5c 100644 --- a/plugins/webapi/faucet/plugin.go +++ b/plugins/webapi/faucet/plugin.go @@ -60,7 +60,7 @@ func requestFunds(c echo.Context) error { return c.JSON(http.StatusBadRequest, Response{Error: "Invalid address"}) } - faucetPayload, err := faucet.NewRequest(addr, config.Node().GetInt(faucet.CfgFaucetPoWDifficulty)) + faucetPayload, err := faucet.NewRequest(addr, config.Node().Int(faucet.CfgFaucetPoWDifficulty)) if err != nil { return c.JSON(http.StatusBadRequest, Response{Error: err.Error()}) } diff --git a/plugins/webapi/plugin.go b/plugins/webapi/plugin.go index 57ed60de2627ff150d30d5e8ee5ef9c2baaaf28a..0ce5144002a15ae6d094b459a7867014caa1e0be 100644 --- a/plugins/webapi/plugin.go +++ b/plugins/webapi/plugin.go @@ -50,10 +50,10 @@ func Server() *echo.Echo { })) // if enabled, configure basic-auth - if config.Node().GetBool(CfgBasicAuthEnabled) { + if config.Node().Bool(CfgBasicAuthEnabled) { server.Use(middleware.BasicAuth(func(username, password string, c echo.Context) (bool, error) { - if username == config.Node().GetString(CfgBasicAuthUsername) && - password == config.Node().GetString(CfgBasicAuthPassword) { + if username == config.Node().String(CfgBasicAuthUsername) && + password == config.Node().String(CfgBasicAuthPassword) { return true, nil } return false, nil @@ -120,9 +120,9 @@ func worker(shutdownSignal <-chan struct{}) { defer log.Infof("Stopping %s ... done", PluginName) stopped := make(chan struct{}) - bindAddr := config.Node().GetString(CfgBindAddress) + bindAddr := config.Node().String(CfgBindAddress) go func() { - log.Infof("%s started, bind-address=%s, basic-auth=%v", PluginName, bindAddr, config.Node().GetBool(CfgBasicAuthEnabled)) + log.Infof("%s started, bind-address=%s, basic-auth=%v", PluginName, bindAddr, config.Node().Bool(CfgBasicAuthEnabled)) if err := server.Start(bindAddr); err != nil { if !errors.Is(err, http.ErrServerClosed) { log.Errorf("Error serving: %s", err) diff --git a/tools/docker-network/docker-compose.yml b/tools/docker-network/docker-compose.yml index db5c967b4f89e727712442a1b3016a654fc332a5..b548a858a65bbf5da2e927858a2b1305a5bd5e79 100644 --- a/tools/docker-network/docker-compose.yml +++ b/tools/docker-network/docker-compose.yml @@ -8,7 +8,7 @@ services: stop_grace_period: 1m entrypoint: /go/bin/main command: > - --config-dir=/tmp + --config=/tmp/config.json --database.directory=/tmp/mainnetdb --autopeering.seed=base58:8kPPCqaJFAt8BJtx6qw5PN8bKEM2XKXor6PxkmHf6bcr --autopeering.entryNodes= @@ -38,7 +38,7 @@ services: stop_grace_period: 1m entrypoint: /go/bin/main command: > - --config-dir=/tmp + --config=/tmp/config.json --database.directory=/tmp/mainnetdb --autopeering.seed=base58:8q491c3YWjbPwLmF2WD95YmCgh61j2kenCKHfGfByoWi --node.enablePlugins=prometheus,spammer,faucet,syncbeacon @@ -63,7 +63,7 @@ services: stop_grace_period: 1m entrypoint: /go/bin/main command: > - --config-dir=/tmp + --config=/tmp/config.json --database.directory=/tmp/mainnetdb --node.enablePlugins=bootstrap --valueLayer.snapshot.file=/tmp/assets/7R1itJx5hVuo9w9hjg5cwKFmek4HMSoBDgJZN8hKGxih.bin diff --git a/tools/integration-tests/tester/go.mod b/tools/integration-tests/tester/go.mod index 30b9e9f170017ebcbc49cf1cbba322753deba796..18ae2b9bee034945046735ef13c0c30d5a1779e6 100644 --- a/tools/integration-tests/tester/go.mod +++ b/tools/integration-tests/tester/go.mod @@ -10,7 +10,7 @@ require ( github.com/docker/go-units v0.4.0 // indirect github.com/drand/drand v1.1.1 github.com/iotaledger/goshimmer v0.1.3 - github.com/iotaledger/hive.go v0.0.0-20201010155836-c0af5551de50 + github.com/iotaledger/hive.go v0.0.0-20201026194603-90676fed31f9 github.com/mr-tron/base58 v1.2.0 github.com/opencontainers/go-digest v1.0.0 // indirect github.com/stretchr/testify v1.6.1 diff --git a/tools/integration-tests/tester/go.sum b/tools/integration-tests/tester/go.sum index c778f37b0933735b43a107b09f3701b1cb1b529c..ef25100be95500357254bb541f914019d8fcb770 100644 --- a/tools/integration-tests/tester/go.sum +++ b/tools/integration-tests/tester/go.sum @@ -88,6 +88,7 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z github.com/cockroachdb/errors v1.2.4/go.mod h1:rQD95gz6FARkaKkQXUksEje/d9a6wBJoCr5oaCLELYA= github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= github.com/cockroachdb/pebble v0.0.0-20200915204653-08b545a1f540/go.mod h1:hU7vhtrqonEphNF+xt8/lHdaBprxmV1h8BOGrd9XwmQ= +github.com/cockroachdb/pebble v0.0.0-20201023120638-f1224da22976/go.mod h1:BbtTitvfmE0eZNcncJgJw5BlQhskTzgZgoISnY+8s6k= github.com/cockroachdb/redact v0.0.0-20200622112456-cd282804bbd3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= @@ -162,12 +163,16 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -262,6 +267,8 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -351,6 +358,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/iotaledger/hive.go v0.0.0-20201010155836-c0af5551de50 h1:dHSz9lKA4Cemj+vecCzVeHQNBJrGjzAZ5wNYtX1a/x0= github.com/iotaledger/hive.go v0.0.0-20201010155836-c0af5551de50/go.mod h1:h56kcBj+CYn3UEoCG6RJI5lVdYVJmhmeuIHOUgFCfEg= +github.com/iotaledger/hive.go v0.0.0-20201026194603-90676fed31f9 h1:iRZdsjS3upMCTjZPhdhZkUTq8vqAtwOLHxnyumS3a44= +github.com/iotaledger/hive.go v0.0.0-20201026194603-90676fed31f9/go.mod h1:xqn2tIsuGgEU68fgTiR5SH6tD1hxRwznLfvgR0ZEPUs= github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM= @@ -427,6 +436,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.9.5 h1:U+CaK85mrNNb4k8BNOfgJtJ/gr6kswUCFj6miSzVC6M= github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/knadh/koanf v0.14.0 h1:h9XeG4wEiEuxdxqv/SbY7TEK+7vzrg/dOaGB+S6+mPo= +github.com/knadh/koanf v0.14.0/go.mod h1:H5mEFsTeWizwFXHKtsITL5ipsLTuAMQoGuQpp+1JL9U= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -624,6 +635,8 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc35r0TV4= +github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -680,6 +693,8 @@ github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c h1:5bFTChQxSKNwy github.com/nikkolasg/hexjson v0.0.0-20181101101858-78e39397e00c/go.mod h1:7qN3Y0BvzRUf4LofcoJplQL10lsFDb4PYlePTVwrP28= github.com/oasisprotocol/ed25519 v0.0.0-20200528083105-55566edd6df0 h1:qmiMZ6ZhkeQZkV/Huajj+QBAu1jX0HTGsOwi+eXTGY8= github.com/oasisprotocol/ed25519 v0.0.0-20200528083105-55566edd6df0/go.mod h1:IZbb50w3AB72BVobEF6qG93NNSrTw/V2QlboxqSu3Xw= +github.com/oasisprotocol/ed25519 v0.0.0-20200819094954-65138ca6ec7c h1:/Ydlzrdta1Gegs20RPue2Tpkmh28dMjkwqDyikptskA= +github.com/oasisprotocol/ed25519 v0.0.0-20200819094954-65138ca6ec7c/go.mod h1:IZbb50w3AB72BVobEF6qG93NNSrTw/V2QlboxqSu3Xw= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -713,12 +728,15 @@ github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/panjf2000/ants/v2 v2.4.1 h1:7RtUqj5lGOw0WnZhSKDZ2zzJhaX5490ZW1sUolRXCxY= github.com/panjf2000/ants/v2 v2.4.1/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= +github.com/panjf2000/ants/v2 v2.4.3 h1:wHghL17YKFanB62QjPQ9o+DuM4q7WrQ7zAhoX8+eBXU= +github.com/panjf2000/ants/v2 v2.4.3/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= @@ -769,6 +787,7 @@ github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFB github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rhnvrm/simples3 v0.5.0/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= @@ -816,6 +835,8 @@ github.com/spf13/afero v1.3.0 h1:Ysnmjh1Di8EaWaBv40CYR4IdaIsBc5996Gh1oZzCBKk= github.com/spf13/afero v1.3.0/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v0.0.6/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= @@ -838,6 +859,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -921,6 +943,8 @@ go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.5.1/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= @@ -934,6 +958,8 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +go.uber.org/zap v1.16.0 h1:uFRZXykJGK9lLY4HtgSw44DnIcAM+kRBP7x5m+NpAOM= +go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -963,6 +989,8 @@ golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 h1:DZhuSZLsGlFL4CmhA8BcRA0mnthyA/nZ00AqCUo7vHg= golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -982,6 +1010,7 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNT golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367 h1:0IiAsCRByjO2QjX7ZPkw5oU9x+n1YqRL802rjC0c3Aw= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -1034,6 +1063,7 @@ golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1069,6 +1099,7 @@ golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190902133755-9109b7679e13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191025090151-53bf42e6b339/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1081,6 +1112,7 @@ golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1224,6 +1256,8 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/tools/relay-checker/config.go b/tools/relay-checker/config.go index 5e8d2ed774ba1e3e2a0cd09795c99ccdf7e77197..bab2566e577480fa316ac518ff4d15687fbe8208 100644 --- a/tools/relay-checker/config.go +++ b/tools/relay-checker/config.go @@ -11,24 +11,24 @@ var ( ) func initConfig() { - if config.Node().GetString(CfgTargetNode) == "" { + if config.Node().String(CfgTargetNode) == "" { panic("Set the target node address\n") } - target = config.Node().GetString(CfgTargetNode) + target = config.Node().String(CfgTargetNode) - if len(config.Node().GetStringSlice(CfgTestNodes)) == 0 { + if len(config.Node().Strings(CfgTestNodes)) == 0 { panic("Set node addresses\n") } - nodes = append(nodes, config.Node().GetStringSlice(CfgTestNodes)...) + nodes = append(nodes, config.Node().Strings(CfgTestNodes)...) // optional settings - if config.Node().GetString(CfgData) != "" { - msgData = config.Node().GetString(CfgData) + if config.Node().String(CfgData) != "" { + msgData = config.Node().String(CfgData) } - if config.Node().GetInt(CfgCooldownTime) > 0 { - cooldownTime = config.Node().GetInt(CfgCooldownTime) + if config.Node().Int(CfgCooldownTime) > 0 { + cooldownTime = config.Node().Int(CfgCooldownTime) } - if config.Node().GetInt(CfgRepeat) > 0 { - repeat = config.Node().GetInt(CfgRepeat) + if config.Node().Int(CfgRepeat) > 0 { + repeat = config.Node().Int(CfgRepeat) } }