Skip to content

Commit 27395cf

Browse files
committed
Try to clarify comment on IPv4 start bit depth
1 parent 8dac192 commit 27395cf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

reader.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,11 @@ func (r *Reader) LookupOffset(ip net.IP) (uintptr, error) {
167167
func (r *Reader) cidr(ip net.IP, prefixLength int) *net.IPNet {
168168
// This is necessary as the node that the IPv4 start is at may
169169
// be at a bit depth that is less that 96, i.e., ipv4Start points
170-
// to a leaf node.
170+
// to a leaf node. For instance, if a record was inserted at ::/8,
171+
// the ipv4Start would point directly at the leaf node for the
172+
// record and would have a bit depth of 8. This would not happen
173+
// with databases currently distributed by MaxMind as all of them
174+
// have an IPv4 subtree that is greater than a single node.
171175
if r.Metadata.IPVersion == 6 &&
172176
len(ip) == net.IPv4len &&
173177
r.ipv4StartBitDepth != 96 {

0 commit comments

Comments
 (0)