Skip to content

Commit

Permalink
iptables 添加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
bjdgyc committed Feb 26, 2024
1 parent a0e8431 commit 5a331e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions server/handler/link_tun.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ func checkTun() {
base.CheckModOrLoad("iptable_filter")
base.CheckModOrLoad("iptable_nat")

natRule := []string{"-s", base.Cfg.Ipv4CIDR, "-o", base.Cfg.Ipv4Master, "-j", "MASQUERADE"}
forwardRule := []string{"-j", "ACCEPT"}
natRule := []string{"-s", base.Cfg.Ipv4CIDR, "-o", base.Cfg.Ipv4Master, "-m", "comment",
"--comment", "anylink tun nat", "-j", "MASQUERADE"}
if natExists, _ := ipt.Exists("nat", "POSTROUTING", natRule...); !natExists {
ipt.Insert("nat", "POSTROUTING", 1, natRule...)
}
forwardRule := []string{"-m", "comment", "--comment", "anylink forward filter", "-j", "ACCEPT"}
if forwardExists, _ := ipt.Exists("filter", "FORWARD", forwardRule...); !forwardExists {
ipt.Insert("filter", "FORWARD", 1, forwardRule...)
}
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.2
0.11.3

0 comments on commit 5a331e2

Please sign in to comment.