(file string)
| 61 | } |
| 62 | |
| 63 | func (nodes NodeSet) WriteNodesJSON(file string) { |
| 64 | nodesJSON, err := json.MarshalIndent(nodes, "", jsonIndent) |
| 65 | if err != nil { |
| 66 | panic(err) |
| 67 | } |
| 68 | if file == "-" { |
| 69 | os.Stdout.Write(nodesJSON) |
| 70 | return |
| 71 | } |
| 72 | if err := os.WriteFile(file, nodesJSON, 0644); err != nil { |
| 73 | panic(err) |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | // Nodes returns the node records contained in the set. |
| 78 | func (ns NodeSet) Nodes() []*enode.Node { |