Browse Source

raw output: add custom fields

This will include all configured custom fields in the raw output
under the "custom_fields" key.
keep-around/5eb75ff9bbaddad7f7e1cb91c2f9624f569c1ff0
nrbffs 1 year ago
committed by genofire
parent
commit
9a70560cfb
1 changed files with 14 additions and 12 deletions
  1. + 14
    - 12
      output/raw/raw.go

+ 14
- 12
output/raw/raw.go

@ -8,12 +8,13 @@ import (
// Node struct
type RawNode struct {
Firstseen jsontime.Time `json:"firstseen"`
Lastseen jsontime.Time `json:"lastseen"`
Online bool `json:"online"`
Statistics *data.Statistics `json:"statistics"`
Nodeinfo *data.Nodeinfo `json:"nodeinfo"`
Neighbours *data.Neighbours `json:"neighbours"`
Firstseen jsontime.Time `json:"firstseen"`
Lastseen jsontime.Time `json:"lastseen"`
Online bool `json:"online"`
Statistics *data.Statistics `json:"statistics"`
Nodeinfo *data.Nodeinfo `json:"nodeinfo"`
Neighbours *data.Neighbours `json:"neighbours"`
CustomFields map[string]interface{} `json:"custom_fields"`
}
type NodeList struct {
@ -31,12 +32,13 @@ func transform(nodes *runtime.Nodes) *NodeList {
for _, nodeOrigin := range nodes.List {
if nodeOrigin != nil {
node := &RawNode{
Firstseen: nodeOrigin.Firstseen,
Lastseen: nodeOrigin.Lastseen,
Online: nodeOrigin.Online,
Statistics: nodeOrigin.Statistics,
Nodeinfo: nodeOrigin.Nodeinfo,
Neighbours: nodeOrigin.Neighbours,
Firstseen: nodeOrigin.Firstseen,
Lastseen: nodeOrigin.Lastseen,
Online: nodeOrigin.Online,
Statistics: nodeOrigin.Statistics,
Nodeinfo: nodeOrigin.Nodeinfo,
Neighbours: nodeOrigin.Neighbours,
CustomFields: nodeOrigin.CustomFields,
}
nodelist.List = append(nodelist.List, node)
}

Loading…
Cancel
Save