mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 20:15:27 +00:00
* initial implementation with manual code generation * testing generation * refactor to package methods + auto memoize * more memos * fixing signatures * refactor * adding gen util * adding util * regenerate memoized files --------- Co-authored-by: Tarun Koyalwar <tarun@projectdiscovery.io>
42 lines
1003 B
Go
Executable File
42 lines
1003 B
Go
Executable File
// Warning - This is generated code
|
|
package mysql
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/protocolstate"
|
|
)
|
|
|
|
func memoizedisMySQL(host string, port int) (bool, error) {
|
|
hash := "isMySQL" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port)
|
|
|
|
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
|
|
return isMySQL(host, port)
|
|
})
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
if value, ok := v.(bool); ok {
|
|
return value, nil
|
|
}
|
|
|
|
return false, errors.New("could not convert cached result")
|
|
}
|
|
|
|
func memoizedfingerprintMySQL(host string, port int) (MySQLInfo, error) {
|
|
hash := "fingerprintMySQL" + ":" + fmt.Sprint(host) + ":" + fmt.Sprint(port)
|
|
|
|
v, err, _ := protocolstate.Memoizer.Do(hash, func() (interface{}, error) {
|
|
return fingerprintMySQL(host, port)
|
|
})
|
|
if err != nil {
|
|
return MySQLInfo{}, err
|
|
}
|
|
if value, ok := v.(MySQLInfo); ok {
|
|
return value, nil
|
|
}
|
|
|
|
return MySQLInfo{}, errors.New("could not convert cached result")
|
|
}
|