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

[Improvement-3690][common] Get the native IP policy problem (获取本机ip策略问题 ) #3695

Merged
merged 9 commits into from Sep 14, 2020

Conversation

felix-thinkingdata
Copy link
Contributor

@felix-thinkingdata felix-thinkingdata commented Sep 8, 2020

Tips

What is the purpose of the pull request

Improvement #3690

The current policy is to take the first one, but the first test is not fixed。This is my debug screenshot.


当前策略是取第一个,但是第一个测试下来也是不固定的,这个是我调试截图。
image
image

The problem is that on the server, the acquired IP is the external network card IP.External network control is more strict, so it is not a full port through. Therefore, it is recommended to get IP of Intranet card first.So make logical optimizations in your code.


遇到的问题是服务器上,获取的ip为外网网卡ip.外网控制比较严格,所以不是全端口打通。所以,建议优先获取内网网卡ip。
所以做出代码中的逻辑优化。

@davidzollo davidzollo changed the title [Improvement][COMMON-netUtils] 获取本机ip策略问题 Get the native IP policy problem [Improvement][COMMON-netUtils] Get the native IP policy problem (获取本机ip策略问题 ) Sep 8, 2020
@davidzollo davidzollo linked an issue Sep 8, 2020 that may be closed by this pull request
@davidzollo davidzollo added this to the 1.3.3-release milestone Sep 8, 2020
@yangyichao-mango
Copy link
Contributor

Please add test case to make sure this will success run in github docker.

Copy link
Member

@CalvinKirs CalvinKirs left a comment

Choose a reason for hiding this comment

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

In my opinion, preferential selection of internal network IP may not be suitable for some scenarios. In some cases, we need to obtain external network IP. Therefore, it is recommended to set a switch. By default, internal network IP is selected, but users can specify whether to give priority to Obtain the external network IP.

@felix-thinkingdata
Copy link
Contributor Author

In my opinion, preferential selection of internal network IP may not be suitable for some scenarios. In some cases, we need to obtain external network IP. Therefore, it is recommended to set a switch. By default, internal network IP is selected, but users can specify whether to give priority to Obtain the external network IP.

这种情况可以考虑在内,我加一个快关吧。默认内网优先。如果开关开启就把这个策略关闭,还是加一个外网优先?之前取第一个的策略是不合理的。
This can be taken into account. Let me add a quick switch. Default Intranet priority. Turn this policy off if the switch is on, or add an extranet first? The previous strategy of taking the first one was not reasonable.

@felix-thinkingdata felix-thinkingdata changed the title [Improvement][COMMON-netUtils] Get the native IP policy problem (获取本机ip策略问题 ) [Improvement][COMMON-NetUtils] Get the native IP policy problem (获取本机ip策略问题 ) Sep 9, 2020
@felix-thinkingdata
Copy link
Contributor Author

In my opinion, preferential selection of internal network IP may not be suitable for some scenarios. In some cases, we need to obtain external network IP. Therefore, it is recommended to set a switch. By default, internal network IP is selected, but users can specify whether to give priority to Obtain the external network IP.

这种情况可以考虑在内,我加一个快关吧。默认内网优先。如果开关开启就把这个策略关闭,还是加一个外网优先?之前取第一个的策略是不合理的。
This can be taken into account. Let me add a quick switch. Default Intranet priority. Turn this policy off if the switch is on, or add an extranet first? The previous strategy of taking the first one was not reasonable.

考虑到有的云服务器只有一块外网网卡的情况,需要做一个兼容。
或者有的用户,需要优先获取外网网卡,做一个开关逻辑。
Considering that some cloud servers only have one external network card, need to do a compatibility.
Or some users, need to get the priority of the external network card, do a switch logic.

@felix-thinkingdata
Copy link
Contributor Author

In my opinion, preferential selection of internal network IP may not be suitable for some scenarios. In some cases, we need to obtain external network IP. Therefore, it is recommended to set a switch. By default, internal network IP is selected, but users can specify whether to give priority to Obtain the external network IP.
帮忙起个名字 ,哈哈
The name of this switch in the configuration file, please give it a name

@CalvinKirs
Copy link
Member

In my opinion, preferential selection of internal network IP may not be suitable for some scenarios. In some cases, we need to obtain external network IP. Therefore, it is recommended to set a switch. By default, internal network IP is selected, but users can specify whether to give priority to Obtain the external network IP.

这种情况可以考虑在内,我加一个快关吧。默认内网优先。如果开关开启就把这个策略关闭,还是加一个外网优先?之前取第一个的策略是不合理的。
This can be taken into account. Let me add a quick switch. Default Intranet priority. Turn this policy off if the switch is on, or add an extranet first? The previous strategy of taking the first one was not reasonable.

考虑到有的云服务器只有一块外网网卡的情况,需要做一个兼容。
或者有的用户,需要优先获取外网网卡,做一个开关逻辑。
Considering that some cloud servers only have one external network card, need to do a compatibility.
Or some users, need to get the priority of the external network card, do a switch logic.

In fact, in the original design, users can display the specified ip

For scenarios where there are real multiple network cards and IP coexistence between internal and external networks, you cannot work hard on the framework side, and users also need to do something. There is no near perfect solution

事实上,原有的设计上优先选取用户所配置的网卡。

对于多网卡,内外网IP共存的场景,不能只是框架在做努力,用户也需要做一些事。没有近乎完美的方案。

@CalvinKirs
Copy link
Member

Our default plan is to choose the internal network first, and then the external network. The user can display the designated intranet or extranet. If the user shows that the external network is specified, an error will be reported directly if the external network is not available

我们默认方案优先选择内网,其次选择外网。用户可以显示指定选择内网或者外网。如果用户显示指定了外网,拿不到外网的情况下就直接报错 @qiaozhanwei hi,do you have any good advice

@yangyichao-mango
Copy link
Contributor

yangyichao-mango commented Sep 9, 2020 via email

@felix-thinkingdata
Copy link
Contributor Author

@CalvinKirs CalvinKirs Development has been completed

Copy link
Member

@CalvinKirs CalvinKirs left a comment

Choose a reason for hiding this comment

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

looks good to me,please you review @dailidong @qiaozhanwei

Co-authored-by: Yichao Yang <1048262223@qq.com>
@yangyichao-mango
Copy link
Contributor

Please change the title to [Improvement-3690][common] Get the native IP policy problem (获取本机ip策略问题 )

Copy link
Contributor

@yangyichao-mango yangyichao-mango left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarcloud
Copy link

sonarcloud bot commented Sep 12, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 2 Code Smells

45.9% 45.9% Coverage
0.0% 0.0% Duplication

@felix-thinkingdata felix-thinkingdata changed the title [Improvement][COMMON-NetUtils] Get the native IP policy problem (获取本机ip策略问题 ) [Improvement-3690][common] Get the native IP policy problem (获取本机ip策略问题 ) Sep 13, 2020
Copy link
Contributor

@qiaozhanwei qiaozhanwei left a comment

Choose a reason for hiding this comment

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

+1

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.

[Improvement][COMMON-netUtils] Get the native IP policy problem
6 participants