diff --git a/README.md b/README.md index c0b228a..b2c8685 100644 --- a/README.md +++ b/README.md @@ -74,11 +74,11 @@ root@dev:~# dnat delete -id 1 #### 开启 masquerade ```bash -dnat masquerade -A -o eth0 +root@dev:~# dnat masquerade -A -o eth0 ``` -### 关闭 masquerade +#### 关闭 masquerade ```bash -dnat masquerade -D -o eth0 +root@dev:~# dnat masquerade -D -o eth0 ``` \ No newline at end of file diff --git a/cmd/dnat.go b/cmd/dnat.go index 7523c25..93ee2c7 100644 --- a/cmd/dnat.go +++ b/cmd/dnat.go @@ -1,7 +1,6 @@ package cmd import ( - "fmt" "time" "github.com/go-bai/go-dnat/db" @@ -71,7 +70,8 @@ func List(cCtx *cli.Context) error { } func Get(cCtx *cli.Context) error { - rule, err := rulemodel.Get(cCtx.Int64("id")) + id := cCtx.Int64("id") + rule, err := rulemodel.Get(id) if err != nil { return err } @@ -96,7 +96,6 @@ func Sync(cCtx *cli.Context) error { func Masquerade(cCtx *cli.Context) error { append, delete, iface := cCtx.Bool("append"), cCtx.Bool("delete"), cCtx.String("o") - fmt.Println(append, delete, iface) switch { case append: if err := iptables.AppendMasqueradeRule(iface); err != nil {