mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-07 21:28:50 +08:00
添加自定义首页 状态码
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package dbdata
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/bjdgyc/anylink/base"
|
||||
@@ -121,6 +122,7 @@ func addInitData() error {
|
||||
other := &SettingOther{
|
||||
LinkAddr: "vpn.xx.com",
|
||||
Banner: "您已接入公司网络,请按照公司规定使用。\n请勿进行非工作下载及视频行为!",
|
||||
Homecode: http.StatusOK,
|
||||
Homeindex: "AnyLink 是一个企业级远程办公 sslvpn 的软件,可以支持多人同时在线使用。",
|
||||
AccountMail: accountMail,
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ type SettingAuditLog struct {
|
||||
type SettingOther struct {
|
||||
LinkAddr string `json:"link_addr"`
|
||||
Banner string `json:"banner"`
|
||||
Homecode int `json:"homecode"`
|
||||
Homeindex string `json:"homeindex"`
|
||||
AccountMail string `json:"account_mail"`
|
||||
}
|
||||
|
@@ -27,10 +27,16 @@ func LinkHome(w http.ResponseWriter, r *http.Request) {
|
||||
if err := dbdata.SettingGet(index); err != nil {
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusOK)
|
||||
if index.Homeindex == "" {
|
||||
index.Homeindex = "AnyLink 是一个企业级远程办公 SSL VPN 软件,可以支持多人同时在线使用。"
|
||||
|
||||
if index.Homecode > 0 {
|
||||
w.WriteHeader(index.Homecode)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
// if index.Homeindex == "" {
|
||||
// index.Homeindex = "AnyLink 是一个企业级远程办公 SSL VPN 软件,可以支持多人同时在线使用。"
|
||||
// }
|
||||
fmt.Fprintln(w, index.Homeindex)
|
||||
}
|
||||
|
||||
|
@@ -51,6 +51,9 @@ func checkTun() {
|
||||
// 添加注释
|
||||
natRule := []string{"-s", base.Cfg.Ipv4CIDR, "-o", base.Cfg.Ipv4Master, "-m", "comment",
|
||||
"--comment", "AnyLink", "-j", "MASQUERADE"}
|
||||
if base.InContainer {
|
||||
natRule = []string{"-s", base.Cfg.Ipv4CIDR, "-o", base.Cfg.Ipv4Master, "-j", "MASQUERADE"}
|
||||
}
|
||||
err = ipt.InsertUnique("nat", "POSTROUTING", 1, natRule...)
|
||||
if err != nil {
|
||||
base.Error(err)
|
||||
@@ -58,6 +61,9 @@ func checkTun() {
|
||||
|
||||
// 添加注释
|
||||
forwardRule := []string{"-m", "comment", "--comment", "AnyLink", "-j", "ACCEPT"}
|
||||
if base.InContainer {
|
||||
forwardRule = []string{"-j", "ACCEPT"}
|
||||
}
|
||||
err = ipt.InsertUnique("filter", "FORWARD", 1, forwardRule...)
|
||||
if err != nil {
|
||||
base.Error(err)
|
||||
|
Reference in New Issue
Block a user