Skip to content

Commit

Permalink
Merge pull request #3 from grafana/expose-ptr-lookup
Browse files Browse the repository at this point in the history
expose ptr lookup function externally
  • Loading branch information
rdubrock authored Nov 3, 2021
2 parents 89d6b88 + 89b054a commit 0a45564
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pkg/hop/hop.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (h *HopStatistic) Render(ptrLookup bool) {
l := fmt.Sprintf("%d", h.RingBufferSize)
gm.Printf("%3d:|-- %-20s %5.1f%% %4d %6.1f %6.1f %6.1f %6.1f %"+l+"s\n",
h.TTL,
fmt.Sprintf("%.20s", h.lookupAddr(ptrLookup, 0)),
fmt.Sprintf("%.20s", h.LookupAddr(ptrLookup, 0)),
h.Loss(),
h.Sent,
h.Last.Elapsed.Seconds()*1000,
Expand All @@ -156,8 +156,11 @@ func (h *HopStatistic) Render(ptrLookup bool) {
)
}

func (h *HopStatistic) lookupAddr(ptrLookup bool, index int) string {
addr := "???"
func (h *HopStatistic) LookupAddr(ptrLookup bool, index int) string {
if h.dnsCache == nil {
h.dnsCache = map[string]string{}
}
addr := ""
if h.Targets[index] != "" {
addr = h.Targets[index]
if ptrLookup {
Expand Down

0 comments on commit 0a45564

Please sign in to comment.