Fix iplist.Range.String, and a comment
This commit is contained in:
parent
8479f215e0
commit
3a7152ca21
|
@ -29,8 +29,8 @@ type Range struct {
|
||||||
Description string
|
Description string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Range) String() string {
|
func (r Range) String() string {
|
||||||
return fmt.Sprintf("%s-%s (%s)", r.First, r.Last, r.Description)
|
return fmt.Sprintf("%s-%s: %s", r.First, r.Last, r.Description)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new IP list. The given ranges must already sorted by the lower
|
// Create a new IP list. The given ranges must already sorted by the lower
|
||||||
|
@ -49,7 +49,7 @@ func (ipl *IPList) NumRanges() int {
|
||||||
return len(ipl.ranges)
|
return len(ipl.ranges)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the range the given IP is in. Returns nil if no range is found.
|
// Return the range the given IP is in. ok if false if no range is found.
|
||||||
func (ipl *IPList) Lookup(ip net.IP) (r Range, ok bool) {
|
func (ipl *IPList) Lookup(ip net.IP) (r Range, ok bool) {
|
||||||
if ipl == nil {
|
if ipl == nil {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue