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

Added EncryptionLevel.REQUIRED_NON_LOCAL #191

Merged
merged 8 commits into from
Jul 4, 2016
Merged

Conversation

technige
Copy link
Contributor

No description provided.

@@ -72,6 +73,11 @@
public interface Driver extends AutoCloseable
{
/**
* Return a flag to indicate whether or not encryption is used for this driver.
*/
boolean encrypted();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method should be named #isEncrypted() to signify that it is a configuration option check and not some soft of a fluent interface.

*/
public static boolean isLocalhost( String host )
{
return LOCALHOST.matcher( host ).matches();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a good way to check for localhost. There can be multiple network cards, interfaces and what not. Plus regex matches things like 127.99999.99.123123123123. Class InetAddress has methods like #isAnyLocalAddress(), #isLoopbackAddress(). It seems to be useful to check if address is defined on any interface like this NetworkInterface.getByInetAddress(address) != null. I guess we can adopt smth similar to http://stackoverflow.com/a/2406819/5517896

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple network cards don't apply here. We're talking about the address to which the client connects and whether that is equal to localhost or 127.x.x.x.

I'm also not sure that 127.99999.99.123123123123 would actually be a valid IP address anyway. But I'll check out the utility methods you mention. We do need to make sure we catch localhost here as well as the raw IP addresses so I'll work out which one(s) do that.

@zhenlineo zhenlineo merged commit 80c5f1a into 1.1 Jul 4, 2016
@zhenlineo zhenlineo deleted the 1.1-crypt-non-local branch July 4, 2016 10:28
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.

3 participants