diff --git a/config.json b/config.json new file mode 100644 index 0000000000000000000000000000000000000000..93dbdd992d30429fea6c5168d20c9485c8f75b76 --- /dev/null +++ b/config.json @@ -0,0 +1,29 @@ +{ + "node": { + "logLevel": 3, + "disablePlugins": [], + "enablePlugins": [] + }, + "database": { + "directory": "mainnetdb" + }, + "analysis": { + "serverPort": 0, + "serverAddress": "159.69.158.51:188" + }, + "gossip": { + "port": 14666 + }, + "zeromq": { + "port": 5556 + }, + "autopeering": { + "address": "0.0.0.0", + "port": 14626, + "entryNodes": [ + "7f7a876a4236091257e650da8dcf195fbe3cb625@159.69.158.51:14626" + ], + "acceptRequests": true, + "sendRequests": true + } +} \ No newline at end of file diff --git a/go.mod b/go.mod index b5b30299dbb3741e1f2c39a153005ad8d82dc5a0..f1e0999f51ae1a9d83f18dcbbd6ecf65c6103ec6 100644 --- a/go.mod +++ b/go.mod @@ -4,22 +4,25 @@ go 1.13 require ( github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect + github.com/apsdehal/go-logger v0.0.0-20190506062552-f85330a4b532 // indirect github.com/dgraph-io/badger v1.6.0 github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/ethereum/go-ethereum v1.9.3 github.com/gdamore/tcell v1.2.0 github.com/go-zeromq/zmq4 v0.5.0 github.com/golang/protobuf v1.3.2 // indirect - github.com/google/open-location-code/go v0.0.0-20190723034300-2c7115db77a3 + github.com/google/open-location-code/go v0.0.0-20190903173953-119bc96a3a51 github.com/gorilla/websocket v1.4.1 - github.com/iotaledger/iota.go v1.0.0-beta.7 - github.com/kr/pretty v0.1.0 // indirect + github.com/iotaledger/hive.go v0.0.0-20191113184748-b545de9170d9 + github.com/iotaledger/iota.go v1.0.0-beta.9 github.com/labstack/echo v3.3.10+incompatible github.com/labstack/gommon v0.3.0 // indirect github.com/magiconair/properties v1.8.1 github.com/pkg/errors v0.8.1 github.com/rivo/tview v0.0.0-20190829161255-f8bc69b90341 github.com/rivo/uniseg v0.1.0 // indirect + github.com/spf13/pflag v1.0.5 + github.com/stretchr/objx v0.2.0 // indirect golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 golang.org/x/sys v0.0.0-20190904154756-749cb33beabd // indirect diff --git a/go.sum b/go.sum index 3df102786afb3eeee10747d3452e60d64e12eb1b..40c7c3e67cd8f5930d91480dbfa7f903d046181e 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 h1:cTp8I5+VIoKjsnZuH8vjyaysT/ses3EvZeaV/1UkF2M= github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8= @@ -5,108 +6,219 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/apsdehal/go-logger v0.0.0-20190506062552-f85330a4b532/go.mod h1:U3/8D6R9+bVpX0ORZjV+3mU9pQ86m7h1lESgJbXNvXA= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/beevik/ntp v0.2.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgraph-io/badger v1.5.4/go.mod h1:VZxzAIRPHRVNRKRo6AXrX9BJegn6il06VMTZVJYCIjQ= +github.com/dgraph-io/badger v1.6.0 h1:DshxFxZWXUcO0xX476VJC07Xsr6ZCBVRHKZ93Oh7Evo= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-farm v0.0.0-20190323231341-8198c7b169ec/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/ethereum/go-ethereum v1.9.3 h1:v3bE4abkXknLcyWCf4TRFn+Ecmm9thPtfLFvTEQ+1+U= github.com/ethereum/go-ethereum v1.9.3/go.mod h1:PwpWDrCLZrV+tfrhqqF6kPknbISMHaJv9Ln3kPCZLwY= +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/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= github.com/gdamore/tcell v1.1.2/go.mod h1:h3kq4HO9l2On+V9ed8w8ewqQEmGCSSHOgQ+2h8uzurE= +github.com/gdamore/tcell v1.2.0 h1:ikixzsxc8K8o3V2/CEmyoEW8mJZaNYQQ3NP3VIQdUe4= github.com/gdamore/tcell v1.2.0/go.mod h1:Hjvr+Ofd+gLglo7RYKxxnzCBmev3BzsS67MebKS4zMM= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-zeromq/zmq4 v0.5.0 h1:DijriKlrr2b48mymvAsZApiPzrbxQodYKG1aDH1rz8c= github.com/go-zeromq/zmq4 v0.5.0/go.mod h1:6p7pjNlkfrQQVipmEuZDk7fakLZCqPPVK+Iq3jfbDg8= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/open-location-code/go v0.0.0-20190723034300-2c7115db77a3/go.mod h1:eJfRN6aj+kR/rnua/rw9jAgYhqoMHldQkdTi+sePRKk= +github.com/google/open-location-code/go v0.0.0-20190903173953-119bc96a3a51/go.mod h1:eJfRN6aj+kR/rnua/rw9jAgYhqoMHldQkdTi+sePRKk= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/iotaledger/iota.go v1.0.0-beta.7 h1:OaUNahPvOdQz2nKcgeAfcUdxlEDlEV3xwLIkwzZ1B/U= +github.com/iotaledger/hive.go v0.0.0-20191113184748-b545de9170d9 h1:zlolyGALm324vLK6zJuw9cNp/XoNqsxqqx4jzHgoaFU= +github.com/iotaledger/hive.go v0.0.0-20191113184748-b545de9170d9/go.mod h1:Ks2y/bEyfvb7nUA7l69a+8Epsv16UlGev0BvxggHius= github.com/iotaledger/iota.go v1.0.0-beta.7/go.mod h1:dMps6iMVU1pf5NDYNKIw4tRsPeC8W3ZWjOvYHOO1PMg= +github.com/iotaledger/iota.go v1.0.0-beta.9 h1:c654s9pkdhMBkABUvWg+6k91MEBbdtmZXP1xDfQpajg= +github.com/iotaledger/iota.go v1.0.0-beta.9/go.mod h1:F6WBmYd98mVjAmmPVYhnxg8NNIWCjjH8VWT9qvv3Rc8= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg= github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= +github.com/lucasb-eyer/go-colorful v1.0.2 h1:mCMFu6PgSozg9tDNMMK3g18oJBX7oYGrC09mS6CXfO4= github.com/lucasb-eyer/go-colorful v1.0.2/go.mod h1:0MS4r+7BZKSJ5mw4/S5MPN+qHFF1fYclkSPilDOKW0s= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rivo/tview v0.0.0-20190721135419-23dc8a0944e4/go.mod h1:+rKjP5+h9HMwWRpAfhIkkQ9KE3m3Nz5rwn7YtUpwgqk= github.com/rivo/tview v0.0.0-20190829161255-f8bc69b90341 h1:d2Z5U4d3fenPRFFweaMCogbXiRywM5kgYtu20/hol3M= github.com/rivo/tview v0.0.0-20190829161255-f8bc69b90341/go.mod h1:+rKjP5+h9HMwWRpAfhIkkQ9KE3m3Nz5rwn7YtUpwgqk= github.com/rivo/uniseg v0.0.0-20190513083848-b9f5b9457d44/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/simia-tech/env v0.1.0/go.mod h1:eVRQ7W5NXXHifpPAcTJ3r5EmoGgMn++dXfSVbZv3Opo= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +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/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.5.0 h1:GpsTwfsQ27oS/Aha/6d1oD7tpKIqWnOA6tgOX9HHkt4= +github.com/spf13/viper v1.5.0/go.mod h1:AkYRkVJF8TkSG/xet6PzXX+l39KhhXa2pdqVSxnTcn4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.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= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.mongodb.org/mongo-driver v1.0.0/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 h1:Gv7RPwsi3eZ2Fgewe3CBsuOebPwO27PoXzRpJPsvSSM= golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +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= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -115,19 +227,35 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd h1:DBH9mDw0zluJT/R+nGuV3jWFWLFaHyYZWD4tOT+cjn0= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/h2non/gock.v1 v1.0.14/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdODlynE= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/zeromq/goczmq.v4 v4.1.0 h1:CE+FE81mGVs2aSlnbfLuS1oAwdcVywyMM2AC1g33imI= gopkg.in/zeromq/goczmq.v4 v4.1.0/go.mod h1:h4IlfePEYMpFdywGr5gAwKhBBj+hiBl/nF4VoSE4k+0= +gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/packages/daemon/events.go b/packages/daemon/events.go index dd3953287de61468d50a613d8eb3b7d466474d56..256d4c43f44889a4512718763bd5ba427f16724c 100644 --- a/packages/daemon/events.go +++ b/packages/daemon/events.go @@ -1,7 +1,7 @@ package daemon import ( - "github.com/iotaledger/goshimmer/packages/events" + "github.com/iotaledger/hive.go/events" ) var Events = struct { diff --git a/packages/database/badger_instance.go b/packages/database/badger_instance.go index 6cf834f7140df321e9971e1c439dbd1a86bf1fdb..769da195ce77b9510dbf86381a3a50fb420e64eb 100644 --- a/packages/database/badger_instance.go +++ b/packages/database/badger_instance.go @@ -1,6 +1,7 @@ package database import ( + "github.com/iotaledger/hive.go/parameter" "os" "sync" @@ -37,7 +38,7 @@ func checkDir(dir string) error { } func createDB() (*badger.DB, error) { - directory := *DIRECTORY.Value + directory := parameter.NodeConfig.GetString(CFG_DIRECTORY) if err := checkDir(directory); err != nil { return nil, errors.Wrap(err, "Could not check directory") } diff --git a/packages/database/parameters.go b/packages/database/parameters.go index fb6e1c2c26fc6065f2ae74485f5ca29afc7aa54a..8d647e65a59ea193f461fa9b6a5292e24f1435aa 100644 --- a/packages/database/parameters.go +++ b/packages/database/parameters.go @@ -1,7 +1,13 @@ package database import ( - "github.com/iotaledger/goshimmer/packages/parameter" + flag "github.com/spf13/pflag" ) -var DIRECTORY = parameter.AddString("DATABASE/DIRECTORY", "mainnetdb", "path to the database folder") +const ( + CFG_DIRECTORY = "database.directory" +) + +func init() { + flag.String(CFG_DIRECTORY, "mainnetdb", "path to the database folder") +} diff --git a/packages/events/closure.go b/packages/events/closure.go deleted file mode 100644 index 9777b5556853b380399cdf58a61217c2a0c2cb23..0000000000000000000000000000000000000000 --- a/packages/events/closure.go +++ /dev/null @@ -1,18 +0,0 @@ -package events - -import "reflect" - -type Closure struct { - Id uintptr - Fnc interface{} -} - -func NewClosure(f interface{}) *Closure { - closure := &Closure{ - Fnc: f, - } - - closure.Id = reflect.ValueOf(closure).Pointer() - - return closure -} diff --git a/packages/events/event.go b/packages/events/event.go deleted file mode 100644 index 9bd6053386b7c9506c9c34b8613125de97f8797b..0000000000000000000000000000000000000000 --- a/packages/events/event.go +++ /dev/null @@ -1,36 +0,0 @@ -package events - -import "sync" - -type Event struct { - triggerFunc func(handler interface{}, params ...interface{}) - callbacks map[uintptr]interface{} - mutex sync.RWMutex -} - -func (this *Event) Attach(closure *Closure) { - this.mutex.Lock() - this.callbacks[closure.Id] = closure.Fnc - this.mutex.Unlock() -} - -func (this *Event) Detach(closure *Closure) { - this.mutex.Lock() - delete(this.callbacks, closure.Id) - this.mutex.Unlock() -} - -func (this *Event) Trigger(params ...interface{}) { - this.mutex.RLock() - for _, handler := range this.callbacks { - this.triggerFunc(handler, params...) - } - this.mutex.RUnlock() -} - -func NewEvent(triggerFunc func(handler interface{}, params ...interface{})) *Event { - return &Event{ - triggerFunc: triggerFunc, - callbacks: make(map[uintptr]interface{}), - } -} diff --git a/packages/events/event_test.go b/packages/events/event_test.go deleted file mode 100644 index 37d91bd9a02fe5a49457656f83055eb33c7014d9..0000000000000000000000000000000000000000 --- a/packages/events/event_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package events - -import ( - "fmt" - "strconv" - "testing" -) - -func BenchmarkEvent_Trigger(b *testing.B) { - event := NewEvent(intStringCaller) - - event.Attach(NewClosure(func(param1 int, param2 string) { - // do nothing just get called - })) - - b.ResetTimer() - - for i := 0; i < b.N; i++ { - event.Trigger(4, "test") - } -} - -// define how the event converts the generic parameters to the typed params - ugly but go has no generics :( -func intStringCaller(handler interface{}, params ...interface{}) { - handler.(func(int, string))(params[0].(int), params[1].(string)) -} - -func ExampleEvent() { - // create event object (usually exposed through a public struct that holds all the different event types) - event := NewEvent(intStringCaller) - - // we have to wrap a function in a closure to make it identifiable - closure1 := NewClosure(func(param1 int, param2 string) { - fmt.Println("#1 " + param2 + ": " + strconv.Itoa(param1)) - }) - - // multiple subscribers can attach to an event (closures can be inlined) - event.Attach(closure1) - event.Attach(NewClosure(func(param1 int, param2 string) { - fmt.Println("#2 " + param2 + ": " + strconv.Itoa(param1)) - })) - - // trigger the event - event.Trigger(1, "Hello World") - - // unsubscribe the first closure and trigger again - event.Detach(closure1) - event.Trigger(1, "Hello World") - - // Unordered output: #1 Hello World: 1 - // #2 Hello World: 1 - // #2 Hello World: 1 -} diff --git a/packages/events/types.go b/packages/events/types.go deleted file mode 100644 index 8160d21325b1b894b7b0f14783103cdba0de5583..0000000000000000000000000000000000000000 --- a/packages/events/types.go +++ /dev/null @@ -1,5 +0,0 @@ -package events - -func CallbackCaller(handler interface{}, params ...interface{}) { handler.(func())() } - -func ErrorCaller(handler interface{}, params ...interface{}) { handler.(func(error))(params[0].(error)) } diff --git a/packages/network/events.go b/packages/network/events.go index 0096c1b59f36ce2fe4fa350ce774a6f26eed7c80..7903376b6b4b18ad7622707354bea038ad235ce6 100644 --- a/packages/network/events.go +++ b/packages/network/events.go @@ -1,7 +1,7 @@ package network import ( - "github.com/iotaledger/goshimmer/packages/events" + "github.com/iotaledger/hive.go/events" ) type BufferedConnectionEvents struct { diff --git a/packages/network/managed_connection.go b/packages/network/managed_connection.go index 30b48a894cd6cfdc10933fce3aa61731edf2b962..012a59d8a7134e3411971ab5635b457819cbeaf4 100644 --- a/packages/network/managed_connection.go +++ b/packages/network/managed_connection.go @@ -6,7 +6,7 @@ import ( "sync" "time" - "github.com/iotaledger/goshimmer/packages/events" + "github.com/iotaledger/hive.go/events" ) type ManagedConnection struct { diff --git a/packages/network/tcp/server.go b/packages/network/tcp/server.go index 67b70b26a8744075ac7afc49836b1ddf359711f9..5d962043fd2112b2310d031d81f2534d13bd466a 100644 --- a/packages/network/tcp/server.go +++ b/packages/network/tcp/server.go @@ -5,8 +5,8 @@ import ( "strconv" "sync" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/network" + "github.com/iotaledger/hive.go/events" ) type Server struct { diff --git a/packages/network/tcp/server_events.go b/packages/network/tcp/server_events.go index b5f3fbbeabf7b710b517a2984abc828171dda41b..bf4e8aea2425719a938dc32b1732401615419fa4 100644 --- a/packages/network/tcp/server_events.go +++ b/packages/network/tcp/server_events.go @@ -1,8 +1,8 @@ package tcp import ( - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/network" + "github.com/iotaledger/hive.go/events" ) type serverEvents struct { diff --git a/packages/network/udp/events.go b/packages/network/udp/events.go index dc797d0e5caebe5d6a136b36d3aa609aabad1c76..590c6c256b07500a11f109e7d406717de6cca1a9 100644 --- a/packages/network/udp/events.go +++ b/packages/network/udp/events.go @@ -3,7 +3,7 @@ package udp import ( "net" - "github.com/iotaledger/goshimmer/packages/events" + "github.com/iotaledger/hive.go/events" ) type serverEvents struct { diff --git a/packages/network/udp/server.go b/packages/network/udp/server.go index 3c77a0e8ab0227803ef5e0f69d7d7313fb8c7fd8..00fe86864cc01c3f31cdf7cb14d9e64444213714 100644 --- a/packages/network/udp/server.go +++ b/packages/network/udp/server.go @@ -5,7 +5,7 @@ import ( "strconv" "sync" - "github.com/iotaledger/goshimmer/packages/events" + "github.com/iotaledger/hive.go/events" ) type Server struct { diff --git a/packages/node/events.go b/packages/node/events.go index 4b5a8e80d1d915e40fa7932a28cc09966a969ed8..820be882c8c2ff6b1e394a754824bbd572c27198 100644 --- a/packages/node/events.go +++ b/packages/node/events.go @@ -1,7 +1,7 @@ package node import ( - "github.com/iotaledger/goshimmer/packages/events" + "github.com/iotaledger/hive.go/events" ) type pluginEvents struct { diff --git a/packages/node/node.go b/packages/node/node.go index 51474d9207fe973aab7a37ea9afda0c34a89c9bd..84c461318db523c50b0887a861a6db8c64f8db34 100644 --- a/packages/node/node.go +++ b/packages/node/node.go @@ -1,6 +1,7 @@ package node import ( + "github.com/iotaledger/hive.go/parameter" "sync" "github.com/iotaledger/goshimmer/packages/daemon" @@ -53,7 +54,7 @@ func (node *Node) AddLogger(logger *Logger) { } func (node *Node) LogSuccess(pluginName string, message string) { - if *LOG_LEVEL.Value >= LOG_LEVEL_SUCCESS { + if parameter.NodeConfig.GetInt(CFG_LOG_LEVEL) >= LOG_LEVEL_SUCCESS { for _, logger := range node.loggers { if logger.GetEnabled() { logger.LogSuccess(pluginName, message) @@ -63,7 +64,7 @@ func (node *Node) LogSuccess(pluginName string, message string) { } func (node *Node) LogInfo(pluginName string, message string) { - if *LOG_LEVEL.Value >= LOG_LEVEL_INFO { + if parameter.NodeConfig.GetInt(CFG_LOG_LEVEL) >= LOG_LEVEL_INFO { for _, logger := range node.loggers { if logger.GetEnabled() { logger.LogInfo(pluginName, message) @@ -73,7 +74,7 @@ func (node *Node) LogInfo(pluginName string, message string) { } func (node *Node) LogDebug(pluginName string, message string) { - if *LOG_LEVEL.Value >= LOG_LEVEL_DEBUG { + if parameter.NodeConfig.GetInt(CFG_LOG_LEVEL) >= LOG_LEVEL_DEBUG { for _, logger := range node.loggers { if logger.GetEnabled() { logger.LogDebug(pluginName, message) @@ -83,7 +84,7 @@ func (node *Node) LogDebug(pluginName string, message string) { } func (node *Node) LogWarning(pluginName string, message string) { - if *LOG_LEVEL.Value >= LOG_LEVEL_WARNING { + if parameter.NodeConfig.GetInt(CFG_LOG_LEVEL) >= LOG_LEVEL_WARNING { for _, logger := range node.loggers { if logger.GetEnabled() { logger.LogWarning(pluginName, message) @@ -93,7 +94,7 @@ func (node *Node) LogWarning(pluginName string, message string) { } func (node *Node) LogFailure(pluginName string, message string) { - if *LOG_LEVEL.Value >= LOG_LEVEL_FAILURE { + if parameter.NodeConfig.GetInt(CFG_LOG_LEVEL) >= LOG_LEVEL_FAILURE { for _, logger := range node.loggers { if logger.GetEnabled() { logger.LogFailure(pluginName, message) diff --git a/packages/node/parameters.go b/packages/node/parameters.go index ee244e3d1a91eff75854e8f3cd7abdaeab336e9d..f1acb90c4d4f9cf573b1630d961274c3f5b27959 100644 --- a/packages/node/parameters.go +++ b/packages/node/parameters.go @@ -1,10 +1,17 @@ package node -import "github.com/iotaledger/goshimmer/packages/parameter" - -var ( - LOG_LEVEL = parameter.AddInt("NODE/LOG_LEVEL", LOG_LEVEL_INFO, "controls the log types that are shown") +import ( + "flag" +) - DISABLE_PLUGINS = parameter.AddString("NODE/DISABLE_PLUGINS", "", "a list of plugins that shall be disabled") - ENABLE_PLUGINS = parameter.AddString("NODE/ENABLE_PLUGINS", "", "a list of plugins that shall be enabled") +const ( + CFG_LOG_LEVEL = "node.logLevel" + CFG_DISABLE_PLUGINS = "node.disablePlugins" + CFG_ENABLE_PLGUINS = "node.enablePlugins" ) + +func init() { + flag.Int(CFG_LOG_LEVEL, LOG_LEVEL_INFO, "controls the log types that are shown") + flag.String(CFG_DISABLE_PLUGINS, "", "a list of plugins that shall be disabled") + flag.String(CFG_ENABLE_PLGUINS, "", "a list of plugins that shall be enabled") +} diff --git a/packages/node/plugin.go b/packages/node/plugin.go index bb7efa8494c53492686f30877b9413398f33565f..7a937e9945c95bf1a838bd38c910dbfcbc0c6353 100644 --- a/packages/node/plugin.go +++ b/packages/node/plugin.go @@ -4,8 +4,8 @@ import ( "strings" "sync" - "github.com/iotaledger/goshimmer/packages/events" - "github.com/iotaledger/goshimmer/packages/parameter" + "github.com/iotaledger/hive.go/events" + "github.com/iotaledger/hive.go/parameter" ) const ( diff --git a/packages/parameter/events.go b/packages/parameter/events.go deleted file mode 100644 index b755a038485a09e01eb0c20ddd9ceaa2496dc7ab..0000000000000000000000000000000000000000 --- a/packages/parameter/events.go +++ /dev/null @@ -1,33 +0,0 @@ -package parameter - -import ( - "github.com/iotaledger/goshimmer/packages/events" -) - -var Events = struct { - AddBool *events.Event - AddInt *events.Event - AddString *events.Event - AddPlugin *events.Event -}{ - AddBool: events.NewEvent(boolParameterCaller), - AddInt: events.NewEvent(intParameterCaller), - AddString: events.NewEvent(stringParameterCaller), - AddPlugin: events.NewEvent(pluginParameterCaller), -} - -func boolParameterCaller(handler interface{}, params ...interface{}) { - handler.(func(*BoolParameter))(params[0].(*BoolParameter)) -} - -func intParameterCaller(handler interface{}, params ...interface{}) { - handler.(func(*IntParameter))(params[0].(*IntParameter)) -} - -func stringParameterCaller(handler interface{}, params ...interface{}) { - handler.(func(*StringParameter))(params[0].(*StringParameter)) -} - -func pluginParameterCaller(handler interface{}, params ...interface{}) { - handler.(func(string, int))(params[0].(string), params[1].(int)) -} diff --git a/packages/parameter/parameter.go b/packages/parameter/parameter.go deleted file mode 100644 index 24e9117d815000c2c046b21e6b1e30f248291c9a..0000000000000000000000000000000000000000 --- a/packages/parameter/parameter.go +++ /dev/null @@ -1,104 +0,0 @@ -package parameter - -var boolParameters = make(map[string]*BoolParameter) - -func AddBool(name string, defaultValue bool, description string) *BoolParameter { - if boolParameters[name] != nil { - panic("duplicate parameter - \"" + name + "\" was defined already") - } - - newParameter := &BoolParameter{ - Name: name, - DefaultValue: defaultValue, - Value: &defaultValue, - Description: description, - } - - boolParameters[name] = newParameter - - Events.AddBool.Trigger(newParameter) - - return newParameter -} - -func GetBool(name string) *BoolParameter { - return boolParameters[name] -} - -func GetBools() map[string]*BoolParameter { - return boolParameters -} - -var intParameters = make(map[string]*IntParameter) - -func AddInt(name string, defaultValue int, description string) *IntParameter { - if _, exists := intParameters[name]; exists { - panic("duplicate parameter - \"" + name + "\" was defined already") - } - - newParameter := &IntParameter{ - Name: name, - DefaultValue: defaultValue, - Value: &defaultValue, - Description: description, - } - - intParameters[name] = newParameter - - Events.AddInt.Trigger(newParameter) - - return newParameter -} - -func GetInt(name string) *IntParameter { - return intParameters[name] -} - -func GetInts() map[string]*IntParameter { - return intParameters -} - -var stringParameters = make(map[string]*StringParameter) - -func AddString(name string, defaultValue string, description string) *StringParameter { - if _, exists := stringParameters[name]; exists { - panic("duplicate parameter - \"" + name + "\" was defined already") - } - - newParameter := &StringParameter{ - Name: name, - DefaultValue: defaultValue, - Value: &defaultValue, - Description: description, - } - - stringParameters[name] = newParameter - - Events.AddString.Trigger(newParameter) - - return stringParameters[name] -} - -func GetString(name string) *StringParameter { - return stringParameters[name] -} - -func GetStrings() map[string]*StringParameter { - return stringParameters -} - -var plugins = make(map[string]int) - -func AddPlugin(name string, status int) { - if _, exists := plugins[name]; exists { - panic("duplicate plugin - \"" + name + "\" was defined already") - } - - plugins[name] = status - - Events.AddPlugin.Trigger(name, status) -} - -func GetPlugins() map[string]int { - return plugins -} diff --git a/packages/parameter/types.go b/packages/parameter/types.go deleted file mode 100644 index 92738a34fc066987f729e26033473b0118c6bb14..0000000000000000000000000000000000000000 --- a/packages/parameter/types.go +++ /dev/null @@ -1,26 +0,0 @@ -package parameter - -type BoolParameter struct { - Name string - Value *bool - DefaultValue bool - Description string -} - -type IntParameter struct { - Name string - Value *int - DefaultValue int - Description string -} - -type StringParameter struct { - Name string - Value *string - DefaultValue string - Description string -} - -type IntParameterConsumer = func(param *IntParameter) - -type StringParameterConsumer = func(param *StringParameter) diff --git a/plugins/analysis/client/parameters.go b/plugins/analysis/client/parameters.go index b4eab6ea01d654f530cd672301c2e5b0456ff77b..d66f64749254dac53719b1e7b078c5fbc91390e8 100644 --- a/plugins/analysis/client/parameters.go +++ b/plugins/analysis/client/parameters.go @@ -1,7 +1,13 @@ package client -import "github.com/iotaledger/goshimmer/packages/parameter" +import ( + flag "github.com/spf13/pflag" +) -var ( - SERVER_ADDRESS = parameter.AddString("ANALYSIS/SERVER-ADDRESS", "159.69.158.51:188", "tcp server for collecting analysis information") +const ( + CFG_SERVER_ADDRESS = "analysis.serverAddress" ) + +func init() { + flag.String(CFG_SERVER_ADDRESS, "159.69.158.51:188", "tcp server for collecting analysis information") +} diff --git a/plugins/analysis/client/plugin.go b/plugins/analysis/client/plugin.go index 7bd42836dcc54850451676065c3c5eefa672b63c..fc882b05440dbb589541171911889c1dccc2584a 100644 --- a/plugins/analysis/client/plugin.go +++ b/plugins/analysis/client/plugin.go @@ -1,12 +1,12 @@ package client import ( + "github.com/iotaledger/hive.go/parameter" "net" "time" "github.com/iotaledger/goshimmer/packages/accountability" "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/network" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/packages/timeutil" @@ -18,6 +18,7 @@ import ( "github.com/iotaledger/goshimmer/plugins/autopeering/instances/chosenneighbors" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/knownpeers" "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer" + "github.com/iotaledger/hive.go/events" ) func Run(plugin *node.Plugin) { @@ -30,7 +31,7 @@ func Run(plugin *node.Plugin) { return default: - if conn, err := net.Dial("tcp", *SERVER_ADDRESS.Value); err != nil { + if conn, err := net.Dial("tcp", parameter.NodeConfig.GetString(CFG_SERVER_ADDRESS)); err != nil { plugin.LogDebug("Could not connect to reporting server: " + err.Error()) timeutil.Sleep(1 * time.Second) diff --git a/plugins/analysis/plugin.go b/plugins/analysis/plugin.go index 44268dd0c077025e796cea7df2c859ef74f78061..4756341b99c3e40f4feb5c2dfef496c3be853d06 100644 --- a/plugins/analysis/plugin.go +++ b/plugins/analysis/plugin.go @@ -2,17 +2,18 @@ package analysis import ( "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/analysis/client" "github.com/iotaledger/goshimmer/plugins/analysis/server" "github.com/iotaledger/goshimmer/plugins/analysis/webinterface" + "github.com/iotaledger/hive.go/events" + "github.com/iotaledger/hive.go/parameter" ) var PLUGIN = node.NewPlugin("Analysis", node.Enabled, configure, run) func configure(plugin *node.Plugin) { - if *server.SERVER_PORT.Value != 0 { + if parameter.NodeConfig.GetInt(server.CFG_SERVER_PORT) != 0 { webinterface.Configure(plugin) server.Configure(plugin) @@ -23,14 +24,14 @@ func configure(plugin *node.Plugin) { } func run(plugin *node.Plugin) { - if *server.SERVER_PORT.Value != 0 { + if parameter.NodeConfig.GetInt(server.CFG_SERVER_PORT) != 0 { webinterface.Run(plugin) server.Run(plugin) } else { plugin.Node.LogSuccess("Node", "Starting Plugin: Analysis ... server is disabled (server-port is 0)") } - if *client.SERVER_ADDRESS.Value != "" { + if parameter.NodeConfig.GetString(client.CFG_SERVER_ADDRESS) != "" { client.Run(plugin) } else { plugin.Node.LogSuccess("Node", "Starting Plugin: Analysis ... client is disabled (server-address is empty)") diff --git a/plugins/analysis/server/events.go b/plugins/analysis/server/events.go index e66359ff38a60031c0c12e9e1cf30314704c176d..979dddec563888fc68a2c18a572a8f3f83741d83 100644 --- a/plugins/analysis/server/events.go +++ b/plugins/analysis/server/events.go @@ -1,7 +1,7 @@ package server import ( - "github.com/iotaledger/goshimmer/packages/events" + "github.com/iotaledger/hive.go/events" ) var Events = struct { diff --git a/plugins/analysis/server/parameters.go b/plugins/analysis/server/parameters.go index ccab973ea0242f83b022e3a4bfc82c3ccf1acd37..e27b4a9e2a746de3406cff8645685959deca5dbb 100644 --- a/plugins/analysis/server/parameters.go +++ b/plugins/analysis/server/parameters.go @@ -1,7 +1,13 @@ package server -import "github.com/iotaledger/goshimmer/packages/parameter" +import ( + flag "github.com/spf13/pflag" +) -var ( - SERVER_PORT = parameter.AddInt("ANALYSIS/SERVER-PORT", 0, "tcp port for incoming analysis packets") +const ( + CFG_SERVER_PORT = "analysis.serverPort" ) + +func init() { + flag.Int(CFG_SERVER_PORT, 0, "tcp port for incoming analysis packets") +} diff --git a/plugins/analysis/server/plugin.go b/plugins/analysis/server/plugin.go index cbcbb7259b81acf2e4177bc91fa4a7435b321363..35917d4ef00f2f7c7951240c476ac9fd826c76ab 100644 --- a/plugins/analysis/server/plugin.go +++ b/plugins/analysis/server/plugin.go @@ -2,11 +2,7 @@ package server import ( "encoding/hex" - "math" - "strconv" - "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/network" "github.com/iotaledger/goshimmer/packages/network/tcp" "github.com/iotaledger/goshimmer/packages/node" @@ -15,7 +11,10 @@ import ( "github.com/iotaledger/goshimmer/plugins/analysis/types/disconnectnodes" "github.com/iotaledger/goshimmer/plugins/analysis/types/ping" "github.com/iotaledger/goshimmer/plugins/analysis/types/removenode" + "github.com/iotaledger/hive.go/events" + "github.com/iotaledger/hive.go/parameter" "github.com/pkg/errors" + "math" ) var server *tcp.Server @@ -28,7 +27,7 @@ func Configure(plugin *node.Plugin) { plugin.LogFailure("error in server: " + err.Error()) })) server.Events.Start.Attach(events.NewClosure(func() { - plugin.LogSuccess("Starting Server (port " + strconv.Itoa(*SERVER_PORT.Value) + ") ... done") + plugin.LogSuccess("Starting Server (port " + string(parameter.NodeConfig.GetInt(CFG_SERVER_PORT)) + ") ... done") })) server.Events.Shutdown.Attach(events.NewClosure(func() { plugin.LogSuccess("Stopping Server ... done") @@ -37,9 +36,9 @@ func Configure(plugin *node.Plugin) { func Run(plugin *node.Plugin) { daemon.BackgroundWorker("Analysis Server", func() { - plugin.LogInfo("Starting Server (port " + strconv.Itoa(*SERVER_PORT.Value) + ") ...") + plugin.LogInfo("Starting Server (port " + string(parameter.NodeConfig.GetInt(CFG_SERVER_PORT)) + ") ...") - server.Listen(*SERVER_PORT.Value) + server.Listen(parameter.NodeConfig.GetInt(CFG_SERVER_PORT)) }) } diff --git a/plugins/analysis/webinterface/httpserver/data_stream.go b/plugins/analysis/webinterface/httpserver/data_stream.go index 66f611279705543af71733b10c1aa6a54fcc5ea0..a2d54db771cab43a5c012516942070bf1db3d29e 100644 --- a/plugins/analysis/webinterface/httpserver/data_stream.go +++ b/plugins/analysis/webinterface/httpserver/data_stream.go @@ -3,10 +3,10 @@ package httpserver import ( "fmt" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/plugins/analysis/server" "github.com/iotaledger/goshimmer/plugins/analysis/webinterface/recordedevents" "github.com/iotaledger/goshimmer/plugins/analysis/webinterface/types" + "github.com/iotaledger/hive.go/events" "golang.org/x/net/websocket" ) diff --git a/plugins/analysis/webinterface/httpserver/plugin.go b/plugins/analysis/webinterface/httpserver/plugin.go index a6b62cbb12f33087fbdf7e58b2b2eb2dfacd8833..b88ca23c05149ae926ac8c693b8dfdb50a98a275 100644 --- a/plugins/analysis/webinterface/httpserver/plugin.go +++ b/plugins/analysis/webinterface/httpserver/plugin.go @@ -1,12 +1,12 @@ package httpserver -import ( +import( "net/http" "time" "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" + "github.com/iotaledger/hive.go/events" "golang.org/x/net/context" "golang.org/x/net/websocket" ) diff --git a/plugins/analysis/webinterface/recordedevents/recorded_events.go b/plugins/analysis/webinterface/recordedevents/recorded_events.go index 3110aa6a70614faaf0a066e7f2aa0588d51d7b50..2a85fbc530e01a37d56031f410649b0428a5bb0b 100644 --- a/plugins/analysis/webinterface/recordedevents/recorded_events.go +++ b/plugins/analysis/webinterface/recordedevents/recorded_events.go @@ -3,10 +3,10 @@ package recordedevents import ( "sync" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/analysis/server" "github.com/iotaledger/goshimmer/plugins/analysis/webinterface/types" + "github.com/iotaledger/hive.go/events" ) var nodes = make(map[string]bool) diff --git a/plugins/autopeering/instances/acceptedneighbors/furthest_neighbor.go b/plugins/autopeering/instances/acceptedneighbors/furthest_neighbor.go index 201b4827b10850d3428018df71127a29f4ff9587..b48e7ebf821451e248990b7cc89efe4bc9134010 100644 --- a/plugins/autopeering/instances/acceptedneighbors/furthest_neighbor.go +++ b/plugins/autopeering/instances/acceptedneighbors/furthest_neighbor.go @@ -3,8 +3,8 @@ package acceptedneighbors import ( "sync" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer" + "github.com/iotaledger/hive.go/events" ) var FURTHEST_NEIGHBOR *peer.Peer diff --git a/plugins/autopeering/instances/chosenneighbors/furthest_neighbor.go b/plugins/autopeering/instances/chosenneighbors/furthest_neighbor.go index 5040a89af97296fab70e09033b4af174e36e7508..c62eec99ddf75cbb1ad2469b5a9eb2b4c74d2d59 100644 --- a/plugins/autopeering/instances/chosenneighbors/furthest_neighbor.go +++ b/plugins/autopeering/instances/chosenneighbors/furthest_neighbor.go @@ -3,8 +3,8 @@ package chosenneighbors import ( "sync" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer" + "github.com/iotaledger/hive.go/events" ) var FURTHEST_NEIGHBOR *peer.Peer diff --git a/plugins/autopeering/instances/entrynodes/instance.go b/plugins/autopeering/instances/entrynodes/instance.go index 31e94076f4334b7cbf86be104e7a568f83ef5b17..aae083c61ed56834f0a637593c7d30b207a02ed4 100644 --- a/plugins/autopeering/instances/entrynodes/instance.go +++ b/plugins/autopeering/instances/entrynodes/instance.go @@ -2,13 +2,14 @@ package entrynodes import ( "encoding/hex" + "github.com/iotaledger/goshimmer/plugins/autopeering/parameters" + "github.com/iotaledger/hive.go/parameter" "net" "strconv" "strings" "github.com/iotaledger/goshimmer/packages/identity" "github.com/iotaledger/goshimmer/packages/node" - "github.com/iotaledger/goshimmer/plugins/autopeering/parameters" "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer" "github.com/iotaledger/goshimmer/plugins/autopeering/types/peerlist" ) @@ -22,7 +23,7 @@ func Configure(node *node.Plugin) { func parseEntryNodes() *peerlist.PeerList { result := peerlist.NewPeerList() - for _, entryNodeDefinition := range strings.Fields(*parameters.ENTRY_NODES.Value) { + for _, entryNodeDefinition := range parameter.NodeConfig.GetStringSlice(parameters.CFG_ENTRY_NODES) { if entryNodeDefinition == "" { continue } diff --git a/plugins/autopeering/instances/outgoingrequest/instance.go b/plugins/autopeering/instances/outgoingrequest/instance.go index 6fdf7a79e31f3efc999741703a7483f2384092eb..455e558edb05d2f6c731ef2862d29681f1c6dde8 100644 --- a/plugins/autopeering/instances/outgoingrequest/instance.go +++ b/plugins/autopeering/instances/outgoingrequest/instance.go @@ -1,12 +1,12 @@ package outgoingrequest import ( - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/ownpeer" "github.com/iotaledger/goshimmer/plugins/autopeering/saltmanager" "github.com/iotaledger/goshimmer/plugins/autopeering/types/request" "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt" + "github.com/iotaledger/hive.go/events" ) var INSTANCE *request.Request diff --git a/plugins/autopeering/instances/ownpeer/instance.go b/plugins/autopeering/instances/ownpeer/instance.go index 39f7cc552a80598e4b1b63c520728e261d659ab4..157a5f2da3380547de4abaf3a8b59b8dfc71349f 100644 --- a/plugins/autopeering/instances/ownpeer/instance.go +++ b/plugins/autopeering/instances/ownpeer/instance.go @@ -1,11 +1,12 @@ package ownpeer import ( + "github.com/iotaledger/hive.go/parameter" "net" "github.com/iotaledger/goshimmer/packages/accountability" "github.com/iotaledger/goshimmer/packages/node" - "github.com/iotaledger/goshimmer/plugins/autopeering/parameters" + autopeering_params "github.com/iotaledger/goshimmer/plugins/autopeering/parameters" "github.com/iotaledger/goshimmer/plugins/autopeering/saltmanager" "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer" "github.com/iotaledger/goshimmer/plugins/gossip" @@ -16,9 +17,8 @@ var INSTANCE *peer.Peer func Configure(plugin *node.Plugin) { INSTANCE = &peer.Peer{} INSTANCE.SetIdentity(accountability.OwnId()) - INSTANCE.SetPeeringPort(uint16(*parameters.PORT.Value)) - INSTANCE.SetGossipPort(uint16(*gossip.PORT.Value)) + INSTANCE.SetPeeringPort(uint16(parameter.NodeConfig.GetInt(autopeering_params.CFG_PORT))) + INSTANCE.SetGossipPort(uint16(parameter.NodeConfig.GetInt(gossip.GOSSIP_PORT))) INSTANCE.SetAddress(net.IPv4(0, 0, 0, 0)) INSTANCE.SetSalt(saltmanager.PUBLIC_SALT) - } diff --git a/plugins/autopeering/parameters/parameters.go b/plugins/autopeering/parameters/parameters.go index 8332389119f7dd07ab7aed9065beaf63d9485e5a..12b9b402afb28005b23f0705b27d260abdff284f 100644 --- a/plugins/autopeering/parameters/parameters.go +++ b/plugins/autopeering/parameters/parameters.go @@ -1,11 +1,21 @@ package parameters -import "github.com/iotaledger/goshimmer/packages/parameter" +import ( + "flag" +) -var ( - ADDRESS = parameter.AddString("AUTOPEERING/ADDRESS", "0.0.0.0", "address to bind for incoming peering requests") - ENTRY_NODES = parameter.AddString("AUTOPEERING/ENTRY_NODES", "7f7a876a4236091257e650da8dcf195fbe3cb625@159.69.158.51:14626", "list of trusted entry nodes for auto peering") - PORT = parameter.AddInt("AUTOPEERING/PORT", 14626, "tcp port for incoming peering requests") - ACCEPT_REQUESTS = parameter.AddBool("AUTOPEERING/ACCEPT_REQUESTS", true, "accept incoming autopeering requests") - SEND_REQUESTS = parameter.AddBool("AUTOPEERING/SEND_REQUESTS", true, "send autopeering requests") +const ( + CFG_ADDRESS = "autopeering.address" + CFG_ENTRY_NODES = "autopeering.entryNodes" + CFG_PORT = "autopeering.port" + CFG_ACCEPT_REQUESTS = "autopeering.acceptRequests" + CFG_SEND_REQUESTS = "autopeering.sendRequests" ) + +func init() { + flag.String(CFG_ADDRESS, "0.0.0.0", "address to bind for incoming peering requests") + flag.String(CFG_ENTRY_NODES, "7f7a876a4236091257e650da8dcf195fbe3cb625@159.69.158.51:14626", "list of trusted entry nodes for auto peering") + flag.Int(CFG_PORT, 14626, "tcp port for incoming peering requests") + flag.Bool(CFG_ACCEPT_REQUESTS, true, "accept incoming autopeering requests") + flag.Bool(CFG_SEND_REQUESTS, true, "send autopeering requests") +} diff --git a/plugins/autopeering/peerstorage/peerstorage.go b/plugins/autopeering/peerstorage/peerstorage.go index 5f205decee17a81633b3e89696e2542a5f74a0c3..b65f21ffb944b839cbbb12038aa0e7b16e219453 100644 --- a/plugins/autopeering/peerstorage/peerstorage.go +++ b/plugins/autopeering/peerstorage/peerstorage.go @@ -6,10 +6,10 @@ import ( "sync" "github.com/iotaledger/goshimmer/packages/database" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/knownpeers" "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer" + "github.com/iotaledger/hive.go/events" ) const peerDbName string = "peers" diff --git a/plugins/autopeering/plugin.go b/plugins/autopeering/plugin.go index 430e3a7a2583cdbbd536c4ba4c6c895bc7894637..04c6a41470d8359c9b97a8909cf7c0c859365530 100644 --- a/plugins/autopeering/plugin.go +++ b/plugins/autopeering/plugin.go @@ -2,7 +2,6 @@ package autopeering import ( "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/autopeering/instances" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/acceptedneighbors" @@ -14,6 +13,7 @@ import ( "github.com/iotaledger/goshimmer/plugins/autopeering/server" "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer" "github.com/iotaledger/goshimmer/plugins/gossip" + "github.com/iotaledger/hive.go/events" ) var PLUGIN = node.NewPlugin("Auto Peering", node.Enabled, configure, run) diff --git a/plugins/autopeering/protocol/error_handler.go b/plugins/autopeering/protocol/error_handler.go index a97e5bf76216a731cb82d8e03a5c707aef732558..d64eddc3ed5fe572846d50c048adc514a876536b 100644 --- a/plugins/autopeering/protocol/error_handler.go +++ b/plugins/autopeering/protocol/error_handler.go @@ -3,8 +3,8 @@ package protocol import ( "net" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" + "github.com/iotaledger/hive.go/events" ) func createErrorHandler(plugin *node.Plugin) *events.Closure { diff --git a/plugins/autopeering/protocol/incoming_drop_processor.go b/plugins/autopeering/protocol/incoming_drop_processor.go index 60909e0a81113e828a1d8e6281d52fcff3192fef..808b5c2eb12eda7e6d334e3b44b442ad0b1bde7f 100644 --- a/plugins/autopeering/protocol/incoming_drop_processor.go +++ b/plugins/autopeering/protocol/incoming_drop_processor.go @@ -1,11 +1,11 @@ package protocol import ( - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/acceptedneighbors" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/chosenneighbors" "github.com/iotaledger/goshimmer/plugins/autopeering/types/drop" + "github.com/iotaledger/hive.go/events" ) func createIncomingDropProcessor(plugin *node.Plugin) *events.Closure { diff --git a/plugins/autopeering/protocol/incoming_ping_processor.go b/plugins/autopeering/protocol/incoming_ping_processor.go index 39124bfa6d3f44207b69f10caba02b2ef26023ee..035abaab51eedb961aecf4232243292c3dc24e42 100644 --- a/plugins/autopeering/protocol/incoming_ping_processor.go +++ b/plugins/autopeering/protocol/incoming_ping_processor.go @@ -1,10 +1,10 @@ package protocol import ( - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/knownpeers" "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping" + "github.com/iotaledger/hive.go/events" ) func createIncomingPingProcessor(plugin *node.Plugin) *events.Closure { diff --git a/plugins/autopeering/protocol/incoming_request_processor.go b/plugins/autopeering/protocol/incoming_request_processor.go index dcad375195ec4b8c051fdc1162a2bd88af554dfe..66493c080fa58b94bed22b0a9ba4d438fbd66c04 100644 --- a/plugins/autopeering/protocol/incoming_request_processor.go +++ b/plugins/autopeering/protocol/incoming_request_processor.go @@ -1,11 +1,11 @@ package protocol import ( + "github.com/iotaledger/hive.go/parameter" "math/rand" "github.com/iotaledger/goshimmer/plugins/autopeering/parameters" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/acceptedneighbors" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/knownpeers" @@ -14,6 +14,7 @@ import ( "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer" "github.com/iotaledger/goshimmer/plugins/autopeering/types/peerlist" "github.com/iotaledger/goshimmer/plugins/autopeering/types/request" + "github.com/iotaledger/hive.go/events" ) func createIncomingRequestProcessor(plugin *node.Plugin) *events.Closure { @@ -27,7 +28,7 @@ func processIncomingRequest(plugin *node.Plugin, req *request.Request) { knownpeers.INSTANCE.AddOrUpdate(req.Issuer) - if *parameters.ACCEPT_REQUESTS.Value && requestShouldBeAccepted(req) { + if parameter.NodeConfig.GetBool(parameters.CFG_ACCEPT_REQUESTS) && requestShouldBeAccepted(req) { defer acceptedneighbors.INSTANCE.Lock()() if requestShouldBeAccepted(req) { diff --git a/plugins/autopeering/protocol/incoming_response_processor.go b/plugins/autopeering/protocol/incoming_response_processor.go index 56324d540b170de4ec47b577daab6390c20f063d..e2f45f96572e1e36aeb01abab5848351f91ba4e0 100644 --- a/plugins/autopeering/protocol/incoming_response_processor.go +++ b/plugins/autopeering/protocol/incoming_response_processor.go @@ -1,11 +1,11 @@ package protocol import ( - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/chosenneighbors" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/knownpeers" "github.com/iotaledger/goshimmer/plugins/autopeering/types/response" + "github.com/iotaledger/hive.go/events" ) func createIncomingResponseProcessor(plugin *node.Plugin) *events.Closure { diff --git a/plugins/autopeering/protocol/outgoing_ping_processor.go b/plugins/autopeering/protocol/outgoing_ping_processor.go index 2ac0d02dcdc8b9b664ed280c0ffc9ab9c9b93c88..aacc3eddd4deccdb79173270e955878e589e13f2 100644 --- a/plugins/autopeering/protocol/outgoing_ping_processor.go +++ b/plugins/autopeering/protocol/outgoing_ping_processor.go @@ -6,7 +6,6 @@ import ( "github.com/iotaledger/goshimmer/packages/accountability" "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/neighborhood" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/ownpeer" @@ -16,6 +15,7 @@ import ( "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer" "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping" "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt" + "github.com/iotaledger/hive.go/events" ) var lastPing time.Time diff --git a/plugins/autopeering/protocol/plugin.go b/plugins/autopeering/protocol/plugin.go index a72f522d80d04700762b44948f23b60043bdf4ed..569871e4c632c05e1f4968a07181d5ac05ff336c 100644 --- a/plugins/autopeering/protocol/plugin.go +++ b/plugins/autopeering/protocol/plugin.go @@ -6,6 +6,7 @@ import ( "github.com/iotaledger/goshimmer/plugins/autopeering/parameters" "github.com/iotaledger/goshimmer/plugins/autopeering/server/tcp" "github.com/iotaledger/goshimmer/plugins/autopeering/server/udp" + "github.com/iotaledger/hive.go/parameter" ) func Configure(plugin *node.Plugin) { @@ -24,7 +25,7 @@ func Run(plugin *node.Plugin) { daemon.BackgroundWorker("Autopeering Chosen Neighbor Dropper", createChosenNeighborDropper(plugin)) daemon.BackgroundWorker("Autopeering Accepted Neighbor Dropper", createAcceptedNeighborDropper(plugin)) - if *parameters.SEND_REQUESTS.Value { + if parameter.NodeConfig.GetBool(parameters.CFG_SEND_REQUESTS) { daemon.BackgroundWorker("Autopeering Outgoing Request Processor", createOutgoingRequestProcessor(plugin)) } diff --git a/plugins/autopeering/saltmanager/events.go b/plugins/autopeering/saltmanager/events.go index 26f207e7385adc9a280bb1aacd297f6c66075b34..5de771af08b5608afd47cefadc03c1a93e7a9c36 100644 --- a/plugins/autopeering/saltmanager/events.go +++ b/plugins/autopeering/saltmanager/events.go @@ -1,8 +1,8 @@ package saltmanager import ( - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt" + "github.com/iotaledger/hive.go/events" ) var Events = struct { diff --git a/plugins/autopeering/server/tcp/events.go b/plugins/autopeering/server/tcp/events.go index 2b9110fa4089961cc4956f0347adeb86cd060b83..3555257be9e200b55420baeb7fd9f1078ef07e59 100644 --- a/plugins/autopeering/server/tcp/events.go +++ b/plugins/autopeering/server/tcp/events.go @@ -3,10 +3,10 @@ package tcp import ( "net" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping" "github.com/iotaledger/goshimmer/plugins/autopeering/types/request" "github.com/iotaledger/goshimmer/plugins/autopeering/types/response" + "github.com/iotaledger/hive.go/events" ) var Events = struct { diff --git a/plugins/autopeering/server/tcp/server.go b/plugins/autopeering/server/tcp/server.go index 71d965b8dc867f17ebb3596f2bd97073faa61059..5b9c2812484f6eb6387946b21348d7f1210b30cf 100644 --- a/plugins/autopeering/server/tcp/server.go +++ b/plugins/autopeering/server/tcp/server.go @@ -1,12 +1,7 @@ package tcp import ( - "math" - "net" - "strconv" - "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/network" "github.com/iotaledger/goshimmer/packages/network/tcp" "github.com/iotaledger/goshimmer/packages/node" @@ -14,21 +9,29 @@ import ( "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping" "github.com/iotaledger/goshimmer/plugins/autopeering/types/request" "github.com/iotaledger/goshimmer/plugins/autopeering/types/response" + "github.com/iotaledger/hive.go/events" + "github.com/iotaledger/hive.go/parameter" "github.com/pkg/errors" + "math" + "net" ) var server = tcp.NewServer() func ConfigureServer(plugin *node.Plugin) { + serverAddress := parameter.NodeConfig.GetString(parameters.CFG_ADDRESS) + serverPortStr := parameter.NodeConfig.GetString(parameters.CFG_PORT) + server.Events.Connect.Attach(events.NewClosure(HandleConnection)) server.Events.Error.Attach(events.NewClosure(func(err error) { plugin.LogFailure("error in tcp server: " + err.Error()) })) + server.Events.Start.Attach(events.NewClosure(func() { - if *parameters.ADDRESS.Value == "0.0.0.0" { - plugin.LogSuccess("Starting TCP Server (port " + strconv.Itoa(*parameters.PORT.Value) + ") ... done") + if serverAddress == "0.0.0.0" { + plugin.LogSuccess("Starting TCP Server (port " + serverPortStr + ") ... done") } else { - plugin.LogSuccess("Starting TCP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.PORT.Value) + ") ... done") + plugin.LogSuccess("Starting TCP Server (" + serverAddress + ":" + serverPortStr + ") ... done") } })) server.Events.Shutdown.Attach(events.NewClosure(func() { @@ -37,14 +40,17 @@ func ConfigureServer(plugin *node.Plugin) { } func RunServer(plugin *node.Plugin) { + serverAddress := parameter.NodeConfig.GetString(parameters.CFG_ADDRESS) + serverPortStr := parameter.NodeConfig.GetString(parameters.CFG_PORT) + daemon.BackgroundWorker("Autopeering TCP Server", func() { - if *parameters.ADDRESS.Value == "0.0.0.0" { - plugin.LogInfo("Starting TCP Server (port " + strconv.Itoa(*parameters.PORT.Value) + ") ...") + if serverAddress == "0.0.0.0" { + plugin.LogInfo("Starting TCP Server (port " + serverPortStr + ") ...") } else { - plugin.LogInfo("Starting TCP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.PORT.Value) + ") ...") + plugin.LogInfo("Starting TCP Server (" + serverAddress + ":" + serverPortStr + ") ...") } - server.Listen(*parameters.PORT.Value) + server.Listen(parameter.NodeConfig.GetInt(parameters.CFG_PORT)) }) } diff --git a/plugins/autopeering/server/udp/events.go b/plugins/autopeering/server/udp/events.go index 6db7f3fc961c6a13d5260744a5383f77451d31e8..b7ca2e330108ad22f6e7f99316e89e7d3016b0a0 100644 --- a/plugins/autopeering/server/udp/events.go +++ b/plugins/autopeering/server/udp/events.go @@ -3,11 +3,11 @@ package udp import ( "net" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/plugins/autopeering/types/drop" "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping" "github.com/iotaledger/goshimmer/plugins/autopeering/types/request" "github.com/iotaledger/goshimmer/plugins/autopeering/types/response" + "github.com/iotaledger/hive.go/events" ) var Events = struct { diff --git a/plugins/autopeering/server/udp/server.go b/plugins/autopeering/server/udp/server.go index d79928e17d92c3beee451a7640983deb2978054f..4af9f312699cf1a16285599dc8aedd151f023a81 100644 --- a/plugins/autopeering/server/udp/server.go +++ b/plugins/autopeering/server/udp/server.go @@ -1,12 +1,7 @@ package udp import ( - "math" - "net" - "strconv" - "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/network/udp" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/autopeering/parameters" @@ -14,12 +9,19 @@ import ( "github.com/iotaledger/goshimmer/plugins/autopeering/types/ping" "github.com/iotaledger/goshimmer/plugins/autopeering/types/request" "github.com/iotaledger/goshimmer/plugins/autopeering/types/response" + "github.com/iotaledger/hive.go/events" + "github.com/iotaledger/hive.go/parameter" "github.com/pkg/errors" + "math" + "net" ) var udpServer = udp.NewServer(int(math.Max(float64(request.MARSHALED_TOTAL_SIZE), float64(response.MARSHALED_TOTAL_SIZE)))) func ConfigureServer(plugin *node.Plugin) { + serverAddress := parameter.NodeConfig.GetString(parameters.CFG_ADDRESS) + serverPortStr := parameter.NodeConfig.GetString(parameters.CFG_PORT) + Events.Error.Attach(events.NewClosure(func(ip net.IP, err error) { plugin.LogFailure(err.Error()) })) @@ -29,10 +31,10 @@ func ConfigureServer(plugin *node.Plugin) { plugin.LogFailure("error in udp server: " + err.Error()) })) udpServer.Events.Start.Attach(events.NewClosure(func() { - if *parameters.ADDRESS.Value == "0.0.0.0" { - plugin.LogSuccess("Starting UDP Server (port " + strconv.Itoa(*parameters.PORT.Value) + ") ... done") + if serverAddress == "0.0.0.0" { + plugin.LogSuccess("Starting UDP Server (port " + serverPortStr + ") ... done") } else { - plugin.LogSuccess("Starting UDP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.PORT.Value) + ") ... done") + plugin.LogSuccess("Starting UDP Server (" + serverAddress + ":" + serverPortStr + ") ... done") } })) udpServer.Events.Shutdown.Attach(events.NewClosure(func() { @@ -41,14 +43,17 @@ func ConfigureServer(plugin *node.Plugin) { } func RunServer(plugin *node.Plugin) { + serverAddress := parameter.NodeConfig.GetString(parameters.CFG_ADDRESS) + serverPortStr := parameter.NodeConfig.GetString(parameters.CFG_PORT) + daemon.BackgroundWorker("Autopeering UDP Server", func() { - if *parameters.ADDRESS.Value == "0.0.0.0" { - plugin.LogInfo("Starting UDP Server (port " + strconv.Itoa(*parameters.PORT.Value) + ") ...") + if serverAddress == "0.0.0.0" { + plugin.LogInfo("Starting UDP Server (port " + serverPortStr + ") ...") } else { - plugin.LogInfo("Starting UDP Server (" + *parameters.ADDRESS.Value + ":" + strconv.Itoa(*parameters.PORT.Value) + ") ...") + plugin.LogInfo("Starting UDP Server (" + serverAddress + ":" + serverPortStr + ") ...") } - udpServer.Listen(*parameters.ADDRESS.Value, *parameters.PORT.Value) + udpServer.Listen(serverAddress, parameter.NodeConfig.GetInt(parameters.CFG_PORT)) }) } diff --git a/plugins/autopeering/types/peer/peer.go b/plugins/autopeering/types/peer/peer.go index eba117c743c5c2944c510259d678dd8c83611a2b..1e3f51a868e9d3e59b627a9c6d0107316a4fb185 100644 --- a/plugins/autopeering/types/peer/peer.go +++ b/plugins/autopeering/types/peer/peer.go @@ -7,11 +7,11 @@ import ( "sync" "time" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/identity" "github.com/iotaledger/goshimmer/packages/network" "github.com/iotaledger/goshimmer/plugins/autopeering/protocol/types" "github.com/iotaledger/goshimmer/plugins/autopeering/types/salt" + "github.com/iotaledger/hive.go/events" "github.com/pkg/errors" ) diff --git a/plugins/autopeering/types/peerregister/events.go b/plugins/autopeering/types/peerregister/events.go index ee3479673755c479c745f281e74514ffd718ae52..4f59169b93228198cb0b5a742acbb7fa3711113d 100644 --- a/plugins/autopeering/types/peerregister/events.go +++ b/plugins/autopeering/types/peerregister/events.go @@ -1,8 +1,8 @@ package peerregister import ( - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer" + "github.com/iotaledger/hive.go/events" ) type peerRegisterEvents struct { diff --git a/plugins/autopeering/types/peerregister/peer_register.go b/plugins/autopeering/types/peerregister/peer_register.go index d6dd79d6015d46ac9c912b5fce792aad8b9f6fbc..6cd104ccfcd10f9cceb167e9b265f41d80dd6024 100644 --- a/plugins/autopeering/types/peerregister/peer_register.go +++ b/plugins/autopeering/types/peerregister/peer_register.go @@ -5,9 +5,9 @@ import ( "sync" "github.com/iotaledger/goshimmer/packages/accountability" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/plugins/autopeering/types/peer" "github.com/iotaledger/goshimmer/plugins/autopeering/types/request" + "github.com/iotaledger/hive.go/events" ) type PeerRegister struct { diff --git a/plugins/bundleprocessor/bundleprocessor_test.go b/plugins/bundleprocessor/bundleprocessor_test.go index 14834c67c2b0ed49ef7b418cee8309c5f7e21afd..0b4c77e757265e27cda2a084a556952a63188b70 100644 --- a/plugins/bundleprocessor/bundleprocessor_test.go +++ b/plugins/bundleprocessor/bundleprocessor_test.go @@ -4,9 +4,9 @@ import ( "sync" "testing" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/bundle" "github.com/iotaledger/goshimmer/packages/model/value_transaction" + "github.com/iotaledger/hive.go/events" "github.com/iotaledger/goshimmer/plugins/tipselection" @@ -63,7 +63,7 @@ func TestValidateSignatures(t *testing.T) { func TestProcessSolidBundleHead_Data(t *testing.T) { // show all error messages for tests - *node.LOG_LEVEL.Value = node.LOG_LEVEL_FAILURE + // TODO: adjust logger package // start a test node node.Start(tangle.PLUGIN, PLUGIN) @@ -104,7 +104,7 @@ func TestProcessSolidBundleHead_Data(t *testing.T) { func TestProcessSolidBundleHead_Value(t *testing.T) { // show all error messages for tests - *node.LOG_LEVEL.Value = node.LOG_LEVEL_FAILURE + // TODO: adjust logger package // start a test node node.Start(tangle.PLUGIN, PLUGIN) diff --git a/plugins/bundleprocessor/events.go b/plugins/bundleprocessor/events.go index 6deb5fbb853361d764101be74f94f15ae0abdaab..7fcfb2d3e742a081312bc8d6d5afd9c41d2fc4f9 100644 --- a/plugins/bundleprocessor/events.go +++ b/plugins/bundleprocessor/events.go @@ -2,9 +2,9 @@ package bundleprocessor import ( "github.com/iotaledger/goshimmer/packages/errors" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/bundle" "github.com/iotaledger/goshimmer/packages/model/value_transaction" + "github.com/iotaledger/hive.go/events" ) var Events = pluginEvents{ diff --git a/plugins/bundleprocessor/plugin.go b/plugins/bundleprocessor/plugin.go index db1e1c28cfac3fd8d13041466e6081c6b9e8ed8f..f9b01433513f88efd0ac3b11fb19c2a3d372db2f 100644 --- a/plugins/bundleprocessor/plugin.go +++ b/plugins/bundleprocessor/plugin.go @@ -3,10 +3,10 @@ package bundleprocessor import ( "github.com/iotaledger/goshimmer/packages/daemon" "github.com/iotaledger/goshimmer/packages/errors" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/value_transaction" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/tangle" + "github.com/iotaledger/hive.go/events" ) var PLUGIN = node.NewPlugin("Bundle Processor", node.Enabled, configure, run) diff --git a/plugins/cli/cli.go b/plugins/cli/cli.go index 73aa4f190443766000142900e852467c354d20a6..0051c1a1d8b8bdcac9eebfa4f22bf2808dbd6aaa 100644 --- a/plugins/cli/cli.go +++ b/plugins/cli/cli.go @@ -3,6 +3,7 @@ package cli import ( "flag" "fmt" + "github.com/iotaledger/hive.go/parameter" "os" "path/filepath" "sort" @@ -11,18 +12,6 @@ import ( "github.com/iotaledger/goshimmer/packages/node" ) -func AddBoolParameter(p *bool, name string, usage string) { - flag.BoolVar(p, name, *p, usage) -} - -func AddIntParameter(p *int, name string, usage string) { - flag.IntVar(p, name, *p, usage) -} - -func AddStringParameter(p *string, name string, usage string) { - flag.StringVar(p, name, *p, usage) -} - var enabledPlugins []string var disabledPlugins []string @@ -53,6 +42,6 @@ func printUsage() { ) flag.PrintDefaults() - fmt.Fprintf(os.Stderr, "\nThe following plugins are enabled by default and can be disabled with -%s:\n %s\n", getFlagName(node.DISABLE_PLUGINS.Name), getList(enabledPlugins)) - fmt.Fprintf(os.Stderr, "The following plugins are disabled by default and can be enabled with -%s:\n %s\n\n", getFlagName(node.ENABLE_PLUGINS.Name), getList(disabledPlugins)) + fmt.Fprintf(os.Stderr, "\nThe following plugins are enabled: %s\n", getList(parameter.NodeConfig.GetStringSlice(node.CFG_ENABLE_PLGUINS))) + fmt.Fprintf(os.Stderr, "\nThe following plugins are disabled: %s\n", getList(parameter.NodeConfig.GetStringSlice(node.CFG_DISABLE_PLUGINS))) } diff --git a/plugins/cli/plugin.go b/plugins/cli/plugin.go index ae97189d4520992e2d66e16eda5569afc1533042..bd77e2d5f450e4913ec7a3ea33760ed147b2f1d2 100644 --- a/plugins/cli/plugin.go +++ b/plugins/cli/plugin.go @@ -3,82 +3,62 @@ package cli import ( "flag" "fmt" + "github.com/iotaledger/hive.go/events" "strings" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" - "github.com/iotaledger/goshimmer/packages/parameter" + "github.com/iotaledger/hive.go/parameter" ) -func getFlagName(paramName string) string { - return strings.Replace(strings.Replace(strings.ToLower(paramName), "/", "-", 1), "_", "-", -1) -} - -func onAddBoolParameter(param *parameter.BoolParameter) { - AddBoolParameter(param.Value, getFlagName(param.Name), param.Description) -} - -func onAddIntParameter(param *parameter.IntParameter) { - AddIntParameter(param.Value, getFlagName(param.Name), param.Description) -} +const ( + // AppVersion version number + AppVersion = "v0.0.1" + // AppName app code name + AppName = "GoShimmer" +) -func onAddStringParameter(param *parameter.StringParameter) { - AddStringParameter(param.Value, getFlagName(param.Name), param.Description) -} +var PLUGIN = node.NewPlugin("CLI", node.Enabled, configure, run) func onAddPlugin(name string, status int) { AddPluginStatus(node.GetPluginIdentifier(name), status) } func init() { - for _, param := range parameter.GetBools() { - onAddBoolParameter(param) - } - for _, param := range parameter.GetInts() { - onAddIntParameter(param) - } - for _, param := range parameter.GetStrings() { - onAddStringParameter(param) - } + for name, status := range parameter.GetPlugins() { onAddPlugin(name, status) } - parameter.Events.AddBool.Attach(events.NewClosure(onAddBoolParameter)) - parameter.Events.AddInt.Attach(events.NewClosure(onAddIntParameter)) - parameter.Events.AddString.Attach(events.NewClosure(onAddStringParameter)) parameter.Events.AddPlugin.Attach(events.NewClosure(onAddPlugin)) flag.Usage = printUsage } func parseParameters() { - for _, pluginName := range strings.Fields(*node.DISABLE_PLUGINS.Value) { + for _, pluginName := range parameter.NodeConfig.GetStringSlice(node.CFG_DISABLE_PLUGINS) { node.DisabledPlugins[strings.ToLower(pluginName)] = true } - for _, pluginName := range strings.Fields(*node.ENABLE_PLUGINS.Value) { + for _, pluginName := range parameter.NodeConfig.GetStringSlice(node.CFG_ENABLE_PLGUINS) { node.EnabledPlugins[strings.ToLower(pluginName)] = true } } func configure(ctx *node.Plugin) { - flag.Parse() - - parseParameters() fmt.Println(" _____ _ _ ________ ______ ___ ___________ ") fmt.Println(" / ___| | | |_ _| \\/ || \\/ || ___| ___ \\") fmt.Println(" \\ `--.| |_| | | | | . . || . . || |__ | |_/ /") fmt.Println(" `--. \\ _ | | | | |\\/| || |\\/| || __|| / ") fmt.Println(" /\\__/ / | | |_| |_| | | || | | || |___| |\\ \\ ") - fmt.Println(" \\____/\\_| |_/\\___/\\_| |_/\\_| |_/\\____/\\_| \\_| fullnode 0.0.1") + fmt.Printf(" \\____/\\_| |_/\\___/\\_| |_/\\_| |_/\\____/\\_| \\_| fullnode %s", AppVersion) fmt.Println() + parameter.FetchConfig() + parseParameters() + ctx.Node.LogInfo("Node", "Loading plugins ...") } func run(ctx *node.Plugin) { // do nothing; everything is handled in the configure step } - -var PLUGIN = node.NewPlugin("CLI", node.Enabled, configure, run) diff --git a/plugins/dashboard/plugin.go b/plugins/dashboard/plugin.go index a292f80a9b21463a33e9afa21cecb68f7ef10ee6..5b38ebed5716cdc56ba25dfbcb25e509d386775a 100644 --- a/plugins/dashboard/plugin.go +++ b/plugins/dashboard/plugin.go @@ -7,9 +7,9 @@ import ( "golang.org/x/net/context" "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/metrics" + "github.com/iotaledger/hive.go/events" ) var server *http.Server diff --git a/plugins/dashboard/tps.go b/plugins/dashboard/tps.go index a35d4721c4ba3b484566d51906b7880dfbb827b9..5c779bb1c9dc5466bbad501bb6b0fd9b5a9f8e9b 100644 --- a/plugins/dashboard/tps.go +++ b/plugins/dashboard/tps.go @@ -6,18 +6,18 @@ import ( "html/template" "math" "net/http" - "sync" "strconv" + "sync" "time" "github.com/gorilla/websocket" "github.com/iotaledger/goshimmer/packages/accountability" - "github.com/iotaledger/goshimmer/packages/events" - "github.com/iotaledger/goshimmer/plugins/metrics" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/acceptedneighbors" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/chosenneighbors" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/knownpeers" "github.com/iotaledger/goshimmer/plugins/autopeering/instances/neighborhood" + "github.com/iotaledger/goshimmer/plugins/metrics" + "github.com/iotaledger/hive.go/events" ) var ( diff --git a/plugins/gossip-on-solidification/plugin.go b/plugins/gossip-on-solidification/plugin.go index bd040b9cae5b56a314cef22ab7c144b0c28d291a..22c0f1067b874d1f308076755c3f664fbedee487 100644 --- a/plugins/gossip-on-solidification/plugin.go +++ b/plugins/gossip-on-solidification/plugin.go @@ -1,11 +1,11 @@ package gossip_on_solidification import ( - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/value_transaction" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/gossip" "github.com/iotaledger/goshimmer/plugins/tangle" + "github.com/iotaledger/hive.go/events" ) var PLUGIN = node.NewPlugin("Gossip On Solidification", node.Enabled, func(plugin *node.Plugin) { diff --git a/plugins/gossip/events.go b/plugins/gossip/events.go index 6d3183820d2f8c5986751e13e20896c3cc3f1e8b..4bcb484a1bcdcfc158222e798e5e00fd3ed85223 100644 --- a/plugins/gossip/events.go +++ b/plugins/gossip/events.go @@ -2,10 +2,10 @@ package gossip import ( "github.com/iotaledger/goshimmer/packages/errors" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/identity" "github.com/iotaledger/goshimmer/packages/model/meta_transaction" "github.com/iotaledger/goshimmer/packages/network" + "github.com/iotaledger/hive.go/events" ) var Events = pluginEvents{ diff --git a/plugins/gossip/neighbors.go b/plugins/gossip/neighbors.go index 4e73bf27c129adbb6473662595d110c2973ff975..51c40c7ae67a266d599e584cce7e0578d8660d06 100644 --- a/plugins/gossip/neighbors.go +++ b/plugins/gossip/neighbors.go @@ -1,6 +1,6 @@ package gossip -import ( +import( "math" "net" "strconv" @@ -10,10 +10,10 @@ import ( "github.com/iotaledger/goshimmer/packages/accountability" "github.com/iotaledger/goshimmer/packages/daemon" "github.com/iotaledger/goshimmer/packages/errors" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/identity" "github.com/iotaledger/goshimmer/packages/network" "github.com/iotaledger/goshimmer/packages/node" + "github.com/iotaledger/hive.go/events" ) func configureNeighbors(plugin *node.Plugin) { diff --git a/plugins/gossip/parameters.go b/plugins/gossip/parameters.go index 88ac73da6e57374a06159df00e14984f2770c8ef..aa96e7cbd674429c80c2af2c923a975651950bdc 100644 --- a/plugins/gossip/parameters.go +++ b/plugins/gossip/parameters.go @@ -1,7 +1,13 @@ package gossip -import "github.com/iotaledger/goshimmer/packages/parameter" +import ( + flag "github.com/spf13/pflag" +) -var ( - PORT = parameter.AddInt("GOSSIP/PORT", 14666, "tcp port for gossip connection") +const ( + GOSSIP_PORT = "gossip.port" ) + +func init() { + flag.Int(GOSSIP_PORT, 14666, "tcp port for gossip connection") +} diff --git a/plugins/gossip/protocol.go b/plugins/gossip/protocol.go index f51d11b718911beeb6bec9a7bae22247d9bc715b..54c891714b80d4a7b8eb050bcfe6fb65c8c69438 100644 --- a/plugins/gossip/protocol.go +++ b/plugins/gossip/protocol.go @@ -5,8 +5,8 @@ import ( "sync" "github.com/iotaledger/goshimmer/packages/errors" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/network" + "github.com/iotaledger/hive.go/events" ) // region constants and variables ////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/gossip/protocol_v1.go b/plugins/gossip/protocol_v1.go index 196bc2c63e8c9e083c4ef6040c37e3163b740c58..ccd022a3b6f4b90778e3f761829b1cf4694bb1cd 100644 --- a/plugins/gossip/protocol_v1.go +++ b/plugins/gossip/protocol_v1.go @@ -7,9 +7,9 @@ import ( "github.com/iotaledger/goshimmer/packages/accountability" "github.com/iotaledger/goshimmer/packages/byteutils" "github.com/iotaledger/goshimmer/packages/errors" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/identity" "github.com/iotaledger/goshimmer/packages/model/meta_transaction" + "github.com/iotaledger/hive.go/events" "github.com/iotaledger/iota.go/consts" ) diff --git a/plugins/gossip/send_queue.go b/plugins/gossip/send_queue.go index 7edc3dd2e62de70649a6d363baf309991b682ec1..7b92be4ab051ae72c427fc86615632824972f0ba 100644 --- a/plugins/gossip/send_queue.go +++ b/plugins/gossip/send_queue.go @@ -4,9 +4,9 @@ import ( "sync" "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/meta_transaction" "github.com/iotaledger/goshimmer/packages/node" + "github.com/iotaledger/hive.go/events" ) // region plugin module setup ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/gossip/server.go b/plugins/gossip/server.go index 7dc7cd67c7212b501546664bafb3b588ba4bb116..5577d446d4cfe9b8735d60c51be4c098800f7973 100644 --- a/plugins/gossip/server.go +++ b/plugins/gossip/server.go @@ -1,16 +1,15 @@ package gossip import ( - "strconv" - "github.com/iotaledger/goshimmer/packages/accountability" "github.com/iotaledger/goshimmer/packages/daemon" "github.com/iotaledger/goshimmer/packages/errors" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/identity" "github.com/iotaledger/goshimmer/packages/network" "github.com/iotaledger/goshimmer/packages/network/tcp" "github.com/iotaledger/goshimmer/packages/node" + "github.com/iotaledger/hive.go/events" + "github.com/iotaledger/hive.go/parameter" ) var TCPServer = tcp.NewServer() @@ -65,12 +64,13 @@ func configureServer(plugin *node.Plugin) { } func runServer(plugin *node.Plugin) { - plugin.LogInfo("Starting TCP Server (port " + strconv.Itoa(*PORT.Value) + ") ...") + gossipPort := parameter.NodeConfig.GetString(GOSSIP_PORT) + plugin.LogInfo("Starting TCP Server (port " + gossipPort + ") ...") daemon.BackgroundWorker("Gossip TCP Server", func() { - plugin.LogSuccess("Starting TCP Server (port " + strconv.Itoa(*PORT.Value) + ") ... done") + plugin.LogSuccess("Starting TCP Server (port " + gossipPort + ") ... done") - TCPServer.Listen(*PORT.Value) + TCPServer.Listen(parameter.NodeConfig.GetInt(GOSSIP_PORT)) plugin.LogSuccess("Stopping TCP Server ... done") }) diff --git a/plugins/metrics/events.go b/plugins/metrics/events.go index 18189674612c6c09e396d3d539f79621a9a95645..df87ebadc2218c6aaec6b7c1a45cda2b30979923 100644 --- a/plugins/metrics/events.go +++ b/plugins/metrics/events.go @@ -1,7 +1,7 @@ package metrics -import ( - "github.com/iotaledger/goshimmer/packages/events" +import( + "github.com/iotaledger/hive.go/events" ) var Events = pluginEvents{ diff --git a/plugins/metrics/plugin.go b/plugins/metrics/plugin.go index 290b548fee32bb014b3bcd80e8b03a7f03f8ef7c..6d8aa2fdf45916230a0b562bdaccd8c14259f286 100644 --- a/plugins/metrics/plugin.go +++ b/plugins/metrics/plugin.go @@ -1,14 +1,14 @@ package metrics -import ( +import( "time" "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/meta_transaction" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/packages/timeutil" "github.com/iotaledger/goshimmer/plugins/gossip" + "github.com/iotaledger/hive.go/events" ) var PLUGIN = node.NewPlugin("Metrics", node.Enabled, configure, run) diff --git a/plugins/statusscreen-tps/plugin.go b/plugins/statusscreen-tps/plugin.go index e91121a15859989755e4e35667e166d3acc498ef..1b81a29ec44b96d567b7b08e496c09516d08a292 100644 --- a/plugins/statusscreen-tps/plugin.go +++ b/plugins/statusscreen-tps/plugin.go @@ -6,13 +6,13 @@ import ( "time" "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/meta_transaction" "github.com/iotaledger/goshimmer/packages/model/value_transaction" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/gossip" "github.com/iotaledger/goshimmer/plugins/statusscreen" "github.com/iotaledger/goshimmer/plugins/tangle" + "github.com/iotaledger/hive.go/events" ) var receivedTpsCounter uint64 diff --git a/plugins/statusscreen/statusscreen.go b/plugins/statusscreen/statusscreen.go index 7f13dc4ad4c0e3c9e216465f19a87aa786a9b91d..f76e097e13b79aa848c08d12799dd5a29f3ec83f 100644 --- a/plugins/statusscreen/statusscreen.go +++ b/plugins/statusscreen/statusscreen.go @@ -7,8 +7,8 @@ import ( "github.com/gdamore/tcell" "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" + "github.com/iotaledger/hive.go/events" "github.com/rivo/tview" "golang.org/x/crypto/ssh/terminal" ) diff --git a/plugins/tangle/events.go b/plugins/tangle/events.go index e29ecd20c31dc13dbf3638cf5e880ae328411d37..3cc90ba43176512d4db1aa835bb180b921d35844 100644 --- a/plugins/tangle/events.go +++ b/plugins/tangle/events.go @@ -1,8 +1,8 @@ package tangle import ( - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/value_transaction" + "github.com/iotaledger/hive.go/events" ) var Events = pluginEvents{ diff --git a/plugins/tangle/solidifier.go b/plugins/tangle/solidifier.go index e0408a957a40a2b346f4796a56ed7a07a1c55924..2a0dca5839c117f24d8b481e0dc7c8f8467131b7 100644 --- a/plugins/tangle/solidifier.go +++ b/plugins/tangle/solidifier.go @@ -5,7 +5,6 @@ import ( "github.com/iotaledger/goshimmer/packages/daemon" "github.com/iotaledger/goshimmer/packages/errors" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/approvers" "github.com/iotaledger/goshimmer/packages/model/meta_transaction" "github.com/iotaledger/goshimmer/packages/model/transactionmetadata" @@ -13,6 +12,7 @@ import ( "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/packages/workerpool" "github.com/iotaledger/goshimmer/plugins/gossip" + "github.com/iotaledger/hive.go/events" "github.com/iotaledger/iota.go/trinary" ) diff --git a/plugins/tangle/solidifier_test.go b/plugins/tangle/solidifier_test.go index 9db5e7c89e5b91659264d7907ac02acdd6cdc435..3658bf52b708806eb3c392bbb4416ede8e451cd1 100644 --- a/plugins/tangle/solidifier_test.go +++ b/plugins/tangle/solidifier_test.go @@ -4,16 +4,16 @@ import ( "sync" "testing" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/value_transaction" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/gossip" + "github.com/iotaledger/hive.go/events" "github.com/iotaledger/iota.go/trinary" ) func TestSolidifier(t *testing.T) { // show all error messages for tests - *node.LOG_LEVEL.Value = node.LOG_LEVEL_DEBUG + // TODO: adjust logger package // start a test node node.Start(PLUGIN) diff --git a/plugins/tipselection/plugin.go b/plugins/tipselection/plugin.go index 745c1dad4c8e2ecb8178fd2fc84c405a22357989..a2c7ba175a7b3b1860f6d799a561db1e5ae50b81 100644 --- a/plugins/tipselection/plugin.go +++ b/plugins/tipselection/plugin.go @@ -1,10 +1,10 @@ package tipselection import ( - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/value_transaction" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/tangle" + "github.com/iotaledger/hive.go/events" ) var PLUGIN = node.NewPlugin("Tipselection", node.Enabled, configure, run) diff --git a/plugins/ui/ui.go b/plugins/ui/ui.go index 17d0c3d03e2132beb434c19fbdf2682b87dafedb..6ca34f3d3c9289479029e721ba7ab6094647c63d 100644 --- a/plugins/ui/ui.go +++ b/plugins/ui/ui.go @@ -7,13 +7,13 @@ import ( "time" "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/meta_transaction" "github.com/iotaledger/goshimmer/packages/model/value_transaction" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/gossip" "github.com/iotaledger/goshimmer/plugins/tangle" "github.com/iotaledger/goshimmer/plugins/webapi" + "github.com/iotaledger/hive.go/events" "github.com/labstack/echo" ) diff --git a/plugins/validator/plugin.go b/plugins/validator/plugin.go index f5785b9869d3c26d0d097c4a6ede8f5142858622..70f5241bf442b645140f9072fefbed2e5674458f 100644 --- a/plugins/validator/plugin.go +++ b/plugins/validator/plugin.go @@ -1,11 +1,11 @@ package validator import ( - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/bundle" "github.com/iotaledger/goshimmer/packages/model/value_transaction" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/bundleprocessor" + "github.com/iotaledger/hive.go/events" "github.com/iotaledger/iota.go/kerl" "github.com/iotaledger/iota.go/signing" . "github.com/iotaledger/iota.go/trinary" diff --git a/plugins/webapi/plugin.go b/plugins/webapi/plugin.go index f9de1de526423c6871d8ad02a3be310f485ecee6..9bce5f6eef6a31500c6b5d98a798c920d87c1211 100644 --- a/plugins/webapi/plugin.go +++ b/plugins/webapi/plugin.go @@ -5,8 +5,8 @@ import ( "time" "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/node" + "github.com/iotaledger/hive.go/events" "github.com/labstack/echo" ) diff --git a/plugins/zeromq/parameters.go b/plugins/zeromq/parameters.go index a74b4be24d4113a317d11dbc6efc15e60c711a93..22850260fd58ad3172cff246569ab93ec9306000 100644 --- a/plugins/zeromq/parameters.go +++ b/plugins/zeromq/parameters.go @@ -1,7 +1,13 @@ package zeromq -import "github.com/iotaledger/goshimmer/packages/parameter" +import ( + flag "github.com/spf13/pflag" +) -var ( - PORT = parameter.AddInt("ZEROMQ/PORT", 5556, "tcp port used to connect to the zmq feed") +const ( + ZEROMQ_PORT = "zeromq.port" ) + +func init() { + flag.Int(ZEROMQ_PORT, 5556, "tcp port used to connect to the zmq feed") +} diff --git a/plugins/zeromq/plugin.go b/plugins/zeromq/plugin.go index a94a0ce9311853756f8be07b07ac7b221eec9215..ce8ad4c0b85b57726bce11ef9cf431541e9100e4 100644 --- a/plugins/zeromq/plugin.go +++ b/plugins/zeromq/plugin.go @@ -1,15 +1,16 @@ package zeromq import ( + "github.com/iotaledger/hive.go/parameter" "strconv" "strings" "time" "github.com/iotaledger/goshimmer/packages/daemon" - "github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/model/value_transaction" "github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/plugins/tangle" + "github.com/iotaledger/hive.go/events" ) // zeromq logging is disabled by default @@ -43,14 +44,14 @@ func configure(plugin *node.Plugin) { // Start the zeromq plugin func run(plugin *node.Plugin) { - - plugin.LogInfo("Starting ZeroMQ Publisher (port " + strconv.Itoa(*PORT.Value) + ") ...") + zeromqPort := parameter.NodeConfig.GetString(ZEROMQ_PORT) + plugin.LogInfo("Starting ZeroMQ Publisher (port " + zeromqPort + ") ...") daemon.BackgroundWorker("ZeroMQ Publisher", func() { if err := startPublisher(plugin); err != nil { plugin.LogFailure("Stopping ZeroMQ Publisher: " + err.Error()) } else { - plugin.LogSuccess("Starting ZeroMQ Publisher (port " + strconv.Itoa(*PORT.Value) + ") ... done") + plugin.LogSuccess("Starting ZeroMQ Publisher (port " + zeromqPort + ") ... done") } }) } @@ -63,7 +64,7 @@ func startPublisher(plugin *node.Plugin) error { } publisher = pub - return publisher.Start(*PORT.Value) + return publisher.Start(parameter.NodeConfig.GetInt(ZEROMQ_PORT)) } // Publish a transaction that has recently been added to the ledger