GetLocalNodeID gets current node ID in hash string format.
()
| 101 | |
| 102 | // GetLocalNodeID gets current node ID in hash string format. |
| 103 | func GetLocalNodeID() (rawNodeID proto.NodeID, err error) { |
| 104 | var rawNodeIDBytes []byte |
| 105 | if rawNodeIDBytes, err = GetLocalNodeIDBytes(); err != nil { |
| 106 | return |
| 107 | } |
| 108 | var h *hash.Hash |
| 109 | if h, err = hash.NewHash(rawNodeIDBytes); err != nil { |
| 110 | return |
| 111 | } |
| 112 | rawNodeID = proto.NodeID(h.String()) |
| 113 | |
| 114 | return |
| 115 | } |
| 116 | |
| 117 | // GetLocalNodeIDBytes get current node ID copy in []byte. |
| 118 | func GetLocalNodeIDBytes() (rawNodeID []byte, err error) { |