forked from projectdiscovery/nuclei
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcluster.go
More file actions
23 lines (19 loc) · 658 Bytes
/
Copy pathcluster.go
File metadata and controls
23 lines (19 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package dns
import (
"fmt"
"github.com/cespare/xxhash"
)
// TmplClusterKey generates a unique key for the request
// to be used in the clustering process.
func (request *Request) TmplClusterKey() uint64 {
recursion := ""
if request.Recursion != nil {
recursion = fmt.Sprintf("%t", *request.Recursion)
}
inp := fmt.Sprintf("%s-%d-%d-%d-%s", request.Name, request.class, request.Retries, request.question, recursion)
return xxhash.Sum64String(inp)
}
// IsClusterable returns true if the request is eligible to be clustered.
func (request *Request) IsClusterable() bool {
return len(request.Resolvers) <= 0 && !request.Trace && request.ID == ""
}