Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fixed networkpolicy logic to return as one found #276

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions fastdialer/dialer.go
Expand Up @@ -191,7 +191,6 @@ func (d *Dialer) dial(ctx context.Context, network, address string, shouldUseTLS
return nil, NoAddressFoundError
}

var numInvalidIPS int
var IPS []string
// use fixed ip as first
if fixedIP != "" {
Expand All @@ -203,8 +202,7 @@ 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) {
numInvalidIPS++
continue
return nil, NoAddressAllowedError
}
hostPort := net.JoinHostPort(ip, port)
if shouldUseTLS {
Expand Down Expand Up @@ -288,9 +286,6 @@ func (d *Dialer) dial(ctx context.Context, network, address string, shouldUseTLS
}

if conn == nil {
if numInvalidIPS == len(IPS) {
return nil, NoAddressAllowedError
}
return nil, CouldNotConnectError
}

Expand Down