I prefer option 2. but I think we need a warn message if no public ip exist to let user know this behaviour?
On 2019/04/04 09:21:10, 徐靖峰 <[email protected]> wrote: > Hi, > I notice that recently there are some issue about NetUtils.getLocalHost, > someone complains about that logic changes bring by > issue: https://github.com/apache/incubator-dubbo/issues/538 > <https://github.com/apache/incubator-dubbo/issues/538> > pr: https://github.com/apache/incubator-dubbo/pull/3520 > <https://github.com/apache/incubator-dubbo/pull/3520> > The change places in 2.7.1 is NetUtils.getLocalHost add a new check method: > > static boolean isValidPublicAddress(InetAddress address) { > > return !address.isSiteLocalAddress() && !address.isLoopbackAddress(); > > } > This will exclude local site address like: > 10/8 prefix > 172.16/12 prefix > 192.168/16 prefix > so a internal ip 172.161.3.4 will successfully register into registry > before, but will register localhost(mostly 127.0.0.1) into registry if no > public ip exists. > > Action: > 1. Add a param switch let user choose to prefer to register local site > address or public address. > 2. The default priority to find useful address in multi network cards can be > : public > internal > localhost.
