Skip to content
Snippets Groups Projects
Commit 2111bb9c authored by Hans Moog's avatar Hans Moog
Browse files

Feat: added a banner module for the cli interface

parent 4702cc22
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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())
}
}
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) {}
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
}
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment