code: func (s *DistinctNetSet) key(ip net.IP) net.IP {
  	// Lazily initialize storage.
  	if s.members == nil {
  		s.members = make(map[string]uint)
  		s.buf = make(net.IP, 17)
  	}
  	// Canonicalize ip and bits.
  	typ := byte('6')
  	if ip4 := ip.To4(); ip4 != nil {
  		typ, ip = '4', ip4
  	}
  	bits := s.Subnet
  	if bits > uint(len(ip)*8) {
  		bits = uint(len(ip) * 8)
  	}
  	// Encode the prefix into s.buf.
  	nb := int(bits / 8)
  	mask := ^byte(0xFF >> (bits % 8))
  	s.buf[0] = typ
  	buf := append(s.buf[:1], ip[:nb]...)
  	if nb < len(ip) && mask != 0 {
  		buf = append(buf, ip[nb]&mask)
  	}
  	return buf
  }
docs: // key encodes the map key for an address into a temporary buffer.
  //
  // The first byte of key is '4' or '6' to distinguish IPv4/IPv6 address types.
  // The remainder of the key is the IP, truncated to the number of bits.