From 54f395b7640c61ac343d941b4b566f98f87eb440 Mon Sep 17 00:00:00 2001 From: insanity Date: Tue, 18 Sep 2018 18:57:09 +0900 Subject: [PATCH] ping json mapping --- net/ping/ping.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/net/ping/ping.go b/net/ping/ping.go index 9ef3b67..a595060 100644 --- a/net/ping/ping.go +++ b/net/ping/ping.go @@ -77,12 +77,12 @@ func (r *PingResponse) GetError() string { } type PingSummary struct { - SendCount int - ReceiveCount int - LossPercent float32 - MinTime float32 - MaxTime float32 - AvgTime float32 + SendCount int `json:"sendCount,omitempty"` + ReceiveCount int `json:"receiveCount,omitempty"` + LossPercent float32 `json:"lossPercent,omitempty"` + MinTime float32 `json:"minTime,omitempty"` + MaxTime float32 `json:"maxTime,omitempty"` + AvgTime float32 `json:"avgTime,omitempty"` } func (s *PingSummary) GetSendCount() int { @@ -105,8 +105,8 @@ func (s *PingSummary) GetAvgTime() float32 { } type PingResult struct { - Responses map[int]Response - Summary Summary + Responses map[int]Response `json:"responses,omitempty"` + Summary Summary `json:"summary,omitempty"` } func (r *PingResult) GetResponses() map[int]Response {