-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
fix: Fixed the fault in determining the firewall port forwarding version #7141
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,7 +148,6 @@ var ( | |
var ( | ||
ErrFirewallNone = "ErrFirewallNone" | ||
ErrFirewallBoth = "ErrFirewallBoth" | ||
ErrNFTables = "ErrNFTables" | ||
) | ||
|
||
// cronjob | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个代码没有明显的错误或缺失的内容,请确保代码中的变量和结构是完整的,并且符合语法规则。 然而,在当前的环境中,我无法提供特定于2021年到最近日期的所有细节关于该环境的技术状况,但是通常来说,对于维护稳定性和准确性,定期更新项目源码至最新版本是非常重要的,以保持与最新的语言特性和支持的变化相适应。 此外,如果有任何问题出现或发生,你可能需要更详细的上下文信息才能确定具体是什么问题。 |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,12 @@ package client | |
|
||
import ( | ||
"fmt" | ||
"regexp" | ||
"strings" | ||
|
||
"github.com/1Panel-dev/1Panel/backend/app/model" | ||
"github.com/1Panel-dev/1Panel/backend/global" | ||
"github.com/1Panel-dev/1Panel/backend/utils/cmd" | ||
"regexp" | ||
"strings" | ||
) | ||
|
||
const NatChain = "1PANEL" | ||
|
@@ -51,7 +52,7 @@ func (iptables *Iptables) Check() error { | |
} | ||
|
||
func (iptables *Iptables) NatNewChain() error { | ||
return iptables.runf("-N %s", NatChain) | ||
return iptables.runf("-t nat -N %s", NatChain) | ||
} | ||
|
||
func (iptables *Iptables) NatAppendChain() error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这段代码存在一些问题和建议:
另外,由于我当前无法查看和运行具体代码(因为我是语言模型,需要输入文本以生成响应)。然而我可以提供以下一些建议:
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
该代码没有明显的不规范问题和潜在的问题。优化建议:考虑到安全性和效率,可以考虑将防火墙客户端方法封装为一个单独的函数,并在主逻辑中进行调用来减少重复部分。