From: Matt Joiner Date: Sun, 30 Nov 2014 02:30:04 +0000 (-0600) Subject: Print iplist.Range nicely X-Git-Tag: v1.0.0~1471 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=d39caca48efa803d4b0db4316abc90d3d8fa7b9b;p=btrtrc.git Print iplist.Range nicely --- 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 {