diff --git a/server/.gitignore b/server/.gitignore index 4c9effc..ded724b 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -17,4 +17,5 @@ vendor/ ui/ .idea/ anylink -data.db \ No newline at end of file +data.db +conf/*.db \ No newline at end of file diff --git a/server/dbdata/db.go b/server/dbdata/db.go index 00c992c..c52d209 100644 --- a/server/dbdata/db.go +++ b/server/dbdata/db.go @@ -88,6 +88,7 @@ func addInitData() error { other := &SettingOther{ LinkAddr: "vpn.xx.com", Banner: "您已接入公司网络,请按照公司规定使用。\n请勿进行非工作下载及视频行为!", + Homeindex: "AnyLink 是一个企业级远程办公 sslvpn 的软件,可以支持多人同时在线使用。", AccountMail: accountMail, } err = SettingSessAdd(sess, other) diff --git a/server/dbdata/setting.go b/server/dbdata/setting.go index a9ab9e6..4770401 100644 --- a/server/dbdata/setting.go +++ b/server/dbdata/setting.go @@ -22,6 +22,7 @@ type SettingSmtp struct { type SettingOther struct { LinkAddr string `json:"link_addr"` Banner string `json:"banner"` + Homeindex string `json:"homeindex"` AccountMail string `json:"account_mail"` } diff --git a/server/handler/link_auth.go b/server/handler/link_auth.go index d1740af..f25bb49 100644 --- a/server/handler/link_auth.go +++ b/server/handler/link_auth.go @@ -4,7 +4,6 @@ import ( "encoding/xml" "fmt" "io" - "io/ioutil" "net/http" "strings" "text/template" @@ -28,7 +27,7 @@ func LinkAuth(w http.ResponseWriter, r *http.Request) { return } - body, err := ioutil.ReadAll(r.Body) + body, err := io.ReadAll(r.Body) if err != nil { w.WriteHeader(http.StatusBadRequest) return @@ -188,39 +187,40 @@ var auth_complete = ` ` -var auth_profile = ` - +// var auth_profile = ` +// - - false - false - false - IPSec - true - AllowRemoteUsers - pinAllowed - - - Digital_Signature - - - ClientAuth - - +// +// false +// false +// false +// IPSec +// true +// AllowRemoteUsers +// pinAllowed +// +// +// Digital_Signature +// +// +// ClientAuth +// +// - - localhost - - +// +// localhost +// +// - - - VPN Server - localhost - - - -` +// +// +// VPN Server +// localhost +// +// +// +// +// ` var ds_domains_xml = ` diff --git a/server/handler/link_home.go b/server/handler/link_home.go index 7be4f64..9e874f2 100644 --- a/server/handler/link_home.go +++ b/server/handler/link_home.go @@ -6,13 +6,13 @@ import ( "strings" "github.com/bjdgyc/anylink/admin" + "github.com/bjdgyc/anylink/dbdata" ) func LinkHome(w http.ResponseWriter, r *http.Request) { // fmt.Println(r.RemoteAddr) // hu, _ := httputil.DumpRequest(r, true) // fmt.Println("DumpHome: ", string(hu)) - connection := strings.ToLower(r.Header.Get("Connection")) userAgent := strings.ToLower(r.UserAgent()) if connection == "close" && (strings.Contains(userAgent, "anyconnect") || strings.Contains(userAgent, "openconnect")) { @@ -20,9 +20,11 @@ func LinkHome(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusBadRequest) return } - + index := &dbdata.SettingOther{} + dbdata.SettingGet(index) w.WriteHeader(http.StatusOK) - fmt.Fprintln(w, "AnyLink 是一个企业级远程办公 sslvpn 的软件,可以支持多人同时在线使用。") + fmt.Fprintln(w, index.Homeindex) + // fmt.Fprintln(w, "AnyLink 是一个企业级远程办公 sslvpn 的软件,可以支持多人同时在线使用。") } func LinkOtpQr(w http.ResponseWriter, r *http.Request) { diff --git a/server/handler/link_vtap.go b/server/handler/link_vtap.go index 39fd87d..399f9da 100644 --- a/server/handler/link_vtap.go +++ b/server/handler/link_vtap.go @@ -33,7 +33,7 @@ func checkMacvtap() { ifName := "anylinkMacvtap" // 加载 macvtap - cmdstr0 := fmt.Sprintf("modprobe -i macvtap") + cmdstr0 := fmt.Sprintln("modprobe -i macvtap") // 开启主网卡混杂模式 cmdstr1 := fmt.Sprintf("ip link set dev %s promisc on", base.Cfg.Ipv4Master) // 测试 macvtap 功能 @@ -66,9 +66,9 @@ func LinkMacvtap(cSess *sessdata.ConnSession) error { return createVtap(cSess, ifName) } -func checkIpvtap() { +// func checkIpvtap() { -} +// } // 创建 Ipvtap 网卡 func LinkIpvtap(cSess *sessdata.ConnSession) error { diff --git a/server/handler/pool.go b/server/handler/pool.go old mode 100644 new mode 100755 diff --git a/web/src/pages/set/Other.vue b/web/src/pages/set/Other.vue index 20fdf02..8c518c7 100644 --- a/web/src/pages/set/Other.vue +++ b/web/src/pages/set/Other.vue @@ -51,6 +51,15 @@ + + + + +