New creates a new initialized GobusterDNS
(globalopts *libgobuster.Options, opts *OptionsDNS)
| 46 | |
| 47 | // New creates a new initialized GobusterDNS |
| 48 | func New(globalopts *libgobuster.Options, opts *OptionsDNS) (*GobusterDNS, error) { |
| 49 | if globalopts == nil { |
| 50 | return nil, errors.New("please provide valid global options") |
| 51 | } |
| 52 | |
| 53 | if opts == nil { |
| 54 | return nil, errors.New("please provide valid plugin options") |
| 55 | } |
| 56 | |
| 57 | resolver := net.DefaultResolver |
| 58 | if opts.Resolver != "" { |
| 59 | resolver = &net.Resolver{ |
| 60 | PreferGo: true, |
| 61 | Dial: newCustomDialer(opts.Resolver, opts.Protocol), |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | g := GobusterDNS{ |
| 66 | options: opts, |
| 67 | globalopts: globalopts, |
| 68 | wildcardIps: libgobuster.NewSet[netip.Addr](), |
| 69 | resolver: resolver, |
| 70 | } |
| 71 | return &g, nil |
| 72 | } |
| 73 | |
| 74 | // Name should return the name of the plugin |
| 75 | func (d *GobusterDNS) Name() string { |
no test coverage detected