Skip to content
Snippets Groups Projects
Select Git revision
  • ee2f6ae33368ff935416e11f972f8a37ecb7a3f1
  • main default protected
  • tags/misc
  • tags/version-0.5r2
  • tags/version-0.6
  • tags/version-0.4
  • tags/version-0.5r1
  • tags/libxaal_v01
  • tags/generic-feedback-renderer_complexAPI
  • tags/testing-libsodium
  • tags/testing-nettle
  • tags/testing_ajax
  • tags/testing_clearsilver
  • tags/testing_jansson
  • tags/testing_jsmn
  • tags/testing_json-c
16 results

agent.h

Blame
  • 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"
    // 	]