mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-09-28 16:15:17 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
771e574cdf | ||
|
68751039ff | ||
|
805498e270 | ||
|
946e138a48 |
@@ -266,7 +266,7 @@ https://cloud.tencent.com/document/product/216/62007
|
||||
|
||||
1. 设置配置文件
|
||||
|
||||
> macvtap 设置相对比较简单,只需要配置相应的参数即可。
|
||||
> arp_proxy 性能较高,设置相对比较简单,只需要配置相应的参数即可。
|
||||
>
|
||||
> 网络要求:需要网络支持 ARP 传输,可通过 ARP 宣告普通内网 IP。
|
||||
>
|
||||
@@ -497,8 +497,9 @@ ipv4_end = "10.1.2.200"
|
||||
- [AnyConnect Secure Client](https://www.cisco.com/) (可通过群文件下载: Windows/macOS/Linux/Android/iOS)
|
||||
- [OpenConnect](https://gitlab.com/openconnect/openconnect) (Windows/macOS/Linux)
|
||||
- [三方 AnyLink Secure Client](https://github.com/tlslink/anylink-client) (Windows/macOS/Linux)
|
||||
- 【推荐】三方客户端下载地址(
|
||||
Windows/macOS/Linux/Android/iOS) [国内地址](https://ocserv.yydy.link:2023)
|
||||
- [【推荐】三方客户端下载地址](https://cisco.yydy.link/) (
|
||||
Windows/macOS/Linux/Android/iOS)
|
||||
- [客户端下载面板搭建](https://blog.yydy.link/archives/2018.html) (支持Docker、Linux二进制、Windwos系统直接运行)
|
||||
|
||||
## Contribution
|
||||
|
||||
|
@@ -3,6 +3,7 @@ package admin
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"runtime/debug"
|
||||
"time"
|
||||
|
||||
"github.com/bjdgyc/anylink/base"
|
||||
@@ -120,3 +121,17 @@ func authMiddleware(next http.Handler) http.Handler {
|
||||
|
||||
return http.HandlerFunc(fn)
|
||||
}
|
||||
|
||||
func recoverHttp(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
stack := debug.Stack()
|
||||
base.Error(err, string(stack))
|
||||
// http.Error(w, "Internal Server Error", 500)
|
||||
RespError(w, 500, "Internal Server Error")
|
||||
}
|
||||
}()
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
@@ -21,6 +21,7 @@ var UiData embed.FS
|
||||
func StartAdmin() {
|
||||
|
||||
r := mux.NewRouter()
|
||||
r.Use(recoverHttp, authMiddleware, handlers.CompressHandler)
|
||||
// 所有路由添加安全头
|
||||
r.Use(func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
@@ -29,8 +30,6 @@ func StartAdmin() {
|
||||
next.ServeHTTP(w, req)
|
||||
})
|
||||
})
|
||||
r.Use(authMiddleware)
|
||||
r.Use(handlers.CompressHandler)
|
||||
|
||||
// 监控检测
|
||||
r.HandleFunc("/status.html", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@@ -51,6 +51,9 @@ admin_addr = ":8800"
|
||||
#开启tcp proxy protocol协议
|
||||
proxy_protocol = false
|
||||
|
||||
#开启go标准库http.Server的日志
|
||||
http_server_log=false
|
||||
|
||||
#虚拟网络类型[tun macvtap tap]
|
||||
link_mode = "tun"
|
||||
|
||||
|
@@ -75,8 +75,11 @@ func (auth AuthRadius) checkUser(name, pwd string, g *Group, ext map[string]inte
|
||||
return fmt.Errorf("%s %s", name, "Radius set nasip 出现错误")
|
||||
}
|
||||
}
|
||||
macAddr := ext["mac_addr"].(string)
|
||||
macAddr := ""
|
||||
if ext["mac_addr"] != nil {
|
||||
macAddr = ext["mac_addr"].(string)
|
||||
base.Trace("AuthRadius", ext, macAddr)
|
||||
}
|
||||
if macAddr != "" {
|
||||
err = rfc2865.CallingStationID_AddString(packet, macAddr)
|
||||
if err != nil {
|
||||
@@ -94,5 +97,4 @@ func (auth AuthRadius) checkUser(name, pwd string, g *Group, ext map[string]inte
|
||||
return fmt.Errorf("%s %s", name, "Radius:用户名或密码错误")
|
||||
}
|
||||
return nil
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user