mirror of
				https://github.com/bjdgyc/anylink.git
				synced 2025-11-04 19:16:22 +08:00 
			
		
		
		
	
							
								
								
									
										87
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										87
									
								
								README.md
									
									
									
									
									
								
							@@ -48,17 +48,23 @@ AnyLink 服务端仅在 CentOS 7、CentOS 8、Ubuntu 18.04、Ubuntu 20.04 测试
 | 
			
		||||
>
 | 
			
		||||
> https://github.com/bjdgyc/anylink/releases
 | 
			
		||||
> 
 | 
			
		||||
> 如果不会安装,可以提供有偿远程协助服务。添加QQ联系我 68492170
 | 
			
		||||
> https://gitee.com/bjdgyc/anylink/releases
 | 
			
		||||
>
 | 
			
		||||
> 如果不会安装,可以提供有偿远程协助服务(200 CNY)。添加QQ(68492170)联系我
 | 
			
		||||
> 
 | 
			
		||||
> 也可以添加QQ群 咨询群内大佬
 | 
			
		||||
> 
 | 
			
		||||
> 添加QQ群①(已满): 567510628
 | 
			
		||||
> 
 | 
			
		||||
> 添加QQ群②: 739072205
 | 
			
		||||
 | 
			
		||||
### 使用问题
 | 
			
		||||
 | 
			
		||||
> 对于测试环境,可以使用 vpn.test.vqilu.cn 绑定host进行测试
 | 
			
		||||
>
 | 
			
		||||
> 对于线上环境,必须申请安全的 https 证书,不支持私有证书连接
 | 
			
		||||
> 对于线上环境,必须申请安全的https证书(跟nginx使用的证书类型一致),不支持私有证书连接
 | 
			
		||||
>
 | 
			
		||||
> 服务端安装 yum install iproute 或者 apt-get install iproute2
 | 
			
		||||
>
 | 
			
		||||
> 客户端请使用群共享文件的版本,其他版本没有测试过,不保证使用正常
 | 
			
		||||
> 群共享文件有相关客户端软件下载,其他版本没有测试过,不保证使用正常
 | 
			
		||||
> 
 | 
			
		||||
> 其他问题 [前往查看](doc/question.md)
 | 
			
		||||
>
 | 
			
		||||
@@ -80,7 +86,7 @@ git clone https://github.com/bjdgyc/anylink.git
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
cd anylink
 | 
			
		||||
sh build.sh
 | 
			
		||||
bash build.sh
 | 
			
		||||
 | 
			
		||||
# 注意使用root权限运行
 | 
			
		||||
cd anylink-deploy
 | 
			
		||||
@@ -161,6 +167,17 @@ sudo ./anylink
 | 
			
		||||
 | 
			
		||||
## Setting
 | 
			
		||||
 | 
			
		||||
### 依赖设置
 | 
			
		||||
 | 
			
		||||
> 服务端依赖安装:
 | 
			
		||||
>
 | 
			
		||||
> centos: yum install iptables iproute
 | 
			
		||||
>
 | 
			
		||||
> ubuntu: apt-get install iptables iproute2
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### link_mode 设置
 | 
			
		||||
 | 
			
		||||
> 以下参数必须设置其中之一
 | 
			
		||||
 | 
			
		||||
网络模式选择,需要配置 `link_mode` 参数,如 `link_mode="tun"`,`link_mode="macvtap"`,`link_mode="tap"(不推荐)` 等参数。
 | 
			
		||||
@@ -170,11 +187,13 @@ sudo ./anylink
 | 
			
		||||
IP 层的数据互相转换,性能会有所下降。 如果需要在虚拟机内开启 tap
 | 
			
		||||
模式,请确认虚拟机的网卡开启混杂模式。
 | 
			
		||||
 | 
			
		||||
### tun 设置
 | 
			
		||||
#### tun 设置
 | 
			
		||||
 | 
			
		||||
1. 开启服务器转发
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
# 新版本支持自动设置ip转发
 | 
			
		||||
 | 
			
		||||
# file: /etc/sysctl.conf
 | 
			
		||||
net.ipv4.ip_forward = 1
 | 
			
		||||
 | 
			
		||||
@@ -223,13 +242,49 @@ https://cloud.tencent.com/document/product/216/62007
 | 
			
		||||
 | 
			
		||||
3. 使用 AnyConnect 客户端连接即可
 | 
			
		||||
 | 
			
		||||
### macvtap 设置
 | 
			
		||||
#### 桥接设置
 | 
			
		||||
 | 
			
		||||
1. 设置配置文件
 | 
			
		||||
 | 
			
		||||
> macvtap 设置相对比较简单,只需要配置相应的参数即可。
 | 
			
		||||
> 
 | 
			
		||||
> 网络要求:需要网络支持 ARP 传输,可通过 ARP 宣告普通内网 IP。
 | 
			
		||||
> 
 | 
			
		||||
> 网络限制:云环境下不能使用,网卡mac加白环境不能使用,802.1x认证网络不能使用
 | 
			
		||||
> 
 | 
			
		||||
> 以下参数可以通过执行 `ip a` 查看
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1.1 arp_proxy
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# file: /etc/sysctl.conf
 | 
			
		||||
net.ipv4.conf.all.proxy_arp = 1
 | 
			
		||||
 | 
			
		||||
#执行如下命令
 | 
			
		||||
sysctl -w net.ipv4.conf.all.proxy_arp=1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
配置文件修改:
 | 
			
		||||
 | 
			
		||||
# 首先关闭nat转发功能
 | 
			
		||||
iptables_nat = false
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
link_mode = "tun"
 | 
			
		||||
#内网主网卡名称
 | 
			
		||||
ipv4_master = "eth0"
 | 
			
		||||
#以下网段需要跟ipv4_master网卡设置成一样
 | 
			
		||||
ipv4_cidr = "10.1.2.0/24"
 | 
			
		||||
ipv4_gateway = "10.1.2.99"
 | 
			
		||||
ipv4_start = "10.1.2.100"
 | 
			
		||||
ipv4_end = "10.1.2.200"
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
1.2 macvtap
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# 命令行执行 master网卡需要打开混杂模式
 | 
			
		||||
@@ -356,25 +411,29 @@ ipv4_end = "10.1.2.200"
 | 
			
		||||
 | 
			
		||||
请前往 [问题地址](doc/question.md) 查看具体信息
 | 
			
		||||
 | 
			
		||||
<!--
 | 
			
		||||
## Discussion
 | 
			
		||||
 | 
			
		||||
添加QQ群(1)(已满): 567510628
 | 
			
		||||
 | 
			
		||||
添加QQ群(2): 739072205
 | 
			
		||||
 | 
			
		||||
群共享文件有相关软件下载
 | 
			
		||||
 | 
			
		||||
<!--
 | 
			
		||||
添加微信群: 群共享文件有相关软件下载
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
## Support Document
 | 
			
		||||
 | 
			
		||||
