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

Use switch with default for RemoteAddr parsing #200

Merged
merged 1 commit into from
Jul 19, 2023

Conversation

jmwample
Copy link
Member

make mocking conns slightly easier for handleNewTCPConn()

If using a non-IP based net.Conn you will need to wrap and mock / override RemoteAddr() to make sure it does return a net.IP.

	remoteIP := getRemoteAsIP(clientConn)
	if remoteIP == nil {
		// Socket returned non-IP Remote Address - we can't really use that. If testing w/ pipe try
		// wrapping with struct to provide mock RemoteAddr which return a real IP address.
                return
        }

@jmwample jmwample merged commit 2582d97 into master Jul 19, 2023
10 checks passed
@jmwample jmwample deleted the conn-remote-addr-type branch July 19, 2023 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant