From d39caca48efa803d4b0db4316abc90d3d8fa7b9b Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sat, 29 Nov 2014 20:30:04 -0600 Subject: [PATCH] Print iplist.Range nicely --- iplist/iplist.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/iplist/iplist.go b/iplist/iplist.go index b25c8228..4827f871 100644 --- a/iplist/iplist.go +++ b/iplist/iplist.go @@ -18,6 +18,10 @@ type Range struct { Description string } +func (r *Range) String() string { + return fmt.Sprintf("%s-%s (%s)", r.First, r.Last, r.Description) +} + // Create a new IP list. The given range must already sorted by the lower IP // in the range. Behaviour is undefined for lists of overlapping ranges. func New(initSorted []Range) *IPList { -- 2.48.1