Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/protocols/dns/cluster.go
2070 views
1
package dns
2
3
import (
4
"fmt"
5
6
"github.com/cespare/xxhash"
7
)
8
9
// TmplClusterKey generates a unique key for the request
10
// to be used in the clustering process.
11
func (request *Request) TmplClusterKey() uint64 {
12
recursion := ""
13
if request.Recursion != nil {
14
recursion = fmt.Sprintf("%t", *request.Recursion)
15
}
16
inp := fmt.Sprintf("%s-%d-%d-%d-%s", request.Name, request.class, request.Retries, request.question, recursion)
17
return xxhash.Sum64String(inp)
18
}
19
20
// IsClusterable returns true if the request is eligible to be clustered.
21
func (request *Request) IsClusterable() bool {
22
return len(request.Resolvers) <= 0 && !request.Trace && request.ID == ""
23
}
24
25