Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Goshimmer_without_tipselection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
COLLET Ismael
Goshimmer_without_tipselection
Commits
d2b9e0f3
Commit
d2b9e0f3
authored
5 years ago
by
capossele
Browse files
Options
Downloads
Patches
Plain Diff
Updating code due to code review changes.
parent
b10fa6d8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
client/info.go
+2
-4
2 additions, 4 deletions
client/info.go
pluginmgr/webapi/plugins.go
+1
-1
1 addition, 1 deletion
pluginmgr/webapi/plugins.go
plugins/webapi/info/plugin.go
+9
-9
9 additions, 9 deletions
plugins/webapi/info/plugin.go
with
12 additions
and
14 deletions
client/info.go
+
2
−
4
View file @
d2b9e0f3
...
@@ -11,11 +11,9 @@ const (
...
@@ -11,11 +11,9 @@ const (
)
)
// Info gets the info of the node.
// Info gets the info of the node.
func
(
api
*
GoShimmerAPI
)
Info
(
knownPeers
bool
)
(
*
webapi_info
.
Response
,
error
)
{
func
(
api
*
GoShimmerAPI
)
Info
()
(
*
webapi_info
.
Response
,
error
)
{
res
:=
&
webapi_info
.
Response
{}
res
:=
&
webapi_info
.
Response
{}
if
err
:=
api
.
do
(
http
.
MethodGet
,
func
()
string
{
if
err
:=
api
.
do
(
http
.
MethodGet
,
routeInfo
,
nil
,
res
);
err
!=
nil
{
return
routeInfo
}(),
nil
,
res
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
res
,
nil
return
res
,
nil
...
...
This diff is collapsed.
Click to expand it.
pluginmgr/webapi/plugins.go
+
1
−
1
View file @
d2b9e0f3
...
@@ -20,5 +20,5 @@ var PLUGINS = node.Plugins(
...
@@ -20,5 +20,5 @@ var PLUGINS = node.Plugins(
drng
.
PLUGIN
,
drng
.
PLUGIN
,
message
.
PLUGIN
,
message
.
PLUGIN
,
autopeering
.
PLUGIN
,
autopeering
.
PLUGIN
,
info
.
P
LUGIN
,
info
.
P
lugin
,
)
)
This diff is collapsed.
Click to expand it.
plugins/webapi/info/plugin.go
+
9
−
9
View file @
d2b9e0f3
...
@@ -8,10 +8,10 @@ import (
...
@@ -8,10 +8,10 @@ import (
"github.com/iotaledger/goshimmer/plugins/webapi"
"github.com/iotaledger/goshimmer/plugins/webapi"
"github.com/iotaledger/hive.go/node"
"github.com/iotaledger/hive.go/node"
"github.com/labstack/echo"
"github.com/labstack/echo"
"github.com/mr-tron/base58"
)
)
var
PLUGIN
=
node
.
NewPlugin
(
"WebAPI info Endpoint"
,
node
.
Enabled
,
configure
)
// Plugin exports the plugin
var
Plugin
=
node
.
NewPlugin
(
"WebAPI info Endpoint"
,
node
.
Enabled
,
configure
)
func
configure
(
plugin
*
node
.
Plugin
)
{
func
configure
(
plugin
*
node
.
Plugin
)
{
webapi
.
Server
.
GET
(
"info"
,
getInfo
)
webapi
.
Server
.
GET
(
"info"
,
getInfo
)
...
@@ -21,7 +21,7 @@ func configure(plugin *node.Plugin) {
...
@@ -21,7 +21,7 @@ func configure(plugin *node.Plugin) {
// e.g.,
// e.g.,
// {
// {
// "version":"v0.2.0",
// "version":"v0.2.0",
// "identity":"
7BxV1v3nFHefn4J88jeZebqnJRvSHt1jC7ME6tmKLhy7
",
// "identity
ID
":"
5bf4aa1d6c47e4ce
",
// "publickey":"CjUsn86jpFHWnSCx3NhWfU4Lk16mDdy1Hr7ERSTv3xn9",
// "publickey":"CjUsn86jpFHWnSCx3NhWfU4Lk16mDdy1Hr7ERSTv3xn9",
// "enabledplugins":[
// "enabledplugins":[
// "Config",
// "Config",
...
@@ -53,8 +53,8 @@ func configure(plugin *node.Plugin) {
...
@@ -53,8 +53,8 @@ func configure(plugin *node.Plugin) {
// ]
// ]
// }
// }
func
getInfo
(
c
echo
.
Context
)
error
{
func
getInfo
(
c
echo
.
Context
)
error
{
enabledPlugins
:=
[]
string
{}
var
enabledPlugins
[]
string
disabledPlugins
:=
[]
string
{}
var
disabledPlugins
[]
string
for
plugin
,
status
:=
range
node
.
GetPlugins
()
{
for
plugin
,
status
:=
range
node
.
GetPlugins
()
{
switch
status
{
switch
status
{
case
node
.
Disabled
:
case
node
.
Disabled
:
...
@@ -68,8 +68,8 @@ func getInfo(c echo.Context) error {
...
@@ -68,8 +68,8 @@ func getInfo(c echo.Context) error {
return
c
.
JSON
(
http
.
StatusOK
,
Response
{
return
c
.
JSON
(
http
.
StatusOK
,
Response
{
Version
:
banner
.
AppVersion
,
Version
:
banner
.
AppVersion
,
Identity
:
base58
.
Encode
(
local
.
GetInstance
()
.
Identity
.
ID
()
.
Bytes
()
),
Identity
ID
:
local
.
GetInstance
()
.
Identity
.
ID
()
.
String
(
),
PublicKey
:
base58
.
Encode
(
local
.
GetInstance
()
.
PublicKey
()
.
Bytes
()
),
PublicKey
:
local
.
GetInstance
()
.
PublicKey
()
.
String
(
),
EnabledPlugins
:
enabledPlugins
,
EnabledPlugins
:
enabledPlugins
,
DisabledPlugins
:
disabledPlugins
,
DisabledPlugins
:
disabledPlugins
,
})
})
...
@@ -79,8 +79,8 @@ func getInfo(c echo.Context) error {
...
@@ -79,8 +79,8 @@ func getInfo(c echo.Context) error {
type
Response
struct
{
type
Response
struct
{
// version of GoShimmer
// version of GoShimmer
Version
string
`json:"version,omitempty"`
Version
string
`json:"version,omitempty"`
// identity of the node encoded in
base58
// identity
ID
of the node encoded in
hex and truncated to its first 8 bytes
Identity
string
`json:"identity,omitempty"`
Identity
ID
string
`json:"identity
ID
,omitempty"`
// public key of the node encoded in base58
// public key of the node encoded in base58
PublicKey
string
`json:"publickey,omitempty"`
PublicKey
string
`json:"publickey,omitempty"`
// list of enabled plugins
// list of enabled plugins
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment