Skip to content

Commit

Permalink
增加IP绑定
Browse files Browse the repository at this point in the history
  • Loading branch information
csznet committed Mar 28, 2024
1 parent 7535e95 commit 6ac01e7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions conf/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ var Ch chan string
// Web管理面板端口
var WebPort string

// Web IP绑定
var WebIP string

// Web管理面板密码
var WebPass string

Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func main() {
}
func init() {
flag.StringVar(&conf.WebPort, "port", "8889", "Web Port")
flag.StringVar(&conf.WebIP, "ip", "0.0.0.0", "Web IP")
flag.StringVar(&conf.WebPass, "pass", "", "Web Password")
flag.IntVar(&conf.TcpTimeout, "tt", 3600, "Tcp Timeout")
flag.Parse()
Expand Down
8 changes: 7 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ TCP无传输超时关闭
./goForward -port 8899
```

自定义IP绑定

```
./goForward -ip 1.1.1.1
```

设置web管理访问密码

```
Expand All @@ -62,7 +68,7 @@ sudo nano /etc/systemd/system/goForward.service
Description=Start goForward on boot
[Service]
ExecStart=/full/path/to/your/goForward
ExecStart=/full/path/to/your/goForward -pass 666
[Install]
WantedBy=default.target
Expand Down
2 changes: 1 addition & 1 deletion web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func Run() {
c.Redirect(302, "/")
})
fmt.Println("Web管理面板端口:" + conf.WebPort)
r.Run("0.0.0.0:" + conf.WebPort)
r.Run(conf.WebIP + ":" + conf.WebPort)
}

// 密码验证中间件
Expand Down

0 comments on commit 6ac01e7

Please sign in to comment.