- [三方文档-男孩的天职](https://note.youdao.com/s/X4AxyWfL)
 | 
			
		||||
- [三方文档-issues](https://github.com/bjdgyc/anylink/issues)
 | 
			
		||||
- [三方文档-思有云](https://www.ioiox.com/archives/128.html)
 | 
			
		||||
 | 
			
		||||
## Support Client
 | 
			
		||||
 | 
			
		||||
- [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)
 | 
			
		||||
- [三方 AnyLink Secure Client](https://github.com/tlslink/anylink-client) (Windows/macOS/Linux)
 | 
			
		||||
- [三方客户端下载地址](https://cisco.yangpin.link) (Windows/macOS/Linux/Android/iOS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Contribution
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										55
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										55
									
								
								build.sh
									
									
									
									
									
								
							@@ -1,5 +1,7 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
#github action release.sh
 | 
			
		||||
 | 
			
		||||
set -x
 | 
			
		||||
function RETVAL() {
 | 
			
		||||
  rt=$1
 | 
			
		||||
@@ -11,39 +13,46 @@ function RETVAL() {
 | 
			
		||||
 | 
			
		||||
#当前目录
 | 
			
		||||
cpath=$(pwd)
 | 
			
		||||
#ver=`cat server/base/app_ver.go | grep APP_VER | awk '{print $3}' | sed 's/"//g'`
 | 
			
		||||
 | 
			
		||||
ver=$(cat version)
 | 
			
		||||
echo "当前版本 $ver"
 | 
			
		||||
echo $ver
 | 
			
		||||
 | 
			
		||||
echo "编译前端项目"
 | 
			
		||||
cd $cpath/web
 | 
			
		||||
 | 
			
		||||
#国内可替换源加快速度
 | 
			
		||||
#npx browserslist@latest --update-db
 | 
			
		||||
yarn install --registry=https://registry.npmmirror.com
 | 
			
		||||
yarn run build
 | 
			
		||||
RETVAL $?
 | 
			
		||||
 | 
			
		||||
echo "编译二进制文件"
 | 
			
		||||
echo "copy二进制文件"
 | 
			
		||||
cd $cpath/server
 | 
			
		||||
rm -rf ui
 | 
			
		||||
cp -rf $cpath/web/ui .
 | 
			
		||||
 | 
			
		||||
# -tags osusergo,netgo,sqlite_omit_load_extension
 | 
			
		||||
flags="-v -trimpath"
 | 
			
		||||
flags="-trimpath"
 | 
			
		||||
ldflags="-s -w -extldflags '-static' -X main.appVer=$ver -X main.commitId=$(git rev-parse HEAD) -X main.buildDate=$(date --iso-8601=seconds)"
 | 
			
		||||
#github action
 | 
			
		||||
gopath=/go
 | 
			
		||||
 | 
			
		||||
# -extldflags '-static'
 | 
			
		||||
ldflags="-s -w -X main.appVer=$ver -X main.commitId=$(git rev-parse HEAD) -X main.date=$(date -Iseconds)"
 | 
			
		||||
 | 
			
		||||
#国内可替换源加快速度
 | 
			
		||||
export GOPROXY=https://goproxy.io
 | 
			
		||||
dockercmd=$(
 | 
			
		||||
  cat <<EOF
 | 
			
		||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
 | 
			
		||||
apk add gcc g++ musl musl-dev tzdata
 | 
			
		||||
export GOPROXY=https://goproxy.cn
 | 
			
		||||
go mod tidy
 | 
			
		||||
go build -o anylink $flags -ldflags "$ldflags"
 | 
			
		||||
echo "build:"
 | 
			
		||||
export CGO_ENABLED=1
 | 
			
		||||
go build -v -o anylink_amd64 $flags -ldflags "$ldflags"
 | 
			
		||||
./anylink_amd64 -v
 | 
			
		||||
EOF
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
cd $cpath
 | 
			
		||||
#使用 musl-dev 编译
 | 
			
		||||
docker run -q --rm -v $PWD:/app -v $gopath:/go -w /app --platform=linux/amd64 \
 | 
			
		||||
  golang:1.20-alpine3.19 sh -c "$dockercmd"
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
#arm64编译
 | 
			
		||||
docker run -q --rm -v $PWD:/app -v $gopath:/go -w /app --platform=linux/arm64 \
 | 
			
		||||
  golang:1.20-alpine3.19 go build -o anylink_arm64 $flags -ldflags "$ldflags"
 | 
			
		||||
./anylink_arm64 -v
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
cd $cpath
 | 
			
		||||
 | 
			
		||||
echo "整理部署文件"
 | 
			
		||||
deploy="anylink-deploy"
 | 
			
		||||
rm -rf $deploy ${deploy}.tar.gz
 | 
			
		||||
 
 | 
			
		||||
@@ -8,17 +8,16 @@ echo $ver
 | 
			
		||||
# 生成时间 2024-01-30T21:41:27+08:00
 | 
			
		||||
# date -Iseconds
 | 
			
		||||
 | 
			
		||||
#docker run -it --rm -v $PWD/web:/app -w /app node:16-alpine \
 | 
			
		||||
#  sh -c "yarn install --registry=https://registry.npmmirror.com && yarn run build"
 | 
			
		||||
#bash ./build_web.sh
 | 
			
		||||
 | 
			
		||||
# docker buildx build --platform linux/amd64,linux/arm64 本地不生成镜像
 | 
			
		||||
docker build -t bjdgyc/anylink:latest --progress=plain --build-arg CN="yes" --build-arg appVer=$ver \
 | 
			
		||||
  --build-arg commitId=$(git rev-parse HEAD) -f docker/Dockerfile .
 | 
			
		||||
# docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 本地不生成镜像
 | 
			
		||||
docker build -t bjdgyc/anylink:latest --no-cache --progress=plain --platform linux/amd64 \
 | 
			
		||||
  --build-arg CN="yes" --build-arg appVer=$ver --build-arg commitId=$(git rev-parse HEAD) -f docker/Dockerfile .
 | 
			
		||||
 | 
			
		||||
echo "docker tag latest $ver"
 | 
			
		||||
docker tag bjdgyc/anylink:latest bjdgyc/anylink:$ver
 | 
			
		||||
 | 
			
		||||
#exit 0
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
docker tag bjdgyc/anylink:latest registry.cn-qingdao.aliyuncs.com/bjdgyc/anylink:latest
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								build_web.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								build_web.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
docker run -it --rm -v $PWD/web:/app -w /app node:16-alpine \
 | 
			
		||||
  sh -c "yarn install --registry=https://registry.npmmirror.com && yarn run build"
 | 
			
		||||
 | 
			
		||||
rm -rf server/ui
 | 
			
		||||
cp -r web/ui server/ui
 | 
			
		||||
@@ -4,7 +4,8 @@ set -x
 | 
			
		||||
 | 
			
		||||
#TODO 本地打包时使用镜像
 | 
			
		||||
if [[ $CN == "yes" ]]; then
 | 
			
		||||
  sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
 | 
			
		||||
  #sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
 | 
			
		||||
  sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
 | 
			
		||||
  export GOPROXY=https://goproxy.cn
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
@@ -20,7 +21,7 @@ go mod tidy
 | 
			
		||||
 | 
			
		||||
echo "start build"
 | 
			
		||||
 | 
			
		||||
ldflags="-s -w -X main.appVer=$appVer -X main.commitId=$commitId -X main.buildDate=$(date -Iseconds) -extldflags '-static' "
 | 
			
		||||
ldflags="-s -w -X main.appVer=$appVer -X main.commitId=$commitId -X main.buildDate=$(date -Iseconds) -extldflags \"-static\" "
 | 
			
		||||
 | 
			
		||||
export CGO_ENABLED=1
 | 
			
		||||
go build -v -o anylink -trimpath -ldflags "$ldflags"
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,8 @@ set -x
 | 
			
		||||
 | 
			
		||||
#TODO 本地打包时使用镜像
 | 
			
		||||
if [[ $CN == "yes" ]]; then
 | 
			
		||||
  sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
 | 
			
		||||
  #sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
 | 
			
		||||
  sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
 | 
			
		||||
  export GOPROXY=https://goproxy.cn
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,74 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
#github action release.sh
 | 
			
		||||
 | 
			
		||||
set -x
 | 
			
		||||
function RETVAL() {
 | 
			
		||||
  rt=$1
 | 
			
		||||
  if [ $rt != 0 ]; then
 | 
			
		||||
    echo $rt
 | 
			
		||||
    exit 1
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#当前目录
 | 
			
		||||
cpath=$(pwd)
 | 
			
		||||
 | 
			
		||||
ver=$(cat version)
 | 
			
		||||
echo $ver
 | 
			
		||||
 | 
			
		||||
echo "copy二进制文件"
 | 
			
		||||
cd $cpath/server
 | 
			
		||||
# -tags osusergo,netgo,sqlite_omit_load_extension
 | 
			
		||||
flags="-trimpath"
 | 
			
		||||
ldflags="-s -w -extldflags '-static' -X main.appVer=$ver -X main.commitId=$(git rev-parse HEAD) -X main.buildDate=$(date --iso-8601=seconds)"
 | 
			
		||||
#github action
 | 
			
		||||
gopath=/go
 | 
			
		||||
 | 
			
		||||
dockercmd=$(
 | 
			
		||||
  cat <<EOF
 | 
			
		||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
 | 
			
		||||
apk add gcc g++ musl musl-dev tzdata
 | 
			
		||||
export GOPROXY=https://goproxy.cn
 | 
			
		||||
go mod tidy
 | 
			
		||||
echo "build:"
 | 
			
		||||
export CGO_ENABLED=1
 | 
			
		||||
go build -v -o anylink_amd64 $flags -ldflags "$ldflags"
 | 
			
		||||
./anylink_amd64 -v
 | 
			
		||||
EOF
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
#使用 musl-dev 编译
 | 
			
		||||
docker run -q --rm -v $PWD:/app -v $gopath:/go -w /app --platform=linux/amd64 \
 | 
			
		||||
  golang:1.20-alpine3.19 sh -c "$dockercmd"
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
#arm64编译
 | 
			
		||||
docker run -q --rm -v $PWD:/app -v $gopath:/go -w /app --platform=linux/arm64 \
 | 
			
		||||
  golang:1.20-alpine3.19 go build -o anylink_arm64 $flags -ldflags "$ldflags"
 | 
			
		||||
./anylink_arm64 -v
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
cd $cpath
 | 
			
		||||
 | 
			
		||||
echo "整理部署文件"
 | 
			
		||||
deploy="anylink-deploy"
 | 
			
		||||
rm -rf $deploy ${deploy}.tar.gz
 | 
			
		||||
mkdir $deploy
 | 
			
		||||
mkdir $deploy/log
 | 
			
		||||
 | 
			
		||||
cp -r server/anylink $deploy
 | 
			
		||||
cp -r server/bridge-init.sh $deploy
 | 
			
		||||
cp -r server/conf $deploy
 | 
			
		||||
 | 
			
		||||
cp -r systemd $deploy
 | 
			
		||||
cp -r LICENSE $deploy
 | 
			
		||||
cp -r home $deploy
 | 
			
		||||
 | 
			
		||||
tar zcvf ${deploy}.tar.gz $deploy
 | 
			
		||||
 | 
			
		||||
#注意使用root权限运行
 | 
			
		||||
#cd anylink-deploy
 | 
			
		||||
#sudo ./anylink --conf="conf/server.toml"
 | 
			
		||||
@@ -84,6 +84,7 @@ func authMiddleware(next http.Handler) http.Handler {
 | 
			
		||||
		w.Header().Set("Access-Control-Allow-Methods", "GET,POST,OPTIONS")
 | 
			
		||||
		w.Header().Set("Access-Control-Allow-Headers", "*")
 | 
			
		||||
		if r.Method == http.MethodOptions {
 | 
			
		||||
			// w.WriteHeader(http.StatusOK)
 | 
			
		||||
			// 正式环境不支持 OPTIONS
 | 
			
		||||
			w.WriteHeader(http.StatusForbidden)
 | 
			
		||||
			return
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@ func SendMail(subject, to, htmlBody string) error {
 | 
			
		||||
	// - PLAIN (default)
 | 
			
		||||
	// - LOGIN
 | 
			
		||||
	// - CRAM-MD5
 | 
			
		||||
	server.Authentication = mail.AuthPlain
 | 
			
		||||
	server.Authentication = mail.AuthAuto
 | 
			
		||||
 | 
			
		||||
	// Variable to keep alive connection
 | 
			
		||||
	server.KeepAlive = false
 | 
			
		||||
 
 | 
			
		||||
@@ -33,6 +33,7 @@ type ServerConfig struct {
 | 
			
		||||
	// LinkAddr      string `json:"link_addr"`
 | 
			
		||||
	Conf           string `json:"conf"`
 | 
			
		||||
	Profile        string `json:"profile"`
 | 
			
		||||
	ProfileName    string `json:"profile_name"`
 | 
			
		||||
	ServerAddr     string `json:"server_addr"`
 | 
			
		||||
	ServerDTLSAddr string `json:"server_dtls_addr"`
 | 
			
		||||
	ServerDTLS     bool   `json:"server_dtls"`
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,9 @@ type config struct {
 | 
			
		||||
var configs = []config{
 | 
			
		||||
	{Typ: cfgStr, Name: "conf", Usage: "config file", ValStr: "./conf/server.toml", Short: "c"},
 | 
			
		||||
	{Typ: cfgStr, Name: "profile", Usage: "profile.xml file", ValStr: "./conf/profile.xml"},
 | 
			
		||||
	{Typ: cfgStr, Name: "profile_name", Usage: "profile name(用于区分不同网站的配置)", ValStr: "anylink"},
 | 
			
		||||
	{Typ: cfgStr, Name: "server_addr", Usage: "TCP服务监听地址(任意端口)", ValStr: ":443"},
 | 
			
		||||
	{Typ: cfgBool, Name: "server_dtls", Usage: "开启DTLS", ValBool: true},
 | 
			
		||||
	{Typ: cfgBool, Name: "server_dtls", Usage: "开启DTLS", ValBool: false},
 | 
			
		||||
	{Typ: cfgStr, Name: "server_dtls_addr", Usage: "DTLS监听地址(任意端口)", ValStr: ":443"},
 | 
			
		||||
	{Typ: cfgStr, Name: "admin_addr", Usage: "后台服务监听地址", ValStr: ":8800"},
 | 
			
		||||
	{Typ: cfgBool, Name: "proxy_protocol", Usage: "TCP代理协议", ValBool: false},
 | 
			
		||||
@@ -53,10 +54,10 @@ var configs = []config{
 | 
			
		||||
	{Typ: cfgInt, Name: "ip_lease", Usage: "IP租期(秒)", ValInt: 86400},
 | 
			
		||||
	{Typ: cfgInt, Name: "max_client", Usage: "最大用户连接", ValInt: 200},
 | 
			
		||||
	{Typ: cfgInt, Name: "max_user_client", Usage: "最大单用户连接", ValInt: 3},
 | 
			
		||||
	{Typ: cfgInt, Name: "cstp_keepalive", Usage: "keepalive时间(秒)", ValInt: 5},
 | 
			
		||||
	{Typ: cfgInt, Name: "cstp_dpd", Usage: "死链接检测时间(秒)", ValInt: 12},
 | 
			
		||||
	{Typ: cfgInt, Name: "mobile_keepalive", Usage: "移动端keepalive接检测时间(秒)", ValInt: 10},
 | 
			
		||||
	{Typ: cfgInt, Name: "mobile_dpd", Usage: "移动端死链接检测时间(秒)", ValInt: 22},
 | 
			
		||||
	{Typ: cfgInt, Name: "cstp_keepalive", Usage: "keepalive时间(秒)", ValInt: 20},
 | 
			
		||||
	{Typ: cfgInt, Name: "cstp_dpd", Usage: "死链接检测时间(秒)", ValInt: 30},
 | 
			
		||||
	{Typ: cfgInt, Name: "mobile_keepalive", Usage: "移动端keepalive接检测时间(秒)", ValInt: 40},
 | 
			
		||||
	{Typ: cfgInt, Name: "mobile_dpd", Usage: "移动端死链接检测时间(秒)", ValInt: 60},
 | 
			
		||||
	{Typ: cfgInt, Name: "mtu", Usage: "最大传输单元MTU", ValInt: 1460},
 | 
			
		||||
	{Typ: cfgInt, Name: "idle_timeout", Usage: "空闲链接超时时间(秒)-超时后断开链接,0关闭此功能", ValInt: 1800},
 | 
			
		||||
	{Typ: cfgInt, Name: "session_timeout", Usage: "session过期时间(秒)-用于断线重连,0永不过期", ValInt: 3600},
 | 
			
		||||
 
 | 
			
		||||
@@ -58,10 +58,9 @@ func CheckModOrLoad(mod string) {
 | 
			
		||||
			// 文件存在
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		err = fmt.Errorf("[error] Linux tunFile is null %s", tunPath)
 | 
			
		||||
		log.Println(err)
 | 
			
		||||
		return
 | 
			
		||||
		// panic(err)
 | 
			
		||||
		// err = fmt.Errorf("[error] Linux tunFile is null %s", tunPath)
 | 
			
		||||
		// log.Println(err)
 | 
			
		||||
		// return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if InContainer {
 | 
			
		||||
@@ -76,7 +75,7 @@ func CheckModOrLoad(mod string) {
 | 
			
		||||
	cmd := exec.Command("sh", "-c", cmdstr)
 | 
			
		||||
	b, err := cmd.CombinedOutput()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Println(string(b))
 | 
			
		||||
		log.Println(mod, string(b))
 | 
			
		||||
		panic(err)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,9 @@ cert_file = "./conf/vpn_cert.pem"
 | 
			
		||||
cert_key = "./conf/vpn_cert.key"
 | 
			
		||||
files_path = "./conf/files"
 | 
			
		||||
profile = "./conf/profile.xml"
 | 
			
		||||
#profile name(用于区分不同网站的配置)
 | 
			
		||||
#客户端存放位置 C:\ProgramData\Cisco\Cisco Secure Client\VPN\Profile
 | 
			
		||||
profile_name = "anylink"
 | 
			
		||||
#日志目录,为空写入标准输出
 | 
			
		||||
#log_path = "./log"
 | 
			
		||||
log_path = ""
 | 
			
		||||
@@ -32,7 +35,7 @@ jwt_secret = "abcdef.0123456789.abcdef"
 | 
			
		||||
#TCP服务监听地址(任意端口)
 | 
			
		||||
server_addr = ":443"
 | 
			
		||||
#开启 DTLS
 | 
			
		||||
server_dtls = true
 | 
			
		||||
server_dtls = false
 | 
			
		||||
#UDP监听地址(任意端口)
 | 
			
		||||
server_dtls_addr = ":443"
 | 
			
		||||
#后台服务监听地址
 | 
			
		||||
@@ -44,6 +47,7 @@ proxy_protocol = false
 | 
			
		||||
link_mode = "tun"
 | 
			
		||||
 | 
			
		||||
#客户端分配的ip地址池
 | 
			
		||||
#docker环境一般默认 eth0,其他情况根据实际网卡信息填写
 | 
			
		||||
ipv4_master = "eth0"
 | 
			
		||||
ipv4_cidr = "192.168.90.0/24"
 | 
			
		||||
ipv4_gateway = "192.168.90.1"
 | 
			
		||||
@@ -61,10 +65,14 @@ ip_lease = 86400
 | 
			
		||||
default_group = "one"
 | 
			
		||||
 | 
			
		||||
#客户端失效检测时间(秒) dpd > keepalive
 | 
			
		||||
cstp_keepalive = 5
 | 
			
		||||
cstp_dpd = 12
 | 
			
		||||
mobile_keepalive = 10
 | 
			
		||||
mobile_dpd = 22
 | 
			
		||||
#cstp_keepalive = 5
 | 
			
		||||
#cstp_dpd = 12
 | 
			
		||||
#mobile_keepalive = 10
 | 
			
		||||
#mobile_dpd = 22
 | 
			
		||||
cstp_keepalive = 20
 | 
			
		||||
cstp_dpd = 30
 | 
			
		||||
mobile_keepalive = 40
 | 
			
		||||
mobile_dpd = 60
 | 
			
		||||
 | 
			
		||||
#设置最大传输单元
 | 
			
		||||
mtu = 1460
 | 
			
		||||
@@ -93,4 +101,5 @@ no_compress_limit = 256
 | 
			
		||||
#客户端显示详细错误信息(线上环境慎开启)
 | 
			
		||||
display_error = false
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#排除出口ip路由(出口ip不加密传输)
 | 
			
		||||
exclude_export_ip = true
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ jwt_secret = "abcdef.0123456789.abcdef"
 | 
			
		||||
#TCP服务监听地址(任意端口)
 | 
			
		||||
server_addr = ":443"
 | 
			
		||||
#开启 DTLS
 | 
			
		||||
server_dtls = true
 | 
			
		||||
server_dtls = false
 | 
			
		||||
#UDP监听地址(任意端口)
 | 
			
		||||
server_dtls_addr = ":443"
 | 
			
		||||
#后台服务监听地址
 | 
			
		||||
@@ -40,6 +40,7 @@ max_user_client = 3
 | 
			
		||||
#虚拟网络类型[tun macvtap]
 | 
			
		||||
link_mode = "tun"
 | 
			
		||||
#客户端分配的ip地址池
 | 
			
		||||
#docker环境一般默认 eth0,其他情况根据实际网卡信息填写
 | 
			
		||||
ipv4_master = "eth0"
 | 
			
		||||
ipv4_cidr = "192.168.90.0/24"
 | 
			
		||||
ipv4_gateway = "192.168.90.1"
 | 
			
		||||
 
 | 
			
		||||
@@ -142,7 +142,7 @@ func addInitData() error {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	g1 := Group{
 | 
			
		||||
		Name:         "ops",
 | 
			
		||||
		Name:         "all",
 | 
			
		||||
		AllowLan:     true,
 | 
			
		||||
		ClientDns:    []ValData{{Val: "114.114.114.114"}},
 | 
			
		||||
		RouteInclude: []ValData{{Val: All}},
 | 
			
		||||
@@ -153,6 +153,18 @@ func addInitData() error {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	g2 := Group{
 | 
			
		||||
		Name:         "ops",
 | 
			
		||||
		AllowLan:     true,
 | 
			
		||||
		ClientDns:    []ValData{{Val: "114.114.114.114"}},
 | 
			
		||||
		RouteInclude: []ValData{{Val: "10.0.0.0/8"}},
 | 
			
		||||
		Status:       1,
 | 
			
		||||
	}
 | 
			
		||||
	err = SetGroup(&g2)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,8 @@ const (
 | 
			
		||||
	UserLogoutAdmin    = 4 // 账号被管理员踢下线
 | 
			
		||||
	UserLogoutExpire   = 5 // 账号过期被踢下线
 | 
			
		||||
	UserIdleTimeout    = 6 // 用户空闲链接超时
 | 
			
		||||
	UserLogoutOneAdmin = 7 // 账号被管理员一键下线
 | 
			
		||||
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type UserActLogProcess struct {
 | 
			
		||||
@@ -64,6 +66,7 @@ var (
 | 
			
		||||
			UserLogoutAdmin:    "账号被管理员踢下线",
 | 
			
		||||
			UserLogoutExpire:   "账号过期被踢下线",
 | 
			
		||||
			UserIdleTimeout:    "用户空闲链接超时",
 | 
			
		||||
			UserLogoutOneAdmin: "账号被管理员一键下线",
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
)
 | 
			
		||||
@@ -126,6 +129,9 @@ func (ua *UserActLogProcess) GetStatusOpsWithTag() interface{} {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ua *UserActLogProcess) GetInfoOpsById(id uint8) string {
 | 
			
		||||
	if int(id) >= len(ua.InfoOps) {
 | 
			
		||||
		return "未知的信息类型"
 | 
			
		||||
	}
 | 
			
		||||
	return ua.InfoOps[id]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -139,7 +145,7 @@ func (ua *UserActLogProcess) ParseUserAgent(userAgent string) (os_idx, client_id
 | 
			
		||||
	os_idx = 0
 | 
			
		||||
	if strings.Contains(userAgent, "windows") {
 | 
			
		||||
		os_idx = 1
 | 
			
		||||
	} else if strings.Contains(userAgent, "mac os") || strings.Contains(userAgent, "darwin_i386") {
 | 
			
		||||
	} else if strings.Contains(userAgent, "mac os") || strings.Contains(userAgent, "darwin_i386") || strings.Contains(userAgent, "darwin_amd64") || strings.Contains(userAgent, "darwin_arm64") {
 | 
			
		||||
		os_idx = 2
 | 
			
		||||
	} else if strings.Contains(userAgent, "darwin_arm") || strings.Contains(userAgent, "apple") {
 | 
			
		||||
		os_idx = 5
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ require (
 | 
			
		||||
	github.com/go-acme/lego/v4 v4.15.0
 | 
			
		||||
	github.com/go-co-op/gocron v1.37.0
 | 
			
		||||
	github.com/go-ldap/ldap v3.0.3+incompatible
 | 
			
		||||
	github.com/go-sql-driver/mysql v1.7.1
 | 
			
		||||
	github.com/go-sql-driver/mysql v1.8.0
 | 
			
		||||
	github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a
 | 
			
		||||
	github.com/golang-jwt/jwt/v4 v4.5.0
 | 
			
		||||
	github.com/google/gopacket v1.1.19
 | 
			
		||||
@@ -32,10 +32,9 @@ require (
 | 
			
		||||
	github.com/stretchr/testify v1.8.4
 | 
			
		||||
	github.com/xhit/go-simple-mail/v2 v2.16.0
 | 
			
		||||
	github.com/xlzd/gotp v0.1.0
 | 
			
		||||
	github.com/xuri/excelize/v2 v2.8.0
 | 
			
		||||
	go.uber.org/atomic v1.11.0
 | 
			
		||||
	golang.org/x/crypto v0.19.0
 | 
			
		||||
	golang.org/x/net v0.21.0
 | 
			
		||||
	github.com/xuri/excelize/v2 v2.8.1
 | 
			
		||||
	golang.org/x/crypto v0.21.0
 | 
			
		||||
	golang.org/x/net v0.22.0
 | 
			
		||||
	golang.org/x/text v0.14.0
 | 
			
		||||
	golang.org/x/time v0.5.0
 | 
			
		||||
	layeh.com/radius v0.0.0-20231213012653-1006025d24f8
 | 
			
		||||
@@ -43,11 +42,12 @@ require (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
require (
 | 
			
		||||
	github.com/aliyun/alibaba-cloud-sdk-go v1.62.680 // indirect
 | 
			
		||||
	filippo.io/edwards25519 v1.1.0 // indirect
 | 
			
		||||
	github.com/aliyun/alibaba-cloud-sdk-go v1.62.690 // indirect
 | 
			
		||||
	github.com/cenkalti/backoff/v4 v4.2.1 // indirect
 | 
			
		||||
	github.com/cloudflare/cloudflare-go v0.88.0 // indirect
 | 
			
		||||
	github.com/cloudflare/cloudflare-go v0.89.0 // indirect
 | 
			
		||||
	github.com/felixge/httpsnoop v1.0.4 // indirect
 | 
			
		||||
	github.com/go-jose/go-jose/v3 v3.0.1 // indirect
 | 
			
		||||
	github.com/go-jose/go-jose/v3 v3.0.3 // indirect
 | 
			
		||||
	github.com/go-test/deep v1.1.0 // indirect
 | 
			
		||||
	github.com/google/go-querystring v1.1.0 // indirect
 | 
			
		||||
	github.com/google/uuid v1.6.0 // indirect
 | 
			
		||||
@@ -61,14 +61,15 @@ require (
 | 
			
		||||
	github.com/sagikazarmark/locafero v0.4.0 // indirect
 | 
			
		||||
	github.com/sagikazarmark/slog-shim v0.1.0 // indirect
 | 
			
		||||
	github.com/sourcegraph/conc v0.3.0 // indirect
 | 
			
		||||
	github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.860 // indirect
 | 
			
		||||
	github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.860 // indirect
 | 
			
		||||
	github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.873 // indirect
 | 
			
		||||
	github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.873 // indirect
 | 
			
		||||
	github.com/toorop/go-dkim v0.0.0-20240103092955-90b7d1423f92 // indirect
 | 
			
		||||
	github.com/yusufpapurcu/wmi v1.2.4 // indirect
 | 
			
		||||
	go.uber.org/atomic v1.11.0 // indirect
 | 
			
		||||
	go.uber.org/multierr v1.11.0 // indirect
 | 
			
		||||
	golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
 | 
			
		||||
	golang.org/x/mod v0.15.0 // indirect
 | 
			
		||||
	golang.org/x/tools v0.18.0 // indirect
 | 
			
		||||
	golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
 | 
			
		||||
	golang.org/x/mod v0.16.0 // indirect
 | 
			
		||||
	golang.org/x/tools v0.19.0 // indirect
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
require (
 | 
			
		||||
@@ -99,7 +100,7 @@ require (
 | 
			
		||||
	github.com/tklauser/numcpus v0.7.0 // indirect
 | 
			
		||||
	github.com/xuri/efp v0.0.0-20231025114914-d1ff6096ae53 // indirect
 | 
			
		||||
	github.com/xuri/nfp v0.0.0-20230919160717-d98342af3f05 // indirect
 | 
			
		||||
	golang.org/x/sys v0.17.0 // indirect
 | 
			
		||||
	golang.org/x/sys v0.18.0 // indirect
 | 
			
		||||
	gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
 | 
			
		||||
	gopkg.in/ini.v1 v1.67.0 // indirect
 | 
			
		||||
	gopkg.in/yaml.v3 v3.0.1 // indirect
 | 
			
		||||
 
 | 
			
		||||
@@ -1,17 +1,19 @@
 | 
			
		||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
 | 
			
		||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
 | 
			
		||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
 | 
			
		||||
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
 | 
			
		||||
gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU=
 | 
			
		||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
 | 
			
		||||
github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo=
 | 
			
		||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
 | 
			
		||||
github.com/aliyun/alibaba-cloud-sdk-go v1.62.680 h1:UhaUht5x8avOCBqcnfZvc04FwGsSiXMKXXQ3NwRk85Q=
 | 
			
		||||
github.com/aliyun/alibaba-cloud-sdk-go v1.62.680/go.mod h1:CJJYa1ZMxjlN/NbXEwmejEnBkhi0DV+Yb3B2lxf+74o=
 | 
			
		||||
github.com/aliyun/alibaba-cloud-sdk-go v1.62.690 h1:9ChlXyXZxVeHXPlsUqquutxxmrEGhNmfQiOW/YKIbq8=
 | 
			
		||||
github.com/aliyun/alibaba-cloud-sdk-go v1.62.690/go.mod h1:CJJYa1ZMxjlN/NbXEwmejEnBkhi0DV+Yb3B2lxf+74o=
 | 
			
		||||
github.com/arl/statsviz v0.6.0 h1:jbW1QJkEYQkufd//4NDYRSNBpwJNrdzPahF7ZmoGdyE=
 | 
			
		||||
github.com/arl/statsviz v0.6.0/go.mod h1:0toboo+YGSUXDaS4g1D5TVS4dXs7S7YYT5J/qnW2h8s=
 | 
			
		||||
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
 | 
			
		||||
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
 | 
			
		||||
github.com/cloudflare/cloudflare-go v0.88.0 h1:9CEnvaDMs8ydEBUSPChXmHDe2uJJKZoPpBO2QEr41gY=
 | 
			
		||||
github.com/cloudflare/cloudflare-go v0.88.0/go.mod h1:eyuehb1i6BNRc+ZwaTZAiRHeE+4jbKvHAns19oGeakg=
 | 
			
		||||
github.com/cloudflare/cloudflare-go v0.89.0 h1:3zoVntC8xmUR/weFEcNE1RizdW4LRZdQnJ/AN8DDa1U=
 | 
			
		||||
github.com/cloudflare/cloudflare-go v0.89.0/go.mod h1:eyuehb1i6BNRc+ZwaTZAiRHeE+4jbKvHAns19oGeakg=
 | 
			
		||||
github.com/coreos/go-iptables v0.7.0 h1:XWM3V+MPRr5/q51NuWSgU0fqMad64Zyxs8ZUoMsamr8=
 | 
			
		||||
github.com/coreos/go-iptables v0.7.0/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q=
 | 
			
		||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
 | 
			
		||||
@@ -36,15 +38,15 @@ github.com/go-acme/lego/v4 v4.15.0/go.mod h1:eeGhjW4zWT7Ccqa3sY7ayEqFLCAICx+mXgk
 | 
			
		||||
github.com/go-co-op/gocron v1.37.0 h1:ZYDJGtQ4OMhTLKOKMIch+/CY70Brbb1dGdooLEhh7b0=
 | 
			
		||||
github.com/go-co-op/gocron v1.37.0/go.mod h1:3L/n6BkO7ABj+TrfSVXLRzsP26zmikL4ISkLQ0O8iNY=
 | 
			
		||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
 | 
			
		||||
github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA=
 | 
			
		||||
github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
 | 
			
		||||
github.com/go-jose/go-jose/v3 v3.0.3 h1:fFKWeig/irsp7XD2zBxvnmA/XaRWp5V3CBsZXJF7G7k=
 | 
			
		||||
github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
 | 
			
		||||
github.com/go-ldap/ldap v3.0.3+incompatible h1:HTeSZO8hWMS1Rgb2Ziku6b8a7qRIZZMHjsvuZyatzwk=
 | 
			
		||||
github.com/go-ldap/ldap v3.0.3+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc=
 | 
			
		||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
 | 
			
		||||
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
 | 
			
		||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
 | 
			
		||||
github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI=
 | 
			
		||||
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
 | 
			
		||||
github.com/go-sql-driver/mysql v1.8.0 h1:UtktXaU2Nb64z/pLiGIxY4431SJ4/dR5cjMmlVHgnT4=
 | 
			
		||||
github.com/go-sql-driver/mysql v1.8.0/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
 | 
			
		||||
github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg=
 | 
			
		||||
github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
 | 
			
		||||
github.com/gocarina/gocsv v0.0.0-20231116093920-b87c2d0e983a h1:RYfmiM0zluBJOiPDJseKLEN4BapJ42uSi9SZBQ2YyiA=
 | 
			
		||||
@@ -59,10 +61,10 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
 | 
			
		||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
 | 
			
		||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
 | 
			
		||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
 | 
			
		||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 | 
			
		||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 | 
			
		||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 | 
			
		||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
 | 
			
		||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
 | 
			
		||||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
 | 
			
		||||
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
 | 
			
		||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
 | 
			
		||||
@@ -198,7 +200,6 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS
 | 
			
		||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
 | 
			
		||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 | 
			
		||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
 | 
			
		||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 | 
			
		||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 | 
			
		||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 | 
			
		||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
 | 
			
		||||
@@ -209,10 +210,10 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
 | 
			
		||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
 | 
			
		||||
github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
 | 
			
		||||
github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
 | 
			
		||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.860 h1:d5/YwGX6b5YgFU/0thsbs5aBp4aJJXBi7JyU1JHAaw0=
 | 
			
		||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.860/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
 | 
			
		||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.860 h1:PQ8wuVKhcjpYUW2gH3WWb92R3QF4YRWBCBZifp6SfHs=
 | 
			
		||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.860/go.mod h1:7gu9rKEmx7R/D0RvuaHmMqLLGBtIR6a6de9Yd5IwDBg=
 | 
			
		||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.873 h1:VdQ+lQ98CFwbmfQj02iMVWWzdwnKubuICIa2QhzQBJI=
 | 
			
		||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.873/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
 | 
			
		||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.873 h1:qawAviStyrk6b2bHvRvKxmiiL8Cu6KujtzAHktLqdFI=
 | 
			
		||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.873/go.mod h1:wqyJy+a/L53zH8pRDNOF+7t9iZhSPANmYSuUfvVp9NE=
 | 
			
		||||
github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4=
 | 
			
		||||
github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0=
 | 
			
		||||
github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4=
 | 
			
		||||
@@ -228,12 +229,10 @@ github.com/xhit/go-simple-mail/v2 v2.16.0 h1:ouGy/Ww4kuaqu2E2UrDw7SvLaziWTB60ICL
 | 
			
		||||
github.com/xhit/go-simple-mail/v2 v2.16.0/go.mod h1:b7P5ygho6SYE+VIqpxA6QkYfv4teeyG4MKqB3utRu98=
 | 
			
		||||
github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po=
 | 
			
		||||
github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8qg=
 | 
			
		||||
github.com/xuri/efp v0.0.0-20230802181842-ad255f2331ca/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
 | 
			
		||||
github.com/xuri/efp v0.0.0-20231025114914-d1ff6096ae53 h1:Chd9DkqERQQuHpXjR/HSV1jLZA6uaoiwwH3vSuF3IW0=
 | 
			
		||||
github.com/xuri/efp v0.0.0-20231025114914-d1ff6096ae53/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
 | 
			
		||||
github.com/xuri/excelize/v2 v2.8.0 h1:Vd4Qy809fupgp1v7X+nCS/MioeQmYVVzi495UCTqB7U=
 | 
			
		||||
github.com/xuri/excelize/v2 v2.8.0/go.mod h1:6iA2edBTKxKbZAa7X5bDhcCg51xdOn1Ar5sfoXRGrQg=
 | 
			
		||||
github.com/xuri/nfp v0.0.0-20230819163627-dc951e3ffe1a/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
 | 
			
		||||
github.com/xuri/excelize/v2 v2.8.1 h1:pZLMEwK8ep+CLIUWpWmvW8IWE/yxqG0I1xcN6cVMGuQ=
 | 
			
		||||
github.com/xuri/excelize/v2 v2.8.1/go.mod h1:oli1E4C3Pa5RXg1TBXn4ENCXDV5JUMlBluUhG7c+CEE=
 | 
			
		||||
github.com/xuri/nfp v0.0.0-20230919160717-d98342af3f05 h1:qhbILQo1K3mphbwKh1vNm4oGezE1eF9fQWmNiIpSfI4=
 | 
			
		||||
github.com/xuri/nfp v0.0.0-20230919160717-d98342af3f05/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
 | 
			
		||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
 | 
			
		||||
@@ -246,34 +245,33 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
 | 
			
		||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
 | 
			
		||||
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
 | 
			
		||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
 | 
			
		||||
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
 | 
			
		||||
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
 | 
			
		||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
 | 
			
		||||
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
 | 
			
		||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
 | 
			
		||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 | 
			
		||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 | 
			
		||||
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 | 
			
		||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 | 
			
		||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
 | 
			
		||||
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE=
 | 
			
		||||
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
 | 
			
		||||
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ=
 | 
			
		||||
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc=
 | 
			
		||||
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
 | 
			
		||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
 | 
			
		||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
 | 
			
		||||
golang.org/x/image v0.11.0 h1:ds2RoQvBvYTiJkwpSFDwCcDFNX7DqjL2WsUgTNk0Ooo=
 | 
			
		||||
golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8=
 | 
			
		||||
golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4=
 | 
			
		||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
 | 
			
		||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
 | 
			
		||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
 | 
			
		||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
 | 
			
		||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
 | 
			
		||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
 | 
			
		||||
golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8=
 | 
			
		||||
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
 | 
			
		||||
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
 | 
			
		||||
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
 | 
			
		||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
 | 
			
		||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 | 
			
		||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 | 
			
		||||
@@ -283,8 +281,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
 | 
			
		||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
 | 
			
		||||
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
 | 
			
		||||
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
 | 
			
		||||
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
 | 
			
		||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
 | 
			
		||||
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
 | 
			
		||||
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
 | 
			
		||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
			
		||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
			
		||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
			
		||||
@@ -305,8 +303,9 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
			
		||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
			
		||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
			
		||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 | 
			
		||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
 | 
			
		||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 | 
			
		||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
 | 
			
		||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 | 
			
		||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
 | 
			
		||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
 | 
			
		||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
 | 
			
		||||
@@ -314,6 +313,7 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
 | 
			
		||||
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
 | 
			
		||||
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
 | 
			
		||||
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
 | 
			
		||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
 | 
			
		||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 | 
			
		||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 | 
			
		||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
 | 
			
		||||
@@ -333,8 +333,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
 | 
			
		||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
 | 
			
		||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
 | 
			
		||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
 | 
			
		||||
golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ=
 | 
			
		||||
golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg=
 | 
			
		||||
golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw=
 | 
			
		||||
golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc=
 | 
			
		||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 | 
			
		||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 | 
			
		||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 | 
			
		||||
 
 | 
			
		||||
@@ -32,8 +32,10 @@ func startDtls() {
 | 
			
		||||
 | 
			
		||||
	logf := logging.NewDefaultLoggerFactory()
 | 
			
		||||
	logf.Writer = base.GetBaseLw()
 | 
			
		||||
	// logf.DefaultLogLevel = logging.LogLevelTrace
 | 
			
		||||
	logf.DefaultLogLevel = logging.LogLevelInfo
 | 
			
		||||
	if base.GetLogLevel() == base.LogLevelTrace {
 | 
			
		||||
		// logf.DefaultLogLevel = logging.LogLevelTrace
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// https://github.com/pion/dtls/pull/369
 | 
			
		||||
	sessStore := &sessionStore{}
 | 
			
		||||
 
 | 
			
		||||
@@ -137,7 +137,7 @@ func LinkAuth(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	other := &dbdata.SettingOther{}
 | 
			
		||||
	_ = dbdata.SettingGet(other)
 | 
			
		||||
	rd := RequestData{SessionId: sess.Sid, SessionToken: sess.Sid + "@" + sess.Token,
 | 
			
		||||
		Banner: other.Banner, ProfileHash: profileHash}
 | 
			
		||||
		Banner: other.Banner, ProfileName: base.Cfg.ProfileName, ProfileHash: profileHash}
 | 
			
		||||
	w.WriteHeader(http.StatusOK)
 | 
			
		||||
	tplRequest(tpl_complete, w, rd)
 | 
			
		||||
	base.Debug("login", cr.Auth.Username, userAgent)
 | 
			
		||||
@@ -175,6 +175,7 @@ type RequestData struct {
 | 
			
		||||
	SessionId    string
 | 
			
		||||
	SessionToken string
 | 
			
		||||
	Banner       string
 | 
			
		||||
	ProfileName  string
 | 
			
		||||
	ProfileHash  string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -227,7 +228,7 @@ var auth_complete = `<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
        <vpn-profile-manifest>
 | 
			
		||||
            <vpn rev="1.0">
 | 
			
		||||
                <file type="profile" service-type="user">
 | 
			
		||||
                    <uri>/profile.xml</uri>
 | 
			
		||||
                    <uri>/profile_{{.ProfileName}}.xml</uri>
 | 
			
		||||
                    <hash type="sha1">{{.ProfileHash}}</hash>
 | 
			
		||||
                </file>
 | 
			
		||||
            </vpn>
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,9 @@ package handler
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/xml"
 | 
			
		||||
	"log"
 | 
			
		||||
	"os/exec"
 | 
			
		||||
 | 
			
		||||
	"github.com/bjdgyc/anylink/base"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const BufferSize = 2048
 | 
			
		||||
@@ -46,7 +47,7 @@ func execCmd(cmdStrs []string) error {
 | 
			
		||||
		cmd := exec.Command("sh", "-c", cmdStr)
 | 
			
		||||
		b, err := cmd.CombinedOutput()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			log.Println(string(b))
 | 
			
		||||
			base.Error(cmdStr, string(b))
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -25,9 +25,9 @@ func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessio
 | 
			
		||||
		n         int
 | 
			
		||||
		dataLen   uint16
 | 
			
		||||
		dead      = time.Second * time.Duration(cSess.CstpDpd+5)
 | 
			
		||||
		idle      = time.Second * time.Duration(base.Cfg.IdleTimeout)
 | 
			
		||||
		idle      = int64(base.Cfg.IdleTimeout)
 | 
			
		||||
		checkIdle = base.Cfg.IdleTimeout > 0
 | 
			
		||||
		lastTime  time.Time
 | 
			
		||||
		lastTime  int64
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	go cstpWrite(conn, bufRW, cSess)
 | 
			
		||||
@@ -61,7 +61,7 @@ func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessio
 | 
			
		||||
			// 判断超时时间
 | 
			
		||||
			if checkIdle {
 | 
			
		||||
				lastTime = cSess.LastDataTime.Load()
 | 
			
		||||
				if lastTime.Before(utils.NowSec().Add(-idle)) {
 | 
			
		||||
				if lastTime < (utils.NowSec().Unix() - idle) {
 | 
			
		||||
					base.Warn("IdleTimeout", cSess.Username, cSess.IpAddr, conn.RemoteAddr(), "lastTime", lastTime)
 | 
			
		||||
					sessdata.CloseSess(cSess.Sess.Token, dbdata.UserIdleTimeout)
 | 
			
		||||
					return
 | 
			
		||||
@@ -69,13 +69,13 @@ func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessio
 | 
			
		||||
			}
 | 
			
		||||
		case 0x05: // DISCONNECT
 | 
			
		||||
			cSess.UserLogoutCode = dbdata.UserLogoutClient
 | 
			
		||||
			base.Debug("DISCONNECT", cSess.Username, cSess.IpAddr, conn.RemoteAddr())
 | 
			
		||||
			base.Debug("DISCONNECT", cSess.Username, cSess.IpAddr, conn.RemoteAddr(), n, string(pl.Data[9:n]))
 | 
			
		||||
			sessdata.CloseSess(cSess.Sess.Token, dbdata.UserLogoutClient)
 | 
			
		||||
			return
 | 
			
		||||
		case 0x03: // DPD-REQ
 | 
			
		||||
			base.Trace("recv LinkCstp DPD-REQ", cSess.Username, cSess.IpAddr, conn.RemoteAddr())
 | 
			
		||||
			base.Trace("recv LinkCstp DPD-REQ", cSess.Username, cSess.IpAddr, conn.RemoteAddr(), n, pl.Data[:n])
 | 
			
		||||
			pl.PType = 0x04
 | 
			
		||||
			pl.Data = pl.Data[:n]
 | 
			
		||||
			// pl.Data = pl.Data[:n]
 | 
			
		||||
			if payloadOutCstp(cSess, pl) {
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
@@ -113,7 +113,7 @@ func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessio
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			// 只记录返回正确的数据时间
 | 
			
		||||
			cSess.LastDataTime.Store(utils.NowSec())
 | 
			
		||||
			cSess.LastDataTime.Store(utils.NowSec().Unix())
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -169,7 +169,7 @@ func cstpWrite(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessi
 | 
			
		||||
				binary.BigEndian.PutUint16(pl.Data[4:6], uint16(l))
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			// pl.Data = append(pl.Data[:0], plHeader...)
 | 
			
		||||
			pl.Data = append(pl.Data[:0], plHeader...)
 | 
			
		||||
			// 设置头类型
 | 
			
		||||
			pl.Data[6] = pl.PType
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -62,8 +62,9 @@ func LinkDtls(conn net.Conn, cSess *sessdata.ConnSession) {
 | 
			
		||||
			base.Debug("DISCONNECT DTLS", cSess.Username, cSess.IpAddr, conn.RemoteAddr())
 | 
			
		||||
			return
 | 
			
		||||
		case 0x03: // DPD-REQ
 | 
			
		||||
			base.Trace("recv LinkDtls DPD-REQ", cSess.Username, cSess.IpAddr, conn.RemoteAddr())
 | 
			
		||||
			base.Trace("recv LinkDtls DPD-REQ", cSess.Username, cSess.IpAddr, conn.RemoteAddr(), n, pl.Data[:n])
 | 
			
		||||
			pl.PType = 0x04
 | 
			
		||||
			// 从零开始 可以直接赋值
 | 
			
		||||
			pl.Data = pl.Data[:n]
 | 
			
		||||
			if payloadOutDtls(cSess, dSess, pl) {
 | 
			
		||||
				return
 | 
			
		||||
@@ -95,7 +96,7 @@ func LinkDtls(conn net.Conn, cSess *sessdata.ConnSession) {
 | 
			
		||||
				return
 | 
			
		||||
			}
 | 
			
		||||
			// 只记录返回正确的数据时间
 | 
			
		||||
			cSess.LastDataTime.Store(utils.NowSec())
 | 
			
		||||
			cSess.LastDataTime.Store(utils.NowSec().Unix())
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,12 +4,16 @@ import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
 | 
			
		||||
	"github.com/bjdgyc/anylink/base"
 | 
			
		||||
	"github.com/bjdgyc/anylink/pkg/utils"
 | 
			
		||||
	"github.com/bjdgyc/anylink/sessdata"
 | 
			
		||||
	"github.com/coreos/go-iptables/iptables"
 | 
			
		||||
	"github.com/songgao/water"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func checkTun() {
 | 
			
		||||
	// 测试ip命令
 | 
			
		||||
	base.CheckModOrLoad("tun")
 | 
			
		||||
 | 
			
		||||
	// 测试tun
 | 
			
		||||
	cfg := water.Config{
 | 
			
		||||
		DeviceType: water.TUN,
 | 
			
		||||
@@ -21,16 +25,14 @@ func checkTun() {
 | 
			
		||||
	}
 | 
			
		||||
	defer ifce.Close()
 | 
			
		||||
 | 
			
		||||
	// 测试ip命令
 | 
			
		||||
	base.CheckModOrLoad("tun")
 | 
			
		||||
 | 
			
		||||
	cmdstr1 := fmt.Sprintf("ip link set dev %s up mtu %s multicast off", ifce.Name(), "1399")
 | 
			
		||||
	err = execCmd([]string{cmdstr1})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		base.Fatal("testTun err: ", err)
 | 
			
		||||
	}
 | 
			
		||||
	// 开启服务器转发
 | 
			
		||||
	if err := execCmd([]string{"sysctl -w net.ipv4.ip_forward=1"}); err != nil {
 | 
			
		||||
	err = execCmd([]string{"sysctl -w net.ipv4.ip_forward=1"})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		base.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	if base.Cfg.IptablesNat {
 | 
			
		||||
@@ -45,14 +47,21 @@ func checkTun() {
 | 
			
		||||
		base.CheckModOrLoad("iptable_filter")
 | 
			
		||||
		base.CheckModOrLoad("iptable_nat")
 | 
			
		||||
 | 
			
		||||
		natRule := []string{"-s", base.Cfg.Ipv4CIDR, "-o", base.Cfg.Ipv4Master, "-j", "MASQUERADE"}
 | 
			
		||||
		forwardRule := []string{"-j", "ACCEPT"}
 | 
			
		||||
		if natExists, _ := ipt.Exists("nat", "POSTROUTING", natRule...); !natExists {
 | 
			
		||||
			ipt.Insert("nat", "POSTROUTING", 1, natRule...)
 | 
			
		||||
		// 添加注释
 | 
			
		||||
		natRule := []string{"-s", base.Cfg.Ipv4CIDR, "-o", base.Cfg.Ipv4Master, "-m", "comment",
 | 
			
		||||
			"--comment", "AnyLink", "-j", "MASQUERADE"}
 | 
			
		||||
		err = ipt.InsertUnique("nat", "POSTROUTING", 1, natRule...)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			base.Error(err)
 | 
			
		||||
		}
 | 
			
		||||
		if forwardExists, _ := ipt.Exists("filter", "FORWARD", forwardRule...); !forwardExists {
 | 
			
		||||
			ipt.Insert("filter", "FORWARD", 1, forwardRule...)
 | 
			
		||||
 | 
			
		||||
		// 添加注释
 | 
			
		||||
		forwardRule := []string{"-m", "comment", "--comment", "AnyLink", "-j", "ACCEPT"}
 | 
			
		||||
		err = ipt.InsertUnique("filter", "FORWARD", 1, forwardRule...)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			base.Error(err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		base.Info(ipt.List("nat", "POSTROUTING"))
 | 
			
		||||
		base.Info(ipt.List("filter", "FORWARD"))
 | 
			
		||||
	}
 | 
			
		||||
@@ -73,8 +82,8 @@ func LinkTun(cSess *sessdata.ConnSession) error {
 | 
			
		||||
	cSess.SetIfName(ifce.Name())
 | 
			
		||||
 | 
			
		||||
	// 通过 ip link show  查看 alias 信息
 | 
			
		||||
 | 
			
		||||
	cmdstr1 := fmt.Sprintf("ip link set dev %s up mtu %d multicast off alias %s.%s", ifce.Name(), cSess.Mtu, cSess.Group.Name, cSess.Username)
 | 
			
		||||
	alias := utils.ParseName(cSess.Group.Name + "." + cSess.Username)
 | 
			
		||||
	cmdstr1 := fmt.Sprintf("ip link set dev %s up mtu %d multicast off alias %s", ifce.Name(), cSess.Mtu, alias)
 | 
			
		||||
	cmdstr2 := fmt.Sprintf("ip addr add dev %s local %s peer %s/32",
 | 
			
		||||
		ifce.Name(), base.Cfg.Ipv4Gateway, cSess.IpAddr)
 | 
			
		||||
	err = execCmd([]string{cmdstr1, cmdstr2})
 | 
			
		||||
 
 | 
			
		||||
@@ -133,7 +133,7 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	}
 | 
			
		||||
	// 允许的路由
 | 
			
		||||
	for _, v := range cSess.Group.RouteInclude {
 | 
			
		||||
		if v.Val == dbdata.All {
 | 
			
		||||
		if strings.ToLower(v.Val) == dbdata.All {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		HttpAddHeader(w, "X-CSTP-Split-Include", v.IpMask)
 | 
			
		||||
@@ -181,7 +181,7 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	HttpSetHeader(w, "X-CSTP-Quarantine", "false")
 | 
			
		||||
	HttpSetHeader(w, "X-CSTP-Disable-Always-On-VPN", "false")
 | 
			
		||||
	HttpSetHeader(w, "X-CSTP-Client-Bypass-Protocol", "false")
 | 
			
		||||
	HttpSetHeader(w, "X-CSTP-TCP-Keepalive", "false")
 | 
			
		||||
	HttpSetHeader(w, "X-CSTP-TCP-Keepalive", "true")
 | 
			
		||||
	// 设置域名拆分隧道(移动端不支持)
 | 
			
		||||
	if mobile != "mobile" {
 | 
			
		||||
		SetPostAuthXml(cSess.Group, w)
 | 
			
		||||
 
 | 
			
		||||
@@ -28,12 +28,13 @@ func (v *Vtap) Close() error {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func checkMacvtap() {
 | 
			
		||||
	// 加载 macvtap
 | 
			
		||||
	base.CheckModOrLoad("macvtap")
 | 
			
		||||
 | 
			
		||||
	_setGateway()
 | 
			
		||||
	_checkTapIp(base.Cfg.Ipv4Master)
 | 
			
		||||
 | 
			
		||||
	ifName := "anylinkMacvtap"
 | 
			
		||||
	// 加载 macvtap
 | 
			
		||||
	base.CheckModOrLoad("macvtap")
 | 
			
		||||
 | 
			
		||||
	// 开启主网卡混杂模式
 | 
			
		||||
	cmdstr1 := fmt.Sprintf("ip link set dev %s promisc on", base.Cfg.Ipv4Master)
 | 
			
		||||
@@ -55,8 +56,8 @@ func LinkMacvtap(cSess *sessdata.ConnSession) error {
 | 
			
		||||
	cSess.SetIfName(ifName)
 | 
			
		||||
 | 
			
		||||
	cmdstr1 := fmt.Sprintf("ip link add link %s name %s type macvtap mode bridge", base.Cfg.Ipv4Master, ifName)
 | 
			
		||||
	cmdstr2 := fmt.Sprintf("ip link set dev %s up mtu %d address %s alias %s.%s", ifName, cSess.Mtu,
 | 
			
		||||
		cSess.MacHw, cSess.Group.Name, cSess.Username)
 | 
			
		||||
	alias := utils.ParseName(cSess.Group.Name + "." + cSess.Username)
 | 
			
		||||
	cmdstr2 := fmt.Sprintf("ip link set dev %s up mtu %d address %s alias %s", ifName, cSess.Mtu, cSess.MacHw, alias)
 | 
			
		||||
 | 
			
		||||
	err := execCmd([]string{cmdstr1, cmdstr2})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -98,7 +98,7 @@ func initRoute() http.Handler {
 | 
			
		||||
	r.HandleFunc("/", LinkAuth).Methods(http.MethodPost)
 | 
			
		||||
	r.HandleFunc("/CSCOSSLC/tunnel", LinkTunnel).Methods(http.MethodConnect)
 | 
			
		||||
	r.HandleFunc("/otp_qr", LinkOtpQr).Methods(http.MethodGet)
 | 
			
		||||
	r.HandleFunc("/profile.xml", func(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	r.HandleFunc(fmt.Sprintf("/profile_%s.xml", base.Cfg.ProfileName), func(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
		b, _ := os.ReadFile(base.Cfg.Profile)
 | 
			
		||||
		w.Write(b)
 | 
			
		||||
	}).Methods(http.MethodGet)
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package utils
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"math/rand"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"sync/atomic"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
@@ -91,3 +92,11 @@ func RandomRunes(length int) string {
 | 
			
		||||
 | 
			
		||||
	return string(bytes)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func ParseName(name string) string {
 | 
			
		||||
	name = strings.ReplaceAll(name, " ", "-")
 | 
			
		||||
	name = strings.ReplaceAll(name, "'", "-")
 | 
			
		||||
	name = strings.ReplaceAll(name, "\"", "-")
 | 
			
		||||
	name = strings.ReplaceAll(name, ";", "-")
 | 
			
		||||
	return name
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"net"
 | 
			
		||||
	"sort"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/bjdgyc/anylink/pkg/utils"
 | 
			
		||||
@@ -42,33 +43,74 @@ func (o Onlines) Swap(i, j int) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func OnlineSess() []Online {
 | 
			
		||||
	return GetOnlineSess("", "", false)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Description: GetOnlineSess
 | 
			
		||||
 * @param search_cate 分类:用户名、登录组、MAC地址、IP地址、远端地址
 | 
			
		||||
 * @param search_text 关键字,模糊搜索
 | 
			
		||||
 * @param show_sleeper 是否显示休眠用户
 | 
			
		||||
 * @return []Online
 | 
			
		||||
 */
 | 
			
		||||
func GetOnlineSess(search_cate string, search_text string, show_sleeper bool) []Online {
 | 
			
		||||
	var datas Onlines
 | 
			
		||||
	if strings.TrimSpace(search_text) == "" {
 | 
			
		||||
		search_cate = ""
 | 
			
		||||
	}
 | 
			
		||||
	sessMux.Lock()
 | 
			
		||||
	defer sessMux.Unlock()
 | 
			
		||||
	for _, v := range sessions {
 | 
			
		||||
		v.mux.Lock()
 | 
			
		||||
		if v.IsActive {
 | 
			
		||||
		cSess := v.CSess
 | 
			
		||||
		if cSess == nil {
 | 
			
		||||
			cSess = &ConnSession{}
 | 
			
		||||
		}
 | 
			
		||||
		// 选择需要比较的字符串
 | 
			
		||||
		var compareText string
 | 
			
		||||
		switch search_cate {
 | 
			
		||||
		case "username":
 | 
			
		||||
			compareText = v.Username
 | 
			
		||||
		case "group":
 | 
			
		||||
			compareText = v.Group
 | 
			
		||||
		case "mac_addr":
 | 
			
		||||
			compareText = v.MacAddr
 | 
			
		||||
		case "ip":
 | 
			
		||||
			if cSess != nil {
 | 
			
		||||
				compareText = cSess.IpAddr.String()
 | 
			
		||||
			}
 | 
			
		||||
		case "remote_addr":
 | 
			
		||||
			if cSess != nil {
 | 
			
		||||
				compareText = cSess.RemoteAddr
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if search_cate != "" && !strings.Contains(compareText, search_text) {
 | 
			
		||||
			v.mux.Unlock()
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if show_sleeper || v.IsActive {
 | 
			
		||||
			val := Online{
 | 
			
		||||
				Token:            v.Token,
 | 
			
		||||
				Ip:               v.CSess.IpAddr,
 | 
			
		||||
				Ip:               cSess.IpAddr,
 | 
			
		||||
				Username:         v.Username,
 | 
			
		||||
				Group:            v.Group,
 | 
			
		||||
				MacAddr:          v.MacAddr,
 | 
			
		||||
				UniqueMac:        v.UniqueMac,
 | 
			
		||||
				RemoteAddr:       v.CSess.RemoteAddr,
 | 
			
		||||
				TunName:          v.CSess.IfName,
 | 
			
		||||
				Mtu:              v.CSess.Mtu,
 | 
			
		||||
				Client:           v.CSess.Client,
 | 
			
		||||
				BandwidthUp:      utils.HumanByte(v.CSess.BandwidthUpPeriod.Load()) + "/s",
 | 
			
		||||
				BandwidthDown:    utils.HumanByte(v.CSess.BandwidthDownPeriod.Load()) + "/s",
 | 
			
		||||
				BandwidthUpAll:   utils.HumanByte(v.CSess.BandwidthUpAll.Load()),
 | 
			
		||||
				BandwidthDownAll: utils.HumanByte(v.CSess.BandwidthDownAll.Load()),
 | 
			
		||||
				RemoteAddr:       cSess.RemoteAddr,
 | 
			
		||||
				TunName:          cSess.IfName,
 | 
			
		||||
				Mtu:              cSess.Mtu,
 | 
			
		||||
				Client:           cSess.Client,
 | 
			
		||||
				BandwidthUp:      utils.HumanByte(cSess.BandwidthUpPeriod.Load()) + "/s",
 | 
			
		||||
				BandwidthDown:    utils.HumanByte(cSess.BandwidthDownPeriod.Load()) + "/s",
 | 
			
		||||
				BandwidthUpAll:   utils.HumanByte(cSess.BandwidthUpAll.Load()),
 | 
			
		||||
				BandwidthDownAll: utils.HumanByte(cSess.BandwidthDownAll.Load()),
 | 
			
		||||
				LastLogin:        v.LastLogin,
 | 
			
		||||
			}
 | 
			
		||||
			datas = append(datas, val)
 | 
			
		||||
		}
 | 
			
		||||
		v.mux.Unlock()
 | 
			
		||||
	}
 | 
			
		||||
	sessMux.Unlock()
 | 
			
		||||
	sort.Sort(&datas)
 | 
			
		||||
	return datas
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,6 @@ import (
 | 
			
		||||
	"github.com/bjdgyc/anylink/base"
 | 
			
		||||
	"github.com/bjdgyc/anylink/dbdata"
 | 
			
		||||
	mapset "github.com/deckarep/golang-set"
 | 
			
		||||
	atomic2 "go.uber.org/atomic"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
@@ -41,15 +40,15 @@ type ConnSession struct {
 | 
			
		||||
	CstpDpd             int
 | 
			
		||||
	Group               *dbdata.Group
 | 
			
		||||
	Limit               *LimitRater
 | 
			
		||||
	BandwidthUp         atomic2.Uint32 // 使用上行带宽 Byte
 | 
			
		||||
	BandwidthDown       atomic2.Uint32 // 使用下行带宽 Byte
 | 
			
		||||
	BandwidthUpPeriod   atomic2.Uint32 // 前一周期的总量
 | 
			
		||||
	BandwidthDownPeriod atomic2.Uint32
 | 
			
		||||
	BandwidthUpAll      atomic2.Uint64 // 使用上行带宽总量
 | 
			
		||||
	BandwidthDownAll    atomic2.Uint64 // 使用下行带宽总量
 | 
			
		||||
	BandwidthUp         atomic.Uint32 // 使用上行带宽 Byte
 | 
			
		||||
	BandwidthDown       atomic.Uint32 // 使用下行带宽 Byte
 | 
			
		||||
	BandwidthUpPeriod   atomic.Uint32 // 前一周期的总量
 | 
			
		||||
	BandwidthDownPeriod atomic.Uint32
 | 
			
		||||
	BandwidthUpAll      atomic.Uint64 // 使用上行带宽总量
 | 
			
		||||
	BandwidthDownAll    atomic.Uint64 // 使用下行带宽总量
 | 
			
		||||
	closeOnce           sync.Once
 | 
			
		||||
	CloseChan           chan struct{}
 | 
			
		||||
	LastDataTime        atomic2.Time // 最后数据传输时间
 | 
			
		||||
	LastDataTime        atomic.Int64 // 最后数据传输时间
 | 
			
		||||
	PayloadIn           chan *Payload
 | 
			
		||||
	PayloadOutCstp      chan *Payload // Cstp的数据
 | 
			
		||||
	PayloadOutDtls      chan *Payload // Dtls的数据
 | 
			
		||||
@@ -220,7 +219,7 @@ func (s *Session) NewConn() *ConnSession {
 | 
			
		||||
		PayloadOutDtls: make(chan *Payload, 64),
 | 
			
		||||
		dSess:          &atomic.Value{},
 | 
			
		||||
	}
 | 
			
		||||
	cSess.LastDataTime.Store(time.Now())
 | 
			
		||||
	cSess.LastDataTime.Store(time.Now().Unix())
 | 
			
		||||
 | 
			
		||||
	dSess := &DtlsSession{
 | 
			
		||||
		isActive: -1,
 | 
			
		||||
@@ -464,7 +463,7 @@ func CloseSess(token string, code ...uint8) {
 | 
			
		||||
		sess.CSess.Close()
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	AddUserActLogBySess(sess)
 | 
			
		||||
	AddUserActLogBySess(sess, code...)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func CloseCSess(token string) {
 | 
			
		||||
@@ -501,7 +500,7 @@ func AddUserActLog(cs *ConnSession) {
 | 
			
		||||
	dbdata.UserActLogIns.Add(ua, cs.UserAgent)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func AddUserActLogBySess(sess *Session) {
 | 
			
		||||
func AddUserActLogBySess(sess *Session, code ...uint8) {
 | 
			
		||||
	ua := dbdata.UserActLog{
 | 
			
		||||
		Username:        sess.Username,
 | 
			
		||||
		GroupName:       sess.Group,
 | 
			
		||||
@@ -512,5 +511,8 @@ func AddUserActLogBySess(sess *Session) {
 | 
			
		||||
		Status:          dbdata.UserLogout,
 | 
			
		||||
	}
 | 
			
		||||
	ua.Info = dbdata.UserActLogIns.GetInfoOpsById(dbdata.UserLogoutBanner)
 | 
			
		||||
	if len(code) > 0 {
 | 
			
		||||
		ua.Info = dbdata.UserActLogIns.GetInfoOpsById(code[0])
 | 
			
		||||
	}
 | 
			
		||||
	dbdata.UserActLogIns.Add(ua, sess.UserAgent)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,14 @@
 | 
			
		||||
        <!--子组件上报route信息-->
 | 
			
		||||
        <router-view :route_path.sync="route_path" :route_name.sync="route_name"></router-view>
 | 
			
		||||
      </el-main>
 | 
			
		||||
      <el-footer>
 | 
			
		||||
        <div>
 | 
			
		||||
          <el-button size="mini" @click="goUrl('https://gitee.com/bjdgyc/anylink')">
 | 
			
		||||
            Powered by AnyLink
 | 
			
		||||
          </el-button>
 | 
			
		||||
          企业级远程办公系统 AGPL-3.0 ⓒ 2020-present
 | 
			
		||||
        </div>
 | 
			
		||||
      </el-footer>
 | 
			
		||||
    </el-container>
 | 
			
		||||
  </el-container>
 | 
			
		||||
</template>
 | 
			
		||||
@@ -36,6 +44,11 @@ export default {
 | 
			
		||||
      route_name: ['首页'],
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    goUrl(url) {
 | 
			
		||||
      window.open(url, "_blank")
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  watch: {
 | 
			
		||||
    route_path: function (val) {
 | 
			
		||||
      // var w = document.getElementById('layout-menu').clientWidth;
 | 
			
		||||
@@ -60,4 +73,16 @@ export default {
 | 
			
		||||
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.el-footer {
 | 
			
		||||
  display: flex;
 | 
			
		||||
  align-items: center;
 | 
			
		||||
  justify-content: center;
 | 
			
		||||
  text-align: center;
 | 
			
		||||
 | 
			
		||||
  font-size: 12px;
 | 
			
		||||
  line-height: 12px;
 | 
			
		||||
  margin: 0 12px;
 | 
			
		||||
  color: rgb(134, 144, 156);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,7 @@
 | 
			
		||||
                step: '01:00',
 | 
			
		||||
                end: '23:00',
 | 
			
		||||
              }"
 | 
			
		||||
              editable="false,"
 | 
			
		||||
              :editable="false"
 | 
			
		||||
              size="small"
 | 
			
		||||
              placeholder="请选择"
 | 
			
		||||
              style="width: 130px"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,59 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div>
 | 
			
		||||
    <el-card>
 | 
			
		||||
      <el-form :inline="true">
 | 
			
		||||
        <el-form-item>
 | 
			
		||||
          <el-select
 | 
			
		||||
              v-model="searchCate"
 | 
			
		||||
              style="width: 86px;"                      
 | 
			
		||||
              @change="handleSearch">
 | 
			
		||||
            <el-option
 | 
			
		||||
                label="用户名"
 | 
			
		||||
                value="username">
 | 
			
		||||
            </el-option>
 | 
			
		||||
            <el-option
 | 
			
		||||
                label="登录组"
 | 
			
		||||
                value="group">
 | 
			
		||||
            </el-option>            
 | 
			
		||||
            <el-option
 | 
			
		||||
                label="MAC地址"
 | 
			
		||||
                value="mac_addr">
 | 
			
		||||
            </el-option>
 | 
			
		||||
            <el-option
 | 
			
		||||
                label="IP地址"
 | 
			
		||||
                value="ip">
 | 
			
		||||
            </el-option>
 | 
			
		||||
            <el-option
 | 
			
		||||
                label="远端地址"
 | 
			
		||||
                value="remote_addr">
 | 
			
		||||
            </el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item>
 | 
			
		||||
          <el-input
 | 
			
		||||
              v-model="searchText"
 | 
			
		||||
              placeholder="请输入搜索内容"
 | 
			
		||||
              @input="handleSearch">
 | 
			
		||||
          </el-input>
 | 
			
		||||
        </el-form-item>        
 | 
			
		||||
        <el-form-item>
 | 
			
		||||
          显示休眠用户:
 | 
			
		||||
            <el-switch
 | 
			
		||||
                v-model="showSleeper"
 | 
			
		||||
                @change="handleSearch">
 | 
			
		||||
            </el-switch>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
        <el-form-item>
 | 
			
		||||
          <el-button
 | 
			
		||||
              class="extra-small-button"
 | 
			
		||||
              type="danger"
 | 
			
		||||
              size="mini"
 | 
			
		||||
              :loading="loadingOneOffline"
 | 
			
		||||
              @click="handleOneOffline">
 | 
			
		||||
            一键下线
 | 
			
		||||
          </el-button>
 | 
			
		||||
      </el-form>
 | 
			
		||||
      
 | 
			
		||||
      <el-table
 | 
			
		||||
          ref="multipleTable"
 | 
			
		||||
          :data="tableData"
 | 
			
		||||
@@ -20,7 +73,7 @@
 | 
			
		||||
 | 
			
		||||
        <el-table-column
 | 
			
		||||
            prop="group"
 | 
			
		||||
            label="登陆组">
 | 
			
		||||
            label="登录组">
 | 
			
		||||
        </el-table-column>
 | 
			
		||||
 | 
			
		||||
        <el-table-column
 | 
			
		||||
@@ -67,7 +120,6 @@
 | 
			
		||||
        </el-table-column>
 | 
			
		||||
 | 
			
		||||
        <el-table-column
 | 
			
		||||
            prop="status"
 | 
			
		||||
            label="实时 上行/下行"
 | 
			
		||||
            width="220">
 | 
			
		||||
          <template slot-scope="scope">
 | 
			
		||||
@@ -77,7 +129,6 @@
 | 
			
		||||
        </el-table-column>
 | 
			
		||||
 | 
			
		||||
        <el-table-column
 | 
			
		||||
            prop="status"
 | 
			
		||||
            label="总量 上行/下行"
 | 
			
		||||
            width="200">
 | 
			
		||||
          <template slot-scope="scope">
 | 
			
		||||
@@ -88,7 +139,7 @@
 | 
			
		||||
 | 
			
		||||
        <el-table-column
 | 
			
		||||
            prop="last_login"
 | 
			
		||||
            label="登陆时间"
 | 
			
		||||
            label="登录时间"
 | 
			
		||||
            :formatter="tableDateFormat">
 | 
			
		||||
        </el-table-column>
 | 
			
		||||
 | 
			
		||||
@@ -99,6 +150,7 @@
 | 
			
		||||
            <el-button
 | 
			
		||||
                size="mini"
 | 
			
		||||
                type="primary"
 | 
			
		||||
                v-if="scope.row.remote_addr !== ''"
 | 
			
		||||
                @click="handleReline(scope.row)">重连
 | 
			
		||||
            </el-button>
 | 
			
		||||
 | 
			
		||||
@@ -123,6 +175,7 @@
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import axios from "axios";
 | 
			
		||||
import { MessageBox } from 'element-ui';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "Online",
 | 
			
		||||
@@ -147,6 +200,10 @@ export default {
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      tableData: [],
 | 
			
		||||
      searchCate: 'username',
 | 
			
		||||
      searchText: '',
 | 
			
		||||
      showSleeper: false,
 | 
			
		||||
      loadingOneOffline: false,
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
@@ -185,8 +242,43 @@ export default {
 | 
			
		||||
    handleEdit(a, row) {
 | 
			
		||||
      console.log(a, row)
 | 
			
		||||
    },
 | 
			
		||||
    handleOneOffline() {
 | 
			
		||||
        if (this.tableData === null || this.tableData.length === 0) {
 | 
			
		||||
            this.$message.error('错误:当前在线用户表为空,无法执行一键下线操作!');
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        MessageBox.confirm('当前搜索条件下的所有用户将会“下线”,你确定执行吗?', '危险', {
 | 
			
		||||
            confirmButtonText: '确定',
 | 
			
		||||
            cancelButtonText: '取消',
 | 
			
		||||
            type: 'danger'
 | 
			
		||||
        }).then(() => {   
 | 
			
		||||
            try {
 | 
			
		||||
                this.loadingOneOffline = true;
 | 
			
		||||
                this.getData();        
 | 
			
		||||
                this.$message.success('操作成功');
 | 
			
		||||
                this.loadingOneOffline = false;
 | 
			
		||||
                // 清空当前表格
 | 
			
		||||
                this.tableData = [];
 | 
			
		||||
            } catch (error) {
 | 
			
		||||
                this.loadingOneOffline = false;
 | 
			
		||||
                this.$message.error('操作失败');
 | 
			
		||||
            }
 | 
			
		||||
        });        
 | 
			
		||||
    },
 | 
			
		||||
    handleSearch() {
 | 
			
		||||
        this.getData();
 | 
			
		||||
    },
 | 
			
		||||
    getData() {
 | 
			
		||||
      axios.get('/user/online').then(resp => {
 | 
			
		||||
      axios.get('/user/online', 
 | 
			
		||||
        {
 | 
			
		||||
          params: {            
 | 
			
		||||
            search_cate: this.searchCate,
 | 
			
		||||
            search_text: this.searchText,
 | 
			
		||||
            show_sleeper: this.showSleeper,
 | 
			
		||||
            one_offline: this.loadingOneOffline
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      ).then(resp => {
 | 
			
		||||
        var data = resp.data.data
 | 
			
		||||
        console.log(data);
 | 
			
		||||
        this.tableData = data.datas;
 | 
			
		||||
@@ -201,5 +293,23 @@ export default {
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
 | 
			
		||||
/deep/ .el-form .el-form-item__label,
 | 
			
		||||
/deep/ .el-form .el-form-item__content,
 | 
			
		||||
/deep/ .el-form .el-input,
 | 
			
		||||
/deep/ .el-form .el-select,
 | 
			
		||||
/deep/ .el-form .el-button,
 | 
			
		||||
/deep/ .el-form .el-select-dropdown__item {
 | 
			
		||||
  font-size: 11px;
 | 
			
		||||
}
 | 
			
		||||
.el-select-dropdown .el-select-dropdown__item {
 | 
			
		||||
    font-size: 11px;
 | 
			
		||||
    padding: 0 10px;
 | 
			
		||||
}
 | 
			
		||||
/deep/ .el-input__inner{
 | 
			
		||||
    height: 30px;
 | 
			
		||||
    padding: 0 10px;
 | 
			
		||||
}
 | 
			
		||||
.extra-small-button {
 | 
			
		||||
  padding: 5px 10px;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded
 | 
			
		||||
 | 
			
		||||
if (process.env.NODE_ENV !== 'production') {
 | 
			
		||||
    // 开发环境
 | 
			
		||||
    axios.defaults.baseURL = 'http://172.23.83.233:8800';
 | 
			
		||||
    axios.defaults.baseURL = 'https://192.168.8.24:8800';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function request(vm) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user