p2p/simulations: add node properties support and utility functions (#20060)
This commit is contained in:
@ -101,6 +101,11 @@ type NodeConfig struct {
|
||||
// services registered by calling the RegisterService function)
|
||||
Services []string
|
||||
|
||||
// Properties are the names of the properties this node should hold
|
||||
// within running services (e.g. "bootnode", "lightnode" or any custom values)
|
||||
// These values need to be checked and acted upon by node Services
|
||||
Properties []string
|
||||
|
||||
// Enode
|
||||
node *enode.Node
|
||||
|
||||
@ -120,6 +125,7 @@ type nodeConfigJSON struct {
|
||||
PrivateKey string `json:"private_key"`
|
||||
Name string `json:"name"`
|
||||
Services []string `json:"services"`
|
||||
Properties []string `json:"properties"`
|
||||
EnableMsgEvents bool `json:"enable_msg_events"`
|
||||
Port uint16 `json:"port"`
|
||||
}
|
||||
@ -131,6 +137,7 @@ func (n *NodeConfig) MarshalJSON() ([]byte, error) {
|
||||
ID: n.ID.String(),
|
||||
Name: n.Name,
|
||||
Services: n.Services,
|
||||
Properties: n.Properties,
|
||||
Port: n.Port,
|
||||
EnableMsgEvents: n.EnableMsgEvents,
|
||||
}
|
||||
@ -168,6 +175,7 @@ func (n *NodeConfig) UnmarshalJSON(data []byte) error {
|
||||
|
||||
n.Name = confJSON.Name
|
||||
n.Services = confJSON.Services
|
||||
n.Properties = confJSON.Properties
|
||||
n.Port = confJSON.Port
|
||||
n.EnableMsgEvents = confJSON.EnableMsgEvents
|
||||
|
||||
|
Reference in New Issue
Block a user