Skip to content

Commit

Permalink
Merge pull request #20 from cego/more-ip-debugging
Browse files Browse the repository at this point in the history
Fix unique guess unique remote ip
  • Loading branch information
moberghammer authored Apr 29, 2024
2 parents 1db6df0 + 99b6372 commit 628d87b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,13 @@ func root(_ *cobra.Command, _ []string) {
}

connections := append(connections4, connections6...)
connectionsMap := make(map[string]bool, len(connections))
for _, ip := range connections {
connectionsMap[ip.String()] = true
}

if len(connections) != 1 {
log.Fatalf("Unable to guess remote IP. %d results returned", len(connections))
if len(connectionsMap) != 1 {
log.Fatalf("Unable to guess remote IP for %s. %d results returned, connectionMap '%v', ipv4 connections '%v' , ipv6 connections '%v'", hostname, len(connectionsMap), connectionsMap, connections4, connections6)
}

q.Add("remote_ip", connections[0].String())
Expand Down

0 comments on commit 628d87b

Please sign in to comment.