]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Print iplist.Range nicely
authorMatt Joiner <anacrolix@gmail.com>
Sun, 30 Nov 2014 02:30:04 +0000 (20:30 -0600)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 30 Nov 2014 02:30:04 +0000 (20:30 -0600)
iplist/iplist.go

index b25c8228eaeec37917dca91e28b3e458a15a49fe..4827f871949123ce3f9e2ec3cf33dfe3770da54a 100644 (file)
@@ -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 {