mirror of
https://github.com/bjdgyc/anylink.git
synced 2025-09-29 00:19:36 +08:00
Compare commits
58 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
380a8cb3fb | ||
|
fa5ced4660 | ||
|
bac497475f | ||
|
f43b413ed4 | ||
|
356e135ea1 | ||
|
e5c6533c9b | ||
|
8d92cac37d | ||
|
eb7401f6e5 | ||
|
8777501391 | ||
|
2949ea2a89 | ||
|
11f39d0b78 | ||
|
bdc8e267a3 | ||
|
268e9c4e92 | ||
|
b3eb128dbd | ||
|
ce89ea680b | ||
|
fc3b39e09f | ||
|
09160a6891 | ||
|
b059c555cf | ||
|
8ea158a71e | ||
|
3bb71b84b6 | ||
|
afec9af445 | ||
|
eb8d8f4171 | ||
|
632080c1d6 | ||
|
cca9e377c5 | ||
|
8455ef6ed4 | ||
|
ef05b9372a | ||
|
000b041578 | ||
|
57a67ee030 | ||
|
a945c636f4 | ||
|
edf33ba4ae | ||
|
03467e4f06 | ||
|
74782e883b | ||
|
ace4ef08d9 | ||
|
2b24e53c24 | ||
|
a4fd1769a5 | ||
|
0f8877bafc | ||
|
5ee3b3967a | ||
|
3c8d0c6d60 | ||
|
5a331e2125 | ||
|
a0e84312ba | ||
|
098f321343 | ||
|
096b6f8f08 | ||
|
0ff6dbcd78 | ||
|
a650db816c | ||
|
2b8ce3e94a | ||
|
a59e480b61 | ||
|
33139a571d | ||
|
0227c3ee8b | ||
|
8eac03df03 | ||
|
d3d8b2620c | ||
|
bbb9cfda67 | ||
|
ff07c81401 | ||
|
6514657f2f | ||
|
70f3e4302c | ||
|
0e6e4e501c | ||
|
29a3e4bfb3 | ||
|
d73816a811 | ||
|
43a9d31b82 |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,6 +1,6 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ 'bjdgyc' ] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -75,7 +75,7 @@ jobs:
|
||||
build-args: |
|
||||
appVer=${{ env.APP_VER }}
|
||||
commitId=${{ env.commitId }}
|
||||
tags: bjdgyc/anylink:latest,bjdgyc/anylink:${{ env.APP_VER }}
|
||||
tags: bjdgyc/anylink:${{ env.APP_VER }},bjdgyc/anylink:latest
|
||||
#tags: bjdgyc/anylink:${{ env.APP_VER }}
|
||||
|
||||
- name: Build deploy binary
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -2,8 +2,12 @@
|
||||
.idea/
|
||||
anylink-deploy
|
||||
anylink-deploy.tar.gz
|
||||
anylink-deploy-*
|
||||
anylink
|
||||
anylink.db
|
||||
|
||||
dist
|
||||
artifact-dist
|
||||
|
||||
anylink_amd64
|
||||
anylink_arm64
|
||||
|
109
README.md
109
README.md
@@ -26,7 +26,7 @@ AnyLink 基于 [ietf-openconnect](https://tools.ietf.org/html/draft-mavrogiannop
|
||||
AnyLink 使用 TLS/DTLS 进行数据加密,因此需要 RSA 或 ECC 证书,可以通过 Let's Encrypt 和 TrustAsia 申请免费的 SSL 证书。
|
||||
|
||||
AnyLink 服务端仅在 CentOS 7、CentOS 8、Ubuntu 18.04、Ubuntu 20.04 测试通过,如需要安装在其他系统,需要服务端支持 tun/tap
|
||||
功能、ip 设置命令。
|
||||
功能、ip 设置命令、iptables命令。
|
||||
|
||||
## Screenshot
|
||||
|
||||
@@ -48,46 +48,55 @@ 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)
|
||||
>
|
||||
> 默认管理后台访问地址 https://host:8800 默认账号密码 admin 123456
|
||||
> 默认管理后台访问地址 https://host:8800 或 https://域名:8800 默认账号密码 admin 123456
|
||||
>
|
||||
> 首次使用,请在浏览器访问 https://域名:443 浏览器提示安全后,在客户端输入 【域名:443】 即可
|
||||
|
||||
### 自行编译安装
|
||||
|
||||
> 需要提前安装好 golang >= 1.20 和 nodejs = 16.x 和 yarn >= v1.22.x
|
||||
> 需要提前安装好 docker
|
||||
|
||||
```shell
|
||||
git clone https://github.com/bjdgyc/anylink.git
|
||||
|
||||
# 编译参考软件版本
|
||||
# docker编译 参考软件版本(不需要安装)
|
||||
# go 1.20.12
|
||||
# node v16.20.2
|
||||
# yarn 1.22.19
|
||||
|
||||
|
||||
cd anylink
|
||||
sh build.sh
|
||||
|
||||
# 编译前端
|
||||
bash build_web.sh
|
||||
# 编译 anylink-deploy 发布文件
|
||||
bash build.sh
|
||||
|
||||
# 注意使用root权限运行
|
||||
cd anylink-deploy
|
||||
sudo ./anylink
|
||||
|
||||
# 默认管理后台访问地址
|
||||
# 注意该host为anylink的内网ip,不能跟客户端请求的ip一样
|
||||
# https://host:8800
|
||||
# 默认账号 密码
|
||||
# admin 123456
|
||||
@@ -103,10 +112,11 @@ sudo ./anylink
|
||||
- [x] 兼容 AnyConnect
|
||||
- [x] 兼容 OpenConnect
|
||||
- [x] 基于 tun 设备的 nat 访问模式
|
||||
- [x] 基于 tap 设备的桥接访问模式
|
||||
- [x] 基于 tun 设备的桥接访问模式
|
||||
- [x] 基于 macvtap 设备的桥接访问模式
|
||||
- [x] 支持 [proxy protocol v1&v2](http://www.haproxy.org/download/2.2/doc/proxy-protocol.txt) 协议
|
||||
- [x] 用户组支持
|
||||
- [x] 用户组策略支持
|
||||
- [x] 多用户支持
|
||||
- [x] 用户策略支持
|
||||
- [x] TOTP 令牌支持
|
||||
@@ -114,10 +124,15 @@ sudo ./anylink
|
||||
- [x] 流量速率限制
|
||||
- [x] 后台管理界面
|
||||
- [x] 访问权限管理
|
||||
- [x] 用户活动审计功能
|
||||
- [x] IP 访问审计功能
|
||||
- [x] 域名动态拆分隧道(域名路由功能)
|
||||
- [x] radius认证支持
|
||||
- [x] LDAP认证支持
|
||||
- [x] 空闲链接超时自动断开
|
||||
- [x] 流量压缩功能
|
||||
- [x] 出口 IP 自动放行
|
||||
- [x] 支持多服务的配置区分
|
||||
- [ ] 基于 ipvtap 设备的桥接访问模式
|
||||
|
||||
## Config
|
||||
@@ -162,6 +177,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"(不推荐)` 等参数。
|
||||
@@ -171,11 +197,13 @@ sudo ./anylink
|
||||
IP 层的数据互相转换,性能会有所下降。 如果需要在虚拟机内开启 tap
|
||||
模式,请确认虚拟机的网卡开启混杂模式。
|
||||
|
||||
### tun 设置
|
||||
#### tun 设置
|
||||
|
||||
1. 开启服务器转发
|
||||
|
||||
```shell
|
||||
# 新版本支持自动设置ip转发
|
||||
|
||||
# file: /etc/sysctl.conf
|
||||
net.ipv4.ip_forward = 1
|
||||
|
||||
@@ -224,13 +252,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网卡需要打开混杂模式
|
||||
@@ -357,25 +421,30 @@ 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)
|
||||
- [三方文档-啵品](https://yangpin.link/archives/1633.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
|
||||
|
||||
|
65
build.sh
65
build.sh
@@ -1,65 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -x
|
||||
function RETVAL() {
|
||||
rt=$1
|
||||
if [ $rt != 0 ]; then
|
||||
echo $rt
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
#当前目录
|
||||
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
|
||||
#前端编译 仅需要执行一次
|
||||
#bash ./build_web.sh
|
||||
|
||||
#国内可替换源加快速度
|
||||
#npx browserslist@latest --update-db
|
||||
yarn install --registry=https://registry.npmmirror.com
|
||||
yarn run build
|
||||
RETVAL $?
|
||||
bash build_docker.sh
|
||||
|
||||
echo "编译二进制文件"
|
||||
cd $cpath/server
|
||||
rm -rf ui
|
||||
cp -rf $cpath/web/ui .
|
||||
deploy="anylink-deploy-$ver"
|
||||
docker container rm $deploy
|
||||
docker container create --name $deploy bjdgyc/anylink:$ver
|
||||
rm -rf anylink-deploy anylink-deploy.tar.gz
|
||||
docker cp -a $deploy:/app ./anylink-deploy
|
||||
tar zcf ${deploy}.tar.gz anylink-deploy
|
||||
|
||||
# -tags osusergo,netgo,sqlite_omit_load_extension
|
||||
flags="-v -trimpath"
|
||||
|
||||
# -extldflags '-static'
|
||||
ldflags="-s -w -X main.appVer=$ver -X main.commitId=$(git rev-parse HEAD) -X main.date=$(date -Iseconds)"
|
||||
./anylink-deploy/anylink -v
|
||||
|
||||
#国内可替换源加快速度
|
||||
export GOPROXY=https://goproxy.io
|
||||
go mod tidy
|
||||
go build -o anylink $flags -ldflags "$ldflags"
|
||||
|
||||
cd $cpath
|
||||
echo "anylink 编译完成,目录: anylink-deploy"
|
||||
ls -lh anylink-deploy
|
||||
|
||||
exit 0
|
||||
|
||||
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"
|
||||
|
@@ -8,11 +8,18 @@ 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 -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 \
|
||||
--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
|
||||
|
||||
docker tag bjdgyc/anylink:latest registry.cn-qingdao.aliyuncs.com/bjdgyc/anylink:latest
|
||||
|
||||
docker push registry.cn-qingdao.aliyuncs.com/bjdgyc/anylink:latest
|
||||
|
72
build_test.sh
Normal file
72
build_test.sh
Normal file
@@ -0,0 +1,72 @@
|
||||
#!/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
|
||||
|
||||
#前端编译 仅需要执行一次
|
||||
#bash ./build_web.sh
|
||||
|
||||
echo "copy二进制文件"
|
||||
|
||||
# -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.ustc.edu.cn/g' /etc/apk/repositories
|
||||
apk add gcc g++ musl musl-dev tzdata
|
||||
export GOPROXY=https://goproxy.cn
|
||||
go mod tidy
|
||||
echo "build:"
|
||||
rm anylink
|
||||
export CGO_ENABLED=1
|
||||
go build -v -o anylink $flags -ldflags "$ldflags"
|
||||
./anylink -v
|
||||
EOF
|
||||
)
|
||||
|
||||
#使用 musl-dev 编译
|
||||
docker run -q --rm -v $PWD/server:/app -v $gopath:/go -w /app --platform=linux/amd64 \
|
||||
golang:1.20-alpine3.19 sh -c "$dockercmd"
|
||||
|
||||
#arm64编译
|
||||
#docker run -q --rm -v $PWD/server:/app -v $gopath:/go -w /app --platform=linux/arm64 \
|
||||
# golang:1.20-alpine3.19 go build -o anylink_arm64 $flags -ldflags "$ldflags"
|
||||
#exit 0
|
||||
|
||||
#cd $cpath
|
||||
|
||||
echo "整理部署文件"
|
||||
rm -rf anylink-deploy anylink-deploy.tar.gz
|
||||
mkdir anylink-deploy
|
||||
mkdir anylink-deploy/log
|
||||
|
||||
cp -r server/anylink anylink-deploy
|
||||
cp -r server/conf anylink-deploy
|
||||
|
||||
cp -r index_template anylink-deploy
|
||||
cp -r deploy anylink-deploy
|
||||
cp -r LICENSE anylink-deploy
|
||||
|
||||
tar zcvf anylink-deploy.tar.gz anylink-deploy
|
||||
|
||||
#注意使用root权限运行
|
||||
#cd anylink-deploy
|
||||
#sudo ./anylink --conf="conf/server.toml"
|
9
build_web.sh
Normal file
9
build_web.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm -rf web/ui server/ui
|
||||
|
||||
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"
|
||||
|
||||
|
||||
cp -r web/ui server/ui
|
@@ -10,6 +10,10 @@
|
||||
|
||||
> 请使用手机安装 freeotp ,然后扫描otp二维码,生成的数字即是动态码
|
||||
|
||||
### 用户策略问题
|
||||
|
||||
> 只要有用户策略,组策略就不生效,相当于覆盖了组策略的配置
|
||||
|
||||
### 远程桌面连接
|
||||
|
||||
> 本软件已经支持远程桌面里面连接anyconnect。
|
||||
|
@@ -4,11 +4,12 @@ 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
|
||||
|
||||
apk add build-base tzdata gcc musl-dev upx
|
||||
apk add build-base tzdata gcc g++ musl musl-dev upx
|
||||
|
||||
uname -a
|
||||
env
|
||||
@@ -20,11 +21,10 @@ go mod tidy
|
||||
|
||||
echo "start build"
|
||||
|
||||
extldflags="-static"
|
||||
ldflags="-s -w -X main.appVer=$appVer -X main.commitId=$commitId -X main.buildDate=$(date -Iseconds) \
|
||||
-extldflags \"$extldflags\" "
|
||||
ldflags="-s -w -X main.appVer=$appVer -X main.commitId=$commitId -X main.buildDate=$(date -Iseconds) -extldflags \"-static\" "
|
||||
|
||||
CGO_ENABLED=1 go build -o anylink -trimpath -ldflags "$ldflags"
|
||||
export CGO_ENABLED=1
|
||||
go build -v -o anylink -trimpath -ldflags "$ldflags"
|
||||
|
||||
ls -lh /server/
|
||||
|
||||
|
@@ -4,11 +4,17 @@ 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
|
||||
|
||||
apk add --no-cache bash iptables iproute2 tzdata
|
||||
# alpine:3.19 兼容老版 iptables
|
||||
apk add --no-cache iptables iptables-legacy
|
||||
rm /sbin/iptables
|
||||
ln -s /sbin/iptables-legacy /sbin/iptables
|
||||
|
||||
apk add --no-cache ca-certificates bash iproute2 tzdata
|
||||
chmod +x /app/docker_entrypoint.sh
|
||||
mkdir /app/log
|
||||
|
||||
|
165
index_template/自定义首页2.html
Normal file
165
index_template/自定义首页2.html
Normal file
@@ -0,0 +1,165 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<meta charset=UTF-8">
|
||||
<title id="pageTitle">客户端下载</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style type="text/css">
|
||||
body {
|
||||
background-color: #fff;
|
||||
background-image: linear-gradient(0deg, transparent 24%, rgba(207, 207, 207, 0.2) 25%, rgba(207, 207, 207, 0.2) 26%, transparent 27%, transparent 74%, rgba(207, 207, 207, 0.2) 75%, rgba(207, 207, 207, 0.2) 76%, transparent 77%, transparent),
|
||||
linear-gradient(90deg, transparent 24%, rgba(207, 207, 207, 0.2) 25%, rgba(207, 207, 207, 0.2) 26%, transparent 27%, transparent 74%, rgba(207, 207, 207, 0.2) 75%, rgba(207, 207, 207, 0.2) 76%, transparent 77%, transparent);
|
||||
background-size: 50px 50px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
#box {
|
||||
background-color: #ffffff;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
position: relative;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
max-width: 550px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #333;
|
||||
font-weight: 600;
|
||||
font-size: 28px;
|
||||
margin: 0 0 20px 0;
|
||||
}
|
||||
|
||||
p {
|
||||
color: #666;
|
||||
font-size: 16px;
|
||||
line-height: 1.6;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.button {
|
||||
background-color: #ddd;
|
||||
text-decoration: none;
|
||||
line-height: 44px;
|
||||
padding: 9px 42px;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
-webkit-transition: background-color 0.25s ease-out 0s;
|
||||
-moz-transition: background-color 0.25s ease-out 0s;
|
||||
transition: background-color 0.25s ease-out 0s;
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background-color: #CCC;
|
||||
color: #444;
|
||||
}
|
||||
|
||||
.button:active {
|
||||
background-color: #666;
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.blue {
|
||||
background-color: #007BFF;
|
||||
}
|
||||
|
||||
.deep-blue {
|
||||
background-color: #0056B3;
|
||||
}
|
||||
|
||||
.green {
|
||||
background-color: #28A745;
|
||||
}
|
||||
|
||||
.grey {
|
||||
background-color: #6C757D;
|
||||
}
|
||||
|
||||
.black {
|
||||
background-color: #343A40;
|
||||
}
|
||||
|
||||
.light-blue {
|
||||
background-color: #17A2B8;
|
||||
}
|
||||
|
||||
.dark-grey {
|
||||
background-color: #495057;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.button {
|
||||
padding: 7px 35px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
<div id="box">
|
||||
<h2 id="title">请选择对应平台下载</h2>
|
||||
<p id="windowsTab">Windows 系统</p>
|
||||
<a id="linkWindowsX86_64" class="button blue" href="#">Win X86_64</a>
|
||||
<a id="linkWindowsARM64" class="button deep-blue" href="#">Win ARM64</a>
|
||||
|
||||
<p id="mobileTab">移动端</p>
|
||||
<a id="linkAndroid" class="button green" href="#">Android</a>
|
||||
<a id="linkIphone" class="button grey" href="#" target="_blank">iPhone</a>
|
||||
|
||||
<p id="macOSTab">MacOS 系统</p>
|
||||
<a id="linkMacos" class="button black" href="#">Mac Intel</a>
|
||||
<a id="linkMacosARM64" class="button blue" href="#">Mac ARM64</a>
|
||||
|
||||
<p id="totpTab">TOTP 移动客户端</p>
|
||||
<a id="linkTotpAndroid" class="button light-blue" href="#">Android</a>
|
||||
<a id="linkTotpIphone" class="button dark-grey" href="#" target="_blank">iPhone</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
const data = {
|
||||
links: {
|
||||
windowsX86_64: '/files/anyconnect-win-4.10.05111.msi',
|
||||
windowsARM64: '/files/anyconnect-win-4.10.05111.msi',
|
||||
android: '/files/CiscoSecureClientAnyConnect_v5.0.00247.apk',
|
||||
iphone: 'https://apps.apple.com/cn/app/cisco-anyconnect/id1135064690',
|
||||
macosIntel: '/files/anyconnect-macos-4.10.05111.dmg',
|
||||
macosARM64: '/files/anyconnect-macos-4.10.05111.dmg',
|
||||
totpAndroid: '/files/Authenticator_v5.10_apkpure.com.apk',
|
||||
totpIphone: 'https://apps.apple.com/cn/app/google-authenticator/id388497605',
|
||||
}
|
||||
};
|
||||
|
||||
window.onload = function () {
|
||||
document.getElementById('linkWindowsX86_64').href = data.links.windowsX86_64;
|
||||
document.getElementById('linkWindowsARM64').href = data.links.windowsARM64;
|
||||
document.getElementById('linkAndroid').href = data.links.android;
|
||||
document.getElementById('linkIphone').href = data.links.iphone;
|
||||
document.getElementById('linkMacos').href = data.links.macosIntel;
|
||||
document.getElementById('linkMacosARM64').href = data.links.macosARM64;
|
||||
document.getElementById('linkTotpAndroid').href = data.links.totpAndroid;
|
||||
document.getElementById('linkTotpIphone').href = data.links.totpIphone;
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@@ -1,58 +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)
|
||||
|
||||
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.date=$(date --iso-8601=seconds)"
|
||||
#github action
|
||||
gopath=$(go env GOPATH)
|
||||
go mod tidy
|
||||
# alpine3
|
||||
apk add gcc musl-dev
|
||||
#使用 musl-dev 编译
|
||||
docker run -q --rm -v $PWD:/app -v $gopath:/go -w /app --platform=linux/amd64 \
|
||||
golang:1.20-alpine3.19 go build -o anylink_amd64 $flags -ldflags "$ldflags"
|
||||
./anylink_amd64 -v
|
||||
#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
|
||||
|
@@ -72,6 +72,7 @@ func SetSystem(w http.ResponseWriter, r *http.Request) {
|
||||
"goroutine": runtime.NumGoroutine(),
|
||||
"appVersion": "v" + base.APP_VER,
|
||||
"appCommitId": base.CommitId,
|
||||
"appBuildDate": base.BuildDate,
|
||||
|
||||
"hostname": hi.Hostname,
|
||||
"platform": fmt.Sprintf("%v %v %v", hi.Platform, hi.PlatformFamily, hi.PlatformVersion),
|
||||
|
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/bjdgyc/anylink/dbdata"
|
||||
"github.com/bjdgyc/anylink/sessdata"
|
||||
"github.com/skip2/go-qrcode"
|
||||
mail "github.com/xhit/go-simple-mail/v2"
|
||||
)
|
||||
|
||||
func UserList(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -272,5 +273,13 @@ func userAccountMail(user *dbdata.User) error {
|
||||
return err
|
||||
}
|
||||
// fmt.Println(w.String())
|
||||
return SendMail(base.Cfg.Issuer+"平台通知", user.Email, w.String())
|
||||
imgData, _ := userOtpQr(user.Id, false)
|
||||
attach := &mail.File{
|
||||
MimeType: "image/png",
|
||||
Name: "userOtpQr.png",
|
||||
Data: []byte(imgData),
|
||||
Inline: true,
|
||||
}
|
||||
|
||||
return SendMail(base.Cfg.Issuer, user.Email, w.String(), attach)
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ func GetJwtData(jwtToken string) (map[string]interface{}, error) {
|
||||
return claims, nil
|
||||
}
|
||||
|
||||
func SendMail(subject, to, htmlBody string) error {
|
||||
func SendMail(subject, to, htmlBody string, attach *mail.File) error {
|
||||
|
||||
dataSmtp := &dbdata.SettingSmtp{}
|
||||
err := dbdata.SettingGet(dataSmtp)
|
||||
@@ -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
|
||||
@@ -102,6 +102,10 @@ func SendMail(subject, to, htmlBody string) error {
|
||||
AddTo(to).
|
||||
SetSubject(subject)
|
||||
|
||||
if attach != nil {
|
||||
email.Attach(attach)
|
||||
}
|
||||
|
||||
email.SetBody(mail.TextHTML, htmlBody)
|
||||
|
||||
// Call Send and pass the client
|
||||
|
@@ -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"`
|
||||
@@ -82,6 +83,7 @@ type ServerConfig struct {
|
||||
NoCompressLimit int `json:"no_compress_limit"` // int
|
||||
|
||||
DisplayError bool `json:"display_error"`
|
||||
ExcludeExportIp bool `json:"exclude_export_ip"`
|
||||
}
|
||||
|
||||
func initServerCfg() {
|
||||
|
@@ -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},
|
||||
@@ -35,7 +36,7 @@ var configs = []config{
|
||||
{Typ: cfgStr, Name: "log_path", Usage: "日志文件路径,默认标准输出", ValStr: ""},
|
||||
{Typ: cfgStr, Name: "log_level", Usage: "日志等级 [debug info warn error]", ValStr: "debug"},
|
||||
{Typ: cfgBool, Name: "http_server_log", Usage: "开启go标准库http.Server的日志", ValBool: false},
|
||||
{Typ: cfgBool, Name: "pprof", Usage: "开启pprof", ValBool: false},
|
||||
{Typ: cfgBool, Name: "pprof", Usage: "开启pprof", ValBool: true},
|
||||
{Typ: cfgStr, Name: "issuer", Usage: "系统名称", ValStr: "XX公司VPN"},
|
||||
{Typ: cfgStr, Name: "admin_user", Usage: "管理用户名", ValStr: "admin"},
|
||||
{Typ: cfgStr, Name: "admin_pass", Usage: "管理用户密码", ValStr: defaultPwd},
|
||||
@@ -48,17 +49,17 @@ var configs = []config{
|
||||
{Typ: cfgStr, Name: "ipv4_start", Usage: "IPV4开始地址", ValStr: "192.168.90.100"},
|
||||
{Typ: cfgStr, Name: "ipv4_end", Usage: "IPV4结束", ValStr: "192.168.90.200"},
|
||||
{Typ: cfgStr, Name: "default_group", Usage: "默认用户组", ValStr: "one"},
|
||||
{Typ: cfgStr, Name: "default_domain", Usage: "要发布的默认域", ValStr: ""},
|
||||
{Typ: cfgStr, Name: "default_domain", Usage: "客户端dns的默认搜索域", ValStr: ""},
|
||||
|
||||
{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: 3},
|
||||
{Typ: cfgInt, Name: "cstp_dpd", Usage: "死链接检测时间(秒)", ValInt: 20},
|
||||
{Typ: cfgInt, Name: "mobile_keepalive", Usage: "移动端keepalive接检测时间(秒)", ValInt: 4},
|
||||
{Typ: cfgInt, Name: "mobile_dpd", Usage: "移动端死链接检测时间(秒)", ValInt: 60},
|
||||
{Typ: cfgInt, Name: "mtu", Usage: "最大传输单元MTU", ValInt: 1460},
|
||||
{Typ: cfgInt, Name: "idle_timeout", Usage: "空闲链接超时时间(秒)-超时后断开链接,0关闭此功能", ValInt: 7200},
|
||||
{Typ: cfgInt, Name: "idle_timeout", Usage: "空闲链接超时时间(秒)-超时后断开链接,0关闭此功能", ValInt: 0},
|
||||
{Typ: cfgInt, Name: "session_timeout", Usage: "session过期时间(秒)-用于断线重连,0永不过期", ValInt: 3600},
|
||||
// {Typ: cfgInt, Name: "auth_timeout", Usage: "auth_timeout", ValInt: 0},
|
||||
{Typ: cfgInt, Name: "audit_interval", Usage: "审计去重间隔(秒),-1关闭", ValInt: 600},
|
||||
@@ -69,6 +70,7 @@ var configs = []config{
|
||||
{Typ: cfgInt, Name: "no_compress_limit", Usage: "低于及等于多少字节不压缩", ValInt: 256},
|
||||
|
||||
{Typ: cfgBool, Name: "display_error", Usage: "客户端显示详细错误信息(线上环境慎开启)", ValBool: false},
|
||||
{Typ: cfgBool, Name: "exclude_export_ip", Usage: "排除出口ip路由(出口ip不加密传输)", ValBool: true},
|
||||
}
|
||||
|
||||
var envs = map[string]string{}
|
||||
|
@@ -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)
|
||||
}
|
||||
}
|
||||
|
@@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# docker run -it --rm -v $PWD:/app -v /go:/go -w /app --platform=linux/arm64 golang:alpine3.19 sh build_test.sh
|
||||
|
||||
set -x
|
||||
|
||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
|
||||
export GOPROXY=https://goproxy.cn
|
||||
|
||||
|
||||
apk add build-base tzdata gcc musl-dev upx
|
||||
|
||||
#go build -o anylink
|
||||
go build -o anylink -ldflags "-s -w -extldflags '-static'"
|
||||
|
||||
|
||||
go env
|
||||
uname -a
|
||||
|
||||
./anylink -v
|
@@ -7,15 +7,24 @@
|
||||
db_type = "sqlite3"
|
||||
db_source = "./conf/anylink.db"
|
||||
#证书文件 使用跟nginx一样的证书即可
|
||||
cert_file = "./conf/vpn_cert.crt"
|
||||
cert_file = "./conf/vpn_cert.pem"
|
||||
cert_key = "./conf/vpn_cert.key"
|
||||
files_path = "./conf/files"
|
||||
profile = "./conf/profile.xml"
|
||||
#日志目录,为空写入标准输出
|
||||
#profile name(用于区分不同服务端的配置)
|
||||
#客户端存放位置
|
||||
#Windows 10
|
||||
#%ProgramData%Cisco\Cisco AnyConnect Secure Mobility Client\Profile
|
||||
#Mac Os X
|
||||
#/opt/cisco/anyconnect/profile
|
||||
#Linux
|
||||
#/opt/cisco/anyconnect/profile
|
||||
profile_name = "anylink"
|
||||
#日志目录,默认为空写入标准输出
|
||||
#log_path = "./log"
|
||||
log_path = ""
|
||||
log_level = "debug"
|
||||
pprof = false
|
||||
pprof = true
|
||||
|
||||
#系统名称
|
||||
issuer = "XX公司VPN"
|
||||
@@ -32,7 +41,7 @@ jwt_secret = "abcdef.0123456789.abcdef"
|
||||
#TCP服务监听地址(任意端口)
|
||||
server_addr = ":443"
|
||||
#开启 DTLS
|
||||
server_dtls = true
|
||||
server_dtls = false
|
||||
#UDP监听地址(任意端口)
|
||||
server_dtls_addr = ":443"
|
||||
#后台服务监听地址
|
||||
@@ -44,6 +53,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,23 +71,29 @@ ip_lease = 86400
|
||||
default_group = "one"
|
||||
|
||||
#客户端失效检测时间(秒) dpd > keepalive
|
||||
cstp_keepalive = 5
|
||||
cstp_dpd = 12
|
||||
mobile_keepalive = 10
|
||||
mobile_dpd = 22
|
||||
cstp_keepalive = 3
|
||||
cstp_dpd = 20
|
||||
mobile_keepalive = 4
|
||||
mobile_dpd = 60
|
||||
|
||||
# 根据实际情况修改
|
||||
#cstp_keepalive = 20
|
||||
#cstp_dpd = 30
|
||||
#mobile_keepalive = 40
|
||||
#mobile_dpd = 60
|
||||
|
||||
#设置最大传输单元
|
||||
mtu = 1460
|
||||
|
||||
# 要发布的默认域
|
||||
# 客户端dns的默认搜索域
|
||||
default_domain = "example.com"
|
||||
#default_domain = "example.com abc.example.com"
|
||||
|
||||
#空闲链接超时时间(秒)-超时后断开链接,0关闭此功能
|
||||
idle_timeout = 7200
|
||||
idle_timeout = 0
|
||||
#session过期时间,用于断线重连,0永不过期
|
||||
session_timeout = 3600
|
||||
auth_timeout = 0
|
||||
#auth_timeout = 0
|
||||
audit_interval = 600
|
||||
|
||||
show_sql = false
|
||||
@@ -93,4 +109,5 @@ no_compress_limit = 256
|
||||
#客户端显示详细错误信息(线上环境慎开启)
|
||||
display_error = false
|
||||
|
||||
|
||||
#排除出口ip路由(出口ip不加密传输)
|
||||
exclude_export_ip = true
|
||||
|
@@ -7,9 +7,12 @@
|
||||
db_type = "sqlite3"
|
||||
db_source = "./conf/anylink.db"
|
||||
#证书文件
|
||||
cert_file = "./conf/vpn_cert.crt"
|
||||
cert_file = "./conf/vpn_cert.pem"
|
||||
cert_key = "./conf/vpn_cert.key"
|
||||
files_path = "./conf/files"
|
||||
|
||||
#日志目录,默认为空写入标准输出
|
||||
#log_path = "./log"
|
||||
log_level = "debug"
|
||||
|
||||
#系统名称
|
||||
@@ -26,15 +29,21 @@ jwt_secret = "abcdef.0123456789.abcdef"
|
||||
#TCP服务监听地址(任意端口)
|
||||
server_addr = ":443"
|
||||
#开启 DTLS
|
||||
server_dtls = true
|
||||
server_dtls = false
|
||||
#UDP监听地址(任意端口)
|
||||
server_dtls_addr = ":443"
|
||||
#后台服务监听地址
|
||||
admin_addr = ":8800"
|
||||
|
||||
#最大客户端数量
|
||||
max_client = 200
|
||||
#单个用户同时在线数量
|
||||
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"
|
||||
|
@@ -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,
|
||||
}
|
||||
@@ -142,7 +144,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 +155,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
|
||||
}
|
||||
|
||||
@@ -169,17 +183,22 @@ const accountMail = `<p>您好:</p>
|
||||
用户PIN码: <b>{{.PinCode}}</b> <br/>
|
||||
<!--
|
||||
用户动态码(3天后失效):<br/>
|
||||
<img src="{{.OtpImg}}"/>
|
||||
<img src="{{.OtpImg}}"/><br/>
|
||||
|
||||
用户动态码(请妥善保存):<br/>
|
||||
<img src="{{.OtpImgBase64}}"/><br/>
|
||||
|
||||
下面是兼容 gmail 的写法
|
||||
-->
|
||||
用户动态码(请妥善保存):<br/>
|
||||
<img src="{{.OtpImgBase64}}"/>
|
||||
<img src="cid:userOtpQr.png" alt="userOtpQr" /><br/>
|
||||
</p>
|
||||
<div>
|
||||
使用说明:
|
||||
<ul>
|
||||
<li>请使用OTP软件扫描动态码二维码</li>
|
||||
<li>然后使用anyconnect客户端进行登陆</li>
|
||||
<li>登陆密码为 【PIN码+动态码】</li>
|
||||
<li>登陆密码为 【PIN码+动态码】(中间没有+号)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p>
|
||||
|
@@ -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"`
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -5,10 +5,10 @@ go 1.20
|
||||
require (
|
||||
github.com/arl/statsviz v0.6.0
|
||||
github.com/deckarep/golang-set v1.8.0
|
||||
github.com/go-acme/lego/v4 v4.14.2
|
||||
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
|
||||
@@ -17,9 +17,9 @@ require (
|
||||
github.com/ivpusic/grpool v1.0.0
|
||||
github.com/lanrenwo/lzsgo v0.0.2
|
||||
github.com/lib/pq v1.10.9
|
||||
github.com/mattn/go-sqlite3 v1.14.19
|
||||
github.com/mattn/go-sqlite3 v1.14.22
|
||||
github.com/orcaman/concurrent-map v1.0.0
|
||||
github.com/pion/dtls/v2 v2.2.9
|
||||
github.com/pion/dtls/v2 v2.2.10
|
||||
github.com/pion/logging v0.2.2
|
||||
github.com/pires/go-proxyproto v0.7.0
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||
@@ -32,25 +32,25 @@ 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.18.0
|
||||
golang.org/x/net v0.20.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
|
||||
xorm.io/xorm v1.3.7
|
||||
xorm.io/xorm v1.3.8
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.62.664 // 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.86.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.5.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.5 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.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.846 // indirect
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.846 // 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.3 // 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-20240119083558-1b970713d09a // indirect
|
||||
golang.org/x/mod v0.14.0 // indirect
|
||||
golang.org/x/tools v0.17.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.16.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.664 h1:6cNj+hrRbQiMDV5PLO7iYY2GfMtjRhuqsM9t1+UhJok=
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.62.664/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.86.0 h1:jEKN5VHNYNYtfDL2lUFLTRo+nOVNPFxpXTstVx0rqHI=
|
||||
github.com/cloudflare/cloudflare-go v0.86.0/go.mod h1:wYW/5UP02TUfBToa/yKbQHV+r6h1NnJ1Je7XjuGM4Jw=
|
||||
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=
|
||||
@@ -31,20 +33,20 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||
github.com/go-acme/lego/v4 v4.14.2 h1:/D/jqRgLi8Cbk33sLGtu2pX2jEg3bGJWHyV8kFuUHGM=
|
||||
github.com/go-acme/lego/v4 v4.14.2/go.mod h1:kBXxbeTg0x9AgaOYjPSwIeJy3Y33zTz+tMD16O4MO6c=
|
||||
github.com/go-acme/lego/v4 v4.15.0 h1:A7MHEU3b+TDFqhC/HmzMJnzPbyeaYvMZQBbqgvbThhU=
|
||||
github.com/go-acme/lego/v4 v4.15.0/go.mod h1:eeGhjW4zWT7Ccqa3sY7ayEqFLCAICx+mXgkMHKIkLxg=
|
||||
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,18 +61,18 @@ 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=
|
||||
github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
|
||||
github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo=
|
||||
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
|
||||
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE=
|
||||
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
@@ -116,9 +118,9 @@ github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||
github.com/mattn/go-sqlite3 v1.14.19 h1:fhGleo2h1p8tVChob4I9HpmVFIAkKGpiukdrgQbWfGI=
|
||||
github.com/mattn/go-sqlite3 v1.14.19/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
|
||||
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/miekg/dns v1.1.58 h1:ca2Hdkz+cDg/7eNF6V56jjzuZ4aCAE+DbVkILdQWG/4=
|
||||
github.com/miekg/dns v1.1.58/go.mod h1:Ypv+3b/KadlvW9vJfXOTf300O4UqaHFzFCuHz+rPkBY=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
@@ -143,11 +145,10 @@ github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HD
|
||||
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
|
||||
github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI=
|
||||
github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
||||
github.com/pion/dtls/v2 v2.2.9 h1:K+D/aVf9/REahQvqk6G5JavdrD8W1PWDKC11UlwN7ts=
|
||||
github.com/pion/dtls/v2 v2.2.9/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s=
|
||||
github.com/pion/dtls/v2 v2.2.10 h1:u2Axk+FyIR1VFTPurktB+1zoEPGIW3bmyj3LEFrXjAA=
|
||||
github.com/pion/dtls/v2 v2.2.10/go.mod h1:d9SYc9fch0CqK90mRk1dC7AkzzpwJj6u2GU3u+9pqFE=
|
||||
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
|
||||
github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
|
||||
github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g=
|
||||
github.com/pion/transport/v2 v2.2.4 h1:41JJK6DZQYSeVLxILA2+F4ZkKb4Xd/tFJZRFZQ9QAlo=
|
||||
github.com/pion/transport/v2 v2.2.4/go.mod h1:q2U/tf9FEfnSBGSW6w5Qp5PFWRLRj3NjLhCCgpRK4p0=
|
||||
github.com/pires/go-proxyproto v0.7.0 h1:IukmRewDQFWC7kfnb66CSomk2q/seBuilHBYFwyq0Hs=
|
||||
@@ -199,22 +200,20 @@ 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=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
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.846 h1:5/fC1P4bzGmlHWmzgRgZ/pybS3er4dxpqa/yquF+YOQ=
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.846/go.mod h1:r5r4xbfxSaeR04b166HGsBa/R4U3SueirEUpXGuw+Q0=
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.846 h1:X3gwCrnd5FeCnk0cqIm7lfK5684zYrwRhhzlzHcjMVk=
|
||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.846/go.mod h1:jHNnw3sqFpKGHLTewQ9x4pjiaB6Rn91RXKLWuFE9Bgg=
|
||||
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=
|
||||
@@ -230,17 +229,15 @@ 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=
|
||||
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
|
||||
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
@@ -248,45 +245,44 @@ 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.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
|
||||
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 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
|
||||
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
|
||||
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-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA=
|
||||
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
|
||||
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.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
|
||||
golang.org/x/mod v0.14.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=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||
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 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
|
||||
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
|
||||
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=
|
||||
@@ -303,19 +299,21 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
|
||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
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=
|
||||
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
|
||||
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=
|
||||
@@ -335,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.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc=
|
||||
golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps=
|
||||
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=
|
||||
@@ -382,5 +380,5 @@ modernc.org/token v1.0.1 h1:A3qvTqOwexpfZZeyI0FeGPDlSWX5pjZu9hF4lU+EKWg=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
xorm.io/builder v0.3.13 h1:a3jmiVVL19psGeXx8GIurTp7p0IIgqeDmwhcR6BAOAo=
|
||||
xorm.io/builder v0.3.13/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE=
|
||||
xorm.io/xorm v1.3.7 h1:mLceAGu0b87r9pD4qXyxGHxifOXIIrAdVcA6k95/osw=
|
||||
xorm.io/xorm v1.3.7/go.mod h1:LsCCffeeYp63ssk0pKumP6l96WZcHix7ChpurcLNuMw=
|
||||
xorm.io/xorm v1.3.8 h1:CJmplmWqfSRpLWSPMmqz+so8toBp3m7ehuRehIWedZo=
|
||||
xorm.io/xorm v1.3.8/go.mod h1:LsCCffeeYp63ssk0pKumP6l96WZcHix7ChpurcLNuMw=
|
||||
|
@@ -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{}
|
||||
|
@@ -46,10 +46,11 @@ func LinkAuth(w http.ResponseWriter, r *http.Request) {
|
||||
cr := ClientRequest{}
|
||||
err = xml.Unmarshal(body, &cr)
|
||||
if err != nil {
|
||||
base.Error(err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
// fmt.Printf("%+v \n", cr)
|
||||
base.Trace(fmt.Sprintf("%+v \n", cr))
|
||||
// setCommonHeader(w)
|
||||
if cr.Type == "logout" {
|
||||
// 退出删除session信息
|
||||
@@ -137,10 +138,10 @@ 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)
|
||||
base.Info("login", cr.Auth.Username, userAgent)
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -175,6 +176,7 @@ type RequestData struct {
|
||||
SessionId string
|
||||
SessionToken string
|
||||
Banner string
|
||||
ProfileName string
|
||||
ProfileHash string
|
||||
}
|
||||
|
||||
@@ -227,7 +229,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)
|
||||
@@ -37,14 +37,14 @@ func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessio
|
||||
// 设置超时限制
|
||||
err = conn.SetReadDeadline(utils.NowSec().Add(dead))
|
||||
if err != nil {
|
||||
base.Error("SetDeadline: ", cSess.Username, err)
|
||||
base.Error("SetDeadline: ", cSess.Username, cSess.IpAddr, err)
|
||||
return
|
||||
}
|
||||
// hdata := make([]byte, BufferSize)
|
||||
pl := getPayload()
|
||||
n, err = bufRW.Read(pl.Data)
|
||||
if err != nil {
|
||||
base.Error("read hdata: ", cSess.Username, err)
|
||||
base.Warn("read hdata: ", cSess.Username, cSess.IpAddr, err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -57,30 +57,30 @@ func LinkCstp(conn net.Conn, bufRW *bufio.ReadWriter, cSess *sessdata.ConnSessio
|
||||
switch pl.Data[6] {
|
||||
case 0x07: // KEEPALIVE
|
||||
// do nothing
|
||||
// base.Debug("recv keepalive", cSess.IpAddr)
|
||||
base.Trace("recv LinkCstp Keepalive", cSess.Username, cSess.IpAddr, conn.RemoteAddr())
|
||||
// 判断超时时间
|
||||
if checkIdle {
|
||||
lastTime = cSess.LastDataTime.Load()
|
||||
if lastTime.Before(utils.NowSec().Add(-idle)) {
|
||||
base.Warn("IdleTimeout", cSess.Username, cSess.IpAddr, "lastTime", lastTime)
|
||||
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
|
||||
}
|
||||
}
|
||||
case 0x05: // DISCONNECT
|
||||
cSess.UserLogoutCode = dbdata.UserLogoutClient
|
||||
base.Debug("DISCONNECT", cSess.Username, cSess.IpAddr)
|
||||
base.Info("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.Debug("recv DPD-REQ", cSess.IpAddr)
|
||||
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
|
||||
}
|
||||
case 0x04:
|
||||
// log.Println("recv DPD-RESP")
|
||||
base.Trace("recv LinkCstp DPD-RESP", cSess.Username, cSess.IpAddr, conn.RemoteAddr())
|
||||
case 0x08: // decompress
|
||||
if cSess.CstpPickCmp == nil {
|
||||
continue
|
||||
@@ -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,14 +169,14 @@ 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
|
||||
}
|
||||
|
||||
n, err = conn.Write(pl.Data)
|
||||
if err != nil {
|
||||
base.Error("write err", cSess.Username, err)
|
||||
base.Warn("write err", cSess.Username, cSess.IpAddr, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -36,14 +36,14 @@ func LinkDtls(conn net.Conn, cSess *sessdata.ConnSession) {
|
||||
for {
|
||||
err = conn.SetReadDeadline(utils.NowSec().Add(dead))
|
||||
if err != nil {
|
||||
base.Error("SetDeadline: ", cSess.Username, err)
|
||||
base.Error("SetDeadline: ", cSess.Username, cSess.IpAddr, err)
|
||||
return
|
||||
}
|
||||
|
||||
pl := getPayload()
|
||||
n, err = conn.Read(pl.Data)
|
||||
if err != nil {
|
||||
base.Error("read hdata: ", cSess.Username, err)
|
||||
base.Warn("read hdata: ", cSess.Username, cSess.IpAddr, err)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -56,20 +56,21 @@ func LinkDtls(conn net.Conn, cSess *sessdata.ConnSession) {
|
||||
switch pl.Data[0] {
|
||||
case 0x07: // KEEPALIVE
|
||||
// do nothing
|
||||
// base.Debug("recv keepalive", cSess.IpAddr)
|
||||
base.Trace("recv LinkDtls Keepalive", cSess.Username, cSess.IpAddr, conn.RemoteAddr())
|
||||
case 0x05: // DISCONNECT
|
||||
cSess.UserLogoutCode = dbdata.UserLogoutClient
|
||||
base.Debug("DISCONNECT DTLS", cSess.Username, cSess.IpAddr)
|
||||
base.Info("DISCONNECT DTLS", cSess.Username, cSess.IpAddr, conn.RemoteAddr())
|
||||
return
|
||||
case 0x03: // DPD-REQ
|
||||
// base.Debug("recv DPD-REQ", cSess.IpAddr)
|
||||
base.Trace("recv LinkDtls DPD-REQ", cSess.Username, cSess.IpAddr, conn.RemoteAddr(), n)
|
||||
pl.PType = 0x04
|
||||
// 从零开始 可以直接赋值
|
||||
pl.Data = pl.Data[:n]
|
||||
if payloadOutDtls(cSess, dSess, pl) {
|
||||
return
|
||||
}
|
||||
case 0x04:
|
||||
// base.Debug("recv DPD-RESP", cSess.IpAddr)
|
||||
base.Trace("recv LinkDtls DPD-RESP", cSess.Username, cSess.IpAddr, conn.RemoteAddr())
|
||||
case 0x08: // decompress
|
||||
if cSess.DtlsPickCmp == nil {
|
||||
continue
|
||||
@@ -95,7 +96,7 @@ func LinkDtls(conn net.Conn, cSess *sessdata.ConnSession) {
|
||||
return
|
||||
}
|
||||
// 只记录返回正确的数据时间
|
||||
cSess.LastDataTime.Store(utils.NowSec())
|
||||
cSess.LastDataTime.Store(utils.NowSec().Unix())
|
||||
}
|
||||
|
||||
}
|
||||
@@ -150,12 +151,15 @@ func dtlsWrite(conn net.Conn, dSess *sessdata.DtlsSession, cSess *sessdata.ConnS
|
||||
}
|
||||
} else {
|
||||
// 设置头类型
|
||||
// pl.Data = append(pl.Data[:0], pl.PType)
|
||||
if pl.PType == 0x04 {
|
||||
pl.Data[0] = pl.PType
|
||||
} else {
|
||||
pl.Data = append(pl.Data[:0], pl.PType)
|
||||
}
|
||||
}
|
||||
n, err := conn.Write(pl.Data)
|
||||
if err != nil {
|
||||
base.Error("write err", cSess.Username, err)
|
||||
base.Warn("write err", cSess.Username, cSess.IpAddr, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -27,10 +27,16 @@ func LinkHome(w http.ResponseWriter, r *http.Request) {
|
||||
if err := dbdata.SettingGet(index); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if index.Homecode > 0 {
|
||||
w.WriteHeader(index.Homecode)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
if index.Homeindex == "" {
|
||||
index.Homeindex = "AnyLink 是一个企业级远程办公 SSL VPN 软件,可以支持多人同时在线使用。"
|
||||
}
|
||||
|
||||
// if index.Homeindex == "" {
|
||||
// index.Homeindex = "AnyLink 是一个企业级远程办公 SSL VPN 软件,可以支持多人同时在线使用。"
|
||||
// }
|
||||
fmt.Fprintln(w, index.Homeindex)
|
||||
}
|
||||
|
||||
|
@@ -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 {
|
||||
@@ -44,15 +46,29 @@ func checkTun() {
|
||||
// 修复 rockyos nat 不生效
|
||||
base.CheckModOrLoad("iptable_filter")
|
||||
base.CheckModOrLoad("iptable_nat")
|
||||
// base.CheckModOrLoad("xt_comment")
|
||||
|
||||
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"}
|
||||
if base.InContainer {
|
||||
natRule = []string{"-s", base.Cfg.Ipv4CIDR, "-o", base.Cfg.Ipv4Master, "-j", "MASQUERADE"}
|
||||
}
|
||||
if forwardExists, _ := ipt.Exists("filter", "FORWARD", forwardRule...); !forwardExists {
|
||||
ipt.Insert("filter", "FORWARD", 1, forwardRule...)
|
||||
err = ipt.InsertUnique("nat", "POSTROUTING", 1, natRule...)
|
||||
if err != nil {
|
||||
base.Error(err)
|
||||
}
|
||||
|
||||
// 添加注释
|
||||
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)
|
||||
}
|
||||
|
||||
base.Info(ipt.List("nat", "POSTROUTING"))
|
||||
base.Info(ipt.List("filter", "FORWARD"))
|
||||
}
|
||||
@@ -73,8 +89,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})
|
||||
|
@@ -43,13 +43,13 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
|
||||
// 判断session-token的值
|
||||
cookie, err := r.Cookie("webvpn")
|
||||
if err != nil || cookie.Value == "" {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
sess := sessdata.SToken2Sess(cookie.Value)
|
||||
if sess == nil {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
|
||||
cSess := sess.NewConn()
|
||||
if cSess == nil {
|
||||
log.Println(err)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -66,6 +66,8 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
|
||||
cstpBaseMtu := r.Header.Get("X-CSTP-Base-MTU")
|
||||
masterSecret := r.Header.Get("X-DTLS-Master-Secret")
|
||||
localIp := r.Header.Get("X-Cstp-Local-Address-Ip4")
|
||||
// 出口ip
|
||||
exportIp4 := r.Header.Get("X-Cstp-Remote-Address-Ip4")
|
||||
mobile := r.Header.Get("X-Cstp-License")
|
||||
|
||||
cSess.SetMtu(cstpMtu)
|
||||
@@ -90,20 +92,12 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
|
||||
dtlsPort = ss[1]
|
||||
}
|
||||
|
||||
base.Debug(cSess.IpAddr, cSess.MacHw, sess.Username, mobile)
|
||||
base.Info(sess.Username, cSess.IpAddr, cSess.MacHw, cSess.Client, mobile)
|
||||
|
||||
// 检测密码套件
|
||||
dtlsCiphersuite := checkDtls12Ciphersuite(r.Header.Get("X-Dtls12-Ciphersuite"))
|
||||
base.Trace("dtlsCiphersuite", dtlsCiphersuite)
|
||||
|
||||
// 压缩
|
||||
if cmpName, ok := cSess.SetPickCmp("cstp", r.Header.Get("X-Cstp-Accept-Encoding")); ok {
|
||||
HttpSetHeader(w, "X-CSTP-Content-Encoding", cmpName)
|
||||
}
|
||||
if cmpName, ok := cSess.SetPickCmp("dtls", r.Header.Get("X-Dtls-Accept-Encoding")); ok {
|
||||
HttpSetHeader(w, "X-DTLS-Content-Encoding", cmpName)
|
||||
}
|
||||
|
||||
// 返回客户端数据
|
||||
HttpSetHeader(w, "Server", fmt.Sprintf("%s %s", base.APP_NAME, base.APP_VER))
|
||||
HttpSetHeader(w, "X-CSTP-Version", "1")
|
||||
@@ -113,11 +107,19 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
|
||||
HttpSetHeader(w, "X-CSTP-Netmask", sessdata.IpPool.Ipv4Mask.String()) // 子网掩码
|
||||
HttpSetHeader(w, "X-CSTP-Hostname", hn) // 机器名称
|
||||
HttpSetHeader(w, "X-CSTP-Base-MTU", cstpBaseMtu)
|
||||
// 要发布的默认域
|
||||
// 客户端dns的默认搜索域
|
||||
if base.Cfg.DefaultDomain != "" {
|
||||
HttpSetHeader(w, "X-CSTP-Default-Domain", base.Cfg.DefaultDomain)
|
||||
}
|
||||
|
||||
// 压缩
|
||||
if cmpName, ok := cSess.SetPickCmp("cstp", r.Header.Get("X-Cstp-Accept-Encoding")); ok {
|
||||
HttpSetHeader(w, "X-CSTP-Content-Encoding", cmpName)
|
||||
}
|
||||
if cmpName, ok := cSess.SetPickCmp("dtls", r.Header.Get("X-Dtls-Accept-Encoding")); ok {
|
||||
HttpSetHeader(w, "X-DTLS-Content-Encoding", cmpName)
|
||||
}
|
||||
|
||||
// 设置用户策略
|
||||
SetUserPolicy(cSess.Username, cSess.Group)
|
||||
|
||||
@@ -131,15 +133,19 @@ 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)
|
||||
}
|
||||
// 不允许的路由 X-Cstp-Remote-Address-Ip4:
|
||||
// 不允许的路由
|
||||
for _, v := range cSess.Group.RouteExclude {
|
||||
HttpAddHeader(w, "X-CSTP-Split-Exclude", v.IpMask)
|
||||
}
|
||||
// 排除出口ip路由(出口ip不加密传输)
|
||||
if base.Cfg.ExcludeExportIp && exportIp4 != "" {
|
||||
HttpAddHeader(w, "X-CSTP-Split-Exclude", exportIp4+"/255.255.255.255")
|
||||
}
|
||||
|
||||
HttpSetHeader(w, "X-CSTP-Lease-Duration", "1209600") // ip地址租期
|
||||
HttpSetHeader(w, "X-CSTP-Session-Timeout", "none")
|
||||
@@ -186,7 +192,7 @@ func LinkTunnel(w http.ResponseWriter, r *http.Request) {
|
||||
hClone := w.Header().Clone()
|
||||
buf := &bytes.Buffer{}
|
||||
_ = hClone.Write(buf)
|
||||
base.Trace("LinkTunnel Response Header:", buf.String())
|
||||
base.Debug("LinkTunnel Response Header:", buf.String())
|
||||
|
||||
hj := w.(http.Hijacker)
|
||||
conn, bufRW, err := hj.Hijack()
|
||||
|
@@ -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 {
|
||||
|
@@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
@@ -97,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)
|
||||
@@ -116,8 +117,10 @@ func initRoute() http.Handler {
|
||||
|
||||
func notFound(w http.ResponseWriter, r *http.Request) {
|
||||
// fmt.Println(r.RemoteAddr)
|
||||
// hu, _ := httputil.DumpRequest(r, true)
|
||||
// fmt.Println("NotFound: ", string(hu))
|
||||
if base.GetLogLevel() == base.LogLevelTrace {
|
||||
hd, _ := httputil.DumpRequest(r, true)
|
||||
base.Trace("NotFound: ", r.RemoteAddr, string(hd))
|
||||
}
|
||||
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
fmt.Fprintln(w, "404 page not found")
|
||||
|
@@ -17,6 +17,12 @@ func Start() {
|
||||
sessdata.Start()
|
||||
cron.Start()
|
||||
|
||||
// 开启服务器转发
|
||||
err := execCmd([]string{"sysctl -w net.ipv4.ip_forward=1"})
|
||||
if err != nil {
|
||||
base.Fatal(err)
|
||||
}
|
||||
|
||||
switch base.Cfg.LinkMode {
|
||||
case base.LinkModeTUN:
|
||||
checkTun()
|
||||
|
@@ -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>
|
||||
|
@@ -197,10 +197,14 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排除本地网络" prop="allow_lan">
|
||||
<el-switch
|
||||
v-model="ruleForm.allow_lan"
|
||||
active-text="开启后 用户本地所在网段将不通过anylink加密传输">
|
||||
</el-switch>
|
||||
<!-- active-text="开启后 用户本地所在网段将不通过anylink加密传输" -->
|
||||
<el-switch v-model="ruleForm.allow_lan"></el-switch>
|
||||
<div class="msg-info">
|
||||
注:本地网络 指的是:
|
||||
运行 anyconnect 客户端的PC 所在的的网络,既本地路由网段。
|
||||
开启后,PC本地路由网段的数据就不会走隧道链路转发数据了。
|
||||
同时 anyconnect 客户端需要勾选本地网络(Local Lan)的开关,功能才能生效。
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="客户端DNS" prop="client_dns">
|
||||
@@ -377,7 +381,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="排除域名" prop="ds_exclude_domains">
|
||||
<el-input type="textarea" :rows="5" v-model="ruleForm.ds_exclude_domains" placeholder="输入域名用,号分隔,默认匹配所有子域名, 如baidu.com,163.com"></el-input>
|
||||
<div class="msg-info">注:域名拆分隧道,仅支持AnyConnect的桌面客户端,不支持移动端.</div>
|
||||
<div class="msg-info">注:域名拆分隧道,仅支持AnyConnect的windows和MacOS桌面客户端,不支持移动端.</div>
|
||||
</el-form-item>
|
||||
</el-tab-pane>
|
||||
<el-form-item>
|
||||
|
@@ -37,7 +37,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('dataSmtp')"
|
||||
>保存</el-button
|
||||
>保存
|
||||
</el-button
|
||||
>
|
||||
<el-button @click="resetForm('dataSmtp')">重置</el-button>
|
||||
</el-form-item>
|
||||
@@ -88,7 +89,7 @@
|
||||
step: '01:00',
|
||||
end: '23:00',
|
||||
}"
|
||||
editable="false,"
|
||||
:editable="false"
|
||||
size="small"
|
||||
placeholder="请选择"
|
||||
style="width: 130px"
|
||||
@@ -97,7 +98,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('dataAuditLog')"
|
||||
>保存</el-button
|
||||
>保存
|
||||
</el-button
|
||||
>
|
||||
<el-button @click="resetForm('dataAuditLog')">重置</el-button>
|
||||
</el-form-item>
|
||||
@@ -125,7 +127,8 @@
|
||||
:limit="1"
|
||||
>
|
||||
<el-button size="mini" icon="el-icon-plus" slot="trigger"
|
||||
>证书文件</el-button
|
||||
>证书文件
|
||||
</el-button
|
||||
>
|
||||
<el-tooltip
|
||||
class="item"
|
||||
@@ -145,7 +148,8 @@
|
||||
:limit="1"
|
||||
>
|
||||
<el-button size="mini" icon="el-icon-plus" slot="trigger"
|
||||
>私钥文件</el-button
|
||||
>私钥文件
|
||||
</el-button
|
||||
>
|
||||
<el-tooltip
|
||||
class="item"
|
||||
@@ -163,7 +167,8 @@
|
||||
icon="el-icon-upload"
|
||||
type="primary"
|
||||
@click="submitForm('customCert')"
|
||||
>上传</el-button
|
||||
>上传
|
||||
</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -214,7 +219,8 @@
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('letsCert')"
|
||||
>申请</el-button
|
||||
>申请
|
||||
</el-button
|
||||
>
|
||||
<el-button @click="resetForm('letsCert')">重置</el-button>
|
||||
</el-form-item>
|
||||
@@ -227,7 +233,7 @@
|
||||
:model="dataOther"
|
||||
ref="dataOther"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
label-width="130px"
|
||||
class="tab-one"
|
||||
>
|
||||
<el-form-item label="vpn对外地址" prop="link_addr">
|
||||
@@ -245,6 +251,14 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="自定义首页状态码" prop="homecode">
|
||||
<el-input-number
|
||||
v-model="dataOther.homecode"
|
||||
:min="0"
|
||||
:max="1000"
|
||||
></el-input-number>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="自定义首页" prop="homeindex">
|
||||
<el-input
|
||||
type="textarea"
|
||||
@@ -253,12 +267,12 @@
|
||||
v-model="dataOther.homeindex"
|
||||
>
|
||||
</el-input>
|
||||
<el-tooltip content="自定义内容可以参考 home 目录下的文件" placement="top">
|
||||
<el-tooltip content="自定义内容可以参考 index_template 目录下的文件" placement="top">
|
||||
<i class="el-icon-question"></i>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="账户开通邮件" prop="account_mail">
|
||||
<el-form-item label="账户开通邮件模板" prop="account_mail">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="10"
|
||||
@@ -279,7 +293,8 @@
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('dataOther')"
|
||||
>保存</el-button
|
||||
>保存
|
||||
</el-button
|
||||
>
|
||||
<el-button @click="resetForm('dataOther')">重置</el-button>
|
||||
</el-form-item>
|
||||
@@ -324,19 +339,19 @@ export default {
|
||||
authToken: "",
|
||||
},
|
||||
},
|
||||
customCert: { cert: "", key: "" },
|
||||
customCert: {cert: "", key: ""},
|
||||
dataOther: {},
|
||||
rules: {
|
||||
host: { required: true, message: "请输入服务器地址", trigger: "blur" },
|
||||
host: {required: true, message: "请输入服务器地址", trigger: "blur"},
|
||||
port: [
|
||||
{ required: true, message: "请输入服务器端口", trigger: "blur" },
|
||||
{required: true, message: "请输入服务器端口", trigger: "blur"},
|
||||
{
|
||||
type: "number",
|
||||
message: "请输入正确的服务器端口",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
],
|
||||
issuer: { required: true, message: "请输入系统名称", trigger: "blur" },
|
||||
issuer: {required: true, message: "请输入系统名称", trigger: "blur"},
|
||||
domain: {
|
||||
required: true,
|
||||
message: "请输入需要申请证书的域名",
|
||||
@@ -347,7 +362,7 @@ export default {
|
||||
message: "请输入申请证书的邮箱地址",
|
||||
trigger: "blur",
|
||||
},
|
||||
name: { required: true, message: "请选择域名服务商", trigger: "blur" },
|
||||
name: {required: true, message: "请选择域名服务商", trigger: "blur"},
|
||||
},
|
||||
certUpload: "/set/other/customcert",
|
||||
dnsProvider: {
|
||||
|
@@ -50,6 +50,7 @@
|
||||
</div>
|
||||
<Cell left="软件版本" :right="system.sys.appVersion" divider/>
|
||||
<Cell left="软件CommitId" :right="system.sys.appCommitId" divider/>
|
||||
<Cell left="软件BuildDate" :right="system.sys.appBuildDate" divider/>
|
||||
<Cell left="GO系统" :right="system.sys.goOs" divider/>
|
||||
<Cell left="GoArch" :right="system.sys.goArch" divider/>
|
||||
<Cell left="GO版本" :right="system.sys.goVersion" divider/>
|
||||
|
@@ -217,7 +217,8 @@
|
||||
|
||||
<el-form-item label="禁用OTP" prop="disable_otp">
|
||||
<el-switch
|
||||
v-model="ruleForm.disable_otp">
|
||||
v-model="ruleForm.disable_otp"
|
||||
active-text="开启OTP后,用户密码为【PIN码+OTP动态码】(中间没有+号)">
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
|
||||
|
@@ -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) {
|
||||
|
3951
web/yarn.lock
3951
web/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user