mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-08-08 09:04:52 +08:00
优化ip获取流程
This commit is contained in:
@@ -18,6 +18,10 @@ import (
|
||||
var profileHash = ""
|
||||
|
||||
func LinkAuth(w http.ResponseWriter, r *http.Request) {
|
||||
// TODO 调试信息输出
|
||||
//hd, _ := httputil.DumpRequest(r, true)
|
||||
//base.Debug("DumpRequest: ", string(hd))
|
||||
|
||||
// 判断anyconnect客户端
|
||||
userAgent := strings.ToLower(r.UserAgent())
|
||||
xAggregateAuth := r.Header.Get("X-Aggregate-Auth")
|
||||
@@ -106,6 +110,7 @@ func LinkAuth(w http.ResponseWriter, r *http.Request) {
|
||||
sess.PlatformVersion = ua.PlatformVersion
|
||||
sess.RemoteAddr = r.RemoteAddr
|
||||
// 获取客户端mac地址
|
||||
sess.UniqueMac = true
|
||||
macHw, err := net.ParseMAC(sess.MacAddr)
|
||||
if err != nil {
|
||||
var sum [16]byte
|
||||
@@ -113,6 +118,7 @@ func LinkAuth(w http.ResponseWriter, r *http.Request) {
|
||||
sum = md5.Sum([]byte(sess.UniqueIdGlobal))
|
||||
} else {
|
||||
sum = md5.Sum([]byte(sess.Token))
|
||||
sess.UniqueMac = false
|
||||
}
|
||||
macHw = sum[0:5] // 5个byte
|
||||
macHw = append([]byte{0x02}, macHw...)
|
||||
|
@@ -34,9 +34,8 @@ func HttpAddHeader(w http.ResponseWriter, key string, value string) {
|
||||
|
||||
func LinkTunnel(w http.ResponseWriter, r *http.Request) {
|
||||
// TODO 调试信息输出
|
||||
// hd, _ := httputil.DumpRequest(r, true)
|
||||
// fmt.Println("DumpRequest: ", string(hd))
|
||||
// fmt.Println("LinkTunnel", r.RemoteAddr)
|
||||
//hd, _ := httputil.DumpRequest(r, true)
|
||||
//base.Debug("DumpRequest: ", string(hd))
|
||||
|
||||
// 判断session-token的值
|
||||
cookie, err := r.Cookie("webvpn")
|
||||
|
@@ -66,7 +66,7 @@ func startTls() {
|
||||
if base.Cfg.ProxyProtocol {
|
||||
ln = &proxyproto.Listener{
|
||||
Listener: ln,
|
||||
ReadHeaderTimeout: 20 * time.Second,
|
||||
ReadHeaderTimeout: 40 * time.Second,
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user