Select Git revision
tipselection.go
plugin.go 2.96 KiB
package info
import (
"net/http"
"sort"
goSync "sync"
"gitlab.imt-atlantique.fr/i18colle/goshimmer_without_tipselection/plugins/autopeering/local"
"gitlab.imt-atlantique.fr/i18colle/goshimmer_without_tipselection/plugins/banner"
"gitlab.imt-atlantique.fr/i18colle/goshimmer_without_tipselection/plugins/sync"
"gitlab.imt-atlantique.fr/i18colle/goshimmer_without_tipselection/plugins/webapi"
"github.com/iotaledger/hive.go/node"
"github.com/labstack/echo"
)
// PluginName is the name of the web API info endpoint plugin.
const PluginName = "WebAPI info Endpoint"
var (
// plugin is the plugin instance of the web API info endpoint plugin.
plugin *node.Plugin
once goSync.Once
)
// Plugin gets the plugin instance.
func Plugin() *node.Plugin {
once.Do(func() {
plugin = node.NewPlugin(PluginName, node.Enabled, configure)
})
return plugin
}
func configure(_ *node.Plugin) {
webapi.Server().GET("info", getInfo)
}
// getInfo returns the info of the node
// e.g.,
// {
// "version":"v0.2.0",
// "synchronized": true,
// "identityID":"5bf4aa1d6c47e4ce",
// "publickey":"CjUsn86jpFHWnSCx3NhWfU4Lk16mDdy1Hr7ERSTv3xn9",
// "enabledplugins":[
// "Config",
// "Autopeering",
// "Analysis",
// "WebAPI data Endpoint",
// "WebAPI dRNG Endpoint",
// "MessageLayer",
// "CLI",
// "Database",
// "DRNG",
// "WebAPI autopeering Endpoint",
// "Metrics",
// "PortCheck",
// "Dashboard",
// "WebAPI",
// "WebAPI info Endpoint",
// "WebAPI message Endpoint",
// "Banner",
// "Gossip",
// "Graceful Shutdown",
// "Logger"
// ],
// "disabledplugins":[
// "RemoteLog",
// "Spammer",
// "WebAPI Auth"
// ]