[
https://issues.apache.org/jira/browse/WHIRR-730?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Songping Lv updated WHIRR-730:
------------------------------
Description:
Hi,all
I have found the FirewallManager.getOriginatingIp() use the following method to
get the ip address
{code:title=FirewallManager.java|borderStyle=solid}
/**
* @return the IP address of the client on which this code is running.
* @throws IOException
*/
private String getOriginatingIp() throws IOException {
if ("stub".equals(clusterSpec.getProvider())) {
return "62.217.232.123";
}
URL url = new URL("http://checkip.amazonaws.com/");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
return IOUtils.toString(connection.getInputStream()).trim() + "/32";
}
{code}
I think we should use the InetAddress.getLocalHost() to get the ipaddress,
here's some of my reason:
1). I think it is illegal for an application to get the client ip address
throght the erternal website, what else if the amazon is broken and we can
access the http://checkip.amazonaws.com/ or if the situation of the internet
can't worked well, it will be failed to launch the cluster because we can't
connect to the http://checkip.amazonaws.com/.
2). If any of the private company want to reuse the whirr project to create the
cluster, Some of the company need to use the proxy to access the external
website, Although the whirr project support to config the proxy, but it is
still complicated for us to apply for the IT Department to authorize the proxy
for the VM we have created by the whirr.
3). I think it is simple to use the InetAddress.getLocalHost() to get the local
ip address
Thanks
-Jeremy Lv
was:
Hi,all
I have found the FirewallManager.getOriginatingIp() use the following method to
get the ip address
{code:title=Bar.java|borderStyle=solid}
/**
* @return the IP address of the client on which this code is running.
* @throws IOException
*/
private String getOriginatingIp() throws IOException {
if ("stub".equals(clusterSpec.getProvider())) {
return "62.217.232.123";
}
URL url = new URL("http://checkip.amazonaws.com/");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
return IOUtils.toString(connection.getInputStream()).trim() + "/32";
}
{code}
I think we should use the InetAddress.getLocalHost() to get the ipaddress,
here's some of my reason:
1). I think it is illegal for an application to get the client ip address
throght the erternal website, what else if the amazon is broken and we can
access the http://checkip.amazonaws.com/ or if the situation of the internet
can't worked well, it will be failed to launch the cluster because we can't
connect to the http://checkip.amazonaws.com/.
2). If any of the private company want to reuse the whirr project to create the
cluster, Some of the company need to use the proxy to access the external
website, Although the whirr project support to config the proxy, but it is
still complicated for us to apply for the IT Department to authorize the proxy
for the VM we have created by the whirr.
3). I think it is simple to use the InetAddress.getLocalHost() to get the local
ip address
Thanks
-Jeremy Lv
> Use the InetAddress.getLocalHost() instead of
> URL("http://checkip.amazonaws.com/") to get the local address
> -----------------------------------------------------------------------------------------------------------
>
> Key: WHIRR-730
> URL: https://issues.apache.org/jira/browse/WHIRR-730
> Project: Whirr
> Issue Type: Improvement
> Components: core
> Affects Versions: 0.8.2
> Environment: Unbuntu, Openstack
> Reporter: Songping Lv
> Fix For: 0.9.0
>
>
> Hi,all
> I have found the FirewallManager.getOriginatingIp() use the following method
> to get the ip address
> {code:title=FirewallManager.java|borderStyle=solid}
> /**
> * @return the IP address of the client on which this code is running.
> * @throws IOException
> */
> private String getOriginatingIp() throws IOException {
> if ("stub".equals(clusterSpec.getProvider())) {
> return "62.217.232.123";
> }
> URL url = new URL("http://checkip.amazonaws.com/");
> HttpURLConnection connection = (HttpURLConnection) url.openConnection();
> connection.connect();
> return IOUtils.toString(connection.getInputStream()).trim() + "/32";
> }
> {code}
> I think we should use the InetAddress.getLocalHost() to get the ipaddress,
> here's some of my reason:
> 1). I think it is illegal for an application to get the client ip address
> throght the erternal website, what else if the amazon is broken and we can
> access the http://checkip.amazonaws.com/ or if the situation of the internet
> can't worked well, it will be failed to launch the cluster because we can't
> connect to the http://checkip.amazonaws.com/.
> 2). If any of the private company want to reuse the whirr project to create
> the cluster, Some of the company need to use the proxy to access the external
> website, Although the whirr project support to config the proxy, but it is
> still complicated for us to apply for the IT Department to authorize the
> proxy for the VM we have created by the whirr.
> 3). I think it is simple to use the InetAddress.getLocalHost() to get the
> local ip address
> Thanks
> -Jeremy Lv
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira