github.com/projectdiscovery/nuclei/v2@v2.9.15/pkg/protocols/dns/cluster.go (about)

     1  package dns
     2  
     3  // CanCluster returns true if the request can be clustered.
     4  //
     5  // This used by the clustering engine to decide whether two requests
     6  // are similar enough to be considered one and can be checked by
     7  // just adding the matcher/extractors for the request and the correct IDs.
     8  func (request *Request) CanCluster(other *Request) bool {
     9  	if len(request.Resolvers) > 0 || request.Trace || request.ID != "" {
    10  		return false
    11  	}
    12  	if request.Name != other.Name ||
    13  		request.class != other.class ||
    14  		request.Retries != other.Retries ||
    15  		request.question != other.question {
    16  		return false
    17  	}
    18  	if request.Recursion != nil {
    19  		if other.Recursion == nil {
    20  			return false
    21  		}
    22  		if *request.Recursion != *other.Recursion {
    23  			return false
    24  		}
    25  	}
    26  	return true
    27  }