Skip to content

Commit

Permalink
Merge pull request #227 from projectdiscovery/feat-226-fw
Browse files Browse the repository at this point in the history
adding more callbacks
  • Loading branch information
Mzack9999 committed Jan 5, 2024
2 parents c1bef0c + 1880a83 commit 74a2ccc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fastdialer/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,15 @@ func (d *Dialer) dial(ctx context.Context, network, address string, shouldUseTLS
for _, ip := range IPS {
// check if we have allow/deny list
if !d.networkpolicy.Validate(ip) {
if d.options.OnInvalidTarget != nil {
d.options.OnInvalidTarget(hostname, ip, port)
}
numInvalidIPS++
continue
}
if d.options.OnBeforeDial != nil {
d.options.OnBeforeDial(hostname, ip, port)
}
hostPort := net.JoinHostPort(ip, port)
if shouldUseTLS {
tlsconfigCopy := tlsconfig.Clone()
Expand Down
2 changes: 2 additions & 0 deletions fastdialer/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ type Options struct {
ProxyDialer *proxy.Dialer
WithZTLS bool
SNIName string
OnBeforeDial func(hostname, IP, port string)
OnInvalidTarget func(hostname, IP, port string)
OnDialCallback func(hostname, IP string)
DisableZtlsFallback bool
WithNetworkPolicyOptions *networkpolicy.Options
Expand Down

0 comments on commit 74a2ccc

Please sign in to comment.