diff --git a/main.go b/main.go index bf91966f1f9ad06f9bd1a968f9fbe86441515b1c..352f263f0efdff36b848fecf26034b4e9ef08336 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "github.com/iotaledger/goshimmer/plugins/analysis" "github.com/iotaledger/goshimmer/plugins/autopeering" + "github.com/iotaledger/goshimmer/plugins/banner" "github.com/iotaledger/goshimmer/plugins/cli" "github.com/iotaledger/goshimmer/plugins/config" "github.com/iotaledger/goshimmer/plugins/gossip" @@ -27,6 +28,7 @@ func main() { node.Run( node.Plugins( + banner.PLUGIN, config.PLUGIN, logger.PLUGIN, cli.PLUGIN, diff --git a/plugins/autopeering/autopeering.go b/plugins/autopeering/autopeering.go index c02b8bf87d18bd47a48d0555e073a99b0b340eed..390bc68e920560d01169642cb8ba11e932c6a295 100644 --- a/plugins/autopeering/autopeering.go +++ b/plugins/autopeering/autopeering.go @@ -18,7 +18,7 @@ import ( "github.com/iotaledger/goshimmer/packages/netutil" "github.com/iotaledger/goshimmer/plugins/autopeering/local" - "github.com/iotaledger/goshimmer/plugins/cli" + "github.com/iotaledger/goshimmer/plugins/banner" "github.com/iotaledger/goshimmer/plugins/config" "github.com/iotaledger/goshimmer/plugins/gossip" ) @@ -172,6 +172,6 @@ func checkConnection(localAddr *net.UDPAddr, self *peer.Peer) { if err != nil { log.Errorf("Error testing service: %s", err) log.Panicf("Please check that %s is publicly reachable at %s/%s", - cli.AppName, peering.String(), peering.Network()) + banner.AppName, peering.String(), peering.Network()) } } diff --git a/plugins/banner/plugin.go b/plugins/banner/plugin.go new file mode 100644 index 0000000000000000000000000000000000000000..3d06962807e50c8662c86f9b8545927ad0afabcb --- /dev/null +++ b/plugins/banner/plugin.go @@ -0,0 +1,35 @@ +package banner + +import ( + "fmt" + + "github.com/iotaledger/hive.go/node" +) + +var PLUGIN = node.NewPlugin("Banner", node.Enabled, configure, run) + +const ( + // AppVersion version number + AppVersion = "v0.1.1" + + // AppName app code name + AppName = "GoShimmer" +) + +func configure(ctx *node.Plugin) { + fmt.Printf(` + _____ ____ _____ _ _ _____ __ __ __ __ ______ _____ + / ____|/ __ \ / ____| | | |_ _| \/ | \/ | ____| __ \ + | | __| | | | (___ | |__| | | | | \ / | \ / | |__ | |__) | + | | |_ | | | |\___ \| __ | | | | |\/| | |\/| | __| | _ / + | |__| | |__| |____) | | | |_| |_| | | | | | | |____| | \ \ + \_____|\____/|_____/|_| |_|_____|_| |_|_| |_|______|_| \_\ + %s +`, AppVersion) + fmt.Println() + + ctx.Node.Logger.Infof("GoShimmer version %s ...", AppVersion) + ctx.Node.Logger.Info("Loading plugins ...") +} + +func run(ctx *node.Plugin) {} diff --git a/plugins/cli/plugin.go b/plugins/cli/plugin.go index 47b250aeac45d31e0098d6fda4d3993d6552f091..e85619d676771d63d9f16ccae3c581709d4795dd 100644 --- a/plugins/cli/plugin.go +++ b/plugins/cli/plugin.go @@ -1,21 +1,12 @@ package cli import ( - "fmt" - "github.com/iotaledger/hive.go/events" "github.com/iotaledger/hive.go/node" flag "github.com/spf13/pflag" ) -const ( - // AppVersion version number - AppVersion = "v0.1.1" - // AppName app code name - AppName = "GoShimmer" -) - -var PLUGIN = node.NewPlugin("CLI", node.Enabled, configure, run) +var PLUGIN = node.NewPlugin("CLI", node.Enabled, run) func onAddPlugin(name string, status int) { AddPluginStatus(node.GetPluginIdentifier(name), status) @@ -31,22 +22,6 @@ func init() { flag.Usage = printUsage } -func configure(ctx *node.Plugin) { - fmt.Printf(` - _____ ____ _____ _ _ _____ __ __ __ __ ______ _____ - / ____|/ __ \ / ____| | | |_ _| \/ | \/ | ____| __ \ - | | __| | | | (___ | |__| | | | | \ / | \ / | |__ | |__) | - | | |_ | | | |\___ \| __ | | | | |\/| | |\/| | __| | _ / - | |__| | |__| |____) | | | |_| |_| | | | | | | |____| | \ \ - \_____|\____/|_____/|_| |_|_____|_| |_|_| |_|______|_| \_\ - %s -`, AppVersion) - fmt.Println() - - ctx.Node.Logger.Infof("GoShimmer version %s ...", AppVersion) - ctx.Node.Logger.Info("Loading plugins ...") -} - func run(ctx *node.Plugin) { - // do nothing; everything is handled in the configure step + // do nothing; everything is handled in the init method } diff --git a/plugins/gossip/gossip.go b/plugins/gossip/gossip.go index 3697608d0a732f7cd097834c08879ed9423a10e0..ab00f21d466b33ad1a4ec023cd34433054f6e90f 100644 --- a/plugins/gossip/gossip.go +++ b/plugins/gossip/gossip.go @@ -14,7 +14,7 @@ import ( gp "github.com/iotaledger/goshimmer/packages/gossip" "github.com/iotaledger/goshimmer/packages/gossip/server" "github.com/iotaledger/goshimmer/plugins/autopeering/local" - "github.com/iotaledger/goshimmer/plugins/cli" + "github.com/iotaledger/goshimmer/plugins/banner" "github.com/iotaledger/goshimmer/plugins/config" "github.com/iotaledger/goshimmer/plugins/tangle" ) @@ -99,7 +99,7 @@ func checkConnection(srv *server.TCP, self *peer.Peer) { log.Errorf("Error testing: %s", err) addr := self.Services().Get(service.GossipKey) log.Panicf("Please check that %s is publicly reachable at %s/%s", - cli.AppName, addr.String(), addr.Network()) + banner.AppName, addr.String(), addr.Network()) } _ = conn.Close() wg.Wait()