(w http.ResponseWriter, r *http.Request)
| 34 | } |
| 35 | |
| 36 | func (d *DosNode) status(w http.ResponseWriter, r *http.Request) { |
| 37 | isPendingNode, err := d.chain.IsPendingNode(d.id) |
| 38 | if err != nil { |
| 39 | html := "err : " + err.Error() + "\n|" |
| 40 | w.Write([]byte(html)) |
| 41 | return |
| 42 | } |
| 43 | html := "=================================================" + "\n|" |
| 44 | html = html + "Version : " + d.config.VERSION + "\n|" |
| 45 | html = html + "StartTime : " + d.startTime.Format("2006-01-02T15:04:05.999999-07:00") + "\n|" |
| 46 | html = html + "Address : " + fmt.Sprintf("%x", d.p.GetID()) + "\n|" |
| 47 | html = html + "IP : " + fmt.Sprintf("%s", d.p.GetIP()) + "\n|" |
| 48 | html = html + "NumOfMembers : " + strconv.Itoa(d.p.NumOfMembers()) + "\n|" |
| 49 | html = html + "State : " + d.state + "\n|" |
| 50 | html = html + "IsPendingNode : " + strconv.FormatBool(isPendingNode) + "\n|" |
| 51 | html = html + "TotalQuery : " + strconv.Itoa(d.totalQuery) + "\n|" |
| 52 | html = html + "FulfilledQuery : " + strconv.Itoa(d.fulfilledQuery) + "\n|" |
| 53 | html = html + "Group Number : " + strconv.Itoa(d.numOfworkingGroup) + "\n|" |
| 54 | html = html + "=================================================" + "\n|" |
| 55 | // result := d.dkg.GetGroupNumber() |
| 56 | balance, err := d.chain.Balance() |
| 57 | if err != nil { |
| 58 | html = html + "Balance : " + err.Error() + "\n|" |
| 59 | } else { |
| 60 | html = html + "Balance : " + balance.String() + "\n|" |
| 61 | } |
| 62 | workingGroupNum, err := d.chain.GetWorkingGroupSize() |
| 63 | if err != nil { |
| 64 | html = html + "WorkingGroupSize : " + err.Error() + "\n|" |
| 65 | } else { |
| 66 | html = html + "WorkingGroupSize : " + strconv.FormatUint(workingGroupNum, 10) + "\n|" |
| 67 | } |
| 68 | expiredGroupNum, err := d.chain.GetExpiredWorkingGroupSize() |
| 69 | if err != nil { |
| 70 | html = html + "ExpiredGroupSize : " + err.Error() + "\n|" |
| 71 | } else { |
| 72 | html = html + "ExpiredGroupSize : " + strconv.FormatUint(expiredGroupNum, 10) + "\n|" |
| 73 | } |
| 74 | pendingGroupNum, err := d.chain.NumPendingGroups() |
| 75 | if err != nil { |
| 76 | html = html + "PendingGroupSize : " + err.Error() + "\n|" |
| 77 | } else { |
| 78 | html = html + "PendingGroupSize : " + strconv.FormatUint(pendingGroupNum, 10) + "\n|" |
| 79 | } |
| 80 | pendingNodeNum, err := d.chain.NumPendingNodes() |
| 81 | if err != nil { |
| 82 | html = html + "PendingNodeSize : " + err.Error() + "\n|" |
| 83 | } else { |
| 84 | html = html + "PendingNodeSize : " + strconv.FormatUint(pendingNodeNum, 10) + "\n|" |
| 85 | } |
| 86 | |
| 87 | curBlk, err := d.chain.CurrentBlock() |
| 88 | if err != nil { |
| 89 | html = html + "CurrentBlock : " + err.Error() + "\n" |
| 90 | } else { |
| 91 | html = html + "CurrentBlock : " + strconv.FormatUint(curBlk, 10) + "\n" |
| 92 | } |
| 93 | html = html + "=================================================" + "\n" |
nothing calls this directly
no test coverage detected