Compare commits

..
218 Commits
Author SHA1 Message Date
aoshiguchen 2936a934d2 更新官网. 2024-12-07 15:23:19 +08:00
aoshiguchen 98e9a9c663 更新官网 2024-12-07 15:18:59 +08:00
aoshiguchen a8fec7caef 新增发版文章 2024-12-07 15:13:54 +08:00
aoshiguchen 64c155ad68 更新官网文档 2024-12-07 14:58:40 +08:00
aoshiguchen b260602810 更新README. 2024-12-07 11:31:57 +08:00
aoshiguchen ca2e7e5254 http代理优化,解决多个主域名存在上下级关系时,域名映射不能正常使用的问题 2024-11-22 22:22:39 +08:00
aoshiguchen 00eb14c3be 新增/更新域名 校验逻辑调整 2024-11-22 22:01:03 +08:00
aoshiguchen df7aec109d 更新官网常见问题列表 2024-11-09 15:33:29 +08:00
aoshiguchen 59ce5cfe85 更新官网赞赏列表 2024-11-09 15:25:16 +08:00
aoshiguchen d6ff43c7a6 更新VLog 2024-11-09 15:16:31 +08:00
aoshiguchen 9d226ab23b 配置调整 2024-11-09 14:30:49 +08:00
aoshiguchen 50afac643e 启动输出调整. 2024-11-04 16:37:23 +08:00
aoshiguchen 249dd5ec12 更新scripts 2024-11-03 16:58:54 +08:00
aoshiguchen 7c82dce6a6 解决admin编译报错 2024-11-03 16:50:34 +08:00
zCans 55c62c9281 端口映射:新增编辑优化 2024-11-02 17:36:12 +08:00
aoshiguchen b01226b5c5 调整端口映射中client ip的长度 2024-10-30 08:52:26 +08:00
aoshiguchen e2f64ce407 域名管理,校验正则优化 2024-10-27 19:10:37 +08:00
aoshiguchen c2cf34e6c8 去除文件头版权描述 2024-10-27 18:46:01 +08:00
aoshiguchen 1a326397f6 去除文件头版权描述 2024-10-26 15:15:19 +08:00
aoshiguchen e6e0639a92 更新README.md 2024-10-26 14:55:43 +08:00
aoshiguchen 8e26e5b36c Merge remote-tracking branch 'origin/master' into dev 2024-10-25 21:44:59 +08:00
aoshiguchen 0006a33a5d 新增docker-compose脚本 2024-10-25 21:39:12 +08:00
aoshiguchen 98ab8fd3d0 新增启动信息输出. 2024-10-25 16:43:31 +08:00
aoshiguchen 131a8120ca 新增启动信息输出 2024-10-16 18:04:45 +08:00
傲世孤尘 14b03c5d51 !65 对域名映射相关功能的重构
Merge pull request !65 from Mirac/dev-multi-domain
2024-10-10 13:06:43 +00:00
suxiang e207b81d3b 2.0.2版本文档维护 2024-09-22 14:02:43 +08:00
suxiang 8761a4e93e 2.0.2版本文档维护 2024-09-22 11:55:47 +08:00
suxiang 19f4ad915e 文档维护 2024-09-22 11:49:34 +08:00
suxiang 38a1304dab 文档维护 2024-09-22 11:48:46 +08:00
suxiang 4d35c8ffef optimizer: 域名管理支持多级域名 & fix:修改子域名,输入相同子域名引起的报错。优化前端交互内容显示。 2024-09-21 17:48:17 +08:00
suxiang 930ad52b3e 文档维护 2024-09-19 18:53:18 +08:00
suxiang 214804b365 删除无用接口 2024-09-18 22:48:15 +08:00
suxiang 2243118206 optimizer: native打包支持新版本域名映射 2024-09-18 22:47:09 +08:00
suxiang 29ab0118ff 文档维护 2024-09-18 22:45:46 +08:00
suxiang 402aeb1e40 fix: 修复了用户没有创建域名时,无法修改HTTP(S)映射 2024-09-18 22:45:28 +08:00
suxiang 8bbd8d000d fix: 修复禁用域名后,已建立的通道仍然可以访问的问题 2024-09-18 22:43:34 +08:00
suxiang 2950e123b0 内容维护 2024-09-18 18:33:26 +08:00
suxiang 132e4cf053 fix: 修复项目初始化问题 2024-09-18 18:32:52 +08:00
suxiang 5b2ccbe5c3 fix: 修复域名的 SSL 上下文初始化错误 2024-09-18 13:53:52 +08:00
suxiang fa5030277f HTTP(S)代理端口检测,不配置则不支持HTTP(S)域名映射 2024-09-18 13:25:49 +08:00
suxiang b6224c42e7 维护表结构 2024-09-18 12:44:48 +08:00
suxiang b08bef691f optimizer: 服务器证书维护新增删除 2024-09-17 14:57:57 +08:00
suxiang ee08bc6ed3 配置文件维护 2024-09-17 14:56:45 +08:00
suxiang bc7046305c fix: 修复不存在域名时查询保存问题 2024-09-17 10:55:27 +08:00
suxiang cdec03d031 配置文件维护 2024-09-17 10:54:53 +08:00
suxiang c36a89ba30 optimizer: 更新域名映射接口返回值和前端页面显示 2024-09-14 17:38:15 +08:00
suxiang 87857ef55a fix: 修复了页面按钮UI显示问题 2024-09-13 10:31:38 +08:00
suxiang eafa89a35e 补充注释 2024-09-11 15:19:13 +08:00
suxiang 30f6dc38f7 修复:添加或更新Http端口映射不指定域名引起的报错 2024-09-10 23:18:42 +08:00
suxiang 9476ee4bcd 更新详细注释 2024-09-10 23:16:23 +08:00
suxiang 243605481a 域名映射功能重构:支持多域名HTTPS映射和SSL证书自动切换 2024-08-27 22:30:05 +08:00
suxiang 5aac309f47 域名映射功能重构:支持多域名HTTP映射 2024-08-25 17:21:00 +08:00
suxiang c8f025290c 更新前端域名状态更新接口 2024-08-25 16:24:57 +08:00
suxiang 4b52d7fafe 维护域名端口映射中间表建表唯一索引 2024-08-24 20:02:17 +08:00
aoshiguchen ac901a551b 更新README 2024-08-10 09:51:46 +08:00
aoshiguchen 4db6a15113 官网新增GitCode跳转、更新赞赏记录 2024-08-09 08:05:22 +08:00
suxiang cb095575c0 更改端口映射查询域名相关接口 2024-08-08 23:36:30 +08:00
suxiang b10eb48a45 支持多域名映射 2024-08-08 23:34:23 +08:00
suxiang fe9da42442 更新域名管理功能:添加根据域名状态获取所有域名接口 2024-08-08 20:32:42 +08:00
suxiang c28ce07a6d 更新端口映射前端页面:支持多域名添加和编辑 2024-08-08 20:32:05 +08:00
suxiang d1fde2e21d 维护表结构 2024-08-08 20:31:02 +08:00
suxiang 4a016d8102 更新域名管理功能:添加SSL证书状态字段,支持强制HTTPS设置 2024-07-23 14:26:47 +08:00
suxiang 1145467c11 域名管理:更新域名状态&设置默认域名 2024-07-23 12:08:14 +08:00
suxiang 571152b58a 更新域名状态 2024-07-23 12:07:12 +08:00
suxiang f70eb85419 add TODO: jks密码不为空仍无法通过验证 2024-07-22 23:23:40 +08:00
suxiang 6b5597514d 域名管理服务端初步设计:支持域名搜索、添加、修改 2024-07-22 23:21:05 +08:00
suxiang dcb59975da 维护数据库表结构 2024-07-22 23:20:51 +08:00
suxiang 8c455e5024 域名管理前端页面初步设计:支持域名搜索、添加、修改 2024-07-22 23:20:15 +08:00
aoshiguchen 2955ad1a26 更新solon依赖版本 2024-05-08 18:45:20 +08:00
aoshiguchen aa298c61b6 更新打包脚本 2024-05-08 14:21:33 +08:00
aoshiguchen 63bcd32a2a 新增win下的服务端打包脚本. 2024-05-08 13:37:14 +08:00
aoshiguchen 179904c3fe 新增win下的admin打包脚本. 2024-05-08 13:16:49 +08:00
aoshiguchen 00e37e0a27 新增win下的客户端native打包脚本. 2024-05-08 11:57:50 +08:00
aoshiguchen 5838481358 新增win下的客户端native打包脚本. 2024-05-08 10:59:38 +08:00
aoshiguchen 88baeb3f33 新增win下的客户端native打包脚本 2024-05-07 22:31:07 +08:00
aoshiguchen 2fc1754161 新增win下的客户端native打包脚本. 2024-05-07 22:17:18 +08:00
aoshiguchen dd27a6609d Merge remote-tracking branch 'origin/dev' into dev 2024-05-07 18:36:27 +08:00
aoshiguchen d8d4fbf6a6 新增win下的客户端native打包脚本 2024-05-07 18:36:04 +08:00
aoshiguchen c7c7afa8af 更新README 2024-05-06 17:35:20 +08:00
aoshiguchen fe9dc46796 更新官网打包脚本 2024-05-06 17:26:41 +08:00
aoshiguchen 21c5dcb053 Merge remote-tracking branch 'origin/master' into dev 2024-05-06 15:14:46 +08:00
傲世孤尘 482214529e !61 update README.md.
Merge pull request !61 from WuName/N/A
2024-05-06 07:12:59 +00:00
WuName 5998fb8785 update README.md.
发现readme的jdk还是17,修改为21

Signed-off-by: WuName <[email protected]>
2024-05-05 02:11:54 +00:00
aoshiguchen 6411b8759d 更新赞助列表、首页特别赞助 2024-04-16 20:06:44 +08:00
aoshiguchen da173f2005 Revert "解决后台分页查询的已知问题" 2024-04-09 12:00:36 +08:00
aoshiguchen c427213dfb 服务端解决native下清理日志报错的问题 2024-03-15 18:31:31 +08:00
aoshiguchen bf6b1767b3 解决客户端docker环境变量指定参数不生效的问题 2024-02-19 18:19:44 +08:00
aoshiguchen 223ab4a447 修正文档中的错误 2024-01-09 10:29:03 +08:00
aoshiguchen b91910b61c 解决分页后点击搜索,页面上页码显示错误的问题 2024-01-04 21:58:33 +08:00
aoshiguchen b01864e362 更新官网赞赏列表. 2023-12-29 13:32:03 +08:00
aoshiguchen a5df904f9a 更新官网赞赏列表. 2023-12-27 17:23:56 +08:00
aoshiguchen 3d250b6833 更新官网赞赏列表 2023-12-26 14:11:20 +08:00
aoshiguchen 889817e484 解决native编译后,端口池批量删除报错的问题 2023-12-26 12:45:50 +08:00
aoshiguchen 665ec3a708 更新官网赞助列表 2023-12-21 17:56:15 +08:00
aoshiguchen fe5c2fe3ef 代码优化.解决映射域名访问因ipv6报错的问题. 2023-12-21 16:15:11 +08:00
aoshiguchen 744335b433 代码优化.解决映射域名访问因ipv6报错的问题 2023-12-21 16:07:30 +08:00
aoshiguchen 66e803d14e Merge branch 'dev' 2023-12-20 17:05:55 +08:00
aoshiguchen 8b84d281e7 . 2023-12-20 17:05:45 +08:00
aoshiguchen b5d30e227c 新增2.0.1发版文章. 2023-12-20 10:05:38 +08:00
aoshiguchen 88790c7f36 新增2.0.1发版文章 2023-12-19 18:01:29 +08:00
aoshiguchen c30755c663 更新官网安装部署文档 2023-12-19 15:44:37 +08:00
aoshiguchen 2e81bfbe2c 更新官网里程碑 2023-12-19 15:26:41 +08:00
aoshiguchen f49898b9b0 更新官网管理后台文档. 2023-12-19 14:56:12 +08:00
aoshiguchen 74d36fc5d1 更新官网赞赏列表 2023-12-19 14:13:33 +08:00
aoshiguchen fb5980e577 新增运行示例截图 2023-12-19 14:07:58 +08:00
aoshiguchen b9277d142c 更新官网首页 2023-12-19 11:32:44 +08:00
aoshiguchen 81b0a28e2c 更新官网里程碑、版本记录 2023-12-19 11:09:17 +08:00
aoshiguchen 59d47e6bf1 更新revision 2023-12-19 10:46:33 +08:00
aoshiguchen 7255701084 workflow调整 2023-12-18 22:31:26 +08:00
aoshiguchen 99b3b673f1 workflow调整. 2023-12-18 21:45:26 +08:00
aoshiguchen f6f6017f8a 更新版本日志 2023-12-18 19:20:22 +08:00
aoshiguchen fc0830acfe 解决使用映射域名上传文件连接断开的问题 2023-12-18 18:39:23 +08:00
aoshiguchen 9baee2c909 调整workflow. 2023-12-18 16:43:19 +08:00
aoshiguchen 6558a8c327 调整workflow 2023-12-18 16:27:22 +08:00
aoshiguchen ffa8ee502c Merge remote-tracking branch 'origin/dev' into dev 2023-12-18 15:44:29 +08:00
aoshiguchen 4c993316de . 2023-12-18 15:44:21 +08:00
songyinyin d451424de8 Github Action: fix 前端打包 2023-12-18 15:35:49 +08:00
songyinyin 754070e795 Github Action: 临时上传构建物 2023-12-18 14:43:54 +08:00
aoshiguchen b21fd8e2d9 注释无用测试类. 2023-12-18 13:50:28 +08:00
aoshiguchen 4f5fc5dfbc 注释无用测试类 2023-12-18 13:39:06 +08:00
aoshiguchen d1eba19cb9 注释无用测试类 2023-12-18 13:38:37 +08:00
songyinyin efb3a7015d Merge remote-tracking branch 'origin/dev' into dev 2023-12-18 12:00:16 +08:00
songyinyin 47efe37a0e Github Action: 构建物的版本号使用 pom 文件中定义的 2023-12-18 12:00:06 +08:00
aoshiguchen 0ad05e7dc8 端口映射分页优化,解决license被删除后,端口映射分页报错的问题 2023-12-18 11:53:44 +08:00
aoshiguchen 9576707660 限速描述支持小数,如1.5M、3.7M 2023-12-18 11:36:27 +08:00
aoshiguchen 168acd6bfe 更新版本日志. 2023-12-18 11:30:09 +08:00
aoshiguchen ad32e36ba2 . 2023-12-18 10:47:55 +08:00
aoshiguchen 00fd0bab84 限速相关处理优化 2023-12-16 16:07:47 +08:00
songyinyin 8f90cf461d 原生编译:注册 netty 在 jdk 21 中新使用的类 2023-12-15 18:18:00 +08:00
aoshiguchen e44f6e195c 更新配置 2023-12-15 17:15:06 +08:00
aoshiguchen 5db0bf94cb 新增限速功能 2023-12-15 17:09:16 +08:00
aoshiguchen 99c79f612a 修正文案 2023-12-15 11:49:32 +08:00
aoshiguchen 4890b8783f 更新官网docker部署文档 2023-12-15 10:25:21 +08:00
aoshiguchen 8e150c7696 更新客户端验证失败提示文案 2023-12-14 16:21:35 +08:00
aoshiguchen 051a36a43e 安全组拦截的逻辑从代理转发逻辑中剥离. 2023-12-14 15:54:44 +08:00
aoshiguchen 46bcc8a25d 安全组拦截的逻辑从代理转发逻辑中剥离 2023-12-14 15:48:54 +08:00
aoshiguchen 6c3d195afc 1、解决原生编译报错
2、启动日志增加版本号输出
2023-12-14 14:18:35 +08:00
aoshiguchen 00de9ee464 README更新贡献者列表 2023-12-14 13:34:13 +08:00
aoshiguchen a1608ba1be 解决HTTP(S)映射时使用tcp端口访问正常,使用域名访问偶现一直loading的问题 2023-12-14 12:03:08 +08:00
aoshiguchen e7bdd4a631 安全组相关代码优化. 2023-12-14 11:36:53 +08:00
aoshiguchen 67c42a19bb 安全组相关代码优化 2023-12-11 10:12:05 +08:00
aoshiguchen d3c658fa4d 安全组相关代码优化. 2023-12-10 22:43:59 +08:00
aoshiguchen bb96caca64 安全组相关代码优化. 2023-12-10 20:43:23 +08:00
aoshiguchen 306cd66034 1、jdk版本改为21,对应的打包脚本调整
2、安全组相关代码优化.
2023-12-10 16:55:50 +08:00
aoshiguchen 5ccf0d1936 1、jdk版本改为21,对应的打包脚本调整
2、安全组相关代码优化
2023-12-10 16:42:52 +08:00
aoshiguchen 1ad80a6d8b jdk版本降为17,解决jdk21打包后启动客户端连接报错的问题 2023-12-10 12:50:25 +08:00
aoshiguchen faf5ec9bdc 安全组相关接口url调整 2023-12-10 12:07:17 +08:00
aoshiguchen a369ee1a15 日志调整. 2023-12-10 11:38:21 +08:00
aoshiguchen 9121ff37bb 日志调整. 2023-12-10 11:37:42 +08:00
aoshiguchen 5e1a2f5620 tcp代理,针对安全组获取真实ip逻辑优化 2023-12-09 23:40:02 +08:00
aoshiguchen 7530fd7d9f http域名访问时,安全组获取真实ip逻辑调整 2023-12-09 23:27:46 +08:00
傲世孤尘 57339dc56c !52 修改TcpVisitorHandler获取真实IP地址的方式
Merge pull request !52 from NichenFly/dev
2023-12-09 14:35:26 +00:00
az d072c05d31 修改TcpVisitorHandler获取真实IP地址的方式 2023-12-09 22:30:31 +08:00
az a21a786884 修改TcpVisitorHandler获取真实IP地址的方式 2023-12-09 22:30:07 +08:00
aoshiguchen 670f581185 udp代理下安全组放行逻辑调整 2023-12-09 22:28:34 +08:00
傲世孤尘 e642e5f103 !51 修改安全组在TCP协议和UDP协议控制生效的生命周期
Merge pull request !51 from NichenFly/dev
2023-12-09 13:52:08 +00:00
aoshiguchen d551aaeff6 更新sql脚本 2023-12-09 21:50:38 +08:00
az 78f2488fe9 1、安全组不允许修改默认放行类型
2、添加TCP协议和UDP协议的安全组判断在读取数据时判断是否放行
2023-12-09 21:41:14 +08:00
傲世孤尘 035283a757 !49 安全组管控带有域名的HTTP映射
Merge pull request !49 from NichenFly/dev
2023-12-09 12:39:58 +00:00
az 644102996b 添加安全组对http(s)的控制,并添加安全规则的默认配置 2023-12-09 20:33:01 +08:00
傲世孤尘 2ee2a5f38e !48 更新sql以及配置文件还原
Merge pull request !48 from NichenFly/dev
2023-12-07 08:16:32 +00:00
= b883cac767 更新sql以及配置文件还原 2023-12-07 15:33:33 +08:00
aoshiguchen 8fd9a24d7c 更新配置文件. 2023-12-07 13:53:58 +08:00
aoshiguchen 40cc5c0c7c 更新配置文件. 2023-12-07 13:45:02 +08:00
傲世孤尘 d23f907d03 !47 添加了安全组功能
Merge pull request !47 from NichenFly/dev
2023-12-07 05:42:13 +00:00
傲世孤尘 438714e9ee !46 添加了安全组功能
Merge pull request !46 from NichenFly/dev
2023-12-07 04:47:41 +00:00
= 7a173757f0 端口映射安全规则界面修改后即时生效 2023-12-07 11:03:54 +08:00
= 9f2198e32e 端口映射的安全组解绑设置值为0 2023-12-07 09:21:17 +08:00
az 6cbf2ecac4 更新vue版本,添加端口映射配置 2023-12-06 22:18:09 +08:00
= 781b14861c 添加安全组页面和安全规则页面 2023-12-06 17:22:14 +08:00
aoshiguchen 82d78d2e4b 更新配置文件 2023-12-06 15:04:34 +08:00
aoshiguchen d40028365b 更新原生部署文档 2023-12-06 14:47:37 +08:00
= 90623b9146 安全组返回数据修改 2023-12-06 11:06:10 +08:00
= aab26f5b9d 安全组相关接口 2023-12-06 09:58:07 +08:00
az 169551445c 添加安全组接口 2023-12-05 21:33:21 +08:00
= 00308c0f5c 端口映射添加安全组id字段 2023-12-05 17:00:30 +08:00
= 306f2ed4d3 规则判断 2023-12-05 16:16:06 +08:00
aoshiguchen bbdd1860cf 更新官网赞赏记录 2023-12-05 10:27:56 +08:00
= a9fc8f4cb4 安全规则判断 2023-12-05 09:14:57 +08:00
az 836252f85b 安全组和安全规则定义 2023-12-04 21:04:14 +08:00
aoshiguchen ce053be992 更新VLog 2023-12-04 09:45:17 +08:00
aoshiguchen 323e7c6277 更新官网首页赞助 2023-11-26 16:56:33 +08:00
aoshiguchen f4797d22ba 更新赞助列表 2023-11-26 16:46:32 +08:00
aoshiguchen 7c9aa1ebdc 更新SQL脚本 2023-11-26 16:33:08 +08:00
aoshiguchen 9564e51c91 每日流量报表job逻辑优化 2023-11-26 16:05:28 +08:00
aoshiguchen 09f934bdd0 更新打包脚本 2023-11-02 17:32:10 +08:00
aoshiguchen d54c4644cf 新增专用于打包复制的配置文件,更新Dockerfile 2023-11-02 17:15:16 +08:00
aoshiguchen 4232be546a 更新Dockerfile 2023-11-02 16:54:29 +08:00
aoshiguchen b5b82e0b80 修正官网客户端配置错误 2023-11-02 16:18:52 +08:00
aoshiguchen 0eaad35379 jdk版本升级为21 2023-11-02 15:56:22 +08:00
aoshiguchen b754dd5456 jdk版本升级为21. 2023-11-02 14:59:49 +08:00
aoshiguchen 035db05e70 jdk版本升级为21 2023-11-02 14:54:24 +08:00
aoshiguchen f7c3e5b76b 新增文章[从Neutrino-Proxy(中微子代理)到Solon Native] 2023-11-02 13:36:33 +08:00
aoshiguchen 85d86e15c2 更新solon版本为2.5.12 2023-11-01 13:41:17 +08:00
aoshiguchen eea06908f9 更新赞赏公示 2023-11-01 11:58:42 +08:00
aoshiguchen 7fc339e6c1 更新todolist 2023-11-01 11:56:57 +08:00
songyinyin 97714e02c5 支持应用中获取当前的版本号 2023-10-31 12:02:44 +08:00
aoshiguchen d8d5cc61ab aot阶段操作数据库逻辑跳过 2023-10-30 18:19:56 +08:00
aoshiguchen 67bcbb4383 .. 2023-10-30 17:17:59 +08:00
aoshiguchen c8207097c1 日志输出内容调整. 2023-10-30 12:40:42 +08:00
songyinyin 8a89786a41 原生编译:增加三方包 高版本jdk 反射的支持 2023-10-29 21:43:29 +08:00
songyinyin c9b501f334 打包时把 lombok 排除掉 2023-10-29 21:40:57 +08:00
aoshiguchen e90bc0f10a 修正官网错别字 2023-10-28 10:47:03 +08:00
aoshiguchen 66d98711bf 更新官网使用须知 2023-10-28 10:42:12 +08:00
aoshiguchen de0ac5b500 更新公众号官宣文章. 2023-10-27 23:32:15 +08:00
aoshiguchen 1dffa1d921 更新官网文档. 2023-10-27 23:24:13 +08:00
aoshiguchen 42dedf03e1 升级solon版本. 2023-10-27 21:12:02 +08:00
aoshiguchen f1ebc47f51 服务端、客户端native编译打包脚本调整 2023-10-27 18:12:29 +08:00
aoshiguchen 4ca43572a0 服务端、客户端编译打包脚本调整 2023-10-27 17:36:44 +08:00
aoshiguchen 116f3d7b36 workflow去掉mac构建 2023-10-27 15:52:07 +08:00
aoshiguchen 265699c3dc aot阶段放开数据库初始化 2023-10-27 15:30:47 +08:00
aoshiguchen c644128552 升级solon版本为2.5.12.-SNAPSHOT 2023-10-27 12:55:17 +08:00
songyinyin fa63ec71a5 原生镜像赋予执行权限 2023-10-26 23:15:26 +08:00
songyinyin 07d5c9f5e4 解决远程编译windows乱码问题 2023-10-26 23:11:10 +08:00
aoshiguchen cb9aa5da81 1、增加LOG_LEVEL环境变量处理逻辑
2、aot处理阶段不执行初始化数据库的逻辑
2023-10-26 21:24:43 +08:00
aoshiguchen 03a9d2e971 修正官网错别字 2023-10-26 20:32:40 +08:00
aoshiguchen 52d96157a4 更新官网赞助列表 2023-10-26 20:24:19 +08:00
aoshiguchen c998512549 官网新增企业登记案例展示 2023-10-26 20:19:20 +08:00
323 changed files with 7315 additions and 3391 deletions
+40 -14
View File
@@ -1,7 +1,7 @@
name: Build linux and mac native image
on:
workflow_dispatch:
workflow_dispatch:
push:
tags:
- 'v*'
@@ -12,7 +12,8 @@ jobs:
fail-fast: false
matrix:
# see: https://docs.github.com/zh/actions/using-jobs/choosing-the-runner-for-a-job
os: ['ubuntu-20.04', 'macos-12']
# os: ['ubuntu-20.04', 'macos-12']
os: ['ubuntu-20.04']
name: build - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
# https://github.com/softprops/action-gh-release/issues/236#issuecomment-1150530128
@@ -31,10 +32,10 @@ jobs:
npm install
npm run build:docker
cp -rf ./dist/ ./../neutrino-proxy-server/src/main/resources/static/
- name: GitHub Action for GraalVM JDK 17
- name: GitHub Action for GraalVM JDK 21
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7' # for a specific JDK 17; or '17' for the latest JDK 17
java-version: '21.0.1' # for a specific JDK 21
distribution: 'graalvm' # New 'distribution' option
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache local Maven repository
@@ -44,30 +45,55 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set vars
shell: bash
run: |
OS=$(echo '${{ runner.os }}' | awk '{print tolower($0)}')
[[ $OS == 'ubuntu' ]] && echo "OS=linux" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
[[ $OS == 'macos' ]] && echo "OS=darwin" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Build with Maven (neutrino-proxy-server)
run: |
mvn clean install -pl neutrino-proxy-core -am -DskipTests --no-transfer-progress
cd neutrino-proxy-server
cd neutrino-proxy-server
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
cp target/neutrino-proxy-server ./../neutrino-proxy-server-${{ github.ref_name }}
chmod +x target/neutrino-proxy-server
mkdir ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native
cp target/neutrino-proxy-server ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native/neutrino-proxy-server
cp target/classes/app-copy.yml ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native/app.yml
- name: Archive zip (neutrino-proxy-server)
uses: thedoctor0/zip-release@master
with:
type: 'zip'
path: 'neutrino-proxy-server-${{ github.ref_name }}'
filename: neutrino-proxy-server-${{ matrix.os }}-${{ github.ref_name }}.zip
path: 'neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native'
filename: neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
- name: Build with Maven (neutrino-proxy-client)
run: |
cd neutrino-proxy-client
mvn clean package --file pom.xml --no-transfer-progress
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
cp target/neutrino-proxy-client ./../neutrino-proxy-client-${{ github.ref_name }}
chmod +x target/neutrino-proxy-client
mkdir ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native
cp target/neutrino-proxy-client ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native/neutrino-proxy-client
cp target/classes/app-copy.yml ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native/app.yml
- name: Archive zip (neutrino-proxy-client)
uses: thedoctor0/zip-release@master
with:
type: 'zip'
path: 'neutrino-proxy-client-${{ github.ref_name }}'
filename: neutrino-proxy-client-${{ matrix.os }}-${{ github.ref_name }}.zip
path: 'neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native'
filename: neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
# 上传构建产物
- name: Upload artifact
uses: actions/[email protected]
with:
name: neutrino-proxy-server-client-${{ env.OS }}-${{ env.VERSION }}
path: |
neutrino-proxy-server/target/neutrino-proxy-server.jar
neutrino-proxy-client/target/neutrino-proxy-client.jar
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
# 保存时间,默认 90 天
retention-days: 5
# GitHub 上创建 release
- name: Release
uses: softprops/action-gh-release@v1
@@ -76,7 +102,7 @@ jobs:
files: |
neutrino-proxy-server/target/neutrino-proxy-server.jar
neutrino-proxy-client/target/neutrino-proxy-client.jar
neutrino-proxy-server-${{ matrix.os }}-${{ github.ref_name }}.zip
neutrino-proxy-client-${{ matrix.os }}-${{ github.ref_name }}.zip
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
+37 -14
View File
@@ -1,7 +1,7 @@
name: Build windows native image
on:
workflow_dispatch:
workflow_dispatch:
push:
tags:
- 'v*'
@@ -31,10 +31,10 @@ jobs:
npm install
npm run build:docker
cp -r ./dist/ ./../neutrino-proxy-server/src/main/resources/static/
- name: GitHub Action for GraalVM JDK 17
- name: GitHub Action for GraalVM JDK 21
uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7' # for a specific JDK 17; or '17' for the latest JDK 17
java-version: '21.0.1' # for a specific JDK 21;
distribution: 'graalvm' # New 'distribution' option
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache local Maven repository
@@ -44,32 +44,55 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set vars
shell: bash
run: |
OS=$(echo '${{ runner.os }}' | awk '{print tolower($0)}')
[[ $OS == 'ubuntu' ]] && echo "OS=linux" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
[[ $OS == 'macos' ]] && echo "OS=darwin" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Build with Maven (neutrino-proxy-server)
run: |
set MAVEN_OPTS= -Duser.language=UTF-8 -Dfile.encoding=UTF-8
set MAVEN_OPTS="-Duser.language=UTF-8 -Dfile.encoding=UTF-8"
mvn clean install -pl neutrino-proxy-core -am -DskipTests --no-transfer-progress
cd neutrino-proxy-server
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
cp target/neutrino-proxy-server.exe ./../neutrino-proxy-server.exe
mkdir ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native
cp target/neutrino-proxy-server.exe ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native/neutrino-proxy-server.exe
cp target/classes/app-copy.yml ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native/app.yml
- name: Archive zip (neutrino-proxy-server)
uses: thedoctor0/zip-release@master
with:
type: 'zip'
path: 'neutrino-proxy-server.exe'
filename: neutrino-proxy-server-${{ matrix.os }}-${{ github.ref_name }}.zip
path: 'neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native'
filename: neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
- name: Build with Maven (neutrino-proxy-client)
run: |
set MAVEN_OPTS= -Duser.language=UTF-8 -Dfile.encoding=UTF-8
set MAVEN_OPTS="-Duser.language=UTF-8 -Dfile.encoding=UTF-8"
cd neutrino-proxy-client
mvn clean package --file pom.xml --no-transfer-progress
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
cp target/neutrino-proxy-client.exe ./../neutrino-proxy-client.exe
mkdir ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native
cp target/neutrino-proxy-client.exe ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native/neutrino-proxy-client.exe
cp target/classes/app-copy.yml ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native/app.yml
- name: Archive zip (neutrino-proxy-client)
uses: thedoctor0/zip-release@master
with:
type: 'zip'
path: 'neutrino-proxy-client.exe'
filename: neutrino-proxy-client-${{ matrix.os }}-${{ github.ref_name }}.zip
path: 'neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native'
filename: neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
# 上传构建产物
- name: Upload artifact
uses: actions/[email protected]
with:
name: neutrino-proxy-server-client-${{ env.OS }}-${{ env.VERSION }}
path: |
neutrino-proxy-server/target/neutrino-proxy-server.jar
neutrino-proxy-client/target/neutrino-proxy-client.jar
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
# 保存时间,默认 90 天
retention-days: 5
# GitHub 上创建 release
- name: Release
uses: softprops/action-gh-release@v1
@@ -78,7 +101,7 @@ jobs:
files: |
neutrino-proxy-server/target/neutrino-proxy-server.jar
neutrino-proxy-client/target/neutrino-proxy-client.jar
neutrino-proxy-server-${{ matrix.os }}-${{ github.ref_name }}.zip
neutrino-proxy-client-${{ matrix.os }}-${{ github.ref_name }}.zip
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
+1
View File
@@ -54,6 +54,7 @@ hs_err_pid*
**/memo/**
neutrino-proxy-vuepress/deploy
neutrino-proxy-vuepress/deploy.sh
.NEUTRINO_PROXY_CLIENT_ID
logs
+2
View File
@@ -14,3 +14,5 @@
- 2023-09-07 1.8.6版本发布,后台若干细节优化
- 2023-09-22 1.9.0版本发布,端口映射支持UDP协议
- 2023-09-25 中微子代理Gitee Star数突破1000
- 2023-10-31 2.0.0版本发布,升级jdk版本至jdk17、支持原生编译、去掉sqlite改为默认H2数据库
- 2023-12-21 2.0.1版本发布,jdk版本升级到21,支持安全组(黑/白名单IP限制)、限速
-52
View File
@@ -1,52 +0,0 @@
# 基础
- [x] 服务端编译、启动成功
- [x] 客户端编译、启动成功
- [x] 配置
- [x] 启动参数
- [x] 外部配置文件
- [x] 环境变量
- [x] 日志
- [x] 控制台输出
- [x] debug启动有netty错误日志
- [x] 文件输出
- [x] 修改日志级别
- [x] 心跳日志
- [x] 传输报文日志
- [x] 连接
- [x] 隧道SSL连接
- [x] 隧道非SSL连接
- [x] 隧道SSL连接自定义证书
# 服务端管理后台
- [x] 登录成功
- [x] 首页统计
- [x] 代理配置
- [x] license管理
- [x] 端口映射
- [x] 系统管理
- [x] 用户管理
- [x] 端口分组管理
- [x] 端口池管理
- [x] 协议管理
- [x] 调度管理
- [x] 报表管理
- [x] 用户流量报表
- [x] License流量报表
- [x] 用户流量月度明细
- [x] License流量月度明细
- [x] 日志管理
- [x] 调度日志
- [x] 登录日志
- [x] 客户端连接日志
# 客户端
- [x] 重连机制
# 代理
- [x] TCP代理
- [x] HTTP(S)代理
- [x] 端口访问
- [x] HTTP域名访问
- [x] HTTPS域名访问
- [x] UDP代理
+13 -4
View File
@@ -4,8 +4,8 @@
<p align="center">
<a href='https://gitee.com/dromara/neutrino-proxy/stargazers'><img src='https://gitee.com/dromara/neutrino-proxy/badge/star.svg?theme=dark' alt='star'></img></a>
<a href='https://gitee.com/dromara/neutrino-proxy/members'><img src='https://gitee.com/dromara/neutrino-proxy/badge/fork.svg?theme=dark' alt='fork'></img></a>
<a target="_blank" href="https://www.oracle.com/java/technologies/javase/javase-jdk17-downloads.html">
<img src="https://img.shields.io/badge/JDK-17+-red.svg" />
<a target="_blank" href="https://www.oracle.com/java/technologies/javase/javase-jdk21-downloads.html">
<img src="https://img.shields.io/badge/JDK-21+-red.svg" />
</a>
<a href="./LICENSE">
<img src="https://img.shields.io/badge/license-MIT-red" alt="license MIT">
@@ -17,8 +17,9 @@
- 技术栈:Solon、MybatisPlus、Netty
- 遵循MIT许可,因此您可以对它进行复制、修改、传播并用于任何个人或商业行为。
- 官网地址1https://neutrino-proxy.dromara.org
- 官网地址2https://dromara.gitee.io/neutrino-proxy
- 快速上手请[点击这里](https://dromara.gitee.io/neutrino-proxy/pages/793dcb)
- ~~官网地址2https://dromara.gitee.io/neutrino-proxy~~
- ~~官网地址3https://neutrino-proxy-docs.asgc.fun~~
- 快速上手请[点击这里](https://neutrino-proxy.dromara.org/neutrino-proxy/pages/793dcb/)
# 2、名称由来
中微子,是轻子的一种,是组成自然界的最基本的粒子之一。它十分微小、不带电,可自由穿过地球,以接近光速运动,与其他物质的相互作用十分微弱,号称宇宙间的“隐身人”。
@@ -39,7 +40,9 @@
# 5、联系我们
- 微信: yuyunshize
- GitCodehttps://gitcode.com/dromara/neutrino-proxy
- Gitee: https://gitee.com/asgc/neutrino-proxy
- Github仓库:https://github.com/dromara/neutrino-proxy
# 6、贡献者列表
<p>
@@ -88,6 +91,12 @@
<a href="https://gitee.com/songyinyin" target="_blank">
<img src="assets/developer/songyinyin.png" width="11%">
</a>
<a href="https://gitee.com/nichenxyx" target="_blank">
<img src="assets/developer/NichenFly.jpg" width="11%">
</a>
<a href="https://gitee.com/miracrl" target="_blank">
<img src="assets/developer/miracrl.png" width="11%">
</a>
</p>
# ❤️ 感谢
+20
View File
@@ -72,3 +72,23 @@
- jdk版本升级为17
- 支持原生编译改造
- 默认支持的数据库由sqlite改为h2
## 2.0.1
- jdk版本升级为21
- 新增安全组模块,支持黑名单、白名单限制
- 支持对用户、license限速
- 修复HTTP(S)映射时使用tcp端口访问正常,使用域名访问偶现一直loading的问题
- 修复HTTP(S)映射时使用映射的域名上传文件时,连接中断的问题
## 2.0.2
- 部分细节优化
- 解决客户端docker方式部署环境变量指定参数不生效的问题
- 服务端解决服务端native下,清理日志定时任务报错的问题
- 解决后台分页查询的已知问题
- 端口映射中的客户端ip字段加长,解决配置阿里云数据库域名字段不够的问题
- 管理后台新增域名管理
- [x] 支持设置一个默认域名
- [x] 删除、修改、禁用实时生效
- [x] 支持维护https证书
- 端口映射支持支持绑定多个子域名
- 选择择不同的主域名、子域名变更实时生效
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

+1 -1
View File
@@ -20,7 +20,7 @@
> 从1.9.0之前的版本升级需要注意:
- 在项目`neutrino-proxy-server/src/main/resources/sql`目录下找到mysql/sqlite的增量sql文件`UPDATE-20230922.SQL`,执行更新自己的中微子代理数据库
- 参照[官网服务端配置](https://dromara.gitee.io/neutrino-proxy/pages/f2d0f1)调整现有的服务端配置
- 参照[官网客户端配置](https://dromara.gitee.io/neutrino-proxy/pages/50ce10)吊证现有的客户端配置
- 参照[官网客户端配置](https://dromara.gitee.io/neutrino-proxy/pages/50ce10)调整现有的客户端配置
- 从[仓库发行版](https://gitee.com/dromara/neutrino-proxy/releases)下载最新版本的客户端(neutrino-proxy-client.jar)、服务端(neutrino-proxy-server.jar、 neutrino-proxy-admin.zip)部署文件。若为服务端是docker镜像部署,则更新镜像重启即可
## 项目简介
+5 -2
View File
@@ -25,8 +25,8 @@
- 9、原生部署:支持编译为原生可执行文件,更低部署门槛、更少内存占用
- 10、采用最为宽松的MIT协议,免去你的后顾之忧
## 更新内容
- solon版本升级为`2.5.11`
## 本次更新内容
- solon版本升级为`2.5.12-M1`
- jdk版本升级为17
- 支持原生编译改造
- 默认支持的数据库由sqlite改为h2
@@ -40,6 +40,9 @@
- 配置文件做了较大调整,请参照官网使用须知中的`服务端配置``客户端配置`进行更新
## 运行示例
#### 本地原生启动截图
<img src="./run1.png" width="100%"/>
#### 管理后台首页
<img src="./home.png" width="100%"/>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 KiB

+86
View File
@@ -0,0 +1,86 @@
# 从Neutrino-Proxy(中微子代理)到Solon Native
## Neutrino-Proxy(中微子代理)是啥
#### 项目简介
- [中微子代理(neutrino-proxy)](https://gitee.com/asgc/neutrino-proxy) 是一款基于netty的内网穿透神器。该项目采用最为宽松的MIT协议,因此您可以对它进行复制、修改、传播并用于任何个人或商业行为。
- 市面上基于内网穿透的常见产品有:花生壳、TeamView、cpolar等。
- 常见的使用场景:
- 本地开发调试第三方回调
- 本地开发异地接口连调
- 远程登录内网windows机器
- 将本地服务映射到外网,用于演示
- Gitee仓库:https://gitee.com/dromara/neutrino-proxy
- Github仓库:https://github.com/dromara/neutrino-proxy
- 官网地址1: https://neutrino-proxy.dromara.org
- 官网地址2: https://dromara.gitee.io/neutrino-proxy
#### 主要特点:
- 1、流量监控:首页图表、报表管理多维度流量监控。全方位掌握实时、历史代理数据。
- 2、用户/License:支持多用户、多客户端使用。后台禁用实时生效。
- 3、端口池:对外端口统一管理,支持用户、License独占端口。
- 4、端口映射:新增、编辑、删除、禁用实时生效。
- 5、Docker:服务端/客户端支持Docker一键部署。
- 6、SSL证书:隧道通信支持SSL加密,保护您的数据安全。
- 7、域名映射:支持绑定子域名,方便本地调试三方回调
- 8、多种协议:支持代理TCP、HTTP、HTTPS、UDP协议
- 9、原生部署:支持编译为原生可执行文件,更低部署门槛、更少内存占用
- 10、采用最为宽松的MIT协议,免去你的后顾之忧
## 为什么开发Neutrino-Proxy(中微子代理)
2022年4月份左右,因工作原因需要用到内网穿透。此前一段时间使用的`coplar`,由于公司担心带来安全隐患,
因此决定自己研究一下这一块。
对于常年写业务代码的一介码农来说,内网穿透就是一个黑盒。为了打开这个黑盒,我开始到处找相关的开源项目,其中包括lanproxy、ngrok、nps、frp等。
经过一翻努力,2022年6月份,实现了中微子代理1.0.0。此版本纯粹为了练手, 所以是基于自己手写的一套底层框架(包含Ioc、Aop、SqlMaper(简易版本的mybatis)、xxljob等)
实现了客户端/服务端+纯配置文件版本的TCP代理。
千里之行,始于足下。1.0.0版本发布后,经过不断的迭代,如今2.0.0版本终于和大家见面了。
## 为什么选择Solon
中微子1.0.0版本发布之后,大约7~8个月的时间,进行了大量的更新,主要围绕在底层基础框架、
管理后台这一块。
此时中微子陆陆续续开始有了一些用户,开始迫切的需要加快代理相关功能的迭代进度。而此时自己手写
的底层框架成为了最大的掣肘,单单底层框架各种细节优化、测试、参考借鉴其他框架源码这些就足以耗光
我为数不多的业余时间,更别提在这个尚不成熟的框架上开发代理功能了。任何一次底层的优化调整,可能带来的
是上层代理功能的大量重构。
于是,我开始搜寻其它替代框架。因日常工作一直都在用Spring体系,我始终相信多种技术两相印证之后学到的东西更为深刻,所以自己的开源项目始终将Spring体系作为优先级最低
的选项。最终一个或偶然、或必然的机会,我了解到了Solon。
经过对Solon项目源码、官网文档、项目更新频率、生态完善度的深入了解,最终决定选择Solon作为中微子代理的底层框架。
2023年3月12日,中微子代理1.7.0版本发布,开始正式基于Solon框架。
2023年10月30日,中微子代理2.0.0版本发布,基于Solon Native实现原生部署。
## Solon简介
#### 项目简介
- Solon是一个全新的java生态体系,给人带来一种与众不同的开发体验,让你能更快的构建自己的应用、更小的打包产出、更快的启动速度。
- Gitee仓库:https://gitee.com/noear/solon
- Github仓库:https://github.com/noear/solon
- 官网地址:https://solon.noear.org/
#### 主要特性
> 启动快 5 ~ 10 倍;qps 高 2~ 3 倍;运行时内存节省 1/3 ~ 1/2;打包可以缩到 1/2 ~ 1/10
- 克制、简洁、高效、开放、生态
- 支持 JDK8、JDK11、JDK17、JDK21
- Http、WebSocket、Socket 三种信号统一的开发体验(俗称:三源合一)
- 支持“注解”与“手动”两种模式,按需自由操控
- Not Servlet,可以适配任何基础通讯框架(最小 0.3m 运行rpc架构)
- 独特的 IOC/AOP 容器设计。不会因为插件变多而启动变很慢
- 支持 Web、Data、Job、Remoting、Cloud 等任何开发场景
- 兼顾 Handler + Context 和 Listener + Message 两种架构模式
- 强调插件式扩展,可扩展可切换;适应不同的应用场景
- 支持 GraalVm Native Image 打包
- 允许业务插件“热插”、“热拔”、“热管理”
## 最后说点什么
开源实属不易,开源国产生态型基础框架更是举步维艰。不仅需要长时间、持续、稳定的投入迭代、测试、文档撰写、bug修复、发版、推广,
还经常需要面对来自四面八方汹涌如潮的质疑。
时光无言,它磨灭了一切、也证明着一切。
一千八百多个日日夜夜、五年的风雨兼程,Solon生态已经初具规模,社区汇聚了一大批开源爱好者。
大鹏一日通风起,扶摇直上九万里。我相信国产开源在大家的努力下,一定会越来越好!
Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

+62
View File
@@ -0,0 +1,62 @@
# NeutrinoProxy2.0.1发布,新增IP访问拦截+限速支持
## 项目简介
- [中微子代理(neutrino-proxy)](https://gitee.com/asgc/neutrino-proxy) 是一款基于Solon、Netty的内网穿透神器。该项目采用最为宽松的MIT协议,因此您可以对它进行复制、修改、传播并用于任何个人或商业行为。
- 市面上基于内网穿透的常见产品有:花生壳、TeamView、cpolar等。
- 常见的使用场景:
- 本地开发调试第三方回调
- 本地开发异地接口连调
- 远程登录内网windows机器
- 将本地服务映射到外网,用于演示
- Gitee仓库:https://gitee.com/dromara/neutrino-proxy
- Github仓库:https://github.com/dromara/neutrino-proxy
- 官网地址1: https://neutrino-proxy.dromara.org
- 官网地址2: https://dromara.gitee.io/neutrino-proxy
## 主要特点:
- 1、流量监控:首页图表、报表管理多维度流量监控。全方位掌握实时、历史代理数据。
- 2、用户/License:支持多用户、多客户端使用。后台禁用实时生效。
- 3、端口池:对外端口统一管理,支持用户、License独占端口。
- 4、端口映射:新增、编辑、删除、禁用实时生效。
- 5、Docker:服务端/客户端支持Docker一键部署。
- 6、SSL证书:隧道通信支持SSL加密,保护您的数据安全。
- 7、域名映射:支持绑定子域名,方便本地调试三方回调
- 8、多种协议:支持代理TCP、HTTP、HTTPS、UDP协议
- 9、原生部署:支持编译为原生可执行文件,更低部署门槛、更少内存占用
- 10、安全组:支持黑/白名单IP访问限制
- 11、限速:支持对License、端口映射限制上传/下载速度
- 12、采用最为宽松的MIT协议,免去你的后顾之忧
## 本次更新内容
- jdk版本升级为21
- 新增安全组模块,支持黑名单、白名单限制
- 支持对用户、license限速
- 修复HTTP(S)映射时使用tcp端口访问正常,使用域名访问偶现一直loading的问题
- 修复HTTP(S)映射时使用映射的域名上传文件时,连接中断的问题
## 安装使用说明
- 快速上手:https://neutrino-proxy.dromara.org/neutrino-proxy/pages/793dcb/
- 升级须知:
- jdk版本升级为了jdk21,jar部署时请注意
- 涉及到表结构变更,执行增量SQLhttps://gitee.com/dromara/neutrino-proxy/blob/master/neutrino-proxy-server/src/main/resources/sql/mysql/update/UPDATE-20231215.SQL
## 运行示例
#### License限速
<img src="./license2.png" width="100%"/>
#### 端口映射限速
<img src="./port-mapping2.png" width="100%"/>
#### 安全组
<img src="./security-group1.png" width="100%"/>
<img src="./security-rule1.png" width="100%"/>
## 联系我们
笔者时间、能力有限,且开源项目非一朝一夕之事,存在众多问题亦在所难免。使用、学习过程中有任何问题欢迎大家与我联系。
对项目有什么想法或者建议,可以加我微信拉交流群,或者创建[issues](https://gitee.com/dromara/neutrino-proxy/issues),一起完善项目
- 微信号:yuyunshize
- Email: aoshiguchen@dromara.org
- 微信二维码(添加时请备注"中微子进群"):
<img src="MyWeChatQRCode.jpeg" width="100%"/>
Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

+81
View File
@@ -0,0 +1,81 @@
# NeutrinoProxy2.0.2发布,端口映射支持绑定多个域名
## 项目简介
- [中微子代理(neutrino-proxy)](https://gitee.com/dromara/neutrino-proxy) 是一款基于Solon、Netty的内网穿透神器。该项目采用最为宽松的MIT协议,因此您可以对它进行复制、修改、传播并用于任何个人或商业行为。
- 市面上基于内网穿透的常见产品有:花生壳、TeamView、cpolar等。
- 常见的使用场景:
- 本地开发调试第三方回调
- 本地开发异地接口连调
- 远程登录内网windows机器
- 将本地服务映射到外网,用于演示
- GitCodehttps://gitcode.com/dromara/neutrino-proxy
- Gitee仓库:https://gitee.com/dromara/neutrino-proxy
- Github仓库:https://github.com/dromara/neutrino-proxy
- 官网地址: https://neutrino-proxy.dromara.org
## 主要特点:
- 1、流量监控:首页图表、报表管理多维度流量监控。全方位掌握实时、历史代理数据。
- 2、用户/License:支持多用户、多客户端使用。后台禁用实时生效。
- 3、端口池:对外端口统一管理,支持用户、License独占端口。
- 4、端口映射:新增、编辑、删除、禁用实时生效。
- 5、Docker:服务端/客户端支持Docker一键部署。
- 6、SSL证书:隧道通信支持SSL加密,保护您的数据安全。
- 7、域名映射:支持绑定多个子域名,方便本地调试三方回调
- 8、多种协议:支持代理TCP、HTTP、HTTPS、UDP协议
- 9、原生部署:支持编译为原生可执行文件,更低部署门槛、更少内存占用
- 10、安全组:支持黑/白名单IP访问限制
- 11、限速:支持对License、端口映射限制上传/下载速度
- 12、采用最为宽松的MIT协议,免去你的后顾之忧
## 本次更新内容
- bug修复
- 解决安全组在ipv6场景下误拦截导致域名映射访问不通的问题
- 解决native编译后,端口池批量删除报错的问题
- 解决客户端docker方式部署环境变量指定参数不生效的问题
- 服务端解决native下清理日志定时任务报错的问题
- 解决后台分页查询的已知问题
- 端口映射中的客户端ip字段加长一点,解决配置阿里云数据库域名字段不够的问题
- 解决服务端native部署时,访问后台用户列表,日志警告“you should use: nativeMetadata.registerField(field) at aot runtime”的问题
- 新增功能
- 新增后台域名管理,⽀持新增、修改、删除、禁⽤主域名,支持添加多级域名。
- 域名管理支持上传域名对应的SSL证书、⽀持设置强制HTTPS、⽀持域名映射⾃动加载对应的服务器证书。
- 端口映射支持选择切换不同的主域名,⽀持绑定多个⼦域名,单个端⼝⽀持绑定多个不同的主域名。
## 安装使用说明
- 快速上手:https://neutrino-proxy.dromara.org/neutrino-proxy/pages/793dcb/
- 支持的部署方式
- 1、jar
- 2、docker
- 3、native
- windows
- linux
- mac
- 4、docker-compose
- 升级须知:
- **域名和SSL证书的配置由配置文件配置改为后台域名管理页面配置。**
- 去掉了配置文件声明服务器端域名和证书的方式,改为通过页面进行管理,请注意自行进行数据迁移。
- 数据库新增`域名表``域名映射中间表`,修改了`端口映射表`,涉及到表结构变更,执行[增量SQL](https://gitee.com/dromara/neutrino-proxy/blob/master/neutrino-proxy-server/src/main/resources/sql/mysql/update/UPDATE-20240808.SQL)
## 运行示例
#### License限速
<img src="./license2.png" width="100%"/>
#### 端口映射限速
<img src="./port-mapping2.png" width="100%"/>
#### 端口映射绑定多个域名
<img src="./port-mapping3.png" width="100%"/>
#### 安全组
<img src="./security-group1.png" width="100%"/>
<img src="./security-rule1.png" width="100%"/>
## 联系我们
笔者时间、能力有限,且开源项目非一朝一夕之事,存在众多问题亦在所难免。使用、学习过程中有任何问题欢迎大家与我联系。
对项目有什么想法或者建议,可以加我微信拉交流群,或者创建[issues](https://gitee.com/dromara/neutrino-proxy/issues),一起完善项目
- 微信号:yuyunshize
- Email: aoshiguchen@dromara.org
- 微信二维码(添加时请备注"中微子进群"):
<img src="MyWeChatQRCode.jpeg" width="100%"/>
Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

+2 -2
View File
@@ -31,7 +31,7 @@
- 原则上,不允许自行添加第三方依赖库。若确有必要,请先和项目负责人沟通达成一致。
- 对现有代码的优化,请在注释中说明原因。
- 如果涉及到数据库的变更,则至少需要做到以下绩点:
- sqlite、mysql下均测试通过
- h2、mysql下均测试通过
-`./neutrino-proxy-server/src/main/resource/sql`下维护更新对应的表结构sql文件
- 对于新增的表,维护必要的初始化数据
- 在对应的mysql、sqlite的update目录下,维护SQL变更记录,确保SQL执行测试通过
- 在对应的mysql、h2的update目录下,维护SQL变更记录,确保SQL执行测试通过
+1 -1
View File
@@ -37,7 +37,7 @@ registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:1.7.1
- 在服务器上新建部署目录:`/work/projects/neutrino-proxy-server`
-` neutrino-proxy-server.jar``neutrino-proxy-admin.zip`上传至服务器部署目录。
- 解压`neutrino-proxy-admin.zip`文件
- 执行命令`java -jar neutrino-proxy-server.jar`启动服务端完成部署,默认使用sqlite数据库。
- 执行命令`java -jar neutrino-proxy-server.jar`启动服务端完成部署,默认使用h2数据库。
- 若需要指定自己的mysql数据库,同样的需要在当前目录下新建`app.yml`文件,文件内容同上。执行命令`java -jar neutrino-proxy-server.jar config=app.yml`启动服务端完成部署
- 可参照 https://gitee.com/dromara/neutrino-proxy/blob/master/bin/server_start.sh 使用shell脚本启动服务端。
+1
View File
@@ -8,6 +8,7 @@
# 代理配置
- License管理:License是客户端连接服务端的唯一合法凭证。一个License同时只能被一个客户端使用,一个License可以维护多条端口映射
- 端口映射:服务端IP+端口 -> 客户端IP+端口的四元组映射(因目前服务端单节点只有一个公网IP,所以不体现出来),是内网穿透的基本单元。
- 域名管理:用于统一管理服务器主域名和证书,支持多域名。
# 系统管理
- 用户管理:支持多用户,一个用户可持有多个License。由于项目目前主推个人版,所以暂是没有权限这一套,管理员之外的所有用户都属于游客。对于绝大多数操作,游客仅有只读权限。
+2 -2
View File
@@ -23,7 +23,7 @@
"codemirror": "5.32.0",
"dropzone": "5.2.0",
"echarts": "3.8.5",
"element-ui": "2.0.8",
"element-ui": "^2.15.14",
"file-saver": "1.3.3",
"font-awesome": "4.7.0",
"js-cookie": "2.2.0",
@@ -70,7 +70,7 @@
"friendly-errors-webpack-plugin": "1.6.1",
"html-webpack-plugin": "2.30.1",
"node-notifier": "5.1.2",
"node-sass": "^4.7.2",
"node-sass": "^9.0.0",
"optimize-css-assets-webpack-plugin": "3.2.0",
"ora": "1.3.0",
"portfinder": "1.0.13",
+66
View File
@@ -7,3 +7,69 @@ export function domainNameBindInfo(query) {
params: query
})
}
export function fetchList(query) {
return request({
url: '/domain/page',
method: 'get',
params: query
})
}
export function fetchAvailableDomainList(query) {
return request({
url: '/domain/all',
method: 'get',
params: query
})
}
export function updateEnableStatus(id, enable, domain) {
return request({
url: '/domain/update/enable-status',
method: 'post',
data: {
id: id,
enable: enable,
domain: domain,
}
})
}
export function createDomain(data) {
return request({
url: '/domain/create',
method: 'post',
data
})
}
export function updateDomain(data) {
return request({
url: '/domain/update',
method: 'post',
data
})
}
export function deleteDomain(id) {
return request({
url: '/domain/delete',
method: 'post',
params: {
id: id
}
})
}
export function updateDefaultStatus(id, isDefault) {
return request({
url: '/domain/update/default-status',
method: 'post',
data: {
id: id,
isDefault: isDefault
}
})
}
@@ -44,3 +44,22 @@ export function updateEnableStatus(id, enable) {
}
})
}
export function portMappingBindSecurityGroup(id, securityGroupId) {
return request({
url: '/port-mapping/bind/security-group',
method: 'post',
data: {
id: id,
securityGroupId: securityGroupId
}
})
}
export function portMappingUnbindSecurityGroup(id) {
return request({
url: `/port-mapping/unbind/security-group?id=${id}`,
method: 'post'
})
}
@@ -0,0 +1,109 @@
import request from '@/utils/request'
export function fetchGroupPage(query) {
return request({
url: '/security/group/page',
method: 'get',
params: query
})
}
export function fetchGroupList() {
return request({
url: '/security/group/list',
method: 'get'
})
}
export function fetchGroupDetail(query) {
return request({
url: '/security/group/detail',
method: 'get',
params: query
})
}
export function createGroup(data) {
return request({
url: `/security/group/create`,
method: 'post',
data
})
}
export function updateGroup(query) {
return request({
url: `/security/group/update`,
method: 'post',
params: query
})
}
export function deleteGroup(data) {
return request({
url: '/security/group/delete',
method: 'post',
data
})
}
export function updateGroupEnableStatus(id, enable) {
return request({
url: '/security/group/update/enable-status',
method: 'post',
data: {
id: id,
enable: enable
}
})
}
export function fetchRulePage(query) {
return request({
url: '/security/rule/page',
method: 'get',
params: query
})
}
export function fetchRuleList(query) {
return request({
url: '/security/rule/list',
method: 'get',
params: query
})
}
export function createRule(data) {
return request({
url: `/security/rule/create`,
method: 'post',
data
})
}
export function updateRule(data) {
return request({
url: `/security/rule/update`,
method: 'post',
data
})
}
export function deleteRule(query) {
return request({
url: '/security/rule/delete',
method: 'post',
params: query
})
}
export function updateRuleEnableStatus(id, enable) {
return request({
url: '/security/rule/update/enable-status',
method: 'post',
data: {
id: id,
enable: enable
}
})
}
@@ -50,7 +50,7 @@
:hide-on-single-pageInfo="false"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-pageInfo="PaginationData.currentPage"
:current-page="PaginationData.currentPage"
:pageInfo-sizes="[10, 20, 50, 100]"
:pageInfo-size="PaginationData.pageSize"
layout="total, sizes, prev, pager, next, jumper"
@@ -0,0 +1,83 @@
<template>
<el-popover
placement="top"
:width="width"
v-model="visible">
<p class="popper-p-css"><i class="el-icon-warning" style="color: #e6a23c"/>{{title}}</p>
<div style="text-align: center; margin: 0">
<el-button size="mini" @click="handleCancelClick">{{cancelText}}</el-button>
<el-button type="primary" size="mini" @click="handleCommitClick">{{okText}}</el-button>
</div>
<el-link slot="reference" :underline="false" :type="type" :size="size" :icon="icon" :disabled="disabled" style="text-align: left; font-size: 12px">{{buttonText}}</el-link>
</el-popover>
</template>
<script>
export default {
name: 'deleteLink',
props: {
width: {
type: Number,
default: 160
},
buttonText: {
type: String,
default: '删除'
},
type: {
type: String,
default: 'danger'
},
size: {
type: String,
default: 'mini'
},
icon: {
type: String,
default: ''
},
disabled: {
type: Boolean,
default: false
},
title: {
type: String,
default: '确定删除吗?'
},
okText: {
type: String,
default: '确定'
},
cancelText: {
type: String,
default: '取消'
}
},
data() {
return {
visible: false
}
},
methods: {
handleCancelClick() {
this.visible = false
this.$emit('handleCancelClick')
},
handleCommitClick() {
this.visible = false
this.$emit('handleCommitClick')
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.popper-p-css{
margin-top: 0px !important;
margin-bottom: 5px !important;
.el-icon-warning{
margin-right: 5px;
}
}
</style>
+18 -1
View File
@@ -48,11 +48,14 @@ export default {
user: '用户管理',
system: '系统管理',
portPool: '端口池管理',
securityGroup: '安全组管理',
securityRule: '安全规则管理',
portGroup: '端口分组管理',
protocal: '协议管理',
proxy: '代理配置',
license: 'License管理',
portMapping: '端口映射',
domainManagement: '域名管理',
jobManager: '调度管理',
jobLog: '调度日志',
log: '日志管理',
@@ -126,8 +129,10 @@ export default {
deleteBatch: '批量删除',
cancel: '取 消',
confirm: '确 定',
domain: '域名',
userId: '用户ID',
userName: '用户名',
name: '名称',
group: '分组',
groupName: '分组名称',
groupPossessor: '分组所属',
@@ -169,7 +174,19 @@ export default {
totalFlow: '总流量',
protocalName: '协议',
supportStatus: '支持状态',
domainName: '域名'
domainName: '域名',
securityGroup: '安全组',
defaultPassType: '默认放行类型',
ruleName: '规则名称',
rule: '规则内容',
passType: '放行类型',
priority: '优先级',
ruleConfig: '配置规则',
portMappingBindSecurityGroup: '绑定安全组',
securityGroupBindPortMapping: '端口映射绑定',
bind: '绑定',
unbind: '解绑',
bindOtherSecurityGroup: '已绑定其他安全组'
},
button: {
lookOver: '查看'
+4 -1
View File
@@ -61,7 +61,8 @@ export const asyncRouterMap = [
},
children: [
{ path: 'license', component: _import('proxy/license'), name: 'license', meta: { title: 'license' }},
{ path: 'portMapping', component: _import('proxy/portMapping'), name: 'portMapping', meta: { title: 'portMapping' }}
{ path: 'portMapping', component: _import('proxy/portMapping'), name: 'portMapping', meta: { title: 'portMapping' }},
{ path: 'domainManagement', component: _import('proxy/domain'), name: 'domainManagement', meta: { title: 'domainManagement' }}
]
},
{
@@ -77,6 +78,8 @@ export const asyncRouterMap = [
{ path: 'user', component: _import('system/user'), name: 'user', meta: { title: 'user' }},
{ path: 'portGroup', component: _import('system/portGroup'), name: 'portGroup', meta: { title: 'portGroup' }},
{ path: 'portPool', component: _import('system/portPool'), name: 'portPool', meta: { title: 'portPool' }},
{ path: 'securityGroup', component: _import('system/securityGroup'), name: 'securityGroup', meta: { title: 'securityGroup' }},
{ path: 'securityRule', component: _import('system/securityRule'), name: 'securityRule', meta: { title: 'securityRule' }, hidden: true },
{ path: 'protocal', component: _import('system/protocal'), name: 'protocal', meta: { title: 'protocal' }},
{ path: 'jobManager', component: _import('system/jobManager'), name: 'jobManager', meta: { title: 'jobManager' }}
]
@@ -51,7 +51,7 @@
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
@@ -46,7 +46,7 @@
</el-table-column>-->
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
@@ -31,7 +31,7 @@
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
@@ -0,0 +1,467 @@
<template>
<div class="app-container calendar-list-container">
<div class="filter-container" style="display:flex">
<el-select v-model="listQuery.userId" placeholder="请选择用户" filterable clearable style="margin-right:10px;width: 120px;">
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable style="width:145px;margin-right:10px">
<el-option v-for="item in selectObj.statusOptions" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
</div>
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
style="width: 100%">
<el-table-column align="center" :label="$t('table.id')" width="50">
<template slot-scope="scope">
<span>{{scope.row.id}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.userName')" width="150">
<template slot-scope="scope">
<span>{{scope.row.userName}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.domain')" width="300">
<template slot-scope="scope">
<span>{{scope.row.domain}}</span>
</template>
</el-table-column>
<el-table-column width="150px" align="center" :label="$t('table.createTime')">
<template slot-scope="scope">
<span>{{scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
</template>
</el-table-column>
<el-table-column width="150px" align="center" :label="$t('table.updateTime')">
<template slot-scope="scope">
<span>{{scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('SSL证书状态')" width="110">
<template slot-scope="scope">
<el-tag :type="scope.row.sslStatus | statusFilter">{{scope.row.sslStatus | sslStatusName}}</el-tag>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('默认域名')" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.isDefault | statusFilter">{{scope.row.isDefault | httpStatusName}}</el-tag>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('强制HTTPS')" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.forceHttps | statusFilter">{{scope.row.forceHttps | httpStatusName}}</el-tag>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.enable | statusFilter">{{scope.row.enable | statusName}}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.actions')" width="330" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button v-if="scope.row.isDefault !='1' && scope.row.enable == '1'" size="mini" type="primary" @click="handleDefaultStatus(scope.row)">{{$t('默认')}}</el-button>
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{$t('table.edit')}}</el-button>
<el-button v-if="scope.row.enable =='1'" size="mini" type="danger" @click="handleModifyStatus(scope.row,2)">{{$t('table.disable')}}</el-button>
<el-button v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row,1)">{{$t('table.enable')}}</el-button>
<!-- <el-button size="mini" type="danger" @click="handleDelete(scope.row,'deleted')">{{$t('table.delete')}}</el-button>-->
<ButtonPopover @handleCommitClick="handleDelete2(scope.row)" style="margin-left: 10px"/>
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="120px" style='width: 400px; margin-left:50px;'>
<el-form-item :label="$t('主域名')" prop="domain">
<el-input v-model="temp.domain"></el-input>
</el-form-item>
<el-form-item :label="$t('强制HTTPS')" prop="userId">
<el-select style="width: 280px" class="filter-item" v-model="temp.forceHttps" placeholder="请选择">
<el-option label="开启" :value="1"></el-option>
<el-option label="关闭" :value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('JKS文件上传')" prop="file">
<el-upload
ref="upload"
class="upload-demo"
action=""
:http-request="httpRequest"
:file-list="this.fileList"
:auto-upload="false"
:multiple="false"
accept=".jks"
:limit="1"
:on-change="handleChange"
>
<el-button slot="trigger" size="small" type="primary">选择文件</el-button>
</el-upload>
</el-form-item>
<el-form-item v-if="passWordInputStatus" :label="$t('JKS密码')" prop="filePassword">
<el-input type="password" v-model="temp.keyStorePassword"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">{{$t('table.confirm')}}</el-button>
<el-button v-else type="primary" @click="updateData">{{$t('table.confirm')}}</el-button>
</div>
</el-dialog>
<!-- <el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">-->
<!-- <el-table :data="pvData" border fit highlight-current-row style="width: 100%">-->
<!-- <el-table-column prop="key" label="Channel"> </el-table-column>-->
<!-- <el-table-column prop="pv" label="Pv"> </el-table-column>-->
<!-- </el-table>-->
<!-- <span slot="footer" class="dialog-footer">-->
<!-- <el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>-->
<!-- </span>-->
<!-- </el-dialog>-->
</div>
</template>
<script>
import { fetchList, updateEnableStatus, createDomain, updateDomain, deleteDomain, updateDefaultStatus } from '@/api/domain'
import { userList } from '@/api/user'
import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils'
import ButtonPopover from '../../components/Button/buttonPopover'
const calendarTypeOptions = [
{ key: 'CN', display_name: 'China' },
{ key: 'US', display_name: 'USA' },
{ key: 'JP', display_name: 'Japan' },
{ key: 'EU', display_name: 'Eurozone' }
]
// arr to obj ,such as { CN : "China", US : "USA" }
const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
acc[cur.key] = cur.display_name
return acc
}, {})
export default {
name: 'complexTable',
directives: {
waves
},
components: {
ButtonPopover
},
data() {
return {
fileList: [],
tableKey: 0,
list: null,
total: null,
listLoading: true,
listQuery: {
current: 1,
size: 10,
enable: undefined,
userId: null
},
importanceOptions: [1, 2, 3],
calendarTypeOptions,
userList: [],
sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
statusOptions: ['published', 'draft', 'deleted'],
showReviewer: false,
temp: {
id: undefined,
importance: 1,
remark: '',
timestamp: new Date(),
title: '',
type: '',
status: 'published',
domain: '',
jks: undefined,
keyStorePassword: '',
forceHttps: ''
},
dialogFormVisible: false,
dialogStatus: '',
passWordInputStatus: false,
textMap: {
update: '编辑',
create: '新建'
},
dialogPvVisible: false,
pvData: [],
rules: {
domain: [
{ required: true, message: '主域名不能为空', trigger: 'blur' },
{ validator: this.validateDomain, trigger: 'blur' }
],
file: [
{ required: false, message: '请选择文件', trigger: 'blur' }
],
filePassword: [
{ required: false, message: '密码不能为空', trigger: 'blur' }
]// TODO required改为true后,密码不为空,仍不能通过
},
downloadLoading: false,
selectObj: {
statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }],
onlineOptions: [{ label: '在线', value: 1 }, { label: '离线', value: 2 }]
}
}
},
filters: {
statusName(status) {
const statusMap = {
1: '启用',
2: '禁用'
}
return statusMap[status]
},
sslStatusName(status) {
const statusMap = {
1: '已上传',
2: '未上传',
3: '已验证'
}
return statusMap[status]
},
httpStatusName(status) {
const statusMap = {
1: '开启',
2: '关闭'
}
return statusMap[status]
},
statusFilter(status) {
const statusMap = {
1: 'success',
2: 'danger'
}
return statusMap[status]
},
typeFilter(type) {
return calendarTypeKeyValue[type]
}
},
created() {
this.getDataList()
},
methods: {
httpRequest(param) {
this.temp.jks = param.file
},
validateDomain(rule, value, callback) {
// 匹配多级域名,例如:sub.example.com, sub.sub.example.com
const domainPattern = /^(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\.)+[A-Za-z]{2,6}$/
if (!value) {
callback(new Error('主域名不能为空'));
} else if (!domainPattern.test(value)) {
callback(new Error('请输入正确的域名格式'));
} else {
callback();
}
},
handleChange(file) {
this.fileList = [file]
this.passWordInputStatus = true
},
getList() {
this.listLoading = true
fetchList(this.listQuery).then(response => {
this.list = response.data.data.records
this.total = response.data.data.total
this.listLoading = false
})
},
getUserList() {
userList().then(response => {
this.userList = response.data.data
})
},
getDataList() {
const loginName = this.$store.state.user.loginName
userList().then(response => {
this.userList = response.data.data
const curUser = this.userList.find((val) => val.loginName === loginName)
if (curUser) {
this.listQuery.userId = curUser.id
}
this.getList()
})
},
handleFilter() {
this.listQuery.current = 1
this.getList()
},
handleSizeChange(val) {
this.listQuery.size = val
this.getList()
},
handleCurrentChange(val) {
this.listQuery.current = val
this.getList()
},
handleDefaultStatus(row) {
updateDefaultStatus(row.id, 1).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
message: '操作成功',
type: 'success'
})
this.getList()
}
this.getList()
})
},
handleModifyStatus(row, enable) {
console.log('route', this.$route)
updateEnableStatus(row.id, enable, row.domain).then(response => {
if (response.data.data.code === 0) {
this.$message({
message: '操作成功',
type: 'success'
})
}
this.getList()
})
},
resetTemp() {
this.passWordInputStatus = false
this.fileList = []
this.temp = {
domain: undefined,
jks: undefined,
keyStorePassword: undefined,
forceHttps: undefined
}
},
handleCreate() {
this.resetTemp()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$refs.upload.submit()
const formData = this.objectToFormData(this.temp)
createDomain(formData).then(response => {
if (response.data.code === 0) {
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
this.getList()
}
})
}
})
},
handleUpdate(row) {
this.resetTemp()
this.temp = Object.assign({}, row) // copy obj
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
console.log(this.temp)
if (valid) {
this.$refs.upload.submit()
const tempData = Object.assign({}, this.temp)
const formData = this.objectToFormData(tempData)
updateDomain(formData).then(response => {
if (response.data.code === 0) {
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
this.getList()
}
})
}
})
},
objectToFormData(obj) {
const formData = new FormData()
Object.keys(obj).forEach(key => {
if (obj[key] !== undefined) {
formData.append(key, obj[key])
}
})
return formData
},
handleDelete(row) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteDomain(row.id).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
this.getList()
}
})
}).catch(() => {})
},
handleDelete2(row) {
deleteDomain(row.id).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
this.getList()
}
})
},
handleDownload() {
this.downloadLoading = true
import('@/vendor/Export2Excel').then(excel => {
const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
const data = this.formatJson(filterVal, this.list)
excel.export_json_to_excel(tHeader, data, 'table-list')
this.downloadLoading = false
})
},
formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => {
if (j === 'timestamp') {
return parseTime(v[j])
} else {
return v[j]
}
}))
}
}
}
</script>
@@ -1,13 +1,13 @@
<template>
<div class="app-container calendar-list-container">
<div class="filter-container">
<el-select v-model="listQuery.userId" placeholder="请选择用户" filterable clearable>
<el-select v-model="listQuery.userId" placeholder="请选择用户" filterable clearable style="margin-right:10px;width: 120px;">
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
<el-select v-model="listQuery.isOnline" placeholder="请选择在线状态" clearable>
<el-select v-model="listQuery.isOnline" placeholder="请选择在线状态" clearable style="width:145px;margin-right:10px">
<el-option v-for="item in selectObj.onlineOptions" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable>
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable style="width:145px;margin-right:10px">
<el-option v-for="item in selectObj.statusOptions" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
@@ -36,6 +36,11 @@
<span>{{scope.row.key}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('限速')" width="100">
<template slot-scope="scope">
<span>{{scope.row.upLimitRate ? scope.row.upLimitRate : '--'}} / {{scope.row.downLimitRate ? scope.row.downLimitRate : '--'}}</span>
</template>
</el-table-column>
<el-table-column width="150px" align="center" :label="$t('table.createTime')">
<template slot-scope="scope">
<span>{{scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
@@ -69,7 +74,7 @@
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
@@ -85,6 +90,12 @@
<el-form-item :label="$t('License名称')" prop="name">
<el-input v-model="temp.name"></el-input>
</el-form-item>
<el-form-item :label="$t('上传限速')" prop="upLimitRate">
<el-input v-model="temp.upLimitRate" placeholder="如:10240B、500K、1M"></el-input>
</el-form-item>
<el-form-item :label="$t('下载限速')" prop="downLimitRate">
<el-input v-model="temp.downLimitRate" placeholder="如:10240B、500K、1M"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
@@ -39,19 +39,21 @@
<span>{{ scope.row.userName }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.licenseName')" width="130">
<el-table-column align="center" :label="$t('table.licenseName')" width="120">
<template slot-scope="scope">
<span>{{ scope.row.licenseName }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.protocalName')" width="100">
<el-table-column align="center" :label="$t('table.protocalName')" width="80">
<template slot-scope="scope">
<span>{{ scope.row.protocal }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.domainName')" width="200">
<el-table-column align="center" :label="$t('table.domainName')" width="190">
<template slot-scope="scope">
<span>{{ scope.row.domain }}</span>
<div v-for="(domain, index) in scope.row.allFullDomainList" :key="index">
<span>{{ domain }}</span>
</div>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.serverPort')" width="80">
@@ -64,17 +66,22 @@
<span>{{ scope.row.clientIp }}:{{ scope.row.clientPort }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('限速')" width="100">
<template slot-scope="scope">
<span>{{scope.row.upLimitRate ? scope.row.upLimitRate : '--'}} / {{scope.row.downLimitRate ? scope.row.downLimitRate : '--'}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.desc')" width="120">
<template slot-scope="scope">
<span>{{ scope.row.description }}</span>
</template>
</el-table-column>
<el-table-column width="150px" align="center" :label="$t('table.createTime')">
<template slot-scope="scope">
<span>{{ scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column width="150px" align="center" :label="$t('table.createTime')">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column width="150px" align="center" :label="$t('table.updateTime')">
<template slot-scope="scope">
<span>{{ scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
@@ -99,8 +106,7 @@
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{ $t('table.edit') }}</el-button>
<el-button v-if="scope.row.enable == '1'" size="mini" type="danger" @click="handleModifyStatus(scope.row, 2)">{{$t('table.disable')}}</el-button>
<el-button v-if="scope.row.enable == '2'" size="mini" type="success"
@click="handleModifyStatus(scope.row, 1)">{{ $t('table.enable') }}</el-button>
<el-button v-if="scope.row.enable == '2'" size="mini" type="success" @click="handleModifyStatus(scope.row, 1)">{{ $t('table.enable') }}</el-button>
<!-- <el-button size="mini" type="danger" @click="handleDelete(scope.row,'deleted')">{{$t('table.delete')}}</el-button>-->
<ButtonPopover @handleCommitClick="handleDelete2(scope.row)" style="margin-left: 10px" />
@@ -110,76 +116,112 @@
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-pageInfo.sync="listQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="listQuery.size"
:current-page.sync="listQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="listQuery.size"
layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="120px"
style='width: 400px; margin-left:50px;'>
<!-- <el-form-item :label="$t('License')" prop="licenseId">-->
<!-- <el-select style="width: 280px;" class="filter-item" v-model="temp.licenseId" placeholder="请选择" :disabled="dialogStatus=='update'">-->
<!-- <el-option v-for="item in licenseList" :key="item.id" :label="item.name" :value="item.id">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item :label="$t('License')" prop="licenseId">
<DropdownTable v-model="temp.licenseId" :name.sync="temp.licenseName" :tableData="licenseAuthList"
@selectedData="selectedFeeItem" placeholder="请选择" :width="280" :disabled="dialogStatus === 'update'" />
<!-- <DropdownTable
:columns="countryColumns"
:data="licenseList"
v-model="temp.licenseId"
:value="temp.licenseName"
@rowClick="selectedFeeItem"
disabled
:disabled="dialogStatus==='update'"
style="width: 280px"
/>-->
</el-form-item>
<el-form-item :label="$t('协议')" prop="protocal">
<el-select style="width: 280px;" class="filter-item" v-model="temp.protocal" placeholder="请选择">
<el-option v-for="item in protocalList" :key="item.name" :label="item.name" :value="item.name"
:disabled="!item.enable">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('服务端端口')" prop="serverPort" >
<load-select style="width: 280px;" class="filter-item"
v-model="temp.serverPort"
:data="serverPortList"
:page="loadServerPortQuery.page"
:hasMore="more"
:clearable="false"
:dictLabel="'port'"
:dictValue="'port'"
:request="loadServerPort"/>
</el-form-item>
<el-form-item :label="$t('客户端IP')" prop="clientIp">
<el-input v-model="temp.clientIp"></el-input>
</el-form-item>
<el-form-item :label="$t('客户端端口')" prop="clientPort">
<el-input v-model="temp.clientPort"></el-input>
</el-form-item>
<el-form-item :label="$t('域名')" prop="subdomain" v-if="(temp.protocal === 'HTTP' || temp.protocal === 'HTTP(S)') && domainName && domainName != ''">
<el-input v-model="temp.subdomain">
<template slot="append">.{{ domainName }}</template>
</el-input>
</el-form-item>
<el-form-item :label="$t('响应数量')" prop="proxyResponses" v-if="temp.protocal === 'UDP'">
<el-input v-model="temp.proxyResponses"></el-input>
</el-form-item>
<el-form-item :label="$t('超时时间')" prop="proxyTimeoutMs" v-if="temp.protocal === 'UDP'">
<el-input v-model="temp.proxyTimeoutMs">
<template slot="append">毫秒</template>
</el-input>
</el-form-item>
<el-form-item :label="$t('描述')" prop="description">
<el-input v-model="temp.description"></el-input>
</el-form-item>
</el-form>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="800px">
<div style="height: 500px; overflow-y: auto;">
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="right" label-width="150px" inline>
<!-- <el-form-item :label="$t('License')" prop="licenseId">-->
<!-- <el-select style="width: 187px;" class="filter-item" v-model="temp.licenseId" placeholder="请选择" :disabled="dialogStatus=='update'">-->
<!-- <el-option v-for="item in licenseList" :key="item.id" :label="item.name" :value="item.id">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item :label="$t('License')" prop="licenseId">
<DropdownTable v-model="temp.licenseId" :name.sync="temp.licenseName" :tableData="licenseAuthList"
@selectedData="selectedFeeItem" placeholder="请选择" :width="280" :disabled="dialogStatus === 'update'" />
<!-- <DropdownTable
:columns="countryColumns"
:data="licenseList"
v-model="temp.licenseId"
:value="temp.licenseName"
@rowClick="selectedFeeItem"
disabled
:disabled="dialogStatus==='update'"
style="width: 280px"
/>-->
</el-form-item>
<el-form-item :label="$t('协议')" prop="protocal">
<el-select style="width: 187px;" class="filter-item" v-model="temp.protocal" placeholder="请选择">
<el-option v-for="item in protocalList" :key="item.name" :label="item.name" :value="item.name"
:disabled="!item.enable">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('服务端端口')" prop="serverPort" >
<load-select style="width: 187px;" class="filter-item"
v-model="temp.serverPort"
:data="serverPortList"
:page="loadServerPortQuery.page"
:hasMore="more"
:clearable="false"
:dictLabel="'port'"
:dictValue="'port'"
:request="loadServerPort"/>
</el-form-item>
<el-form-item :label="$t('客户端IP')" prop="clientIp">
<el-input v-model="temp.clientIp"></el-input>
</el-form-item>
<el-form-item :label="$t('客户端端口')" prop="clientPort">
<el-input v-model="temp.clientPort"></el-input>
</el-form-item>
<el-form-item :label="$t('响应数量')" prop="proxyResponses" v-if="temp.protocal === 'UDP'">
<el-input v-model="temp.proxyResponses"></el-input>
</el-form-item>
<el-form-item :label="$t('超时时间')" prop="proxyTimeoutMs" v-if="temp.protocal === 'UDP'">
<el-input v-model="temp.proxyTimeoutMs">
<template slot="append">毫秒</template>
</el-input>
</el-form-item>
<el-form-item :label="$t('table.securityGroup')" prop="securityGroup">
<el-select style="width: 187px;" class="filter-item" v-model="temp.securityGroupId" clearable >
<el-option v-for="item in securityGroupList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('上传限速')" prop="upLimitRate">
<el-input v-model="temp.upLimitRate" placeholder="如:10240B、500K、1M"></el-input>
</el-form-item>
<el-form-item :label="$t('下载限速')" prop="downLimitRate">
<el-input v-model="temp.downLimitRate" placeholder="如:10240B、500K、1M"></el-input>
</el-form-item>
<el-form-item :label="$t('描述')" prop="description">
<el-input v-model="temp.description" style="width: 540px;"></el-input>
</el-form-item>
<el-form-item :label="$t('域名')" prop="domainMappings" v-if="(temp.protocal === 'HTTP' || temp.protocal === 'HTTP(S)') && domainList != null && domainList.length > 0" >
<div class="my-tag">
<el-tag
:key="index"
v-for="(domain, index) in temp.domainMappings"
closable
:disable-transitions="false"
@close="removeDomainMapping(index)"
class="my-tag_item"
>
<el-input v-model="domain.subdomain" class="my-input"></el-input>
<el-select v-model="domain.domainId" placeholder="请选择主域名" class="my-select">
<el-option v-for="tmp in domainList" :key="tmp.id" :label="'.'+tmp.domain" :value="tmp.id"></el-option>
</el-select>
</el-tag>
<el-button v-if="!temp.domainMappings.length || temp.domainMappings[temp.domainMappings.length - 1].subdomain" class="button-new-tag" size="small" @click="addDomainMapping">+ 添加域名</el-button>
</div>
<!--<div v-for="(domain, index) in temp.domainMappings" :key="index" class="domain-mapping">
<el-input v-model="domain.subdomain">
<template slot="append">
<el-select v-model="domain.domainId" placeholder="请选择主域名" style="width: 187px;">
<el-option v-for="tmp in domainList" :key="tmp.id" :label="'.'+tmp.domain" :value="tmp.id"></el-option>
</el-select>
<el-button type="danger" @click="removeDomainMapping(index)" style="margin-left: 10px;">删除</el-button>
</template>
</el-input>
</div>
<el-button type="primary" @click="addDomainMapping" style="margin-top: 10px;">添加域名</el-button>-->
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="
dialogFormVisible = false">{{ $t('table.cancel') }}</el-button>
@@ -204,17 +246,18 @@
<script>
import { fetchList, createUserPortMapping, updateUserPortMapping, updateEnableStatus, deletePortMapping } from '@/api/portMapping'
import { fetchGroupList } from '@/api/securityGroup'
import { availablePortList, portAvailable } from '@/api/portPool'
import { licenseList, licenseAuthList } from '@/api/license'
import { protocalList } from '@/api/protocal'
import { userList } from '@/api/user'
import { domainNameBindInfo } from '@/api/domain'
import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils'
import ButtonPopover from '../../components/Button/buttonPopover'
import DropdownTable from '../../components/Dropdown/DropdownTable'
// 下拉选择加载组件
import loadSelect from "@/components/Select/SelectLoadMore";
import {fetchAvailableDomainList} from "../../api/domain";
const calendarTypeOptions = [
{ key: 'CN', display_name: 'China' },
@@ -280,7 +323,7 @@ export default {
protocalList: [],
licenseAuthList: [],
serverPortList: [],
domainName: '',
domainList: [{ 'name': 'link.com', 'id': '1' }],
showReviewer: false,
temp: {
id: undefined,
@@ -291,7 +334,8 @@ export default {
clientPort: undefined,
protocal: undefined,
proxyResponses: undefined,
proxyTimeoutMs: undefined
proxyTimeoutMs: undefined,
domainMappings: []
},
selectObj: {
statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }],
@@ -306,6 +350,27 @@ export default {
dialogPvVisible: false,
pvData: [],
rules: {
domainMappings: [
{
validator: (rule, value, callback) => {
if (value && value.length > 0) {
for (let i = 0; i < value.length; i++) {
if (!value[i].subdomain || !value[i].domainId) {
return callback(new Error(`子域名和主域名都不能为空`))
}
}
const set = new Set()
value.forEach(i => {
const row = this.domainList.find(d => d.id === i.domainId)
set.add(i.subdomain + '.' + row.domain)
})
if (set.size !== value.length) return callback(new Error(`域名不能重复`))
}
callback() // 验证通过
},
trigger: ''
}
],
licenseId: [{ required: true, message: '请选择License', trigger: 'blur,change' }],
serverPort: [{ required: true, message: '请输入服务端端口', trigger: 'blur' },
// { validator: isPortAvailable, trigger: 'change' }
@@ -325,6 +390,7 @@ export default {
licenseId:null,
},
more: true,
securityGroupList: []
}
},
filters: {
@@ -354,17 +420,64 @@ export default {
}
},
created() {
this.getDomainNameBindInfo()
this.getDataList()
this.getLicenseList()
this.getLicenseAuthList()
this.getProtocalList()
this.fetchSecurityGroupList()
this.getAvailableDomainList()
},
methods: {
// 添加新的域名映射
addDomainMapping() {
let defaultDomainId = this.domainList[0].id
this.domainList.forEach(item => {
if (item.isDefault === 1) {
defaultDomainId = item.id
}
})
this.temp.domainMappings.push({
subdomain: undefined,
domain: undefined,
domainId: defaultDomainId
});
console.log(this.list)
},
// 删除指定的域名映射
removeDomainMapping(index) {
this.temp.domainMappings.splice(index, 1);
},
getList() {
this.listLoading = true
fetchList(this.listQuery).then(response => {
this.list = response.data.data.records
this.list = response.data.data.records.map(item => {
// 初始化 domainMappings 字段
item.domainMappings = [];
// 检查是否存在 subdomain 和 domain 字段
if (item.fullDomainMappings && Array.isArray(item.fullDomainMappings)) {
let allFullDomainList = []
for (const fullDomainMapping of item.fullDomainMappings) {
item.domainMappings.push({
id: fullDomainMapping.id || '',
subdomain: fullDomainMapping.subdomain || '', // 使用 || '' 保证字段非空
domainId: fullDomainMapping.domainNameId || '',
domain: fullDomainMapping.domain || ''
});
// 拼接完整的域名
let fullDomain = null;
if (fullDomainMapping.forceHttps == 1) {
fullDomain = `https://` + `${fullDomainMapping.subdomain}.${fullDomainMapping.domain}`;
} else {
fullDomain = `http://` + `${fullDomainMapping.subdomain}.${fullDomainMapping.domain}`;
}
// 将拼接后的域名添加到
allFullDomainList.push(fullDomain);
}
item.allFullDomainList = allFullDomainList
}
return item;
});
// console.log(this.list)
this.total = response.data.data.total
this.listLoading = false
})
@@ -380,15 +493,22 @@ export default {
this.getList()
})
},
getDomainNameBindInfo() {
domainNameBindInfo().then(response => {
this.domainName = response.data.data
fetchSecurityGroupList () {
fetchGroupList().then(res => {
if(res.data.code == 0) {
this.securityGroupList = res.data.data
}
})
},
getAvailablePortList(licenseId) {
this.loadServerPortQuery.licenseId = licenseId;
this.serverPortList = []; //清掉数据
},
getAvailableDomainList() {
fetchAvailableDomainList({}).then(response => {
this.domainList = response.data.data
})
},
getAllUserList() {
userList().then(response => {
this.userList = response.data.data
@@ -443,9 +563,10 @@ export default {
clientPort: undefined,
userId: undefined,
proxyResponses: undefined,
proxyTimeoutMs: undefined
}
this.serverPortList = []
proxyTimeoutMs: undefined,
domainMappings: []
};
this.serverPortList = [];
this.loadServerPortQuery.licenseId = null;
this.more = true;
},
@@ -460,6 +581,7 @@ export default {
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
// console.log(this.temp)
createUserPortMapping(this.temp).then(response => {
if (response.data.code === 0) {
this.dialogFormVisible = false
@@ -477,13 +599,19 @@ export default {
},
handleOpenWebPage(row) {
let url = location.protocol + '//' + location.hostname + ':' + row.serverPort
if (row.domain) {
url = location.protocol + '//' + row.domain
if (row.allFullDomainList && row.allFullDomainList.length > 0) {
url = row.allFullDomainList[0]
}
open(url)
},
handleUpdate(row) {
this.temp = Object.assign({}, row) // copy obj
this.resetTemp()
console.log(this.temp)
this.temp = JSON.parse(JSON.stringify(row))
console.log(this.temp)
if (row.securityGroupId === 0) {
this.temp.securityGroupId = null
}
this.temp.timestamp = new Date(this.temp.timestamp)
this.dialogStatus = 'update'
this.dialogFormVisible = true
@@ -607,3 +735,42 @@ export default {
}
}
</script>
<style scoped lang="scss">
.my-tag {
width: 570px;
&_item {
height: 36px;
line-height: 35px;
padding: 0 7px;
.my-input, .my-select {
width: auto;
/deep/ input {
height: 32px;
line-height: 32px;
}
}
.my-input {
/deep/ input {
width: 120px;
padding: 0 6px;
}
}
.my-select {
/deep/ input {
width: 110px;
border-width: 0!important;
background: #ecf5ff!important;
}
}
&:first-child {
margin-right: 8px;
}
& + & {
margin-right: 8px;
margin-bottom: 6px;
}
}
}
</style>
@@ -44,7 +44,7 @@
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
@@ -41,7 +41,7 @@
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
@@ -36,7 +36,7 @@
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
@@ -37,7 +37,7 @@
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
@@ -51,7 +51,7 @@
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
@@ -58,7 +58,7 @@
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-pageInfo.sync="listQuery.current"
:current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size"
layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
@@ -55,7 +55,7 @@
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
@@ -28,7 +28,7 @@
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-pageInfo.sync="listQuery.current"
:current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size"
layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
@@ -0,0 +1,463 @@
<template>
<div class="app-container calendar-list-container">
<div class="filter-container">
<el-input v-model="listQuery.name" style="width:145px;margin-right:10px" placeholder="请输入名称" />
<el-input v-model="listQuery.description" style="width:145px;margin-right:10px" placeholder="请输入描述" />
<el-select v-model="listQuery.defaultPassType" placeholder="请选择默认放行类型" clearable style="width:145px;margin-right:10px">
<el-option v-for="item in selectObj.passType" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable style="width:145px;margin-right:10px">
<el-option v-for="item in selectObj.statusOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{
$t('table.search') }}
</el-button>
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
</div>
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
style="width: 100%">
<!-- <el-table-column align="center" width="40" type="selection" /> -->
<el-table-column align="center" :label="$t('table.id')" width="60">
<template slot-scope="scope">
<span>{{scope.row.id}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.name')">
<template slot-scope="scope">
<span>{{scope.row.name}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.desc')">
<template slot-scope="scope">
<span>{{scope.row.description}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.defaultPassType')">
<template slot-scope="scope">
<el-tag :type="scope.row.defaultPassType | passTypeFilter">{{ scope.row.defaultPassType | passTypeName }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.createTime')">
<template slot-scope="scope">
<span>{{ scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.updateTime')">
<template slot-scope="scope">
<span>{{ scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('table.enableStatus')">
<template slot-scope="scope">
<el-tag :type="scope.row.enable | statusFilter">{{ scope.row.enable | statusName }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.actions')" class-name="small-padding fixed-width" style="display:flex;justify-content:center">
<template slot-scope="scope">
<div >
<el-link :underline="false" type="primary" size="mini" @click="handleGoRulePage(scope.row)" style="font-size: 12px">{{$t('table.ruleConfig')}}</el-link>
<el-link :underline="false" type="primary" size="mini" @click="handleUpdate(scope.row)" style="font-size: 12px">{{$t('table.edit')}}</el-link>
<el-link :underline="false" v-if="scope.row.enable =='1'" size="mini" type="warning" @click="handleModifyStatus(scope.row, 2)" style="font-size: 12px">{{$t('table.disable')}}</el-link>
<el-link :underline="false" v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row, 1)" style="font-size: 12px">{{$t('table.enable')}}</el-link>
</div>
<el-dropdown>
<span class="el-dropdown-link" style="font-size: 12px">
更多操作<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<LinkPopover @handleCommitClick="handleDelete(scope.row)" style="width: 100%"/>
</el-dropdown-item>
<el-dropdown-item>
<el-link :underline="false" type="primary" size="mini" @click="handlePortMapping(scope.row)" style="font-size: 12px">{{$t('table.securityGroupBindPortMapping')}}</el-link>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page.sync="listQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="listQuery.size"
layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="right" label-width="120px" style='width: 500px; margin-left:10px;'>
<el-form-item :label="$t('table.name')" prop="name">
<el-input :placeholder="$t('table.name')" v-model="temp.name"></el-input>
</el-form-item>
<el-form-item :label="$t('table.desc')" prop="desc">
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" :placeholder="$t('table.desc')" v-model="temp.description"></el-input>
</el-form-item>
<el-form-item :label="$t('table.defaultPassType')" prop="defaultPassType">
<el-tooltip class="item" effect="dark" content="当IP地址不能匹配任何规则时,默认执行的放行类型" placement="bottom">
<el-select style="width: 380px" class="filter-item" v-model="temp.defaultPassType" :disabled="dialogStatus === 'update'">
<el-option v-for="item in passTypeList" :key="item.key" :label="item.key" :value="item.value">
</el-option>
</el-select>
</el-tooltip>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">{{$t('table.confirm')}}</el-button>
<el-button v-else type="primary" @click="updateData">{{$t('table.confirm')}}</el-button>
</div>
</el-dialog>
<el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">
<el-table :data="pvData" border fit highlight-current-row style="width: 100%">
<el-table-column prop="key" label="Channel"> </el-table-column>
<el-table-column prop="pv" label="Pv"> </el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>
</span>
</el-dialog>
<el-dialog :title="$t('table.securityGroupBindPortMapping')+'---'+forBindProtMappingSecurityGroup.name+'安全组'" :visible.sync="dialogBindPortMappingVisible" width="90%">
<el-table :key='tableKey' :data="portMappingList" v-loading="listLoading" element-loading-text="给我一点时间" border width="100%"
highlight-current-row style="width: 100%">
<el-table-column align="center" :label="$t('table.id')" width="50">
<template slot-scope="scope">
<span>{{ scope.row.id }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.licenseName')">
<template slot-scope="scope">
<span>{{ scope.row.licenseName }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.protocalName')" width="120">
<template slot-scope="scope">
<span>{{ scope.row.protocal }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.domainName')">
<template slot-scope="scope">
<span>{{ scope.row.domain }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.serverPort')" width="100">
<template slot-scope="scope">
<span>{{ scope.row.serverPort }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.proxyClient')" width="200">
<template slot-scope="scope">
<span>{{ scope.row.clientIp }}:{{ scope.row.clientPort }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.desc')" width="120">
<template slot-scope="scope">
<span>{{ scope.row.description }}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="120">
<template slot-scope="scope">
<el-tag :type="scope.row.enable | statusFilter">{{ scope.row.enable | statusName }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.actions')" width="150" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" v-if="!scope.row.securityGroupId" @click="handleBind(scope.row)">{{$t('table.bind')}}</el-button>
<el-button type="danger" size="mini" v-if="scope.row.securityGroupId && scope.row.securityGroupId == forBindProtMappingSecurityGroup.id" @click="handleUnbind(scope.row)">{{$t('table.unbind')}}</el-button>
<span v-if="scope.row.securityGroupId && scope.row.securityGroupId != forBindProtMappingSecurityGroup.id" style="font-size: 12px;">{{$t('table.bindOtherSecurityGroup')}}</span>
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handlePortMappingSizeChange" @current-change="handlePortMappingCurrentChange"
:current-page.sync="portMappingListQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="portMappingListQuery.size"
layout="total, sizes, prev, pager, next, jumper" :total="portMappingTotal">
</el-pagination>
</div>
</el-dialog>
</div>
</template>
<script>
import {fetchGroupPage, createGroup, updateGroup, deleteGroup, updateGroupEnableStatus} from '@/api/securityGroup'
import { fetchList as fetchPortMappingList, portMappingBindSecurityGroup, portMappingUnbindSecurityGroup} from '@/api/portMapping'
import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils'
import LinkPopover from '../../components/Link/linkPopover'
export default {
name: 'complexTable',
directives: {
waves
},
components: {
LinkPopover
},
data() {
return {
tableKey: 0,
list: [],
total: null,
listQuery: {
current: 1,
size: 10,
name: undefined,
description: undefined,
defaultPassType: undefined,
enable: undefined
},
listLoading: true,
temp: {
id: undefined,
name: '',
description: '',
defaultPassType: undefined
},
selectObj: {
statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }],
onlineOptions: [{ label: '在线', value: 1 }, { label: '离线', value: 2 }],
passType: [{ label: '允许', value: 1 }, { label: '拒绝', value: 0 }]
},
dialogFormVisible: false,
dialogStatus: '',
textMap: {
update: '编辑',
create: '新建'
},
passTypeList: [{key: '允许', value: 1}, {key: '拒绝', value: 0}],
dialogPvVisible: false,
pvData: [],
rules: {
name: [{ required: true, message: '安全组名称必填', trigger: 'blur' }],
defaultPassType: [{ required: true, message: '默认放行类型必选', trigger: 'blur' }]
},
downloadLoading: false,
checkBoxData:[], //表单勾选的行
dialogBindPortMappingVisible: false,
forBindProtMappingSecurityGroup: {},
portMappingList: [],
portMappingTotal: null,
portMappingListLoading: false,
portMappingListQuery: {
current: 1,
size: 10,
importance: undefined,
title: undefined,
type: undefined,
userId: undefined,
license: undefined,
port: undefined,
isOnline: undefined,
enable: undefined,
description: undefined
},
}
},
filters: {
passTypeName(type) {
const statusMap = {
1: '允许',
0: '拒绝'
}
return statusMap[type]
},
passTypeFilter(type) {
const statusMap = {
1: 'success',
0: 'danger'
}
return statusMap[type]
},
statusName(status) {
const statusMap = {
1: '启用',
2: '禁用'
}
return statusMap[status]
},
statusFilter(status) {
const statusMap = {
1: 'success',
2: 'danger'
}
return statusMap[status]
},
typeFilter(type) {
return calendarTypeKeyValue[type]
}
},
created() {
// eslint-disable-next-line no-sequences
this.getList()
this.getPortMappingList()
},
methods: {
getList() {
this.listLoading = true
fetchGroupPage(this.listQuery).then(response => {
this.list = response.data.data.records
this.total = response.data.data.total
this.listLoading = false
})
},
handleFilter() {
this.listQuery.current = 1
this.getList()
},
handleSizeChange(val) {
this.listQuery.size = val
this.getList()
},
handleCurrentChange(val) {
this.listQuery.current = val
this.getList()
},
getPortMappingList() {
this.portMappingListLoading = true
fetchPortMappingList(this.portMappingListQuery).then(response => {
this.portMappingList = response.data.data.records
this.portMappingTotal = response.data.data.total
this.portMappingListQuery.current = response.data.data.current
this.portMappingListLoading = false
})
},
handleModifyStatus(row, enable) {
updateGroupEnableStatus(row.id, enable).then(response => {
if (response.data.data.code === 0) {
this.$message({
message: '操作成功',
type: 'success'
})
}
this.getList()
})
},
resetTemp() {
this.temp = {
id: undefined,
name: '',
description: '',
defaultPassType: undefined
}
},
handleCreate() {
this.resetTemp()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
createGroup(this.temp).then(response => {
if (response.data.code === 0) {
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
this.getList()
}
})
}
})
},
handleUpdate(row) {
this.temp = Object.assign({}, row) // copy obj
// this.temp.timestamp = new Date(this.temp.timestamp)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const tempData = Object.assign({}, this.temp)
updateGroup(tempData).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
this.dialogFormVisible = false
this.getList()
}
})
}
})
},
handleDelete(row) {
deleteGroup({groupId: row.id}).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
this.getList()
}
})
},
handleGoRulePage (row) {
this.$router.push({ path: '/system/securityRule', query: { groupId: row.id }})
// this.$router.push(`/system/securityRule?groupId=${row.id}`)
},
handlePortMapping(row) {
this.dialogBindPortMappingVisible = true
this.forBindProtMappingSecurityGroup = row
},
handlePortMappingSizeChange(val) {
this.portMappingListQuery.size = val
this.getPortMappingList()
},
handlePortMappingCurrentChange(val) {
this.portMappingListQuery.current = val
this.getPortMappingList()
},
handleBind(portMapping) {
portMappingBindSecurityGroup(portMapping.id, this.forBindProtMappingSecurityGroup.id).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
message: '绑定成功',
type: 'success',
duration: 2000
})
this.getPortMappingList()
}
})
},
handleUnbind(portMapping) {
portMappingUnbindSecurityGroup(portMapping.id).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
message: '解绑成功',
type: 'success',
duration: 2000
})
this.getPortMappingList()
}
})
}
}
}
</script>
@@ -0,0 +1,419 @@
<template>
<div class="app-container calendar-list-container">
<div>
<div style="text-align: center;line-height:48px;font-size:24px">{{group.name}}安全组</div>
<div style="text-align: center;font-size:14px; color: #606266">{{group.description}}</div>
</div>
<div class="filter-container">
<el-input v-model="listQuery.name" style="width:145px;margin-right:10px" placeholder="请输入名称" />
<el-input v-model="listQuery.description" style="width:145px;margin-right:10px" placeholder="请输入描述" />
<!-- <el-select v-model="listQuery.passType" placeholder="请选择默认放行类型" clearable style="width:145px;margin-right:10px">-->
<!-- <el-option v-for="item in selectObj.passType" :key="item.value" :label="item.label" :value="item.value" />-->
<!-- </el-select>-->
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable style="width:145px;margin-right:10px">
<el-option v-for="item in selectObj.statusOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{
$t('table.search') }}
</el-button>
<el-button class="filter-item" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
</div>
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
style="width: 100%">
<!-- <el-table-column align="center" width="40" type="selection" /> -->
<el-table-column align="center" :label="$t('table.id')" width="60">
<template slot-scope="scope">
<span>{{scope.row.id}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.ruleName')">
<template slot-scope="scope">
<span>{{scope.row.name}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.desc')">
<template slot-scope="scope">
<span>{{scope.row.description}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.rule')">
<template slot-scope="scope">
<span>{{scope.row.rule}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.passType')">
<template slot-scope="scope">
<el-tag :type="scope.row.passType | passTypeFilter">{{ scope.row.passType | passTypeName }}</el-tag>
</template>
</el-table-column>
<!-- <el-table-column align="center" :label="$t('table.priority')">-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{scope.row.priority}}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="center" :label="$t('table.createTime')">
<template slot-scope="scope">
<span>{{ scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.updateTime')">
<template slot-scope="scope">
<span>{{ scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="150">
<template slot-scope="scope">
<el-tag :type="scope.row.enable | statusFilter">{{ scope.row.enable | statusName }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.actions')" width="250" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-link type="primary" :underline="false" size="mini" @click="handleUpdate(scope.row)" style="font-size:12px">{{$t('table.edit')}}</el-link>
<el-link :underline="false" v-if="scope.row.enable =='1'" size="mini" type="warning" @click="handleModifyStatus(scope.row, 2)" style="font-size:12px">{{$t('table.disable')}}</el-link>
<el-link :underline="false" v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row, 1)" style="font-size:12px">{{$t('table.enable')}}</el-link>
<LinkPopover @handleCommitClick="handleDelete(scope.row)"/>
</template>
</el-table-column>
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page.sync="listQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="listQuery.size"
layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" top="4vh">
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="right" label-width="100px" style='margin-left:50px;margin-right: 150px'>
<el-form-item :label="$t('table.name')" prop="name">
<el-input :placeholder="$t('table.name')" v-model="temp.name"></el-input>
</el-form-item>
<el-form-item :label="$t('table.desc')" prop="desc">
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" :placeholder="$t('table.desc')" v-model="temp.description"></el-input>
</el-form-item>
<el-form-item :label="$t('table.rule')" prop="rule">
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 10}" :placeholder="$t('table.rule')" v-model="temp.rule"></el-input>
</el-form-item>
<el-form-item>
<div style="line-height: 28px; color: cornflowerblue">
<div>规则描述:</div>
<div>单个ip192.168.1.1, AA22:BB11:1122:CDEF:1234:AA99:7654:7410, ipv6只支持单个ip判断</div>
<div>范围类型192.168.1.0-192.168.1.255</div>
<div>掩码类型192.168.1.0/24</div>
<div>泛型0.0.0.0/ALL</div>
<div>每个类型中间以英文逗号分隔,形如 192.168.1.1,192.168.3.0/24 是正确的 </div>
</div>
</el-form-item>
<el-form-item :label="$t('table.passType')" prop="passType">
<el-tooltip class="item" effect="dark" :content="temp.passTypeTooltip" placement="right">
<!-- <el-button>右边</el-button> -->
<el-select class="filter-item" v-model="temp.passType" disabled>
<el-option v-for="item in passTypeList" :key="item.key" :label="item.key" :value="item.value">
</el-option>
</el-select>
</el-tooltip>
</el-form-item>
<!-- <el-form-item :label="$t('table.priority')" prop="priority">
<el-input-number v-model="temp.priority" :min="1" :max="1000" :placeholder="$t('table.priority')"></el-input-number>
</el-form-item> -->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">{{$t('table.confirm')}}</el-button>
<el-button v-else type="primary" @click="updateData">{{$t('table.confirm')}}</el-button>
</div>
</el-dialog>
<el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">
<el-table :data="pvData" border fit highlight-current-row style="width: 100%">
<el-table-column prop="key" label="Channel"> </el-table-column>
<el-table-column prop="pv" label="Pv"> </el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {fetchGroupDetail, fetchRulePage, createRule, updateRule, deleteRule, updateRuleEnableStatus} from '@/api/securityGroup'
import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils'
import LinkPopover from '../../components/Link/linkPopover'
export default {
name: 'complexTable',
directives: {
waves
},
components: {
LinkPopover
},
data() {
return {
groupId: 1,
group: {},
tableKey: 0,
list: [],
total: null,
listQuery: {
current: 1,
size: 10,
groupId: undefined,
name: undefined,
description: undefined,
passType: undefined,
enable: undefined
},
listLoading: true,
temp: {
id: undefined,
groupId: undefined,
name: '',
description: '',
rule: '',
passType: undefined,
passTypeTooltip: '',
priority: 1
},
selectObj: {
statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }],
onlineOptions: [{ label: '在线', value: 1 }, { label: '离线', value: 2 }],
passType: [{ label: '允许', value: 1 }, { label: '拒绝', value: 2 }]
},
dialogFormVisible: false,
dialogStatus: '',
textMap: {
update: '编辑',
create: '新建'
},
passTypeList: [{key: '允许', value: 1}, {key: '拒绝', value: 0}],
dialogPvVisible: false,
pvData: [],
rules: {
name: [{ required: true, message: '安全组名称必填', trigger: 'blur' }],
rule: [{ required: true, message: '规则内容必填', trigger: 'blur' }],
// passType: [{ required: true, message: '放行类型必选', trigger: 'blur' }],
// priority: [{ required: true, message: '优先级必填', trigger: 'blur' }]
},
downloadLoading: false,
checkBoxData:[], //表单勾选的行
}
},
filters: {
passTypeName(type) {
const statusMap = {
1: '允许',
0: '拒绝'
}
return statusMap[type]
},
passTypeFilter(type) {
const statusMap = {
1: 'success',
0: 'danger'
}
return statusMap[type]
},
statusName(status) {
const statusMap = {
1: '启用',
2: '禁用'
}
return statusMap[status]
},
statusFilter(status) {
const statusMap = {
1: 'success',
2: 'danger'
}
return statusMap[status]
},
typeFilter(type) {
return calendarTypeKeyValue[type]
}
},
created() {
// eslint-disable-next-line no-sequences
if (this.$route.query.groupId) {
this.listQuery.groupId = this.$route.query.groupId
} else {
this.$notify({
title: '错误',
message: '没有获取到安全组信息',
type: 'error',
duration: 3000
})
this.$router.push(`/system/securityGroup`)
return
}
this.getGroupDetail()
this.getList()
},
methods: {
getGroupDetail () {
fetchGroupDetail({id: this.listQuery.groupId}).then(response => {
this.group = response.data.data
})
},
getList() {
if (!this.listQuery.groupId) {
this.$notify({
title: '错误',
message: '没有获取到安全组信息',
type: 'error',
duration: 3000
})
return
}
this.listLoading = true
fetchRulePage(this.listQuery).then(response => {
this.list = response.data.data.records
this.total = response.data.data.total
this.listLoading = false
})
},
handleFilter() {
this.listQuery.current = 1
this.getList()
},
handleSizeChange(val) {
this.listQuery.size = val
this.getList()
},
handleCurrentChange(val) {
this.listQuery.current = val
this.getList()
},
handleEnableStatus(row) {
enableRule(row.id).then(response => {
if (response.data.code === 0) {
this.$message({
message: '操作成功',
type: 'success'
})
this.getList()
}
})
},
handleDisableStatus(row) {
disableRule(row.id).then(response => {
if (response.data.code === 0) {
this.$message({
message: '操作成功',
type: 'success'
})
this.getList()
}
})
},
handleModifyStatus(row, enable) {
updateRuleEnableStatus(row.id, enable).then(response => {
if (response.data.data.code === 0) {
this.$message({
message: '操作成功',
type: 'success'
})
}
this.getList()
})
},
resetTemp() {
this.temp = {
id: undefined,
groupId: this.listQuery.groupId,
name: '',
description: '',
rule: '',
passType: this.group.defaultPassType == 1 ? 0 : 1,
passTypeTooltip: `安全组已设置默认${(this.group.defaultPassType == 1 ? '允许' : '拒绝')}`,
priority: 1
}
},
handleCreate() {
this.resetTemp()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.temp.groupId = this.listQuery.groupId
createRule(this.temp).then(response => {
if (response.data.code === 0) {
this.dialogFormVisible = false
this.$notify({
title: '成功',
message: '创建成功',
type: 'success',
duration: 2000
})
this.getList()
}
})
}
})
},
handleUpdate(row) {
this.temp = Object.assign({}, row) // copy obj
this.temp.passType = row.passType
this.temp.passTypeTooltip = `安全组已设置默认${(this.group.defaultPassType == 1 ? '允许' : '拒绝')}`,
this.temp.timestamp = new Date(this.temp.timestamp)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
updateData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const tempData = Object.assign({}, this.temp)
tempData.groupId = this.listQuery.groupId
updateRule(tempData).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
message: '更新成功',
type: 'success',
duration: 2000
})
this.dialogFormVisible = false
this.getList()
}
})
}
})
},
handleDelete(row) {
deleteRule({ruleId: row.id}).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
this.getList()
}
})
}
}
}
</script>
@@ -50,7 +50,7 @@
</el-table>
<div class="pagination-container">
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
+8 -5
View File
@@ -1,12 +1,15 @@
FROM openjdk:17-jdk-alpine
FROM openjdk:21-jdk-oracle
#同步时间
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk update && apk add wget unzip vim && apk add -U tzdata && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
# apk update && apk add wget unzip vim && apk add -U tzdata && \
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
# 设置时区为北京时间
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN mkdir -p /root/neutrino-proxy/config
WORKDIR /root/neutrino-proxy
COPY ./target/neutrino-proxy-client.jar /root/neutrino-proxy/neutrino-proxy-client.jar
COPY ./src/main/resources/app.yml /root/neutrino-proxy/config
COPY ./src/main/resources/app-copy.yml /root/neutrino-proxy/config/app.yml
#VOLUME ["/root/neutrino-proxy"]
ENTRYPOINT ["java","-jar","neutrino-proxy-client.jar","config=./config/app.yml"]
+7
View File
@@ -28,6 +28,13 @@
<build>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>*.yml</include>
</includes>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>false</filtering>
@@ -3,6 +3,7 @@ package org.dromara.neutrinoproxy.client;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.noear.solon.Solon;
import org.noear.solon.Utils;
import org.noear.solon.annotation.SolonMain;
/**
@@ -16,13 +17,18 @@ public class ProxyClient {
public static void main(String[] args) {
Solon.start(ProxyClient.class, args, app -> {
String loglevel = System.getenv("LOG_LEVEL");
if (Utils.isNotEmpty(loglevel)) {
app.cfg().put("solon.logging.logger.root.level", loglevel);
}
setAlias("neutrino.proxy.tunnel.server-ip", "serverIp");
setAlias("neutrino.proxy.tunnel.server-port", "serverPort");
setAlias("neutrino.proxy.tunnel.ssl-enable", "sslEnable");
setAlias("neutrino.proxy.tunnel.jks-path", "jksPath");
setAlias("neutrino.proxy.tunnel.key-store-password", "keyStorePassword");
setAlias("neutrino.proxy.tunnel.license-key", "licenseKey");
});
});
}
/**
@@ -0,0 +1,35 @@
package org.dromara.neutrinoproxy.client.config;
import lombok.extern.slf4j.Slf4j;
import org.noear.solon.Solon;
import org.noear.solon.annotation.Component;
import org.noear.solon.core.event.AppLoadEndEvent;
import org.noear.solon.core.event.EventListener;
import org.noear.solon.core.runtime.NativeDetector;
/**
* 启动成功后信息输出
* @author: aoshiguchen
* @date: 2024/10/16
*/
@Slf4j
@Component
public class AppLoadEndExecutor implements EventListener<AppLoadEndEvent> {
@Override
public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable {
// aot 阶段,不执行
if (NativeDetector.isAotRuntime()) {
return;
}
System.out.printf("""
---------------------------------------------------------------
Neutrino Proxy Client %s
Gitee: https://gitee.com/dromara/neutrino-proxy
GitHub: https://github.com/dromara/neutrino-proxy
GitCode: https://gitcode.com/dromara/neutrino-proxy
---------------------------------------------------------------
%n""", Solon.app().cfg().get("solon.app.version"));
}
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.client.core;
import java.util.concurrent.ThreadFactory;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.client.core;
import io.netty.channel.Channel;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.client.core;
import lombok.extern.slf4j.Slf4j;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.client.util;
import io.netty.channel.ChannelHandler;
@@ -0,0 +1,41 @@
solon.logging.logger:
"root":
level: info
neutrino:
proxy:
tunnel:
# 线程池相关配置,用于技术调优,可忽略
thread-count: 50
# 隧道SSL证书配置
key-store-password: 123456
jks-path: classpath:/test.jks
# 服务端IP
server-ip: ${SERVER_IP:localhost}
# 服务端端口(对应服务端app.yml中的tunnel.port、tunnel.ssl-port)
server-port: ${SERVER_PORT:9002}
# 是否启用SSL(注意:该配置必须和server-port对应上)
ssl-enable: ${SSL_ENABLE:true}
# 客户端连接唯一凭证
license-key: ${LICENSE_KEY:}
# 客户端唯一身份标识(可忽略,若不设置首次启动会自动生成)
client-id:
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
# 是否开启心跳日志
heartbeat-log-enable: false
# 重连设置
reconnection:
# 重连间隔(秒)
interval-seconds: 10
# 是否开启无限重连(未开启时,客户端license不合法会自动停止应用,开启了则不会,请谨慎开启)
unlimited: false
client:
udp:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 5
work-thread-count: 20
# udp傀儡端口范围
puppet-port-range: 10000-10500
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
@@ -1,6 +1,9 @@
solon:
config:
add: ./app.yml
app:
name: neutrino-proxy-client
version: 2.0.2
# 日志级别
solon.logging.appender:
console:
@@ -12,8 +15,8 @@ solon.logging.appender:
rolling: "logs/${neutrino.application.name}_%d{yyyy-MM-dd}_%i.log.gz"
solon.logging.logger:
"root":
# level: ${LOG_LEVEL:info}
level: info
neutrino:
application:
name: neutrino-proxy-client
+3 -3
View File
@@ -30,10 +30,10 @@
<artifactId>hutool-core</artifactId>
<version>${hutool.version}</version>
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<groupId>cn.hutool</groupId>
<artifactId>hutool-cache</artifactId>
<version>${hutool.version}</version>
</dependency>
</dependencies>
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core;
import java.util.HashMap;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core;
import io.netty.channel.Channel;
@@ -49,6 +27,12 @@ public interface Constants {
AttributeKey<Boolean> IS_UDP_KEY = AttributeKey.newInstance("isUdp");
AttributeKey<InetSocketAddress> SENDER = AttributeKey.newInstance("sender");
AttributeKey<Integer> SERVER_PORT = AttributeKey.newInstance("serverPort");
AttributeKey<String> REAL_REMOTE_IP = AttributeKey.newInstance("realRemoteIp");
AttributeKey<Boolean> FLOW_LIMITER_FLAG = AttributeKey.newInstance("flowLimiterFlag");
int HEADER_SIZE = 4;
int TYPE_SIZE = 1;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core;
import io.netty.channel.ChannelHandlerContext;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core;
import lombok.Data;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core;
import lombok.AllArgsConstructor;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core;
import lombok.Data;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core;
import io.netty.buffer.ByteBuf;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core;
import io.netty.buffer.ByteBuf;
@@ -8,6 +8,7 @@ import org.noear.solon.aot.RuntimeNativeRegistrar;
import org.noear.solon.aot.hint.MemberCategory;
import org.noear.solon.core.AppContext;
import java.nio.ByteBuffer;
import java.util.Set;
/**
@@ -22,9 +23,18 @@ public class NeutrinoCoreRuntimeNativeRegistrar implements RuntimeNativeRegistra
metadata.registerReflection(clazz, MemberCategory.INVOKE_DECLARED_METHODS);
}
Set<Class<?>> byteBufferClasses = ClassUtil.scanPackageBySuper("java", ByteBuffer.class);
for (Class<?> clazz : byteBufferClasses) {
metadata.registerReflection(clazz, MemberCategory.INVOKE_DECLARED_METHODS);
}
metadata.registerReflection(ProxyMessage.class, MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
metadata.registerReflection(ProxyMessage.UdpBaseInfo.class, MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
metadata.registerArg("--add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED -march=compatibility");
metadata.registerArg("-J--add-opens=java.base/java.lang.invoke=ALL-UNNAMED");
metadata.registerArg("-J--add-opens=java.base/java.nio=ALL-UNNAMED");
metadata.registerArg("-J--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED");
metadata.registerArg("-march=compatibility");
}
}
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core.base;
/**
@@ -1,5 +1,3 @@
package org.dromara.neutrinoproxy.core.base;
/**
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core.dispatcher;
/**
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core.dispatcher;
/**
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.core.dispatcher;
import java.lang.annotation.*;
@@ -1,4 +1,3 @@
package org.dromara.neutrinoproxy.core.type;
/**
@@ -5,6 +5,7 @@ import org.dromara.neutrinoproxy.core.base.MetaDataConstant;
import org.apache.commons.lang3.StringUtils;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.JarEntry;
@@ -56,7 +57,7 @@ public class FileUtil {
* @throws IOException
*/
public static String readContentAsString(String path) {
try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path)))){
try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path), StandardCharsets.UTF_8))){
return br.lines().collect(Collectors.joining("\n"));
} catch (Exception e) {
return null;
@@ -70,7 +71,7 @@ public class FileUtil {
* @throws IOException
*/
public static String readContentAsString(InputStream in) {
try (BufferedReader br = new BufferedReader(new InputStreamReader(in))){
try (BufferedReader br = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))){
return br.lines().collect(Collectors.joining("\n"));
} catch (Exception e) {
return null;
@@ -84,7 +85,7 @@ public class FileUtil {
* @throws IOException
*/
public static List<String> readContentAsStringList(String path) {
try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path)))){
try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path), StandardCharsets.UTF_8))){
return br.lines().collect(Collectors.toList());
} catch (Exception e) {
return null;
@@ -0,0 +1,60 @@
package org.dromara.neutrinoproxy.core.util;
import org.apache.commons.lang3.StringUtils;
/**
* @author: wen.y
* @date: 2023/12/9
*/
public class HttpUtil {
/**
* 获取请求头 Host 忽略端口号
* @param httpContent
* @return
*/
public static String getHostIgnorePort(String httpContent) {
String host = getHost(httpContent);
if (StringUtils.isEmpty(host) || !host.contains(":")) {
return host;
}
return host.replaceAll(":.*", "");
}
/**
* 获取请求头 Host
* @param httpContent
* @return
*/
public static String getHost(String httpContent) {
return getHeaderValue(httpContent, "Host");
}
/**
* 获取请求头
* @param httpContent
* @return
*/
public static String getHeaderValue(String httpContent, String header) {
String headerContent = httpContent.split("\r\n\r\n")[0];
String[] lines = headerContent.split("\r\n");
String firstLine = lines[0];
if (!(firstLine.endsWith("HTTP/1.1") || firstLine.endsWith("HTTP/1.0"))) {
return null;
}
for (int i = 1; i < lines.length; i++) {
String line = lines[i];
if (!line.startsWith(header + ":")) {
continue;
}
if (line.length() > header.length() + 1) {
return line.substring(header.length() + 1).trim();
} else {
return "";
}
}
return null;
}
}
@@ -0,0 +1,39 @@
package org.dromara.neutrinoproxy.core.util;
import cn.hutool.core.net.Ipv4Util;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import java.net.InetSocketAddress;
@Slf4j
public class IpUtil extends org.noear.solon.core.util.IpUtil {
public static String getRemoteIp(ChannelHandlerContext ctx) {
String remoteAddress = "";
InetSocketAddress socketAddress = (InetSocketAddress) ctx.channel().remoteAddress();
if (socketAddress != null) {
remoteAddress = socketAddress.getAddress().getHostAddress();
}
return remoteAddress;
}
/**
* 工作原理为从http协议的header中找公网地址,此主要用于处理nginx转发时塞进去的真实IP的header,找不到返回null
* @param httpContent http协议文档内容
* @return 返回找到的第一个公网地址
*/
public static String getRealRemoteIp(String httpContent) {
String ip = HttpUtil.getHeaderValue(httpContent, "X-Forwarded-For");
if (StringUtils.isEmpty(ip)) {
ip = HttpUtil.getHeaderValue(httpContent, "X-Real-IP");
}
if (StringUtils.isNotEmpty(ip)) {
log.debug("obtain http header ip{}", ip);
return ip;
}
return null;
}
}
@@ -0,0 +1,19 @@
package org.dromara.neutrinoproxy.core.util;
import org.noear.solon.Solon;
/**
* @author songyinyin
* @since 2023/10/31 11:48
*/
public class NeutrinoProxyVersion {
/**
* 获取 NeutrinoProxy 版本号
*/
public static String getVersion() {
return Solon.cfg().get("solon.app.version");
}
}
+8 -5
View File
@@ -1,12 +1,15 @@
FROM openjdk:17-jdk-alpine
FROM openjdk:21-jdk-oracle
#同步时间
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk update && apk add wget unzip vim && apk add -U tzdata && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
# apk update && apk add wget unzip vim && apk add -U tzdata && \
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
# 设置时区为北京时间
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN mkdir -p /root/neutrino-proxy/config
WORKDIR /root/neutrino-proxy
COPY ./target/neutrino-proxy-server.jar /root/neutrino-proxy/neutrino-proxy-server.jar
COPY ./src/main/resources/app.yml /root/neutrino-proxy/config
COPY ./src/main/resources/app-copy.yml /root/neutrino-proxy/config/app.yml
#VOLUME ["/root/neutrino-proxy"]
ENTRYPOINT ["java","-jar","neutrino-proxy-server.jar","config=./config/app.yml"]
+7
View File
@@ -61,6 +61,13 @@
<build>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>*.yml</include>
</includes>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>false</filtering>
@@ -3,6 +3,7 @@ package org.dromara.neutrinoproxy.server;
import lombok.extern.slf4j.Slf4j;
import org.dromara.solonplugins.job.annotation.EnableJob;
import org.noear.solon.Solon;
import org.noear.solon.Utils;
import org.noear.solon.annotation.SolonMain;
import org.noear.solon.web.cors.CrossFilter;
@@ -20,6 +21,10 @@ public class ProxyServer {
Solon.start(ProxyServer.class, args, app -> {
// 跨域支持。加-1 优先级更高
app.filter(-1, new CrossFilter().allowedOrigins("*"));
String loglevel = System.getenv("LOG_LEVEL");
if (Utils.isNotEmpty(loglevel)) {
app.cfg().put("solon.logging.logger.root.level", loglevel);
}
});
}
}
@@ -0,0 +1,37 @@
package org.dromara.neutrinoproxy.server.base;
import lombok.extern.slf4j.Slf4j;
import org.noear.solon.Solon;
import org.noear.solon.annotation.Component;
import org.noear.solon.core.event.AppLoadEndEvent;
import org.noear.solon.core.event.EventListener;
import org.noear.solon.core.runtime.NativeDetector;
/**
* 启动成功后信息输出
* @author: aoshiguchen
* @date: 2024/10/16
*/
@Slf4j
@Component
public class AppLoadEndExecutor implements EventListener<AppLoadEndEvent> {
@Override
public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable {
// aot 阶段,不执行
if (NativeDetector.isAotRuntime()) {
return;
}
System.out.printf("""
---------------------------------------------------------------
Neutrino Proxy Server %s
admin: http://localhost:8888
account: admin/123456
Gitee: https://gitee.com/dromara/neutrino-proxy
GitHub: https://github.com/dromara/neutrino-proxy
GitCode: https://gitcode.com/dromara/neutrino-proxy
---------------------------------------------------------------
%n""", Solon.app().cfg().get("solon.app.version"));
}
}
@@ -1,30 +1,14 @@
package org.dromara.neutrinoproxy.server.base;
import org.apache.ibatis.type.SimpleTypeRegistry;
import org.dromara.neutrinoproxy.server.base.proxy.ProxyConfig;
import org.dromara.neutrinoproxy.server.base.rest.ResponseBody;
import org.dromara.neutrinoproxy.server.controller.req.proxy.PortMappingCreateReq;
import org.dromara.neutrinoproxy.server.controller.req.proxy.PortMappingUpdateReq;
import org.dromara.neutrinoproxy.server.controller.res.report.HomeDataView;
import org.dromara.neutrinoproxy.server.dal.ClientConnectRecordMapper;
import org.dromara.neutrinoproxy.server.dal.FlowReportDayMapper;
import org.dromara.neutrinoproxy.server.dal.FlowReportHourMapper;
import org.dromara.neutrinoproxy.server.dal.FlowReportMinuteMapper;
import org.dromara.neutrinoproxy.server.dal.FlowReportMonthMapper;
import org.dromara.neutrinoproxy.server.dal.JobInfoMapper;
import org.dromara.neutrinoproxy.server.dal.LicenseMapper;
import org.dromara.neutrinoproxy.server.dal.PortMappingMapper;
import org.dromara.neutrinoproxy.server.dal.PortPoolMapper;
import org.dromara.neutrinoproxy.server.dal.UserLoginRecordMapper;
import org.dromara.neutrinoproxy.server.dal.UserMapper;
import org.dromara.neutrinoproxy.server.dal.UserTokenMapper;
import org.dromara.neutrinoproxy.server.service.ClientConnectRecordService;
import org.dromara.neutrinoproxy.server.service.JobInfoService;
import org.dromara.neutrinoproxy.server.service.JobLogService;
import org.dromara.neutrinoproxy.server.service.LicenseService;
import org.dromara.neutrinoproxy.server.service.PortGroupService;
import org.dromara.neutrinoproxy.server.service.PortMappingService;
import org.dromara.neutrinoproxy.server.service.PortPoolService;
import org.dromara.neutrinoproxy.server.service.ReportService;
import org.dromara.neutrinoproxy.server.service.UserLoginRecordService;
import org.dromara.neutrinoproxy.server.service.UserService;
import org.dromara.neutrinoproxy.server.dal.*;
import org.dromara.neutrinoproxy.server.proxy.enhance.SslContextManager;
import org.dromara.neutrinoproxy.server.service.*;
import org.dromara.solonplugins.job.JobBean;
import org.noear.solon.annotation.Component;
import org.noear.solon.aot.RuntimeNativeMetadata;
@@ -56,6 +40,9 @@ public class NeutrinoServerRuntimeNativeRegistrar implements RuntimeNativeRegist
metadata.registerLambdaSerialization(ReportService.class);
metadata.registerLambdaSerialization(UserLoginRecordService.class);
metadata.registerLambdaSerialization(UserService.class);
metadata.registerLambdaSerialization(SecurityGroupService.class);
metadata.registerLambdaSerialization(DomainService.class);
metadata.registerLambdaSerialization(SslContextManager.class);
metadata.registerLambdaSerialization(LicenseMapper.class);
metadata.registerLambdaSerialization(ClientConnectRecordMapper.class);
@@ -64,11 +51,21 @@ public class NeutrinoServerRuntimeNativeRegistrar implements RuntimeNativeRegist
metadata.registerLambdaSerialization(FlowReportMinuteMapper.class);
metadata.registerLambdaSerialization(FlowReportMonthMapper.class);
metadata.registerLambdaSerialization(JobInfoMapper.class);
metadata.registerLambdaSerialization(JobLogMapper.class);
metadata.registerLambdaSerialization(PortMappingMapper.class);
metadata.registerLambdaSerialization(PortGroupMapper.class);
metadata.registerLambdaSerialization(ReportMapper.class);
metadata.registerLambdaSerialization(PortPoolMapper.class);
metadata.registerLambdaSerialization(UserLoginRecordMapper.class);
metadata.registerLambdaSerialization(UserMapper.class);
metadata.registerLambdaSerialization(UserTokenMapper.class);
metadata.registerLambdaSerialization(SecurityGroupMapper.class);
metadata.registerLambdaSerialization(SecurityRuleMapper.class);
metadata.registerLambdaSerialization(DomainMapper.class);
metadata.registerLambdaSerialization(DomainPortMappingMapper.class);
metadata.registerReflection(PortMappingUpdateReq.DomainMapping.class, MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS);
metadata.registerReflection(PortMappingCreateReq.DomainMapping.class, MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS);
metadata.registerReflection(HomeDataView.class, MemberCategory.DECLARED_FIELDS);
metadata.registerReflection(HomeDataView.Last7dFlow.class, MemberCategory.DECLARED_FIELDS);
@@ -90,6 +87,8 @@ public class NeutrinoServerRuntimeNativeRegistrar implements RuntimeNativeRegist
metadata.registerReflection(JobBean.class, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS);
// 解决mybatis调用deleteBatchIds报错“java.lang.ClassNotFoundException: Cannot find class: org.apache.ibatis.type.SimpleTypeRegistry”
metadata.registerReflection(SimpleTypeRegistry.class, MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS);
}
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.base.db;
import cn.hutool.core.collection.CollectionUtil;
@@ -33,6 +12,7 @@ import org.noear.solon.annotation.Init;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.event.AppLoadEndEvent;
import org.noear.solon.core.event.EventListener;
import org.noear.solon.core.runtime.NativeDetector;
import org.noear.wood.DbContext;
import org.noear.wood.annotation.Db;
@@ -57,6 +37,10 @@ public class DBInitialize implements EventListener<AppLoadEndEvent> {
@Init
public void init() throws Throwable {
// aot 阶段,不初始化数据库
if (NativeDetector.isAotRuntime()) {
return;
}
Assert.notNull(dbConfig.getType(), "neutrino.data.db.type不能为空!");
dbTypeEnum = DbTypeEnum.of(dbConfig.getType());
Assert.notNull(dbTypeEnum, "neutrino.data.db.type取值异常!");
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.base.db;
import org.dromara.neutrinoproxy.server.constant.DbTypeEnum;
@@ -63,7 +63,6 @@ public class ProxyConfig {
public static class Tcp {
private Integer bossThreadCount;
private Integer workThreadCount;
private String domainName;
private Integer httpProxyPort;
private Integer httpsProxyPort;
private String keyStorePassword;
@@ -20,6 +20,9 @@ import io.netty.channel.nio.NioEventLoopGroup;
import org.dromara.neutrinoproxy.server.proxy.core.BytesMetricsHandler;
import org.dromara.neutrinoproxy.server.proxy.core.TcpVisitorChannelHandler;
import org.dromara.neutrinoproxy.server.proxy.core.UdpVisitorChannelHandler;
import org.dromara.neutrinoproxy.server.proxy.security.TcpVisitorSecurityChannelHandler;
import org.dromara.neutrinoproxy.server.proxy.security.UdpVisitorSecurityChannelHandler;
import org.dromara.neutrinoproxy.server.proxy.security.VisitorFlowLimiterChannelHandler;
import org.noear.solon.Solon;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Configuration;
@@ -74,6 +77,8 @@ public class ProxyConfiguration implements LifecycleBean {
}
ch.pipeline().addFirst(new BytesMetricsHandler());
// ch.pipeline().addLast(new ChannelTrafficShapingHandler(1024 * 1024 * 20, 1024 * 1024 * 20, 100, 20000));
ch.pipeline().addLast(new TcpVisitorSecurityChannelHandler());
ch.pipeline().addLast("flowLimiter", new VisitorFlowLimiterChannelHandler());
ch.pipeline().addLast(new TcpVisitorChannelHandler());
}
});
@@ -111,6 +116,8 @@ public class ProxyConfiguration implements LifecycleBean {
if (null != proxyConfig.getServer().getUdp().getTransferLogEnable() && proxyConfig.getServer().getUdp().getTransferLogEnable()) {
ch.pipeline().addFirst(new LoggingHandler(UdpVisitorChannelHandler.class));
}
pipeline.addLast(udpServerWorkerGroup, new UdpVisitorSecurityChannelHandler());
ch.pipeline().addLast("flowLimiter", new VisitorFlowLimiterChannelHandler());
pipeline.addLast(udpServerWorkerGroup, new UdpVisitorChannelHandler());
}
});
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.base.rest;
import java.lang.annotation.ElementType;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.base.rest;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.base.rest;
import org.dromara.neutrinoproxy.server.constant.ExceptionConstant;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.base.rest;
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.base.rest;
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
@@ -8,7 +8,6 @@ import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
import org.dromara.neutrinoproxy.server.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.dromara.neutrinoproxy.server.base.rest.*;
import org.noear.solon.Solon;
import org.noear.solon.annotation.Component;
import org.noear.solon.core.handle.Action;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
@@ -0,0 +1,19 @@
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 默认域名状态枚举
* @author Mirac
* @date 21/7/2024
*/
@Getter
@AllArgsConstructor
public enum DefaultDomainStatusEnum {
ENABLE(1, "默认域名"),
DISABLE(2, "关闭");
private Integer status;
private String desc;
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
@@ -40,8 +19,8 @@ public enum ExceptionConstant {
NO_PERMISSION_VISIT(5, "当前用户无权访问该资源"),
PARAMS_NOT_NULL(10, "参数[{}]不能为空"),
PARAMS_NOT_EMPTY(11, "参数[{}]不能为空"),
FILED_LENGTH_OUT(12 ,"{}不能超出长度{}"),
BYTES_DESC_INVALID(13, "参数[{}]字节描述不合法"),
// 用户管理(11000)
// license管理(12000)
@@ -59,15 +38,23 @@ public enum ExceptionConstant {
PORT_MAPPING_NOT_EXIST(14000, "端口映射记录不存在"),
PORT_CANNOT_REPEAT_MAPPING(14001, "服务端口[{}]不能重复映射"),
AN_UNSUPPORTED_PROTOCOL(14002, "不支持的协议[{}]"),
PORT_MAPPING_SUBDONAME_CONNOT_REPEAT(14003, "子域名不能重复使用!"),
// 调度管理(15000)
JOB_INFO_NOT_EXIST(15000, "调度管理记录不存在"),
SYSTEM_ERROR(500, "系统异常"),
PORT_GROUP_NAME_ALREADY_EXIST(16000,"端口分组名称[{}]已经存在"),
PORT_GROUP_NAME_DOES_NOT_EXIST(16001,"端口分组不存在"),
DEFAULT_GROUP_FORBID_DELETE(16002,"默认分组禁止删除")
DEFAULT_GROUP_FORBID_DELETE(16002,"默认分组禁止删除"),
// 安全组管理(17000)
SECURITY_GROUP_NOT_EXIST(17000, "安全组不存在"),
SECURITY_RULE_NOT_EXIST(17001, "安全规则不存在"),
// 域名映射管理(18000)
DOMAIN_NAME_CANNOT_REPEAT(18000, "域名不能重复"),
DOMAIN_NAME_NOT_EXIST(18001, "域名不存在"),
DOMAIN_NAME_IS_DISABLE(18002, "当前域名[{}]被禁用"),
SUDOMAIN_NAME_CANNOT_REPEAT(18003, "子域名不能重复"),
DOMAIN_NAME_IS_USED(18002, "当前域名正在使用"),
;
private int code;
@@ -0,0 +1,29 @@
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 仅Https状态枚举
* @author Mirac
* @date 21/7/2024
*/
@Getter
@AllArgsConstructor
public enum HttpsStatusEnum {
ONLY_HTTPS(1, "仅HTTPS"),
DISABLE_ONLY_HTTPS(2, "关闭仅HTTPS");
private static Map<Integer, HttpsStatusEnum> CACHE = Stream.of(HttpsStatusEnum.values()).collect(Collectors.toMap(HttpsStatusEnum::getStatus, Function.identity()));
private Integer status;
private String desc;
public static HttpsStatusEnum of(Integer status) {
return CACHE.get(status);
}
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
@@ -0,0 +1,16 @@
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
@Getter
public enum SecurityRulePassTypeEnum {
DENY(0, "deny"),
ALLOW(1, "allow"),
NONE(-1, "none")
;
private final Integer type;
private final String desc;
}
@@ -0,0 +1,25 @@
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 仅Https状态枚举
* @author Mirac
* @date 21/7/2024
*/
@Getter
@AllArgsConstructor
public enum SslStatusEnum {
UPLOADED(1, "已上传"),
NOT_UPLOADED(2, "未上传"),
CERTIFIED(3, "已认证");//预留,用于证书验证
private Integer status;
private String desc;
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.constant;
import lombok.AllArgsConstructor;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
@@ -0,0 +1,91 @@
package org.dromara.neutrinoproxy.server.controller;
import cn.hutool.core.util.StrUtil;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
import org.dromara.neutrinoproxy.server.base.page.PageQuery;
import org.dromara.neutrinoproxy.server.base.rest.Authorization;
import org.dromara.neutrinoproxy.server.controller.req.proxy.*;
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainListRes;
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainUpdateDefaultStatusRes;
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainUpdateEnableStatusRes;
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
import org.noear.solon.annotation.*;
import org.dromara.neutrinoproxy.server.service.DomainService;
import org.noear.solon.core.handle.Context;
import org.noear.solon.core.handle.UploadedFile;
import org.noear.solon.lang.Nullable;
import javax.sound.midi.Soundbank;
import java.io.IOException;
import java.util.List;
/**
* @author Mirac
* @date 21/7/2024
*/
@Mapping("/domain")
@Controller
public class DomainController {
@Inject
private DomainService domainService;
@Get
@Mapping("/page")
public PageInfo<DomainListRes> page(PageQuery pageQuery, DomainListReq req) {
return domainService.page(pageQuery, req);
}
@Get
@Mapping("/all")
public List<DomainListRes> all(DomainListReq req) {
ParamCheckUtil.checkNotNull(req, "req");
return domainService.all(req);
}
@Post
@Mapping(path = "/create")
@Authorization(onlyAdmin = true)
public void create(DomainCreateReq req, UploadedFile jks) throws IOException {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotEmpty(req.getDomain(), "domain");
domainService.create(req, jks);
}
@Post
@Mapping(path = "/update")
@Authorization(onlyAdmin = true)
public void update(DomainUpdateReq req, UploadedFile jks) throws IOException {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotEmpty(req.getDomain(), "domain");
domainService.update(req, jks);
}
@Post
@Mapping(path = "/update/enable-status")
@Authorization(onlyAdmin = true)
public DomainUpdateEnableStatusRes updateEnableStatus(DomainUpdateEnableStatusReq req){
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getId(), "id");
ParamCheckUtil.checkNotNull(req.getEnable(), "enable");
return domainService.updateEnableStatus(req);
}
@Post
@Mapping(path = "/delete")
@Authorization(onlyAdmin = true)
public void delete(DomainDeleteReq req) {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getId(), "id");
domainService.delete(req.getId());
}
@Post
@Mapping(path = "/update/default-status")
@Authorization(onlyAdmin = true)
public DomainUpdateDefaultStatusRes updateDefaultStatus(DomainUpdateDefaultStatusReq req){
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getId(), "id");
ParamCheckUtil.checkNotNull(req.getIsDefault(), "isDefault");
return domainService.updateDefaultStatus(req.getId(), req.getIsDefault());
}
}
@@ -1,27 +0,0 @@
package org.dromara.neutrinoproxy.server.controller;
import lombok.extern.slf4j.Slf4j;
import org.dromara.neutrinoproxy.server.base.proxy.ProxyConfig;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Get;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Mapping;
/**
* @author: aoshiguchen
* @date: 2023/4/2
*/
@Slf4j
@Mapping("/domain-name")
@Controller
public class DomainNameController {
@Inject
private ProxyConfig proxyConfig;
@Get
@Mapping("/bind-info")
public String bindInfo () {
return proxyConfig.getServer().getTcp().getDomainName();
}
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller;
import org.dromara.neutrinoproxy.server.base.rest.Authorization;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
@@ -70,6 +49,8 @@ public class LicenseController {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotEmpty(req.getName(), "name");
ParamCheckUtil.checkNotNull(req.getUserId(), "userId");
ParamCheckUtil.checkBytesDesc(req.getUpLimitRate(), "upLimitRate");
ParamCheckUtil.checkBytesDesc(req.getDownLimitRate(), "downLimitRate");
return licenseService.create(req);
}
@@ -81,6 +62,8 @@ public class LicenseController {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getId(), "id");
ParamCheckUtil.checkNotEmpty(req.getName(), "name");
ParamCheckUtil.checkBytesDesc(req.getUpLimitRate(), "upLimitRate");
ParamCheckUtil.checkBytesDesc(req.getDownLimitRate(), "downLimitRate");
return licenseService.update(req);
}
@@ -13,6 +13,8 @@ import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
import org.apache.commons.lang3.StringUtils;
import org.noear.solon.annotation.*;
import java.util.List;
/**
* 端口映射
* @author: aoshiguchen
@@ -28,7 +30,6 @@ public class PortMappingController {
@Mapping("/page")
public PageInfo<PortMappingListRes> page(PageQuery pageQuery, PortMappingListReq req) {
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
return portMappingService.page(pageQuery, req);
}
@@ -41,6 +42,8 @@ public class PortMappingController {
ParamCheckUtil.checkNotNull(req.getClientPort(), "clientPort");
ParamCheckUtil.checkNotEmpty(req.getProtocal(), "protocal");
ParamCheckUtil.checkMaxLength(req.getDescription(), 50, "描述", "50");
ParamCheckUtil.checkBytesDesc(req.getUpLimitRate(), "upLimitRate");
ParamCheckUtil.checkBytesDesc(req.getDownLimitRate(), "downLimitRate");
if (StringUtils.isBlank(req.getClientIp())) {
// 没传客户端ip,默认为127.0.0.1
req.setClientIp("127.0.0.1");
@@ -49,7 +52,7 @@ public class PortMappingController {
ParamCheckUtil.checkNotNull(networkProtocolEnum, ExceptionConstant.AN_UNSUPPORTED_PROTOCOL, req.getProtocal());
if (networkProtocolEnum != NetworkProtocolEnum.HTTP) {
// 目前仅HTTP支持绑定域名
req.setSubdomain(null);
req.setDomainMappings(null);
}
req.setProtocal(networkProtocolEnum.getDesc());
if (null == req.getProxyResponses()) {
@@ -58,19 +61,24 @@ public class PortMappingController {
if (null == req.getProxyTimeoutMs()) {
req.setProxyTimeoutMs(0L);
}
if (null == req.getSecurityGroupId()) {
req.setSecurityGroupId(0);
}
return portMappingService.create(req);
}
@Post
@Mapping("/update")
public PortMappingUpdateRes update(PortMappingUpdateReq req) {
public void update(PortMappingUpdateReq req) {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getLicenseId(), "licenseId");
ParamCheckUtil.checkNotNull(req.getServerPort(), "serverPort");
ParamCheckUtil.checkNotNull(req.getClientPort(), "clientPort");
ParamCheckUtil.checkNotEmpty(req.getProtocal(), "protocal");
ParamCheckUtil.checkMaxLength(req.getDescription(), 50, "描述", "50");
ParamCheckUtil.checkBytesDesc(req.getUpLimitRate(), "upLimitRate");
ParamCheckUtil.checkBytesDesc(req.getDownLimitRate(), "downLimitRate");
if (StringUtils.isBlank(req.getClientIp())) {
// 没传客户端ip,默认为127.0.0.1
req.setClientIp("127.0.0.1");
@@ -79,7 +87,7 @@ public class PortMappingController {
ParamCheckUtil.checkNotNull(networkProtocolEnum, ExceptionConstant.AN_UNSUPPORTED_PROTOCOL, req.getProtocal());
if (networkProtocolEnum != NetworkProtocolEnum.HTTP) {
// 目前仅HTTP支持绑定域名
req.setSubdomain(null);
req.setDomainMappings(null);
}
req.setProtocal(networkProtocolEnum.getDesc());
if (null == req.getProxyResponses()) {
@@ -88,8 +96,11 @@ public class PortMappingController {
if (null == req.getProxyTimeoutMs()) {
req.setProxyTimeoutMs(0L);
}
if (null == req.getSecurityGroupId()) {
req.setSecurityGroupId(0);
}
return portMappingService.update(req);
portMappingService.update(req);
}
@Get
@@ -119,4 +130,26 @@ public class PortMappingController {
portMappingService.delete(req.getId());
}
/**
* 绑定安全组
* @param req portMappingId和securityGroupId
*/
@Post
@Mapping("/bind/security-group")
public void bindSecurityGroup(PortMappingBindSecurityGroupReq req) {
portMappingService.portBindSecurityGroup(req.getId(), req.getSecurityGroupId());
}
/**
* 安全组解绑
* @param id 端口映射Id
*/
@Post
@Mapping("/unbind/security-group")
public void unbindSecurityGroup(Integer id) {
portMappingService.portUnbindSecurityGroup(id);
}
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
@@ -0,0 +1,127 @@
package org.dromara.neutrinoproxy.server.controller;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
import org.dromara.neutrinoproxy.server.base.page.PageQuery;
import org.dromara.neutrinoproxy.server.controller.req.system.*;
import org.dromara.neutrinoproxy.server.controller.res.system.*;
import org.dromara.neutrinoproxy.server.service.PortMappingService;
import org.dromara.neutrinoproxy.server.service.SecurityGroupService;
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
import org.noear.solon.annotation.*;
import java.util.List;
@Controller
@Mapping("/security")
public class SecurityController {
@Inject
private SecurityGroupService groupService;
@Inject
private PortMappingService portMappingService;
/**
* 获取当前用户权限下的安全组
*/
@Get
@Mapping("/group/page")
public PageInfo<SecurityGroupListRes> groupPage(PageQuery pageQuery, SecurityGroupListReq req) {
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
return groupService.groupPage(pageQuery, req);
}
@Get
@Mapping("/group/list")
public List<SecurityGroupListRes> groupList() {
return groupService.groupList();
}
@Get
@Mapping("/group/detail")
public SecurityGroupDetailRes groupDetail(SecurityGroupDetailReq req) {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getId(), "id");
return groupService.groupDetail(req);
}
@Post
@Mapping("/group/create")
public void createGroup(SecurityGroupCreateReq req) {
groupService.createGroup(req);
}
@Post
@Mapping("/group/update")
public void updateGroup(SecurityGroupUpdateReq req) {
groupService.updateGroup(req);
}
/**
* 将级联删除对应规则,并更新缓存
* @param groupId 安全组Id
*/
@Post
@Mapping("/group/delete")
public void deleteGroup(Integer groupId) {
ParamCheckUtil.checkNotNull(groupId, "groupId");
groupService.deleteGroup(groupId);
}
@Post
@Mapping("/group/update/enable-status")
public SecurityGroupUpdateEnableStatueRes updateGroupEnableStatueReq(SecurityGroupUpdateEnableStatueReq req) {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getId(), "id");
ParamCheckUtil.checkNotNull(req.getEnable(), "enable");
return groupService.updateGroupEnableStatueReq(req);
}
@Get
@Mapping("/rule/page")
public PageInfo<SecurityRuleListRes> rulePage(PageQuery pageQuery, SecurityRuleListReq req) {
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
return groupService.rulePage(pageQuery, req);
}
@Get
@Mapping("/rule/list")
public List<SecurityRuleListRes> getRuleListByGroupId(SecurityRuleListReq req) {
return groupService.ruleList(req);
}
@Post
@Mapping("/rule/create")
public void createRule(SecurityRuleCreateReq req) {
groupService.createRule(req);
}
@Post
@Mapping("/rule/update")
public void updateRule(SecurityRuleUpdateReq req) {
groupService.updateRule(req);
}
@Post
@Mapping("/rule/delete")
public void deleteRule(Integer ruleId) {
groupService.deleteRule(ruleId);
}
@Post
@Mapping("/rule/update/enable-status")
public SecurityRuleUpdateEnableStatueRes updateRuleEnableStatueReq(SecurityRuleUpdateEnableStatueReq req) {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getId(), "id");
ParamCheckUtil.checkNotNull(req.getEnable(), "enable");
return groupService.updateRuleEnableStatueReq(req);
}
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
@@ -28,13 +7,11 @@ import org.dromara.neutrinoproxy.server.base.rest.SystemContextHolder;
import org.dromara.neutrinoproxy.server.constant.ExceptionConstant;
import org.dromara.neutrinoproxy.server.controller.req.system.*;
import org.dromara.neutrinoproxy.server.controller.res.system.*;
import org.dromara.neutrinoproxy.server.controller.res.system.*;
import org.dromara.neutrinoproxy.server.dal.UserMapper;
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
import org.dromara.neutrinoproxy.server.service.UserService;
import org.dromara.neutrinoproxy.server.util.Md5Util;
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
import org.dromara.neutrinoproxy.server.controller.req.system.*;
import org.noear.solon.annotation.*;
import java.util.List;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.log;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.log;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.log;
import lombok.Data;
@@ -0,0 +1,25 @@
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
/**
* @author Mirac
* @date 21/7/2024
*/
@Data
public class DomainCreateReq {
/**
* 主域名
*/
private String domain;
/**
* KeyStore密码
*/
private String keyStorePassword;
/**
* 强制Https
*/
private Integer forceHttps;
}
@@ -0,0 +1,15 @@
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
/**
* @author Mirac
* @date 23/7/2024
*/
@Data
public class DomainDeleteReq {
/**
* id
*/
private Integer id;
}
@@ -0,0 +1,21 @@
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
/**
* @author Mirac
* @date 21/7/2024
*/
@Data
public class DomainListReq {
/**
* 用户ID
*/
private Integer userId;
/**
* 启用状态
* {@link EnableStatusEnum}
*/
private Integer enable;
}
@@ -0,0 +1,22 @@
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
import org.dromara.neutrinoproxy.server.constant.DefaultDomainStatusEnum;
/**
* @author Mirac
* @date 23/7/2024
*/
@Data
public class DomainUpdateDefaultStatusReq {
/**
* id
*/
private Integer id;
/**
* 启用状态 {@link DefaultDomainStatusEnum}
*/
private Integer isDefault;
}
@@ -0,0 +1,26 @@
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
/**
* @author Mirac
* @date 23/7/2024
*/
@Data
public class DomainUpdateEnableStatusReq {
/**
* id
*/
private Integer id;
/**
* 启用状态
*/
private Integer enable;
/**
* 域名
*/
private String domain;
}
@@ -0,0 +1,30 @@
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
/**
* @author Mirac
* @date 21/7/2024
*/
@Data
public class DomainUpdateReq {
/**
* id
*/
private Integer id;
/**
* 主域名
*/
private String domain;
/**
* KeyStore密码
*/
private String keyStorePassword;
/**
* 强制Https
*/
private Integer forceHttps;
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
@@ -38,4 +17,12 @@ public class LicenseCreateReq {
* 用户ID
*/
private Integer userId;
/**
* 上传限速
*/
private String upLimitRate;
/**
* 下载限速
*/
private String downLimitRate;
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
@@ -38,4 +17,12 @@ public class LicenseUpdateReq {
* license名称
*/
private String name;
/**
* 上传限速
*/
private String upLimitRate;
/**
* 下载限速
*/
private String downLimitRate;
}
@@ -0,0 +1,12 @@
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
@Data
public class PortMappingBindSecurityGroupReq {
private Integer id;
private Integer securityGroupId;
}
@@ -1,28 +1,9 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
import java.util.List;
/**
* 端口映射创建请求
* @author: aoshiguchen
@@ -38,10 +19,6 @@ public class PortMappingCreateReq {
* 协议
*/
private String protocal;
/**
* 子域名
*/
private String subdomain;
/**
* 服务端端口
*/
@@ -54,6 +31,14 @@ public class PortMappingCreateReq {
* 客户端端口
*/
private Integer clientPort;
/**
* 上传限速
*/
private String upLimitRate;
/**
* 下载限速
*/
private String downLimitRate;
/**
* 代理响应数量(响应数据包数量,如果没有拆包则等于数据条数)
*/
@@ -62,8 +47,25 @@ public class PortMappingCreateReq {
* 代理超时时间
*/
private Long proxyTimeoutMs;
/**
* 安全组Id
*/
private Integer securityGroupId;
/**
* 描述
*/
private String description;
/**
* 域名映射列表
*/
private List<DomainMapping> domainMappings;
@Data
public class DomainMapping {
private Integer domainId;
private String subdomain;
}
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
@@ -1,28 +1,9 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.proxy;
import lombok.Data;
import java.util.List;
/**
* 端口映射更新请求
* @author: aoshiguchen
@@ -42,10 +23,6 @@ public class PortMappingUpdateReq {
* 协议
*/
private String protocal;
/**
* 子域名
*/
private String subdomain;
/**
* 服务端端口
*/
@@ -58,6 +35,14 @@ public class PortMappingUpdateReq {
* 客户端端口
*/
private Integer clientPort;
/**
* 上传限速
*/
private String upLimitRate;
/**
* 下载限速
*/
private String downLimitRate;
/**
* 代理响应数量(响应数据包数量,如果没有拆包则等于数据条数)
*/
@@ -66,8 +51,26 @@ public class PortMappingUpdateReq {
* 代理超时时间
*/
private Long proxyTimeoutMs;
/**
* 安全组Id
*/
private Integer securityGroupId;
/**
* 描述
*/
private String description;
/**
* 域名映射列表
*/
private List<DomainMapping> domainMappings;
@Data
public class DomainMapping {
private Integer id;
private Integer domainId;
private String subdomain;
}
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -0,0 +1,23 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
@Data
public class SecurityGroupCreateReq {
/**
* 组名
*/
private String name;
/**
* 描述
*/
private String description;
/**
* 通过类型
*/
private Integer defaultPassType;
}
@@ -0,0 +1,12 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
/**
* @author: aoshiguchen
* @date: 2023/12/10
*/
@Data
public class SecurityGroupDetailReq {
private Integer id;
}
@@ -0,0 +1,22 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
/**
* @author: wen.y
* @date: 2023/12/10
*/
@Data
public class SecurityGroupListReq {
private String name;
/**
* 描述
*/
private String description;
/**
* 通过类型
*/
private Integer defaultPassType;
private Integer enable;
}
@@ -0,0 +1,19 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
/**
* @author: aoshiguchen
* @date: 2023/12/10
*/
@Data
public class SecurityGroupUpdateEnableStatueReq {
/**
* id
*/
private Integer id;
/**
* 启用状态
*/
private Integer enable;
}
@@ -0,0 +1,21 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
@Data
public class SecurityGroupUpdateReq {
private Integer id;
/**
* 组名
*/
private String name;
/**
* 描述
*/
private String description;
}
@@ -0,0 +1,57 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import cn.hutool.core.net.Ipv4Util;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
import java.util.Date;
@Data
@ToString
@Accessors(chain = true)
public class SecurityRuleCreateReq {
/**
* 所属安全组
*/
private Integer groupId;
/**
* 规则名
*/
private String name;
/**
* 规则描述
*/
private String description;
/**
* 规则,ipv6只支持单个ip判断
* 单个ip192.168.1.1,0:0:0:0:0:0:10.0.0.1
* 范围类型:192.168.1.0-192.168.1.255
* 掩码类型:192.168.1.0/24
* 泛型:0.0.0.0/ALL
* 每个类型中间以英文逗号分隔
*/
private String rule;
/**
* 放行类型,reject 或 allow
* {@link SecurityRulePassTypeEnum}
*/
private Integer passType;
/**
* 优先级,数字越小,优先级越高
*/
private Integer priority = 1;
}
@@ -0,0 +1,16 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
/**
* @author: aoshiguchen
* @date: 2023/12/10
*/
@Data
public class SecurityRuleListReq {
private String groupId;
private String name;
private String description;
private Integer passType;
private Integer enable;
}
@@ -0,0 +1,19 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
/**
* @author: aoshiguchen
* @date: 2023/12/10
*/
@Data
public class SecurityRuleUpdateEnableStatueReq {
/**
* id
*/
private Integer id;
/**
* 启用状态
*/
private Integer enable;
}
@@ -0,0 +1,51 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
@Data
@ToString
@Accessors(chain = true)
public class SecurityRuleUpdateReq {
private Integer id;
/**
* 所属安全组
*/
private Integer groupId;
/**
* 规则名
*/
private String name;
/**
* 规则描述
*/
private String description;
/**
* 规则,ipv6只支持单个ip判断
* 单个ip192.168.1.1,0:0:0:0:0:0:10.0.0.1
* 范围类型:192.168.1.0-192.168.1.255
* 掩码类型:192.168.1.0/24
* 泛型:0.0.0.0/ALL
* 每个类型中间以英文逗号分隔
*/
private String rule;
/**
* 放行类型,reject 或 allow
* {@link SecurityRulePassTypeEnum}
*/
private Integer passType;
/**
* 优先级,数字越小,优先级越高
*/
private Integer priority;
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,31 +1,18 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
/**
* 用户列表请求
* @author: aoshiguchen
* @date: 2022/8/14
*/
@Data
public class UserListReq {
/**
* 用户名
*/
private String name;
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.log;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.log;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.log;
import lombok.Data;
@@ -0,0 +1,72 @@
package org.dromara.neutrinoproxy.server.controller.res.proxy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.DefaultDomainStatusEnum;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.HttpsStatusEnum;
import org.dromara.neutrinoproxy.server.constant.SslStatusEnum;
import java.util.Date;
/**
* @author Mirac
* @date 21/7/2024
*/
@Accessors(chain = true)
@Data
public class DomainListRes {
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 主域名
*/
private String domain;
/**
* 用户ID
*/
private Integer userId;
/**
* 用户名
*/
private String userName;
/**
* 是否是默认域名(1、是 2、否)
* {@link DefaultDomainStatusEnum}
*/
private Integer isDefault;
/**
* 强制使用HTTPS(1、是 2、否)
* {@link HttpsStatusEnum}
*/
private Integer forceHttps;
/**
* 启用状态
* {@link EnableStatusEnum}
*/
private Integer enable;
/**
* SSLStatusEnum
* {@link SslStatusEnum}
*/
private Integer sslStatus;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
@@ -0,0 +1,8 @@
package org.dromara.neutrinoproxy.server.controller.res.proxy;
/**
* @author Mirac
* @date 23/7/2024
*/
public class DomainUpdateDefaultStatusRes {
}
@@ -0,0 +1,8 @@
package org.dromara.neutrinoproxy.server.controller.res.proxy;
/**
* @author Mirac
* @date 23/7/2024
*/
public class DomainUpdateEnableStatusRes {
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.proxy;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.proxy;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
@@ -32,6 +32,14 @@ public class LicenseListRes {
* 用户名
*/
private String userName;
/**
* 上传限速
*/
private String upLimitRate;
/**
* 下载限速
*/
private String downLimitRate;
/**
* 是否在线
* {@link OnlineStatusEnum}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.proxy;
/**
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.proxy;
/**
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.proxy;
import lombok.Data;
@@ -1,31 +1,12 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.proxy;
import lombok.Data;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.OnlineStatusEnum;
import lombok.Data;
import org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO;
import java.util.Date;
import java.util.List;
/**
* 端口映射列表响应
@@ -43,14 +24,10 @@ public class PortMappingListRes {
* 协议
*/
private String protocal;
/**
* 子域名
*/
private String subdomain;
/**
* 域名
*/
private String domain;
/**
* 完整域名映射
*/
private List<FullDomainNameBO> fullDomainMappings;
/**
* license名称
*/
@@ -75,6 +52,14 @@ public class PortMappingListRes {
* 客户端端口
*/
private Integer clientPort;
/**
* 上传限速
*/
private String upLimitRate;
/**
* 下载限速
*/
private String downLimitRate;
/**
* 客户端端口
*/
@@ -101,6 +86,12 @@ public class PortMappingListRes {
* 描述
*/
private String description;
/**
* 安全组Id
*/
private Integer securityGroupId;
/**
* 创建时间
*/
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.proxy;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.proxy;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
@@ -0,0 +1,47 @@
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
@Data
@Accessors(chain = true)
public class SecurityGroupDetailRes {
private Integer id;
/**
* 组名
*/
private String name;
/**
* 描述
*/
private String description;
/**
* 启用状态
* {@link EnableStatusEnum}
*/
private Integer enable;
/**
* 默认放行类型
* {@link SecurityRulePassTypeEnum}
*/
private Integer defaultPassType;
/**
* 创建时间
*/
private String createTime;
/**
* 更新时间
*/
private String updateTime;
}
@@ -0,0 +1,49 @@
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
import java.util.Date;
@Data
@Accessors(chain = true)
public class SecurityGroupListRes {
private Integer id;
/**
* 组名
*/
private String name;
/**
* 描述
*/
private String description;
/**
* 启用状态
* {@link EnableStatusEnum}
*/
private Integer enable;
/**
* 默认放行类型
* {@link SecurityRulePassTypeEnum}
*/
private Integer defaultPassType;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
@@ -0,0 +1,12 @@
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
/**
* @author: aoshiguchen
* @date: 2023/12/10
*/
@Data
public class SecurityGroupUpdateEnableStatueRes {
}
@@ -0,0 +1,67 @@
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
import java.util.Date;
@Data
@ToString
@Accessors(chain = true)
public class SecurityRuleListRes {
private Integer id;
/**
* 所属安全组
*/
private Integer groupId;
/**
* 规则名
*/
private String name;
/**
* 规则描述
*/
private String description;
/**
* 规则,ipv6只支持单个ip判断
* 单个ip192.168.1.1,0:0:0:0:0:0:10.0.0.1
* 范围类型:192.168.1.0-192.168.1.255
* 掩码类型:192.168.1.0/24
* 泛型:0.0.0.0/ALL
* 每个类型中间以英文逗号分隔
*/
private String rule;
/**
* 放行类型,reject 或 allow
* {@link SecurityRulePassTypeEnum}
*/
private Integer passType;
/**
* 优先级,数字越小,优先级越高
*/
private Integer priority;
/**
* 启用状态
*/
private Integer enable;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
@@ -0,0 +1,8 @@
package org.dromara.neutrinoproxy.server.controller.res.system;
/**
* @author: aoshiguchen
* @date: 2023/12/10
*/
public class SecurityRuleUpdateEnableStatueRes {
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
/**
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
import lombok.Data;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
/**
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.controller.res.system;
/**
@@ -0,0 +1,61 @@
package org.dromara.neutrinoproxy.server.dal;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.dromara.neutrinoproxy.server.dal.entity.DomainNameDO;
import org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO;
import java.util.Date;
import java.util.List;
import java.util.Set;
@Mapper
public interface DomainMapper extends BaseMapper<DomainNameDO> {
default DomainNameDO checkRepeat(String domain, Set<Integer> excludeIds) {
// 查询与输入域名相关的域名列表
List<DomainNameDO> domainList = this.selectList(new LambdaQueryWrapper<DomainNameDO>()
.notIn(excludeIds != null, DomainNameDO::getId, excludeIds)
);
// 遍历数据库中的域名,检查是否存在重复(包括子域名)
for (DomainNameDO domainNameDO : domainList) {
String existingDomain = domainNameDO.getDomain();
// 完全相等的情况
if (existingDomain.equals(domain)) {
return domainNameDO;
}
// // 是子域名关系
// if (isSubdomainOrEqual(existingDomain, domain)) {
// return domainNameDO;
// }
}
// 如果没有找到重复的,返回 null
return null;
}
// 辅助方法:判断 domain1 是否是 domain2 的子域名,或者两者相等
private boolean isSubdomainOrEqual(String domain1, String domain2) {
// 判断是否是子域名关系,例如 "proxy.asgc.fun" 是 "asgc.fun" 的子域名
return domain1.endsWith("." + domain2) || domain2.endsWith("." + domain1);
}
default void updateEnableStatus(Integer id, Integer enable, Date updateTime) {
this.update(Wrappers.<DomainNameDO>lambdaUpdate()
.eq(DomainNameDO::getId, id)
.set(DomainNameDO::getEnable, enable)
.set(DomainNameDO::getUpdateTime, updateTime)
);
}
List<FullDomainNameBO> selectFullDomainNameListByPortMappingIds(@Param("ids") Set<Integer> ids);
List<FullDomainNameBO> selectFullDomainNameListByDomainNameIds(@Param("ids") Set<Integer> ids);
List<FullDomainNameBO> selectFullDomainNameList();
}
@@ -0,0 +1,41 @@
package org.dromara.neutrinoproxy.server.dal;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.ibatis.annotations.Mapper;
import org.dromara.neutrinoproxy.server.dal.entity.DomainPortMappingDO;
import java.util.List;
/**
* @author: Mirac
* @date: 2024/8/24
*/
@Mapper
public interface DomainPortMappingMapper extends BaseMapper<DomainPortMappingDO> {
default Boolean checkRepeatBySubdomain(String subdomain, Integer domainNameId, Integer id) {
return StringUtils.isEmpty(subdomain)? Boolean.FALSE : this.selectCount(new LambdaQueryWrapper<DomainPortMappingDO>()
.eq(DomainPortMappingDO::getSubdomain, subdomain)
.eq(DomainPortMappingDO::getDomainNameId, domainNameId)
.ne(id != null, DomainPortMappingDO::getId, id)
.last("limit 1")
).intValue() > 0;
}
default List<DomainPortMappingDO> findByPortMappingId(Integer portMappingId) {
return this.selectList(Wrappers.<DomainPortMappingDO>lambdaQuery()
.eq(DomainPortMappingDO::getPortMappingId, portMappingId));
}
default void deleteByDomainNameId(Integer doomainNameId) {
this.delete(Wrappers.<DomainPortMappingDO>lambdaQuery()
.eq(DomainPortMappingDO::getDomainNameId, doomainNameId));
}
default boolean checkUsed(Integer domainNameId) {
return this.exists(Wrappers.<DomainPortMappingDO>lambdaQuery()
.eq(DomainPortMappingDO::getDomainNameId, domainNameId));
}
}
@@ -45,8 +45,8 @@ public interface FlowReportHourMapper extends BaseMapper<FlowReportHourDO> {
default List<FlowReportHourDO> findListByDateRange(Date startDate, Date endDate) {
return this.selectList(new LambdaQueryWrapper<FlowReportHourDO>()
.ge(FlowReportHourDO::getDateStr, startDate)
.le(FlowReportHourDO::getDateStr, endDate)
.ge(FlowReportHourDO::getDate, startDate)
.le(FlowReportHourDO::getDate, endDate)
);
}
@@ -89,14 +89,6 @@ public interface LicenseMapper extends BaseMapper<LicenseDO> {
return this.selectById(id);
}
default void update(Integer id, String name, Date updateTime) {
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
.eq(LicenseDO::getId, id)
.set(LicenseDO::getName, name)
.set(LicenseDO::getUpdateTime, updateTime)
);
}
default List<LicenseDO> findByIds(Set<Integer> ids) {
return selectBatchIds(ids);
}
@@ -11,6 +11,7 @@ import org.dromara.neutrinoproxy.server.controller.req.proxy.PortMappingListReq;
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO;
import java.util.Date;
import java.util.List;
@@ -44,18 +45,6 @@ public interface PortMappingMapper extends BaseMapper<PortMappingDO> {
);
}
/**
* 校验子域名是否重复
* @param subdomain
* @return
*/
default Boolean checkRepeatBySubdomain(String subdomain, Set<Integer> excludeIds) {
return StringUtils.isEmpty(subdomain)? Boolean.FALSE : this.selectCount(new LambdaQueryWrapper<PortMappingDO>()
.eq(PortMappingDO::getSubdomain, subdomain)
.notIn(!CollectionUtil.isEmpty(excludeIds), PortMappingDO::getId, excludeIds)
).intValue() > 0;
}
default List<PortMappingDO> findEnableListByLicenseId(Integer licenseId) {
return this.selectList(new LambdaQueryWrapper<PortMappingDO>()
.eq(PortMappingDO::getLicenseId, licenseId)
@@ -0,0 +1,25 @@
package org.dromara.neutrinoproxy.server.dal;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.dromara.neutrinoproxy.server.controller.req.proxy.PortMappingListReq;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupListReq;
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO;
import java.util.Date;
import java.util.List;
public interface SecurityGroupMapper extends BaseMapper<SecurityGroupDO> {
List<SecurityGroupDO> selectByCondition(IPage<SecurityGroupDO> page, @Param("req") SecurityGroupListReq req);
default void updateEnableStatus(Integer id, Integer enable, Date updateTime) {
this.update(null, new LambdaUpdateWrapper<SecurityGroupDO>()
.eq(SecurityGroupDO::getId, id)
.set(SecurityGroupDO::getEnable, enable)
.set(SecurityGroupDO::getUpdateTime, updateTime)
);
}
}
@@ -0,0 +1,25 @@
package org.dromara.neutrinoproxy.server.dal;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupListReq;
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityRuleListReq;
import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO;
import org.dromara.neutrinoproxy.server.dal.entity.SecurityRuleDO;
import java.util.Date;
import java.util.List;
public interface SecurityRuleMapper extends BaseMapper<SecurityRuleDO> {
List<SecurityRuleDO> selectByCondition(IPage<SecurityRuleDO> page, @Param("req") SecurityRuleListReq req);
default void updateEnableStatus(Integer id, Integer enable, Date updateTime) {
this.update(null, new LambdaUpdateWrapper<SecurityRuleDO>()
.eq(SecurityRuleDO::getId, id)
.set(SecurityRuleDO::getEnable, enable)
.set(SecurityRuleDO::getUpdateTime, updateTime)
);
}
}
@@ -0,0 +1,104 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.dal.entity;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.*;
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainListRes;
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingListRes;
import java.util.Date;
/**
* 域名
* @author: Mirac
* @date: 2024/7/21
*/
@ToString
@Accessors(chain = true)
@Data
@TableName("domain_name")
public class DomainNameDO {
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 主域名
*/
private String domain;
/**
* 用户ID
*/
private Integer userId;
/**
* SSL证书文件内容
*/
private byte[] jks;
/**
* KeyStore密码
*/
private String keyStorePassword;
/**
* 是否是默认域名(1、是 2、否)
* {@link DefaultDomainStatusEnum}
*/
private Integer isDefault;
/**
* 强制使用HTTPS(1、是 2、否)
* {@link HttpsStatusEnum}
*/
private Integer forceHttps;
/**
* 启用状态
* {@link EnableStatusEnum}
*/
private Integer enable;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
public DomainListRes toRes() {
DomainListRes res = new DomainListRes();
BeanUtil.copyProperties(this, res);
res.setSslStatus(this.getJks() == null ? SslStatusEnum.NOT_UPLOADED.getStatus() : SslStatusEnum.UPLOADED.getStatus());
return res;
}
}
@@ -0,0 +1,64 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.dal.entity;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.OnlineStatusEnum;
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingListRes;
import java.util.Date;
/**
* @author: Mirac
* @date: 2024/8/24
*/
@ToString
@Accessors(chain = true)
@Data
@TableName("domain_port_mapping")
public class DomainPortMappingDO {
/**
* 主键
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 端口映射id
*/
private Integer portMappingId;
/**
* 域名id
*/
private Integer domainNameId;
/**
* 子域名
*/
private String subdomain;
}
@@ -21,6 +21,7 @@
*/
package org.dromara.neutrinoproxy.server.dal.entity;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@@ -59,6 +60,14 @@ public class LicenseDO {
* 用户ID
*/
private Integer userId;
/**
* 上传限速
*/
private String upLimitRate;
/**
* 下载限速
*/
private String downLimitRate;
/**
* 是否在线
* {@link OnlineStatusEnum}
@@ -80,14 +89,7 @@ public class LicenseDO {
public LicenseListRes toRes() {
LicenseListRes res = new LicenseListRes();
res.setId(id);
res.setName(name);
res.setKey(key);
res.setUserId(userId);
res.setIsOnline(isOnline);
res.setEnable(enable);
res.setCreateTime(createTime);
res.setUpdateTime(updateTime);
BeanUtil.copyProperties(this, res);
return res;
}
}
@@ -21,6 +21,7 @@
*/
package org.dromara.neutrinoproxy.server.dal.entity;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -53,10 +54,6 @@ public class PortMappingDO {
* 协议
*/
private String protocal;
/**
* 子域名
*/
private String subdomain;
/**
* 服务端端口
*/
@@ -69,6 +66,14 @@ public class PortMappingDO {
* 客户端端口
*/
private Integer clientPort;
/**
* 上传限速
*/
private String upLimitRate;
/**
* 下载限速
*/
private String downLimitRate;
/**
* 描述
*/
@@ -92,6 +97,12 @@ public class PortMappingDO {
* {@link EnableStatusEnum}
*/
private Integer enable;
/**
* 安全组Id
*/
private Integer securityGroupId = 0; // 设置为null不生效,不知道为啥
/**
* 创建时间
*/
@@ -101,23 +112,9 @@ public class PortMappingDO {
*/
private Date updateTime;
public PortMappingListRes toRes() {
PortMappingListRes res = new PortMappingListRes();
res.setId(id);
res.setLicenseId(licenseId);
res.setProtocal(protocal);
res.setSubdomain(subdomain);
res.setServerPort(serverPort);
res.setClientIp(clientIp);
res.setClientPort(clientPort);
res.setDescription(description);
res.setIsOnline(isOnline);
res.setProxyResponses(proxyResponses);
res.setProxyTimeoutMs(proxyTimeoutMs);
res.setEnable(enable);
res.setCreateTime(createTime);
res.setUpdateTime(updateTime);
BeanUtil.copyProperties(this, res);
return res;
}
}
@@ -0,0 +1,74 @@
package org.dromara.neutrinoproxy.server.dal.entity;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupDetailRes;
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupListRes;
import java.util.Date;
@Data
@ToString
@Accessors(chain = true)
@TableName("security_group")
public class SecurityGroupDO {
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 组名
*/
private String name;
/**
* 描述
*/
private String description;
/**
* 用户id
*/
private Integer userId;
/**
* 启用状态
* {@link EnableStatusEnum}
*/
private Integer enable;
/**
* 默认放行类型
* {@link SecurityRulePassTypeEnum}
*/
private Integer defaultPassType;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
public SecurityGroupListRes toListRes() {
SecurityGroupListRes res = new SecurityGroupListRes();
BeanUtil.copyProperties(this, res);
return res;
}
public SecurityGroupDetailRes toDetailRes() {
SecurityGroupDetailRes res = new SecurityGroupDetailRes();
BeanUtil.copyProperties(this, res);
return res;
}
}
@@ -0,0 +1,152 @@
package org.dromara.neutrinoproxy.server.dal.entity;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.net.Ipv4Util;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityRuleListRes;
import java.util.Date;
@Data
@ToString
@Accessors(chain = true)
@TableName("security_rule")
public class SecurityRuleDO {
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 所属安全组
*/
private Integer groupId;
/**
* 规则名
*/
private String name;
/**
* 规则描述
*/
private String description;
/**
* 规则,ipv6只支持单个ip判断
* 单个ip192.168.1.1,0:0:0:0:0:0:10.0.0.1
* 范围类型:192.168.1.0-192.168.1.255
* 掩码类型:192.168.1.0/24
* 泛型:0.0.0.0/ALL
* 每个类型中间以英文逗号分隔
*/
private String rule;
/**
* 放行类型,reject 或 allow
* {@link SecurityRulePassTypeEnum}
*/
private Integer passType;
/**
* 优先级,数字越小,优先级越高
*/
private Integer priority = 1;
/**
* 用户id
*/
private Integer userId;
/**
* 启用状态
* {@link EnableStatusEnum}
*/
private Integer enable;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 判断当前规则是否允许指定ip放行
* @param ip 指定的IP
* @return 放行状态
*/
public SecurityRulePassTypeEnum judge(String ip) {
// 被判断的IP地址为空,不做判断
if (StrUtil.isEmpty(ip)) {
return SecurityRulePassTypeEnum.NONE;
}
// 没有规则,默认允许访问
if (StrUtil.isEmpty(rule)) {
return SecurityRulePassTypeEnum.ALLOW;
}
// ipv6只适配单ip形式
boolean isIpv6 = ip.contains(":");
long ipLong = -1L;
if (!isIpv6) {
ipLong = Ipv4Util.ipv4ToLong(ip);
}
String[] rules = this.rule.split(",");
for (String rule : rules) {
rule = rule.trim();
// 单个ip,ipv6在此步已处理,后面不需要额外判断ipv6的情况
if (rule.matches("(\\d+\\.){3}\\d+") || isIpv6) {
if (rule.equalsIgnoreCase(ip)) {
return SecurityRulePassTypeEnum.ALLOW.getType().equals(passType) ? SecurityRulePassTypeEnum.ALLOW : SecurityRulePassTypeEnum.DENY;
}
}
// 范围类型
if (rule.matches("(\\d+\\.){3}\\d+-(\\d+\\.){3}\\d+")) {
String[] ipRange = rule.split("-");
if (ipRange[0].compareTo(ip) <= 0 && ip.compareTo(ipRange[1]) <= 0) {
return SecurityRulePassTypeEnum.ALLOW.getType().equals(passType) ? SecurityRulePassTypeEnum.ALLOW : SecurityRulePassTypeEnum.DENY;
}
}
// 掩码类型
if (rule.matches("(\\d+\\.){3}\\d+/\\d+")) {
String[] netIp = rule.split("/");
Long beginIp = Ipv4Util.getBeginIpLong(netIp[0], Integer.parseInt(netIp[1]));
Long endIp = Ipv4Util.getEndIpLong(netIp[0], Integer.parseInt(netIp[1]));
if (beginIp <= ipLong && ipLong <= endIp) {
return SecurityRulePassTypeEnum.ALLOW.getType().equals(passType) ? SecurityRulePassTypeEnum.ALLOW : SecurityRulePassTypeEnum.DENY;
}
}
if (rule.equalsIgnoreCase("ALL") || rule.equals("0.0.0.0") || rule.equals("0.0.0.0/0")) {
return SecurityRulePassTypeEnum.ALLOW.getType().equals(passType) ? SecurityRulePassTypeEnum.ALLOW : SecurityRulePassTypeEnum.DENY;
}
}
// 都没有匹配到
return SecurityRulePassTypeEnum.NONE;
}
public SecurityRuleListRes toListRes() {
SecurityRuleListRes res = new SecurityRuleListRes();
BeanUtil.copyProperties(this, res);
return res;
}
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.job;
import cn.hutool.core.collection.CollectionUtil;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.proxy.core;
import org.dromara.neutrinoproxy.server.proxy.domain.MetricsCollector;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.proxy.core;
import org.dromara.neutrinoproxy.core.Constants;
@@ -1,6 +1,11 @@
package org.dromara.neutrinoproxy.server.proxy.core;
import cn.hutool.core.util.StrUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOption;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import org.dromara.neutrinoproxy.core.Constants;
import org.dromara.neutrinoproxy.core.ProxyMessage;
@@ -8,11 +13,6 @@ import org.dromara.neutrinoproxy.server.constant.NetworkProtocolEnum;
import org.dromara.neutrinoproxy.server.proxy.domain.VisitorChannelAttachInfo;
import org.dromara.neutrinoproxy.server.service.FlowReportService;
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOption;
import io.netty.channel.SimpleChannelInboundHandler;
import org.noear.solon.Solon;
import java.net.InetSocketAddress;
@@ -43,13 +43,13 @@ public class TcpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteBu
ctx.channel().close();
return;
}
byte[] bytes = new byte[buf.readableBytes()];
buf.readBytes(bytes);
// 代理通道可写,则设置访问通道可读。代理通道不可写,则设置访问通道不可读
visitorChannel.config().setAutoRead(proxyChannel.isWritable());
// 转发代理数据
byte[] bytes = new byte[buf.readableBytes()];
buf.readBytes(bytes);
String visitorId = ProxyUtil.getVisitorIdByChannel(visitorChannel);
proxyChannel.writeAndFlush(ProxyMessage.buildTransferMessage(visitorId, bytes));
@@ -62,8 +62,8 @@ public class TcpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteBu
public void channelActive(ChannelHandlerContext ctx) throws Exception {
Channel visitorChannel = ctx.channel();
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
if (null == cmdChannel) {
// 该端口还没有代理客户端
ctx.channel().close();
@@ -7,7 +7,6 @@ import io.netty.channel.ChannelOption;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.socket.DatagramPacket;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.dromara.neutrinoproxy.core.Constants;
import org.dromara.neutrinoproxy.core.ProxyMessage;
import org.dromara.neutrinoproxy.server.constant.NetworkProtocolEnum;
@@ -18,7 +17,6 @@ import org.dromara.neutrinoproxy.server.util.ProxyUtil;
import org.noear.solon.Solon;
import java.net.InetSocketAddress;
import java.nio.charset.StandardCharsets;
/**
* @author: aoshiguchen
@@ -29,7 +27,9 @@ public class UdpVisitorChannelHandler extends SimpleChannelInboundHandler<Datagr
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket datagramPacket) throws Exception {
log.debug("chid>>>{}", ctx.channel().id().asLongText());
Channel visitorChannel = ctx.channel();
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
byte[] bytes = new byte[datagramPacket.content().readableBytes()];
datagramPacket.content().readBytes(bytes);
datagramPacket.content().resetReaderIndex();
@@ -65,12 +65,6 @@ public class UdpVisitorChannelHandler extends SimpleChannelInboundHandler<Datagr
Solon.context().getBean(FlowReportService.class).addWriteByte(visitorChannelAttachInfo.getLicenseId(), bytes.length);
});
// String visitorId = ProxyUtil.getVisitorIdByChannel(ctx.channel());
// if (StringUtils.isNotBlank(visitorId)) {
// // UDP代理隧道已就绪,直接转发
// proxyAttachment.execute();
// return;
// }
Channel proxyChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
if (null != proxyChannel && proxyChannel.isActive()) {
// UDP代理隧道已就绪,直接转发
@@ -78,8 +72,6 @@ public class UdpVisitorChannelHandler extends SimpleChannelInboundHandler<Datagr
return;
}
Channel visitorChannel = ctx.channel();
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
// 没有指令通道,直接结束
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.proxy.domain;
import io.netty.channel.Channel;
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.proxy.domain;
import java.util.ArrayList;
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.proxy.domain;
import lombok.Data;
@@ -1,8 +1,7 @@
package org.dromara.neutrinoproxy.server.proxy.enhance;
import cn.hutool.core.util.StrUtil;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.*;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
@@ -10,7 +9,8 @@ import io.netty.handler.logging.LoggingHandler;
import lombok.extern.slf4j.Slf4j;
import org.dromara.neutrinoproxy.server.base.proxy.ProxyConfig;
import org.dromara.neutrinoproxy.server.proxy.core.BytesMetricsHandler;
import org.dromara.neutrinoproxy.server.proxy.core.ProxyTunnelServer;
import org.dromara.neutrinoproxy.server.proxy.security.HttpVisitorSecurityChannelHandler;
import org.dromara.neutrinoproxy.server.proxy.security.VisitorFlowLimiterChannelHandler;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.event.AppLoadEndEvent;
@@ -28,8 +28,8 @@ public class HttpProxy implements EventListener<AppLoadEndEvent> {
private ProxyConfig proxyConfig;
@Override
public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable {
if (StrUtil.isBlank(proxyConfig.getServer().getTcp().getDomainName()) || null == proxyConfig.getServer().getTcp().getHttpProxyPort()) {
log.info("no config domain name,nonsupport http proxy.");
if (null == proxyConfig.getServer().getTcp().getHttpProxyPort()) {
log.info("no config http proxy port, nonsupport http proxy.");
return;
}
this.start();
@@ -46,7 +46,9 @@ public class HttpProxy implements EventListener<AppLoadEndEvent> {
ch.pipeline().addFirst(new LoggingHandler(HttpProxy.class));
}
ch.pipeline().addFirst(new BytesMetricsHandler());
ch.pipeline().addLast(new HttpVisitorChannelHandler(proxyConfig.getServer().getTcp().getDomainName()));
ch.pipeline().addLast(new HttpVisitorSecurityChannelHandler(false));
ch.pipeline().addLast("flowLimiter",new VisitorFlowLimiterChannelHandler());
ch.pipeline().addLast(new HttpVisitorChannelHandler());
}
});
bootstrap.bind("0.0.0.0", proxyConfig.getServer().getTcp().getHttpProxyPort()).sync();
@@ -1,6 +1,5 @@
package org.dromara.neutrinoproxy.server.proxy.enhance;
import cn.hutool.core.util.StrUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
@@ -25,22 +24,9 @@ import java.net.InetSocketAddress;
*/
@Slf4j
public class HttpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteBuf> {
/**
* 域名
*/
private String domainName;
public HttpVisitorChannelHandler(String domainName) {
this.domainName = domainName;
}
@Override
protected void channelRead0(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
if (StrUtil.isBlank(domainName)) {
ctx.channel().close();
return;
}
byte[] bytes = new byte[byteBuf.readableBytes()];
byteBuf.readBytes(bytes);
byteBuf.resetReaderIndex();
@@ -68,25 +54,9 @@ public class HttpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteB
// 用户连接到代理服务器时设置用户连接不可读等待代理后端服务器连接成功后再改变为可读状态
ctx.channel().config().setOption(ChannelOption.AUTO_READ, false);
String host = getHost(bytes);
log.debug("HttpProxy host: {}", host);
if (StringUtils.isBlank(host)) {
ctx.channel().close();
return;
}
if (!host.endsWith(domainName)) {
ctx.channel().close();
return;
}
int index = host.lastIndexOf("." + domainName);
String subdomain = host.substring(0, index);
// 根据域名拿到绑定的映射对应的cmdChannel
Integer serverPort = ProxyUtil.getServerPortBySubdomain(subdomain);
if (null == serverPort) {
ctx.channel().close();
return;
}
Integer serverPort = ctx.channel().attr(Constants.SERVER_PORT).get();
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(serverPort);
if (null == cmdChannel) {
ctx.channel().close();
@@ -150,23 +120,15 @@ public class HttpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteB
ctx.close();
}
private String getHost(byte[] buf) {
String req = new String(buf);
String[] lines = req.split("\r\n");
String firstLine = lines[0];
if (!(firstLine.endsWith("HTTP/1.1") || firstLine.endsWith("HTTP/1.0"))) {
return null;
@Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
// 通知代理客户端
Channel visitorChannel = ctx.channel();
Channel proxyChannel = visitorChannel.attr(Constants.NEXT_CHANNEL).get();
if (null != proxyChannel) {
proxyChannel.config().setOption(ChannelOption.AUTO_READ, visitorChannel.isWritable());
}
for (int i = 1; i < lines.length; i++) {
String line = lines[i];
if (!line.startsWith("Host: ")) {
continue;
}
// 域名
String domain = line.substring(6);
// 去掉域名后面的端口号
return domain.replaceAll(":.*", "");
}
return null;
super.channelWritabilityChanged(ctx);
}
}
@@ -1,28 +1,23 @@
package org.dromara.neutrinoproxy.server.proxy.enhance;
import cn.hutool.core.util.StrUtil;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.*;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.handler.logging.LoggingHandler;
import io.netty.handler.ssl.SslHandler;
import io.netty.handler.ssl.SniHandler;
import io.netty.handler.ssl.SslContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.dromara.neutrinoproxy.core.util.FileUtil;
import org.dromara.neutrinoproxy.server.base.proxy.ProxyConfig;
import org.dromara.neutrinoproxy.server.proxy.core.BytesMetricsHandler;
import org.dromara.neutrinoproxy.server.proxy.core.ProxyTunnelServer;
import org.dromara.neutrinoproxy.server.proxy.security.HttpVisitorSecurityChannelHandler;
import org.dromara.neutrinoproxy.server.proxy.security.VisitorFlowLimiterChannelHandler;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.event.AppLoadEndEvent;
import org.noear.solon.core.event.EventListener;
import javax.net.ssl.*;
import java.io.InputStream;
import java.security.KeyStore;
/**
* HTTPS代理
* @author: aoshiguchen
@@ -33,11 +28,13 @@ import java.security.KeyStore;
public class HttpsProxy implements EventListener<AppLoadEndEvent> {
@Inject
private ProxyConfig proxyConfig;
@Inject
private SslContextManager sslContextManager;
@Override
public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable {
if (StrUtil.isBlank(proxyConfig.getServer().getTcp().getDomainName()) || null == proxyConfig.getServer().getTcp().getHttpsProxyPort() ||
StringUtils.isEmpty(proxyConfig.getServer().getTcp().getJksPath()) || StringUtils.isEmpty(proxyConfig.getServer().getTcp().getKeyStorePassword())) {
log.info("no config domain name,nonsupport https proxy.");
public void onEvent(AppLoadEndEvent appLoadEndEvent) {
if (null == proxyConfig.getServer().getTcp().getHttpsProxyPort()) {
log.info("no config https proxy port, nonsupport http proxy.");
return;
}
this.start();
@@ -53,9 +50,11 @@ public class HttpsProxy implements EventListener<AppLoadEndEvent> {
if (null != proxyConfig.getServer().getTcp().getTransferLogEnable() && proxyConfig.getServer().getTcp().getTransferLogEnable()) {
ch.pipeline().addFirst(new LoggingHandler(HttpsProxy.class));
}
ch.pipeline().addLast(createSslHandler());
ch.pipeline().addLast(createSniHandler());
ch.pipeline().addFirst(new BytesMetricsHandler());
ch.pipeline().addLast(new HttpVisitorChannelHandler(proxyConfig.getServer().getTcp().getDomainName()));
ch.pipeline().addLast(new HttpVisitorSecurityChannelHandler(true));
ch.pipeline().addLast("flowLimiter",new VisitorFlowLimiterChannelHandler());
ch.pipeline().addLast(new HttpVisitorChannelHandler());
}
});
bootstrap.bind("0.0.0.0", proxyConfig.getServer().getTcp().getHttpsProxyPort()).sync();
@@ -65,26 +64,19 @@ public class HttpsProxy implements EventListener<AppLoadEndEvent> {
}
}
private ChannelHandler createSslHandler() {
public SniHandler createSniHandler() {
try {
InputStream jksInputStream = FileUtil.getInputStream(proxyConfig.getServer().getTcp().getJksPath());
SSLContext serverContext = SSLContext.getInstance("TLS");
final KeyStore ks = KeyStore.getInstance("JKS");
ks.load(jksInputStream, proxyConfig.getServer().getTcp().getKeyStorePassword().toCharArray());
final KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(ks, proxyConfig.getServer().getTcp().getKeyStorePassword().toCharArray());
TrustManager[] trustManagers = null;
serverContext.init(kmf.getKeyManagers(), trustManagers, null);
SSLEngine sslEngine = serverContext.createSSLEngine();
sslEngine.setUseClientMode(false);
sslEngine.setNeedClientAuth(false);
return new SslHandler(sslEngine);
return new SniHandler(domainName -> {
SslContext sslContext = sslContextManager.getSslContextByFullDomain(domainName);
if (sslContext != null) {
return sslContext;
} else {
log.info("No SSL context available for domain: {}", domainName);
return null;
}
});
} catch (Exception e) {
log.error("create SSL handler failed", e);
log.info("create SSL handler failed", e);
e.printStackTrace();
}
return null;
@@ -0,0 +1,126 @@
package org.dromara.neutrinoproxy.server.proxy.enhance;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.netty.handler.ssl.ClientAuth;
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.solon.annotation.Db;
import org.dromara.neutrinoproxy.server.base.db.DBInitialize;
import org.dromara.neutrinoproxy.server.dal.DomainMapper;
import org.dromara.neutrinoproxy.server.dal.entity.DomainNameDO;
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Init;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.event.AppLoadEndEvent;
import org.noear.solon.core.event.EventListener;
import org.noear.solon.core.runtime.NativeDetector;
import javax.net.ssl.KeyManagerFactory;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.security.KeyStore;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
/**
* 域名到SSL上下文
* @author: Mirac
* @date: 2024/8/25
*/
@Slf4j
@Component
@Data
public class SslContextManager implements EventListener<AppLoadEndEvent> {
@Db
private DomainMapper domainMapper;
@Inject
private DBInitialize dbInitialize;
// 初始化时加载所有域名的 SSL 上下文
@Init
public void init() throws Throwable {
// aot 阶段不初始化
if (NativeDetector.isAotRuntime()) {
return;
}
try {
initializeSslContexts();
} catch (Exception e) {
log.error("initialize SSL handler failed", e);
throw e;
}
}
@Override
public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable {
}
// 维护域名到 SslContext 的映射
private final ConcurrentHashMap<String, SslContext> domainSslContexts = new ConcurrentHashMap<>();
// 初始化所有域名的 SSL 上下文
private void initializeSslContexts() throws Exception {
List<DomainNameDO> domainNameDOS = domainMapper.selectList(Wrappers.<DomainNameDO>lambdaQuery()
.isNotNull(DomainNameDO::getDomain)
.isNotNull(DomainNameDO::getJks)
.isNotNull(DomainNameDO::getKeyStorePassword));
for (DomainNameDO domainNameDO : domainNameDOS) {
if (domainNameDO.getDomain() != null && domainNameDO.getKeyStorePassword() != null && domainNameDO.getJks() != null) {
String domain = domainNameDO.getDomain();
byte[] jks = domainNameDO.getJks();// 假设数据库中存储了每个域名对应的 JKS 路径
String keyStorePassword = domainNameDO.getKeyStorePassword();
SslContext sslContext = loadSslContextFromJks(jks, keyStorePassword);
domainSslContexts.put(domain, sslContext);
}
}
}
// 动态添加新的域名和证书
public void addDomainAndCert(String domain, byte[] jks, String keyStorePassword) throws Exception {
SslContext sslContext = loadSslContextFromJks(jks, keyStorePassword);
domainSslContexts.put(domain, sslContext);
}
// 使用 JKS 文件加载 SSL 上下文禁用客户端认证并设置为服务器模式
private SslContext loadSslContextFromJks(byte[] jks, String keyStorePassword) throws Exception {
InputStream jksInputStream = new ByteArrayInputStream(jks);
// 初始化 KeyStore
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(jksInputStream, keyStorePassword.toCharArray());
// 初始化 KeyManagerFactory
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(keyStore, keyStorePassword.toCharArray());
// 创建 SslContext 并禁用客户端认证
return SslContextBuilder.forServer(kmf)
.clientAuth(ClientAuth.NONE) // 禁用客户端认证
.build();
}
public SslContext getSslContextByDomain(String domain) {
return domainSslContexts.get(domain);
}
public void removeSslContextByDomain(String domain) {
domainSslContexts.remove(domain);
}
public SslContext getSslContextByFullDomain(String fullDomain) {
String domain = ProxyUtil.getDomainNameByFullDomain(fullDomain);
if (StrUtil.isBlank(domain)) {
return null;
}
return domainSslContexts.get(domain);
}
}
@@ -1,25 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.proxy.handler;
import cn.hutool.core.util.StrUtil;
@@ -90,7 +68,7 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
if (StrUtil.isEmpty(licenseKey)) {
log.warn("[client connection] license cannot empty info:{} ", info);
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "license不能为空!", licenseKey));
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "license cannot be empty!", licenseKey));
ctx.channel().close();
clientConnectRecordService.add(new ClientConnectRecordDO()
.setIp(ip)
@@ -105,7 +83,7 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
LicenseDO licenseDO = licenseService.findByKey(licenseKey);
if (null == licenseDO) {
log.warn("[client connection] license notfound info:{} ", info);
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "license不存在!", licenseKey));
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "license not found!", licenseKey));
ctx.channel().close();
clientConnectRecordService.add(new ClientConnectRecordDO()
.setIp(ip)
@@ -50,7 +50,7 @@ public class ProxyMessageConnectHandler implements ProxyMessageHandler {
LicenseDO licenseDO = licenseService.findByKey(licenseKey);
if (null == licenseDO) {
ctx.channel().writeAndFlush(ProxyMessage.buildErrMessage(ExceptionEnum.CONNECT_FAILED, "the license notfound!"));
ctx.channel().writeAndFlush(ProxyMessage.buildErrMessage(ExceptionEnum.CONNECT_FAILED, "the license not found!"));
ctx.channel().close();
return;
}
@@ -69,7 +69,7 @@ public class ProxyMessageConnectHandler implements ProxyMessageHandler {
Channel cmdChannel = ProxyUtil.getCmdChannelByLicenseId(licenseDO.getId());
if (null == cmdChannel) {
ctx.channel().writeAndFlush(ProxyMessage.buildErrMessage(ExceptionEnum.CONNECT_FAILED, "server errorcmd channel notfound!"));
ctx.channel().writeAndFlush(ProxyMessage.buildErrMessage(ExceptionEnum.CONNECT_FAILED, "server errorcmd channel not found!"));
ctx.channel().close();
return;
}
@@ -82,7 +82,8 @@ public class ProxyMessageConnectHandler implements ProxyMessageHandler {
ctx.channel().attr(Constants.LICENSE_ID).set(licenseDO.getId());
ctx.channel().attr(Constants.NEXT_CHANNEL).set(visitorChannel);
visitorChannel.attr(Constants.NEXT_CHANNEL).set(ctx.channel());
// 代理客户端与后端服务器连接成功修改用户连接为可读状态
visitorChannel.attr(Constants.LICENSE_ID).set(licenseDO.getId());
// 代理客户端与后端服务器连接成功修改用户连接为可读状态
visitorChannel.config().setOption(ChannelOption.AUTO_READ, true);
// 获取代理附加对象
@@ -0,0 +1,90 @@
package org.dromara.neutrinoproxy.server.proxy.security;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.dromara.neutrinoproxy.core.Constants;
import org.dromara.neutrinoproxy.core.util.HttpUtil;
import org.dromara.neutrinoproxy.core.util.IpUtil;
import org.dromara.neutrinoproxy.server.service.DomainService;
import org.dromara.neutrinoproxy.server.service.PortMappingService;
import org.dromara.neutrinoproxy.server.service.SecurityGroupService;
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
import org.noear.solon.Solon;
/**
* @author: aoshiguchen
* @date: 2023/12/14
*/
@Slf4j
public class HttpVisitorSecurityChannelHandler extends ChannelInboundHandlerAdapter {
private final SecurityGroupService securityGroupService = Solon.context().getBean(SecurityGroupService.class);
private final PortMappingService portMappingService = Solon.context().getBean(PortMappingService.class);
private final DomainService domainService = Solon.context().getBean(DomainService.class);
/**
* 域名
*/
private Boolean isHttps;
public HttpVisitorSecurityChannelHandler(Boolean isHttps) {
this.isHttps = isHttps;
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
ByteBuf buf = (ByteBuf) msg;
// 获取Host请求头
byte[] bytes = new byte[buf.readableBytes()];
buf.readBytes(bytes);
String httpContent = new String(bytes);
String host = HttpUtil.getHostIgnorePort(httpContent); //test1.asgc.fun
log.debug("HttpProxy host: {}", host);
if (StringUtils.isBlank(host)) {
ctx.channel().close();
return;
}
// 判断域名是否被禁用或删除
Integer domainNameId = ProxyUtil.getDomainNameIdByFullDomain(host);
if (domainNameId == null) {
ctx.channel().close();
return;
}
// 域名映射强制https验证
if (!isHttps && domainService.isOnlyHttps(domainNameId)) {
ctx.channel().close();
return;
}
Integer serverPort = ctx.channel().attr(Constants.SERVER_PORT).get();
if (null == serverPort) {
// channel没有服务器端口信息尝试根据完整域名拿到服务端端口
serverPort = ProxyUtil.getServerPortByFullDomain(host);
if (null == serverPort) {
ctx.channel().close();
return;
}
// 判断IP是否在该端口绑定的安全组允许的规则内
String ip = IpUtil.getRealRemoteIp(httpContent);
if (ip == null) {
ip = IpUtil.getRemoteIp(ctx);
}
if (!securityGroupService.judgeAllow(ip, portMappingService.getSecurityGroupIdByMappingPort(serverPort))) {
// 不在安全组规则放行范围内
ctx.channel().close();
return;
}
ctx.channel().attr(Constants.REAL_REMOTE_IP).set(ip);
ctx.channel().attr(Constants.SERVER_PORT).set(serverPort);
}
// 继续传播
buf.resetReaderIndex();
ctx.fireChannelRead(buf);
}
}
@@ -0,0 +1,68 @@
package org.dromara.neutrinoproxy.server.proxy.security;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.dromara.neutrinoproxy.core.Constants;
import org.dromara.neutrinoproxy.core.util.IpUtil;
import org.dromara.neutrinoproxy.server.service.PortMappingService;
import org.dromara.neutrinoproxy.server.service.SecurityGroupService;
import org.noear.solon.Solon;
import java.net.InetSocketAddress;
/**
* @author: aoshiguchen
* @date: 2023/12/14
*/
@Slf4j
public class TcpVisitorSecurityChannelHandler extends ChannelInboundHandlerAdapter {
private final SecurityGroupService securityGroupService = Solon.context().getBean(SecurityGroupService.class);
private final PortMappingService portMappingService = Solon.context().getBean(PortMappingService.class);
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
Channel visitorChannel = ctx.channel();
ByteBuf buf = (ByteBuf) msg;
byte[] bytes = new byte[buf.readableBytes()];
buf.readBytes(bytes);
// 判断IP是否在该端口绑定的安全组允许的规则内
String ip = IpUtil.getRealRemoteIp(new String(bytes));
if (StringUtils.isEmpty(ip)) {
ip = IpUtil.getRemoteIp(ctx);
}
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
if (!securityGroupService.judgeAllow(ip, portMappingService.getSecurityGroupIdByMappingPort(sa.getPort()))) {
// 不在安全组规则放行范围内
ctx.channel().close();
return;
}
// 继续传播
ctx.channel().attr(Constants.SERVER_PORT).set(sa.getPort());
buf.resetReaderIndex();
ctx.fireChannelRead(buf);
}
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
Channel visitorChannel = ctx.channel();
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
// 判断IP是否在该端口绑定的安全组允许的规则内
if (!securityGroupService.judgeAllow(IpUtil.getRemoteIp(ctx), portMappingService.getSecurityGroupIdByMappingPort(sa.getPort()))) {
// 不在安全组规则放行范围内
ctx.channel().close();
return;
}
// 继续传播
ctx.fireChannelActive();
}
}
@@ -0,0 +1,39 @@
package org.dromara.neutrinoproxy.server.proxy.security;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.socket.DatagramPacket;
import lombok.extern.slf4j.Slf4j;
import org.dromara.neutrinoproxy.core.Constants;
import org.dromara.neutrinoproxy.server.service.PortMappingService;
import org.dromara.neutrinoproxy.server.service.SecurityGroupService;
import org.noear.solon.Solon;
import java.net.InetSocketAddress;
/**
* @author: aoshiguchen
* @date: 2023/12/14
*/
@Slf4j
public class UdpVisitorSecurityChannelHandler extends ChannelInboundHandlerAdapter {
private final SecurityGroupService securityGroupService = Solon.context().getBean(SecurityGroupService.class);
private final PortMappingService portMappingService = Solon.context().getBean(PortMappingService.class);
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
Channel visitorChannel = ctx.channel();
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
DatagramPacket datagramPacket = (DatagramPacket) msg;
// 判断IP是否在该端口绑定的安全组允许的规则内
if (!securityGroupService.judgeAllow(datagramPacket.sender().getAddress().getHostAddress(), portMappingService.getSecurityGroupIdByMappingPort(sa.getPort()))) {
return;
}
// 继续传播
ctx.channel().attr(Constants.SERVER_PORT).set(sa.getPort());
ctx.fireChannelRead(msg);
}
}
@@ -0,0 +1,50 @@
package org.dromara.neutrinoproxy.server.proxy.security;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.traffic.ChannelTrafficShapingHandler;
import lombok.extern.slf4j.Slf4j;
import org.dromara.neutrinoproxy.core.Constants;
import org.dromara.neutrinoproxy.server.service.LicenseService;
import org.dromara.neutrinoproxy.server.service.PortMappingService;
import org.dromara.neutrinoproxy.server.service.SecurityGroupService;
import org.dromara.neutrinoproxy.server.service.bo.FlowLimitBO;
import org.noear.solon.Solon;
/**
* 访问者流量限制器
* @author: aoshiguchen
* @date: 2023/12/15
*/
@Slf4j
public class VisitorFlowLimiterChannelHandler extends ChannelInboundHandlerAdapter {
private final PortMappingService portMappingService = Solon.context().getBean(PortMappingService.class);
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
Boolean flowLimiterFlag = ctx.channel().attr(Constants.FLOW_LIMITER_FLAG).get();
if (null == flowLimiterFlag || !flowLimiterFlag) {
Integer serverPort = ctx.channel().attr(Constants.SERVER_PORT).get();
Long upLimitRate = null;
Long downLimitRate = null;
// 先获取端口映射上的限速设置
FlowLimitBO flowLimitBO = portMappingService.getFlowLimitByServerPort(serverPort);
if (null != flowLimitBO) {
upLimitRate = flowLimitBO.getUpLimitRate();
downLimitRate = flowLimitBO.getDownLimitRate();
}
if (null != upLimitRate || null != downLimitRate) {
// 如果不全为空则需要做限速
ctx.pipeline().addAfter("flowLimiter", "trafficShaping", new ChannelTrafficShapingHandler(downLimitRate == null ? 0 : downLimitRate, upLimitRate == null ? 0 : upLimitRate, 100, 600000));
}
// 每个连接第一次处理之后无论是否限速该连接后续都不在处理避免频繁执行影响性能
ctx.channel().attr(Constants.FLOW_LIMITER_FLAG).set(Boolean.TRUE);
}
// 继续传播
ctx.fireChannelRead(msg);
}
}
@@ -0,0 +1,301 @@
package org.dromara.neutrinoproxy.server.service;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.solon.annotation.Db;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
import org.dromara.neutrinoproxy.server.base.page.PageQuery;
import org.dromara.neutrinoproxy.server.base.rest.SystemContextHolder;
import org.dromara.neutrinoproxy.server.constant.*;
import org.dromara.neutrinoproxy.server.controller.req.proxy.DomainCreateReq;
import org.dromara.neutrinoproxy.server.controller.req.proxy.DomainListReq;
import org.dromara.neutrinoproxy.server.controller.req.proxy.DomainUpdateEnableStatusReq;
import org.dromara.neutrinoproxy.server.controller.req.proxy.DomainUpdateReq;
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainListRes;
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainUpdateDefaultStatusRes;
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainUpdateEnableStatusRes;
import org.dromara.neutrinoproxy.server.dal.DomainMapper;
import org.dromara.neutrinoproxy.server.dal.DomainPortMappingMapper;
import org.dromara.neutrinoproxy.server.dal.PortMappingMapper;
import org.dromara.neutrinoproxy.server.dal.UserMapper;
import org.dromara.neutrinoproxy.server.dal.entity.DomainNameDO;
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
import org.dromara.neutrinoproxy.server.proxy.enhance.SslContextManager;
import org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO;
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Init;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.handle.UploadedFile;
import org.noear.solon.core.runtime.NativeDetector;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author Mirac
* @date 21/7/2024
*/
@Slf4j
@Component
public class DomainService {
@Db
private DomainMapper domainMapper;
@Db
private UserMapper userMapper;
@Db
private PortMappingMapper portMappingMapper;
@Db
private DomainPortMappingMapper domainPortMappingMapper;
@Inject
private SslContextManager sslContextManager;
public PageInfo<DomainListRes> page(PageQuery pageQuery, DomainListReq req) {
Page<DomainNameDO> page = domainMapper.selectPage(new Page<>(pageQuery.getCurrent(), pageQuery.getSize()), new LambdaQueryWrapper<DomainNameDO>()
.eq(req.getEnable() != null, DomainNameDO::getEnable, req.getEnable())
.eq(req.getUserId() != null, DomainNameDO::getUserId, req.getUserId())
.orderByAsc(Arrays.asList(DomainNameDO::getUserId, DomainNameDO::getId))
);
List<DomainListRes> resList = page.getRecords().stream().map(DomainNameDO::toRes).collect(Collectors.toList());
if (CollectionUtils.isEmpty(page.getRecords())) {
return PageInfo.of(resList, page);
}
Set<Integer> userIds = resList.stream().map(DomainListRes::getUserId).collect(Collectors.toSet());
List<UserDO> userDOList = userMapper.findByIds(userIds);
Map<Integer, UserDO> userMap = userDOList.stream().collect(Collectors.toMap(UserDO::getId, c -> c));
for (DomainListRes item : resList) {
UserDO userDO = userMap.get(item.getUserId());
if (null != userDO) {
item.setUserName(userDO.getName());
}
}
return PageInfo.of(resList, page);
}
public List<DomainListRes> all(DomainListReq req) {
LambdaQueryWrapper<DomainNameDO> wrapper = Wrappers.<DomainNameDO>lambdaQuery()
.eq(req.getEnable() != null, DomainNameDO::getEnable, req.getEnable());
List<DomainNameDO> domainNameDOS = domainMapper.selectList(wrapper);
if (CollectionUtil.isEmpty(domainNameDOS)) {
return null;
}
List<DomainListRes> resList = domainNameDOS.stream().map(DomainNameDO::toRes).toList();
Set<Integer> userIds = resList.stream().map(DomainListRes::getUserId).collect(Collectors.toSet());
List<UserDO> userDOList = userMapper.findByIds(userIds);
Map<Integer, UserDO> userMap = userDOList.stream().collect(Collectors.toMap(UserDO::getId, c -> c));
for (DomainListRes item : resList) {
UserDO userDO = userMap.get(item.getUserId());
if (null != userDO) {
item.setUserName(userDO.getName());
}
}
return resList;
}
/**
* 创建域名
*
* @param req
*/
public void create(DomainCreateReq req, UploadedFile jks) {
DomainNameDO domainNameCheck = domainMapper.checkRepeat(req.getDomain(), null);
ParamCheckUtil.checkMustNull(domainNameCheck, ExceptionConstant.DOMAIN_NAME_CANNOT_REPEAT);
DomainNameDO domainNameDO = new DomainNameDO();
if (null != jks) {
try {
ParamCheckUtil.checkNotEmpty(req.getKeyStorePassword(), "keyStorePassword");
InputStream content = jks.getContent();
byte[] byteArray = toByteArray(content);
domainNameDO.setJks(byteArray);
domainNameDO.setKeyStorePassword(req.getKeyStorePassword());
//添加证书
sslContextManager.addDomainAndCert(req.getDomain(), byteArray, req.getKeyStorePassword());
} catch (Exception e) {
log.error("证书添加失败", e);
e.printStackTrace();
}
}
Integer userId = SystemContextHolder.getUserId();
Date now = new Date();
domainNameDO.setDomain(req.getDomain());
domainNameDO.setIsDefault(DefaultDomainStatusEnum.DISABLE.getStatus());
domainNameDO.setForceHttps(req.getForceHttps() != null ? HttpsStatusEnum.of(req.getForceHttps()).getStatus() : HttpsStatusEnum.DISABLE_ONLY_HTTPS.getStatus());
domainNameDO.setUserId(userId);
domainNameDO.setEnable(EnableStatusEnum.ENABLE.getStatus());
domainNameDO.setCreateTime(now);
domainNameDO.setUpdateTime(now);
domainMapper.insert(domainNameDO);
//更新主域名到域名id映射
ProxyUtil.setDomainToDomainNameId(domainNameDO.getDomain(), domainNameDO.getId());
}
/**
* InputStream 转换为 byte[]
*/
private byte[] toByteArray(InputStream input) throws IOException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[1024];
while ((nRead = input.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, nRead);
}
buffer.flush();
return buffer.toByteArray();
}
public void update(DomainUpdateReq req, UploadedFile jks) {
DomainNameDO domainNameCheck = domainMapper.checkRepeat(req.getDomain(), Sets.newHashSet(req.getId()));
ParamCheckUtil.checkMustNull(domainNameCheck, ExceptionConstant.DOMAIN_NAME_CANNOT_REPEAT);
DomainNameDO oldDomainNameDO = domainMapper.selectOne(Wrappers.<DomainNameDO>lambdaQuery().eq(DomainNameDO::getId, req.getId()));
List<FullDomainNameBO> oldFullDomainNameBOS = domainMapper.selectFullDomainNameListByDomainNameIds(Sets.newHashSet(req.getId()));
LambdaUpdateWrapper<DomainNameDO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(DomainNameDO::getId, req.getId());
if (null != jks) {
try {
ParamCheckUtil.checkNotEmpty(req.getKeyStorePassword(), "keyStorePassword");
InputStream content = jks.getContent();
byte[] byteArray = toByteArray(content);
updateWrapper.set(DomainNameDO::getKeyStorePassword, req.getKeyStorePassword());
updateWrapper.set(DomainNameDO::getJks, byteArray);
//添加证书并删除旧的证书
sslContextManager.addDomainAndCert(req.getDomain(), byteArray, req.getKeyStorePassword());
if (!req.getDomain().equals(oldDomainNameDO.getDomain())) {
sslContextManager.removeSslContextByDomain(oldDomainNameDO.getDomain());
}
} catch (Exception e) {
log.error("证书添加失败", e);
e.printStackTrace();
}
}
updateWrapper.set(DomainNameDO::getDomain, req.getDomain());
updateWrapper.set(DomainNameDO::getUpdateTime, new Date());
updateWrapper.set(req.getForceHttps() != null, DomainNameDO::getForceHttps, req.getForceHttps());
domainMapper.update(updateWrapper);
//更新域名相关映射
if (!Objects.equals(oldDomainNameDO.getDomain(), req.getDomain())) {
//更新主域名到域名id映射
ProxyUtil.removeDomainToDomainNameId(oldDomainNameDO.getDomain());
ProxyUtil.setDomainToDomainNameId(req.getDomain(), req.getId());
if (CollectionUtil.isEmpty(oldFullDomainNameBOS)) return;
//存在域名映射更新完整域名到服务器端口映射
for (FullDomainNameBO oldFullDomainNameBO : oldFullDomainNameBOS) {
String oldFullDomain = StrUtil.join(StrPool.DOT, oldFullDomainNameBO.getSubdomain(), oldFullDomainNameBO.getDomain());
Integer serverPort = ProxyUtil.getServerPortByFullDomain(oldFullDomain);
ProxyUtil.removeFullDomainToServerPort(oldFullDomain);
ProxyUtil.setFullDomainToServerPort(StrUtil.join(StrPool.DOT, oldFullDomainNameBO.getSubdomain(), req.getDomain()), serverPort);
}
}
}
public DomainUpdateEnableStatusRes updateEnableStatus(DomainUpdateEnableStatusReq req) {
if (Objects.equals(req.getEnable(), EnableStatusEnum.DISABLE.getStatus())) {
//如果设置状态为禁用则将默认域名设置为非默认域名
updateDefaultStatus(req.getId(), DefaultDomainStatusEnum.DISABLE.getStatus());
}
domainMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
if (Objects.equals(req.getEnable(), EnableStatusEnum.ENABLE.getStatus())) {
ProxyUtil.setDomainToDomainNameId(req.getDomain(), req.getId());
} else {
ProxyUtil.removeDomainToDomainNameId(req.getDomain());
}
return new DomainUpdateEnableStatusRes();
}
public void delete(Integer domainNameId) {
//检查当前域名是否正在使用
boolean checkUsed = domainPortMappingMapper.checkUsed(domainNameId);
ParamCheckUtil.checkExpression(!checkUsed, ExceptionConstant.DOMAIN_NAME_IS_USED);
DomainNameDO domainNameDO = domainMapper.selectOne(Wrappers.<DomainNameDO>lambdaQuery()
.eq(DomainNameDO::getId, domainNameId)
.select(DomainNameDO::getDomain, DomainNameDO::getEnable));
if (Objects.equals(domainNameDO.getEnable(), EnableStatusEnum.ENABLE.getStatus())) {
ProxyUtil.removeDomainToDomainNameId(domainNameDO.getDomain());
}
domainMapper.deleteById(domainNameId);
//删除证书
sslContextManager.removeSslContextByDomain(domainNameDO.getDomain());
}
public DomainUpdateDefaultStatusRes updateDefaultStatus(Integer id, Integer isDefault) {
if (Objects.equals(isDefault, DefaultDomainStatusEnum.ENABLE.getStatus())) {
//如果设置状态为默认域名则将之前的默认域名设置为非默认域名
DomainNameDO oldDomainNameDO = domainMapper.selectOne(Wrappers.<DomainNameDO>lambdaQuery()
.select(DomainNameDO::getId)
.eq(DomainNameDO::getIsDefault, DefaultDomainStatusEnum.ENABLE.getStatus()));
if (oldDomainNameDO != null) {
oldDomainNameDO.setIsDefault(DefaultDomainStatusEnum.DISABLE.getStatus());
domainMapper.updateById(oldDomainNameDO);
}
}
DomainNameDO domainNameDO = new DomainNameDO();
domainNameDO.setId(id);
domainNameDO.setIsDefault(isDefault);
domainMapper.updateById(domainNameDO);
return new DomainUpdateDefaultStatusRes();
}
@Init
public void init() {
// aot 阶段不初始化
if (NativeDetector.isAotRuntime()) {
return;
}
List<FullDomainNameBO> fullDomainNameBOS = domainMapper.selectFullDomainNameList();
if (CollectionUtil.isEmpty(fullDomainNameBOS)) {
return;
}
Set<Integer> portMappingIds = fullDomainNameBOS.stream().map(FullDomainNameBO::getPortMappingId).collect(Collectors.toSet());
List<PortMappingDO> portMappingDOS = portMappingMapper.selectBatchIds(portMappingIds);
if (CollectionUtil.isEmpty(portMappingDOS)) {
return;
}
Map<Integer, PortMappingDO> portMappingDOMap = portMappingDOS.stream()
.filter(item -> NetworkProtocolEnum.HTTP.getDesc().equals(item.getProtocal()))
.collect(Collectors.toMap(PortMappingDO::getId, Function.identity()));
fullDomainNameBOS.forEach(item -> {
PortMappingDO portMappingDO = portMappingDOMap.get(item.getPortMappingId());
if (null == portMappingDO) {
return;
}
String fullDomain = StrUtil.join(StrPool.DOT, item.getSubdomain(), item.getDomain());
//更新完整域名到端口映射
ProxyUtil.setFullDomainToServerPort(fullDomain, portMappingDO.getServerPort());
});
//更新主域名到主域名id缓存未禁用
List<DomainNameDO> domainNameDOS = domainMapper.selectList(Wrappers.<DomainNameDO>lambdaQuery()
.eq(DomainNameDO::getEnable, EnableStatusEnum.ENABLE.getStatus())
.select(DomainNameDO::getDomain, DomainNameDO::getId));
for (DomainNameDO domainNameDO : domainNameDOS) {
ProxyUtil.setDomainToDomainNameId(domainNameDO.getDomain(), domainNameDO.getId());
}
}
public boolean isOnlyHttps(Integer domainNameId) {
ParamCheckUtil.checkExpression((domainNameId != null && domainNameId > 0), ExceptionConstant.DOMAIN_NAME_NOT_EXIST);
DomainNameDO domainNameDO = domainMapper.selectOne(Wrappers.<DomainNameDO>lambdaQuery()
.eq(DomainNameDO::getId, domainNameId));
return domainNameDO != null && Objects.equals(domainNameDO.getForceHttps(), HttpsStatusEnum.ONLY_HTTPS.getStatus());
}
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.service;
import org.dromara.neutrinoproxy.core.util.LockUtil;
@@ -35,11 +35,9 @@ import org.noear.solon.Solon;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Init;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.runtime.NativeDetector;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -67,6 +65,10 @@ public class JobInfoService implements IJobSource {
@Init
public void init() {
// aot 阶段不初始化
if (NativeDetector.isAotRuntime()) {
return;
}
jobHandlerMap.put("DataCleanJob", dataCleanJob);
jobHandlerMap.put("DemoJob", demoJob);
jobHandlerMap.put("FlowReportForDayJob", flowReportForDayJob);
@@ -107,6 +109,10 @@ public class JobInfoService implements IJobSource {
@Override
public List<JobInfo> sourceList() {
// aot 阶段不查数据库
if (NativeDetector.isAotRuntime()) {
return Collections.emptyList();
}
List<JobInfo> jobInfoList = Lists.newArrayList();
List<JobInfoDO> jobInfoDOList = jobInfoMapper.findList();
if (CollectionUtil.isEmpty(jobInfoDOList)) {
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -35,7 +14,9 @@ import org.dromara.neutrinoproxy.server.dal.entity.JobLogDO;
import org.dromara.solonplugins.job.IJobCallback;
import org.dromara.solonplugins.job.JobInfo;
import org.noear.solon.annotation.Component;
import org.noear.solon.core.runtime.NativeDetector;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -53,6 +34,10 @@ public class JobLogService implements IJobCallback {
@Override
public void executeLog(JobInfo jobInfo, String param, Throwable throwable) {
// aot 阶段不查数据库
if (NativeDetector.isAotRuntime()) {
return;
}
Integer code = 0;
String msg = "";
if (null == throwable) {
@@ -1,7 +1,10 @@
package org.dromara.neutrinoproxy.server.service;
import cn.hutool.cache.Cache;
import cn.hutool.cache.CacheUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
import com.google.common.collect.Sets;
@@ -29,11 +32,14 @@ import org.dromara.neutrinoproxy.server.dal.UserMapper;
import org.dromara.neutrinoproxy.server.dal.entity.LicenseDO;
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
import org.dromara.neutrinoproxy.server.service.bo.FlowLimitBO;
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
import org.dromara.neutrinoproxy.server.util.StringUtil;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Init;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.bean.LifecycleBean;
import org.noear.solon.core.runtime.NativeDetector;
import java.util.Arrays;
import java.util.Date;
@@ -62,6 +68,8 @@ public class LicenseService implements LifecycleBean {
private VisitorChannelService visitorChannelService;
@Inject
private DBInitialize dbInitialize;
// 流量限制缓存
private final Cache<Integer, FlowLimitBO> flowLimitCache = CacheUtil.newLRUCache(200, 1000 * 60 * 5);
public PageInfo<LicenseListRes> page(PageQuery pageQuery, LicenseListReq req) {
Page<LicenseDO> page = licenseMapper.selectPage(new Page<>(pageQuery.getCurrent(), pageQuery.getSize()), new LambdaQueryWrapper<LicenseDO>()
@@ -127,15 +135,21 @@ public class LicenseService implements LifecycleBean {
String key = UUID.randomUUID().toString().replaceAll("-", "");
Date now = new Date();
licenseMapper.insert(new LicenseDO()
.setName(req.getName())
.setKey(key)
.setUserId(req.getUserId())
.setIsOnline(OnlineStatusEnum.OFFLINE.getStatus())
.setEnable(EnableStatusEnum.ENABLE.getStatus())
.setCreateTime(now)
.setUpdateTime(now)
);
licenseDO = new LicenseDO()
.setName(req.getName())
.setKey(key)
.setUserId(req.getUserId())
.setUpLimitRate(req.getUpLimitRate())
.setDownLimitRate(req.getDownLimitRate())
.setIsOnline(OnlineStatusEnum.OFFLINE.getStatus())
.setEnable(EnableStatusEnum.ENABLE.getStatus())
.setCreateTime(now)
.setUpdateTime(now);
licenseMapper.insert(licenseDO);
// 刷新流量限制缓存
refreshFlowLimitCache(licenseDO.getId(), licenseDO.getUpLimitRate(), licenseDO.getDownLimitRate());
return new LicenseCreateRes();
}
@@ -146,7 +160,17 @@ public class LicenseService implements LifecycleBean {
LicenseDO licenseCheck = licenseMapper.checkRepeat(oldLicenseDO.getUserId(), req.getName(), Sets.newHashSet(oldLicenseDO.getId()));
ParamCheckUtil.checkMustNull(licenseCheck, ExceptionConstant.LICENSE_NAME_CANNOT_REPEAT);
licenseMapper.update(req.getId(), req.getName(), new Date());
licenseMapper.update(null, new LambdaUpdateWrapper<LicenseDO>()
.eq(LicenseDO::getId, req.getId())
.set(LicenseDO::getName, req.getName())
.set(LicenseDO::getUpLimitRate, req.getUpLimitRate())
.set(LicenseDO::getDownLimitRate, req.getDownLimitRate())
.set(LicenseDO::getUpdateTime, new Date())
);
// 刷新流量限制缓存
refreshFlowLimitCache(req.getId(), req.getUpLimitRate(), req.getDownLimitRate());
return new LicenseUpdateRes();
}
@@ -199,6 +223,8 @@ public class LicenseService implements LifecycleBean {
licenseMapper.deleteById(id);
// 更新VisitorChannel
visitorChannelService.updateVisitorChannelByLicenseId(id, EnableStatusEnum.DISABLE.getStatus());
// 删除流量限制缓存
flowLimitCache.remove(id);
}
/**
@@ -238,10 +264,55 @@ public class LicenseService implements LifecycleBean {
*/
@Init
public void init() {
// aot 阶段不初始化
if (NativeDetector.isAotRuntime()) {
return;
}
// 服务刚启动所以默认所有license都是离线状态解决服务突然关闭在线状态来不及更新的问题
licenseMapper.updateOnlineStatus(OnlineStatusEnum.OFFLINE.getStatus(), new Date());
// 刷新流量限制缓存
List<LicenseDO> licenseDOList = licenseMapper.listAll();
if (CollectionUtils.isEmpty(licenseDOList)) {
for (LicenseDO licenseDO : licenseDOList) {
refreshFlowLimitCache(licenseDO.getId(), licenseDO.getUpLimitRate(), licenseDO.getDownLimitRate());
}
}
}
/**
* 刷新流量限制缓存
* @param id
* @param upLimitRate
* @param downLimitRate
*/
private void refreshFlowLimitCache(Integer id, String upLimitRate, String downLimitRate) {
if (null == id) {
return;
}
flowLimitCache.put(id, new FlowLimitBO()
.setUpLimitRate(StringUtil.parseBytes(upLimitRate))
.setDownLimitRate(StringUtil.parseBytes(downLimitRate))
);
}
/**
* 获取license的流量限制
* @param licenseId
* @return
*/
public FlowLimitBO getFlowLimit(Integer licenseId) {
FlowLimitBO res = flowLimitCache.get(licenseId);
if (null == res) {
LicenseDO licenseDO = licenseMapper.queryById(licenseId);
if (null != licenseDO) {
refreshFlowLimitCache(licenseId, licenseDO.getUpLimitRate(), licenseDO.getDownLimitRate());
res = flowLimitCache.get(licenseId);
}
}
return res;
}
@Override
public void start() throws Throwable {
@@ -1,10 +1,15 @@
package org.dromara.neutrinoproxy.server.service;
import cn.hutool.cache.Cache;
import cn.hutool.cache.CacheUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
import com.google.common.collect.Sets;
import org.apache.ibatis.solon.annotation.Db;
@@ -25,27 +30,21 @@ import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingCreateRe
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingDetailRes;
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingListRes;
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingUpdateEnableStatusRes;
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingUpdateRes;
import org.dromara.neutrinoproxy.server.dal.LicenseMapper;
import org.dromara.neutrinoproxy.server.dal.PortMappingMapper;
import org.dromara.neutrinoproxy.server.dal.PortPoolMapper;
import org.dromara.neutrinoproxy.server.dal.UserMapper;
import org.dromara.neutrinoproxy.server.dal.entity.LicenseDO;
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
import org.dromara.neutrinoproxy.server.dal.entity.PortPoolDO;
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
import org.dromara.neutrinoproxy.server.dal.*;
import org.dromara.neutrinoproxy.server.dal.entity.*;
import org.dromara.neutrinoproxy.server.service.bo.FlowLimitBO;
import org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO;
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
import org.dromara.neutrinoproxy.server.util.StringUtil;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Init;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.bean.LifecycleBean;
import org.noear.solon.core.runtime.NativeDetector;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -63,6 +62,10 @@ public class PortMappingService implements LifecycleBean {
private UserMapper userMapper;
@Db
private PortPoolMapper portPoolMapper;
@Db
private DomainMapper domainMapper;
@Db
private DomainPortMappingMapper domainPortMappingMapper;
@Inject
private VisitorChannelService visitorChannelService;
@@ -72,6 +75,16 @@ public class PortMappingService implements LifecycleBean {
private ProxyConfig proxyConfig;
@Inject
private DBInitialize dbInitialize;
@Inject
private LicenseService licenseService;
/** 端口到安全组Id的映射 */
private final Map<Integer, Integer> mappingPortToSecurityGroupMap = new ConcurrentHashMap<>();
private final Cache<Integer, Integer> serverPortToPortMappingIdCache = CacheUtil.newLRUCache(500, 1000 * 60 * 10);
// 端口映射id到licenseId
private final Cache<Integer, Integer> idToLicenseIdCache = CacheUtil.newLRUCache(500, 1000 * 60 * 10);
// 流量限制缓存
private final Cache<Integer, FlowLimitBO> flowLimitCache = CacheUtil.newLRUCache(500, 1000 * 60 * 5);
public PageInfo<PortMappingListRes> page(PageQuery pageQuery, PortMappingListReq req) {
if (StringUtils.isNotEmpty(req.getDescription())) {
@@ -102,6 +115,11 @@ public class PortMappingService implements LifecycleBean {
Map<Integer, LicenseDO> licenseMap = licenseList.stream().collect(Collectors.toMap(LicenseDO::getId, Function.identity()));
Map<Integer, UserDO> userMap = userList.stream().collect(Collectors.toMap(UserDO::getId, Function.identity()));
//域名相关
Set<Integer> portMappingIds = respList.stream().map(PortMappingListRes::getId).collect(Collectors.toSet());
List<FullDomainNameBO> fullDomainNameBOS = domainMapper.selectFullDomainNameListByPortMappingIds(portMappingIds);
Map<Integer, List<FullDomainNameBO>> fullDomainNameBOMap = fullDomainNameBOS.stream().collect(Collectors.groupingBy(FullDomainNameBO::getPortMappingId));
respList.forEach(item -> {
LicenseDO license = licenseMap.get(item.getLicenseId());
if (null == license) {
@@ -114,15 +132,16 @@ public class PortMappingService implements LifecycleBean {
return;
}
item.setUserName(user.getName());
if (StrUtil.isNotBlank(proxyConfig.getServer().getTcp().getDomainName()) && StrUtil.isNotBlank(item.getSubdomain())) {
item.setDomain(item.getSubdomain() + "." + proxyConfig.getServer().getTcp().getDomainName());
}
//域名映射
item.setFullDomainMappings(fullDomainNameBOMap.get(item.getId()));
if (NetworkProtocolEnum.HTTP.getDesc().equals(item.getProtocal())) {
item.setProtocal("HTTP(S)");
}
});
//sorted [userId asc] [licenseId asc] [createTime asc]
respList = respList.stream().sorted(Comparator.comparing(PortMappingListRes::getUserId).thenComparing(PortMappingListRes::getLicenseId).thenComparing(PortMappingListRes::getCreateTime)).collect(Collectors.toList());
respList = respList.stream()
.filter(e -> null != e.getUserId())
.sorted(Comparator.comparing(PortMappingListRes::getUserId).thenComparing(PortMappingListRes::getLicenseId).thenComparing(PortMappingListRes::getCreateTime)).collect(Collectors.toList());
return PageInfo.of(respList, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
}
@@ -136,16 +155,30 @@ public class PortMappingService implements LifecycleBean {
PortPoolDO portPoolDO = portPoolMapper.findByPort(req.getServerPort());
ParamCheckUtil.checkNotNull(portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
ParamCheckUtil.checkExpression(null == portMappingMapper.findByPort(req.getServerPort(), null), ExceptionConstant.PORT_CANNOT_REPEAT_MAPPING, req.getServerPort());
ParamCheckUtil.checkExpression(!portMappingMapper.checkRepeatBySubdomain(req.getSubdomain(), null), ExceptionConstant.PORT_MAPPING_SUBDONAME_CONNOT_REPEAT);
//验证域名映射相关参数条件
if (NetworkProtocolEnum.isHttp(req.getProtocal()) && CollectionUtil.isNotEmpty(req.getDomainMappings())) {
Set<Integer> domainIds = req.getDomainMappings().stream().map(item -> item.getDomainId()).collect(Collectors.toSet());
List<DomainNameDO> domainNameDOS = domainMapper.selectBatchIds(domainIds);
Map<Integer, DomainNameDO> domainNameDOMap = domainNameDOS.stream().collect(Collectors.toMap(DomainNameDO::getId, Function.identity()));
req.getDomainMappings().forEach(item -> {
DomainNameDO domainNameDO = domainNameDOMap.get(item.getDomainId());
ParamCheckUtil.checkNotNull(domainNameDO, ExceptionConstant.DOMAIN_NAME_NOT_EXIST);
//检查当前域名是否被禁用
//ParamCheckUtil.checkExpression(Objects.equals(EnableStatusEnum.ENABLE.getStatus(), domainNameDO.getEnable()), ExceptionConstant.DOMAIN_NAME_IS_DISABLE, domainNameDO.getDomain());
//检查子域名是否重复
ParamCheckUtil.checkExpression(!domainPortMappingMapper.checkRepeatBySubdomain(item.getSubdomain(), item.getDomainId(), null), ExceptionConstant.SUDOMAIN_NAME_CANNOT_REPEAT);
});
}
Date now = new Date();
PortMappingDO portMappingDO = new PortMappingDO();
portMappingDO.setLicenseId(req.getLicenseId());
portMappingDO.setProtocal(req.getProtocal());
portMappingDO.setSubdomain(req.getSubdomain());
portMappingDO.setServerPort(req.getServerPort());
portMappingDO.setClientIp(req.getClientIp());
portMappingDO.setClientPort(req.getClientPort());
portMappingDO.setUpLimitRate(req.getUpLimitRate());
portMappingDO.setDownLimitRate(req.getDownLimitRate());
portMappingDO.setProxyResponses(req.getProxyResponses());
portMappingDO.setProxyTimeoutMs(req.getProxyTimeoutMs());
portMappingDO.setDescription(req.getDescription());
@@ -156,14 +189,39 @@ public class PortMappingService implements LifecycleBean {
portMappingMapper.insert(portMappingDO);
// 更新VisitorChannel
visitorChannelService.addVisitorChannelByPortMapping(portMappingDO);
// 更新域名映射
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal()) && StrUtil.isNotBlank(proxyConfig.getServer().getTcp().getDomainName()) && StrUtil.isNotBlank(portMappingDO.getSubdomain())) {
ProxyUtil.setSubdomainToServerPort(portMappingDO.getSubdomain(), portMappingDO.getServerPort());
// 更新域名映射添加新的域名映射
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal()) && CollectionUtil.isNotEmpty(req.getDomainMappings())) {
Set<Integer> domainIds = req.getDomainMappings().stream().map(item -> item.getDomainId()).collect(Collectors.toSet());
List<DomainNameDO> domainNameDOS = domainMapper.selectBatchIds(domainIds);
Map<Integer, DomainNameDO> domainNameDOMap = domainNameDOS.stream().collect(Collectors.toMap(DomainNameDO::getId, Function.identity()));
req.getDomainMappings().forEach(item -> {
DomainNameDO domainNameDO = domainNameDOMap.get(item.getDomainId());
//创建域名映射
DomainPortMappingDO domainPortMappingDO = new DomainPortMappingDO();
domainPortMappingDO.setDomainNameId(item.getDomainId());
domainPortMappingDO.setSubdomain(item.getSubdomain());
domainPortMappingDO.setPortMappingId(portMappingDO.getId());
domainPortMappingMapper.insert(domainPortMappingDO);
//设置完整域名到服务端端口的映射
ProxyUtil.setFullDomainToServerPort(StrUtil.join(StrPool.DOT, item.getSubdomain(), domainNameDO.getDomain()), portMappingDO.getServerPort());
});
}
updateMappingPortToSecurityGroupMap(portMappingDO.getServerPort(), req.getSecurityGroupId());
// 更新端口到映射的缓存
serverPortToPortMappingIdCache.put(req.getServerPort(), portMappingDO.getId());
// 更新端口映射到licenseId的缓存
idToLicenseIdCache.put(portMappingDO.getId(), portMappingDO.getLicenseId());
// 刷新流量限制缓存
refreshFlowLimitCache(portMappingDO.getId(), portMappingDO.getUpLimitRate(), portMappingDO.getDownLimitRate());
return new PortMappingCreateRes();
}
public PortMappingUpdateRes update(PortMappingUpdateReq req) {
public void update(PortMappingUpdateReq req) {
LicenseDO licenseDO = licenseMapper.findById(req.getLicenseId());
ParamCheckUtil.checkNotNull(licenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
if (!SystemContextHolder.isAdmin()) {
@@ -173,37 +231,82 @@ public class PortMappingService implements LifecycleBean {
PortPoolDO portPoolDO = portPoolMapper.findByPort(req.getServerPort());
ParamCheckUtil.checkNotNull(portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
ParamCheckUtil.checkExpression(null == portMappingMapper.findByPort(req.getServerPort(), Sets.newHashSet(req.getId())), ExceptionConstant.PORT_CANNOT_REPEAT_MAPPING, req.getServerPort());
ParamCheckUtil.checkExpression(!portMappingMapper.checkRepeatBySubdomain(req.getSubdomain(), Sets.newHashSet(req.getId())), ExceptionConstant.PORT_MAPPING_SUBDONAME_CONNOT_REPEAT);
// 查询原端口映射
PortMappingDO oldPortMappingDO = portMappingMapper.findById(req.getId());
ParamCheckUtil.checkNotNull(oldPortMappingDO, ExceptionConstant.PORT_MAPPING_NOT_EXIST);
PortMappingDO portMappingDO = new PortMappingDO();
portMappingDO.setId(req.getId());
portMappingDO.setProtocal(req.getProtocal());
portMappingDO.setSubdomain(req.getSubdomain());
portMappingDO.setLicenseId(req.getLicenseId());
portMappingDO.setServerPort(req.getServerPort());
portMappingDO.setClientIp(req.getClientIp());
portMappingDO.setClientPort(req.getClientPort());
portMappingDO.setProxyResponses(req.getProxyResponses());
portMappingDO.setProxyTimeoutMs(req.getProxyTimeoutMs());
portMappingDO.setDescription(req.getDescription());
portMappingDO.setUpdateTime(new Date());
portMappingDO.setEnable(EnableStatusEnum.ENABLE.getStatus());
portMappingMapper.updateById(portMappingDO);
//验证域名映射相关参数条件
if (NetworkProtocolEnum.isHttp(req.getProtocal()) && CollectionUtil.isNotEmpty(req.getDomainMappings())) {
Set<Integer> domainIds = req.getDomainMappings().stream().map(item -> item.getDomainId()).collect(Collectors.toSet());
List<DomainNameDO> domainNameDOS = domainMapper.selectBatchIds(domainIds);
Map<Integer, DomainNameDO> domainNameDOMap = domainNameDOS.stream().collect(Collectors.toMap(DomainNameDO::getId, Function.identity()));
req.getDomainMappings().forEach(item -> {
DomainNameDO domainNameDO = domainNameDOMap.get(item.getDomainId());
ParamCheckUtil.checkNotNull(domainNameDO, ExceptionConstant.DOMAIN_NAME_NOT_EXIST);
//检查子域名是否重复
boolean b = !domainPortMappingMapper.checkRepeatBySubdomain(item.getSubdomain(), item.getDomainId(), item.getId());
ParamCheckUtil.checkExpression(b,
ExceptionConstant.SUDOMAIN_NAME_CANNOT_REPEAT);
});
}
// 更新端口映射
portMappingMapper.update(null, new LambdaUpdateWrapper<PortMappingDO>()
.eq(PortMappingDO::getId, req.getId())
.set(PortMappingDO::getProtocal, req.getProtocal())
.set(PortMappingDO::getServerPort, req.getServerPort())
.set(PortMappingDO::getClientIp, req.getClientIp())
.set(PortMappingDO::getClientPort, req.getClientPort())
.set(PortMappingDO::getUpLimitRate, req.getUpLimitRate())
.set(PortMappingDO::getDownLimitRate, req.getDownLimitRate())
.set(PortMappingDO::getProxyTimeoutMs, req.getProxyTimeoutMs())
.set(PortMappingDO::getProxyResponses, req.getProxyResponses())
.set(PortMappingDO::getSecurityGroupId, req.getSecurityGroupId())
.set(PortMappingDO::getDescription, req.getDescription())
.set(PortMappingDO::getUpdateTime, new Date())
);
// 更新VisitorChannel
PortMappingDO portMappingDO = portMappingMapper.findById(req.getId());
visitorChannelService.updateVisitorChannelByPortMapping(oldPortMappingDO, portMappingDO);
// 删除老的域名映射
if (NetworkProtocolEnum.isHttp(oldPortMappingDO.getProtocal()) && StrUtil.isNotBlank(oldPortMappingDO.getSubdomain())) {
ProxyUtil.removeSubdomainToServerPort(oldPortMappingDO.getSubdomain());
}
// 更新域名映射
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal()) && StrUtil.isNotBlank(proxyConfig.getServer().getTcp().getDomainName()) && StrUtil.isNotBlank(portMappingDO.getSubdomain())) {
ProxyUtil.setSubdomainToServerPort(portMappingDO.getSubdomain(), portMappingDO.getServerPort());
// 删除老的域名映射
if (NetworkProtocolEnum.isHttp(oldPortMappingDO.getProtocal())) {
//删除完整域名到服务端端口的映射
ProxyUtil.removeFullDomainToServerPortByServerPort(oldPortMappingDO.getServerPort());
//删除旧的域名映射
LambdaQueryWrapper<DomainPortMappingDO> lambdaQueryWrapper = Wrappers.<DomainPortMappingDO>lambdaQuery()
.eq(DomainPortMappingDO::getPortMappingId, oldPortMappingDO.getId());
domainPortMappingMapper.delete(lambdaQueryWrapper);
}
return new PortMappingUpdateRes();
// 添加新的域名映射
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal()) && CollectionUtil.isNotEmpty(req.getDomainMappings())) {
Set<Integer> domainIds = req.getDomainMappings().stream().map(item -> item.getDomainId()).collect(Collectors.toSet());
List<DomainNameDO> domainNameDOS = domainMapper.selectBatchIds(domainIds);
Map<Integer, DomainNameDO> domainNameDOMap = domainNameDOS.stream().collect(Collectors.toMap(DomainNameDO::getId, Function.identity()));
req.getDomainMappings().forEach(item -> {
DomainNameDO domainNameDO = domainNameDOMap.get(item.getDomainId());
//创建域名映射
DomainPortMappingDO domainPortMappingDO = new DomainPortMappingDO();
domainPortMappingDO.setDomainNameId(item.getDomainId());
domainPortMappingDO.setSubdomain(item.getSubdomain());
domainPortMappingDO.setPortMappingId(portMappingDO.getId());
domainPortMappingMapper.insert(domainPortMappingDO);
//设置完整域名到服务端端口的映射
ProxyUtil.setFullDomainToServerPort(StrUtil.join(StrPool.DOT, item.getSubdomain(), domainNameDO.getDomain()), portMappingDO.getServerPort());
});
}
updateMappingPortToSecurityGroupMap(portMappingDO.getServerPort(), req.getSecurityGroupId());
// 更新端口到映射的缓存
serverPortToPortMappingIdCache.put(req.getServerPort(), req.getId());
// 更新端口映射到licenseId的缓存
idToLicenseIdCache.put(portMappingDO.getId(), portMappingDO.getLicenseId());
// 刷新流量限制缓存
refreshFlowLimitCache(req.getId(), req.getUpLimitRate(), req.getDownLimitRate());
}
public PortMappingDetailRes detail(Integer id) {
@@ -274,10 +377,45 @@ public class PortMappingService implements LifecycleBean {
// 更新VisitorChannel
visitorChannelService.removeVisitorChannelByPortMapping(portMappingDO);
// 更新域名映射
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal()) && StrUtil.isNotBlank(portMappingDO.getSubdomain())) {
ProxyUtil.removeSubdomainToServerPort(portMappingDO.getSubdomain());
// 删除域名映射
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal())) {
//删除完整域名到服务端端口的映射
ProxyUtil.removeFullDomainToServerPortByServerPort(portMappingDO.getServerPort());
//删除旧的域名映射
LambdaQueryWrapper<DomainPortMappingDO> lambdaQueryWrapper = Wrappers.<DomainPortMappingDO>lambdaQuery()
.eq(DomainPortMappingDO::getPortMappingId, portMappingDO.getId());
domainPortMappingMapper.delete(lambdaQueryWrapper);
}
updateMappingPortToSecurityGroupMap(portMappingDO.getServerPort(), null);
// 删除id到licenseId的映射
idToLicenseIdCache.remove(id);
// 删除流量限制缓存
flowLimitCache.remove(id);
}
public void portBindSecurityGroup(Integer portMappingId, Integer groupId) {
PortMappingDO mappingDO = portMappingMapper.findById(portMappingId);
if (mappingDO == null) {
throw new RuntimeException("指定的端口映射不存在");
}
mappingDO.setSecurityGroupId(groupId);
mappingDO.setUpdateTime(new Date());
portMappingMapper.updateById(mappingDO);
updateMappingPortToSecurityGroupMap(mappingDO.getServerPort(), groupId);
}
public void portUnbindSecurityGroup(Integer portMappingId) {
PortMappingDO mappingDO = portMappingMapper.findById(portMappingId);
if (mappingDO == null) {
throw new RuntimeException("指定的端口映射不存在");
}
mappingDO.setSecurityGroupId(0);
mappingDO.setUpdateTime(new Date());
portMappingMapper.updateById(mappingDO);
updateMappingPortToSecurityGroupMap(mappingDO.getServerPort(), null);
}
/**
@@ -290,29 +428,124 @@ public class PortMappingService implements LifecycleBean {
return portMappingMapper.findEnableListByLicenseId(licenseId);
}
public Integer getSecurityGroupIdByMappingPort(Integer port) {
return mappingPortToSecurityGroupMap.get(port);
}
/**
* 服务端项目停止启动时更新在线状态为离线
*/
@Init
public void init() {
// aot 阶段不初始化
if (NativeDetector.isAotRuntime()) {
return;
}
// 服务刚启动所以默认所有license都是离线状态解决服务突然关闭在线状态来不及更新的问题
portMappingMapper.updateOnlineStatus(OnlineStatusEnum.OFFLINE.getStatus(), new Date());
// 未配置域名则不需要处理域名映射逻辑
if (StrUtil.isBlank(proxyConfig.getServer().getTcp().getDomainName())) {
return;
}
List<PortMappingDO> portMappingDOList = portMappingMapper.selectList(new LambdaQueryWrapper<PortMappingDO>().eq(PortMappingDO::getProtocal, NetworkProtocolEnum.HTTP.getDesc()).isNotNull(PortMappingDO::getSubdomain));
if (CollectionUtil.isEmpty(portMappingDOList)) {
return;
}
portMappingDOList.forEach(item -> {
if (StrUtil.isBlank(item.getSubdomain())) {
return;
List<PortMappingDO> allMappingDOList = portMappingMapper.selectList(Wrappers.lambdaQuery(PortMappingDO.class));
allMappingDOList.forEach(item -> {
Integer securityGroupId = item.getSecurityGroupId();
if (securityGroupId != null && securityGroupId > 0) {
updateMappingPortToSecurityGroupMap(item.getServerPort(), item.getSecurityGroupId());
}
ProxyUtil.setSubdomainToServerPort(item.getSubdomain(), item.getServerPort());
// 更新端口到映射的缓存
serverPortToPortMappingIdCache.put(item.getServerPort(), item.getId());
// 更新端口映射到licenseId的缓存
idToLicenseIdCache.put(item.getId(), item.getLicenseId());
// 刷新流量限制缓存
refreshFlowLimitCache(item.getId(), item.getUpLimitRate(), item.getDownLimitRate());
});
}
/**
* 刷新流量限制缓存
* @param id
* @param upLimitRate
* @param downLimitRate
*/
private void refreshFlowLimitCache(Integer id, String upLimitRate, String downLimitRate) {
if (null == id) {
return;
}
flowLimitCache.put(id, new FlowLimitBO()
.setUpLimitRate(StringUtil.parseBytes(upLimitRate))
.setDownLimitRate(StringUtil.parseBytes(downLimitRate))
);
}
/**
* 获取license的流量限制
* @param id
* @return
*/
public FlowLimitBO getFlowLimit(Integer id) {
FlowLimitBO res = flowLimitCache.get(id);
if (null == res) {
PortMappingDO portMappingDO = portMappingMapper.findById(id);
if (null != portMappingDO) {
refreshFlowLimitCache(id, portMappingDO.getUpLimitRate(), portMappingDO.getDownLimitRate());
res = flowLimitCache.get(id);
}
}
return res;
}
public Integer getPortMappingIdByServerPort(Integer serverPort) {
if (null == serverPort) {
return null;
}
Integer id = serverPortToPortMappingIdCache.get(serverPort);
if (null != id) {
return id;
}
List<PortMappingDO> portMappingDOList = portMappingMapper.findListByServerPort(serverPort);
// 不存在 或者 有多条记录都不处理
if (CollectionUtils.isEmpty(portMappingDOList) || portMappingDOList.size() > 1) {
return null;
}
id = portMappingDOList.get(0).getId();
serverPortToPortMappingIdCache.put(serverPort, id);
return id;
}
public Integer getLicenseIdById(Integer id) {
Integer licenseId = idToLicenseIdCache.get(id);
if (null == licenseId) {
PortMappingDO portMappingDO = portMappingMapper.findById(id);
if (null != portMappingDO) {
licenseId = portMappingDO.getLicenseId();
idToLicenseIdCache.put(id, licenseId);
}
}
return licenseId;
}
public FlowLimitBO getFlowLimitByServerPort(Integer serverPort) {
Integer id = getPortMappingIdByServerPort(serverPort);
if (null == id) {
return null;
}
FlowLimitBO res = getFlowLimit(id);
if (null == res || (null == res.getUpLimitRate() && null == res.getDownLimitRate())) {
Integer licenseId = getLicenseIdById(id);
if (null != licenseId) {
res = licenseService.getFlowLimit(licenseId);
}
}
return res;
}
private void updateMappingPortToSecurityGroupMap(Integer serverPort, Integer securityGroupId) {
if (securityGroupId == null || securityGroupId == 0) {
mappingPortToSecurityGroupMap.remove(serverPort);
return;
}
mappingPortToSecurityGroupMap.put(serverPort, securityGroupId);
}
@Override
public void start() throws Throwable {
@@ -23,7 +23,7 @@ public class ProtocalService {
public List<ProtocalListRes> list() {
return Lists.newArrayList(
new ProtocalListRes().setName("TCP").setEnable(Boolean.TRUE).setRemark("支持一切TCP之上的协议"),
new ProtocalListRes().setName("HTTP(S)").setEnable(Boolean.TRUE).setRemark("支持绑定子域名,未绑定时等价于使用TCP。 若配置了证书,则同时支持HTTPS。"),
new ProtocalListRes().setName("HTTP(S)").setEnable(Boolean.TRUE).setRemark("支持绑定子域名,未绑定时等价于使用TCP。 若配置了证书,则同时支持HTTPS。"),
new ProtocalListRes().setName("UDP").setEnable(Boolean.TRUE).setRemark("支持UDP转发、响应。需要配合响应数、超时时间使用")
);
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.service;
import org.dromara.neutrinoproxy.server.constant.OnlineStatusEnum;
@@ -0,0 +1,267 @@
package org.dromara.neutrinoproxy.server.service;
import cn.hutool.cache.Cache;
import cn.hutool.cache.CacheUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.solon.annotation.Db;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
import org.dromara.neutrinoproxy.server.base.page.PageQuery;
import org.dromara.neutrinoproxy.server.base.rest.SystemContextHolder;
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
import org.dromara.neutrinoproxy.server.constant.ExceptionConstant;
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
import org.dromara.neutrinoproxy.server.controller.req.system.*;
import org.dromara.neutrinoproxy.server.controller.res.system.*;
import org.dromara.neutrinoproxy.server.dal.SecurityGroupMapper;
import org.dromara.neutrinoproxy.server.dal.SecurityRuleMapper;
import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO;
import org.dromara.neutrinoproxy.server.dal.entity.SecurityRuleDO;
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Init;
import org.noear.solon.core.runtime.NativeDetector;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@Component
@Slf4j
public class SecurityGroupService {
@Db
private SecurityGroupMapper securityGroupMapper;
@Db
private SecurityRuleMapper securityRuleMapper;
private final Map<Integer, SecurityGroupDO> securityGroupMap = new ConcurrentHashMap<>();
// 允许通过控制的缓存缓存类型最近最久未使用缓存容量100超时时间5分钟
private final Cache<String, Boolean> ipAllowControlCache = CacheUtil.newLRUCache(100, 1000 * 60 * 5);
@Init(index = 100)
public synchronized void init() {
// aot 阶段不初始化
if (NativeDetector.isAotRuntime()) {
return;
}
securityGroupMap.clear();
List<SecurityGroupDO> groupDOList = securityGroupMapper.selectList(Wrappers.lambdaQuery(SecurityGroupDO.class)
.eq(SecurityGroupDO::getEnable, EnableStatusEnum.ENABLE.getStatus()));
groupDOList.forEach(securityGroupDO -> securityGroupMap.put(securityGroupDO.getId(), securityGroupDO));
ipAllowControlCache.clear();
}
public void clearCache() {
ipAllowControlCache.clear();
}
public PageInfo<SecurityGroupListRes> groupPage(PageQuery pageQuery, SecurityGroupListReq req) {
if (StringUtils.isNotEmpty(req.getName())) {
//在应用层处理否则sqlite不支持
req.setName("%" + req.getName() + "%");
}
if (StringUtils.isNotEmpty(req.getDescription())) {
//在应用层处理否则sqlite不支持
req.setDescription("%" + req.getDescription() + "%");
}
Page<SecurityGroupDO> page = new Page<>(pageQuery.getCurrent(), pageQuery.getSize());
List<SecurityGroupDO> list = securityGroupMapper.selectByCondition(page, req);
if (CollectionUtils.isEmpty(list)) {
return PageInfo.of(null, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
}
List<SecurityGroupListRes> respList = list.stream().map(SecurityGroupDO::toListRes).collect(Collectors.toList());
return PageInfo.of(respList, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
}
public List<SecurityGroupListRes> groupList() {
List<SecurityGroupDO> list = securityGroupMapper.selectList(Wrappers.lambdaQuery(SecurityGroupDO.class)
.eq(SecurityGroupDO::getUserId, SystemContextHolder.getUserId()));
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(SecurityGroupDO::toListRes).collect(Collectors.toList());
}
public SecurityGroupDetailRes groupDetail(SecurityGroupDetailReq req) {
SecurityGroupDO securityGroupDO = securityGroupMapper.selectById(req.getId());
if (null != securityGroupDO) {
return securityGroupDO.toDetailRes();
}
return null;
}
public void createGroup(SecurityGroupCreateReq req) {
SecurityGroupDO groupDO = new SecurityGroupDO();
BeanUtil.copyProperties(req, groupDO);
groupDO.setEnable(EnableStatusEnum.ENABLE.getStatus())
.setUserId(SystemContextHolder.getUserId())
.setCreateTime(new Date())
.setUpdateTime(new Date());
securityGroupMapper.insert(groupDO);
init();
}
/**
* 更新时不允许更新默认放行类型
* @param req 安全组更新参数
*/
public void updateGroup(SecurityGroupUpdateReq req) {
SecurityGroupDO groupDO = securityGroupMapper.selectById(req.getId());
BeanUtil.copyProperties(req, groupDO, "defaultPassType");
securityGroupMapper.updateById(groupDO);
init();
}
/**
* 删除安全组并级联删除安全组下的规则删除后需缓存
* @param groupId 安全组Id
*/
public void deleteGroup(Integer groupId) {
securityGroupMapper.deleteById(groupId);
securityRuleMapper.delete(Wrappers.lambdaQuery(SecurityRuleDO.class)
.eq(SecurityRuleDO::getGroupId, groupId));
init();
}
public SecurityGroupUpdateEnableStatueRes updateGroupEnableStatueReq(SecurityGroupUpdateEnableStatueReq req) {
SecurityGroupDO groupDO = securityGroupMapper.selectById(req.getId());
ParamCheckUtil.checkNotNull(groupDO, ExceptionConstant.SECURITY_GROUP_NOT_EXIST);
securityGroupMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
init();
return new SecurityGroupUpdateEnableStatueRes();
}
public PageInfo<SecurityRuleListRes> rulePage(PageQuery pageQuery, SecurityRuleListReq req) {
if (StringUtils.isNotEmpty(req.getName())) {
//在应用层处理否则sqlite不支持
req.setName("%" + req.getName() + "%");
}
if (StringUtils.isNotEmpty(req.getDescription())) {
//在应用层处理否则sqlite不支持
req.setDescription("%" + req.getDescription() + "%");
}
Page<SecurityRuleDO> page = new Page<>(pageQuery.getCurrent(), pageQuery.getSize());
List<SecurityRuleDO> list = securityRuleMapper.selectByCondition(page, req);
if (CollectionUtils.isEmpty(list)) {
return PageInfo.of(null, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
}
List<SecurityRuleListRes> respList = list.stream().map(SecurityRuleDO::toListRes).collect(Collectors.toList());
return PageInfo.of(respList, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
}
public List<SecurityRuleListRes> ruleList(SecurityRuleListReq req) {
List<SecurityRuleDO> list = securityRuleMapper.selectList(new LambdaQueryWrapper<SecurityRuleDO>()
.eq(null != req.getGroupId(), SecurityRuleDO::getGroupId, req.getGroupId())
);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(SecurityRuleDO::toListRes).collect(Collectors.toList());
}
public void createRule(SecurityRuleCreateReq req) {
SecurityRuleDO ruleDO = new SecurityRuleDO();
BeanUtil.copyProperties(req, ruleDO);
ruleDO.setUserId(SystemContextHolder.getUserId())
.setCreateTime(new Date())
.setEnable(EnableStatusEnum.ENABLE.getStatus())
.setUpdateTime(new Date());
securityRuleMapper.insert(ruleDO);
clearCache();
}
public void updateRule(SecurityRuleUpdateReq req) {
SecurityRuleDO ruleDO = securityRuleMapper.selectById(req.getId());
BeanUtil.copyProperties(req, ruleDO);
securityRuleMapper.updateById(ruleDO);
clearCache();
}
public void deleteRule(Integer ruleId) {
securityRuleMapper.deleteById(ruleId);
clearCache();
}
public SecurityRuleUpdateEnableStatueRes updateRuleEnableStatueReq(SecurityRuleUpdateEnableStatueReq req) {
SecurityRuleDO ruleDO = securityRuleMapper.selectById(req.getId());
ParamCheckUtil.checkNotNull(ruleDO, ExceptionConstant.SECURITY_RULE_NOT_EXIST);
securityRuleMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
clearCache();
return new SecurityRuleUpdateEnableStatueRes();
}
/**
* 判断ip在该安全组下是否允许,如果安全组没有创建则放行默认黑名单规则
* @param ip 被判断的IP地址
* @param groupId 安全组Id
* @return 是否放行
*/
public boolean judgeAllow(String ip, Integer groupId) {
ip = ip.toLowerCase();
// 不能判断当前连接的IP保守处理拒绝放行
if (StrUtil.isEmpty(ip)) {
log.debug("[SecurityGroup] cannot get remote ip,this pack be reject");
return false;
}
// 黑名单规则没有该安全组则放行
if (groupId == null) {
return true;
}
SecurityGroupDO groupDO = securityGroupMap.get(groupId);
if (groupDO == null) {
return true;
}
Boolean allow = null;
String judgeAllowMapKey = ip + groupId;
if (ipAllowControlCache.containsKey(judgeAllowMapKey)) {
allow = ipAllowControlCache.get(judgeAllowMapKey);
log.debug("[SecurityGroup] ip:{} groupId:{} cached security strategy:{}", ip, groupId, allow ? "allow" : "reject");
return allow;
}
List<SecurityRuleDO> ruleDOList = securityRuleMapper.selectList(Wrappers.lambdaQuery(SecurityRuleDO.class)
.eq(SecurityRuleDO::getGroupId, groupId)
.eq(SecurityRuleDO::getEnable, EnableStatusEnum.ENABLE.getStatus())
.orderByAsc(SecurityRuleDO::getPriority)
);
for (SecurityRuleDO ruleDO : ruleDOList) {
SecurityRulePassTypeEnum passType = ruleDO.judge(ip);
if (passType == SecurityRulePassTypeEnum.ALLOW) {
allow = true;
log.debug("[SecurityGroup] ip:{} groupId:{} ruleId:{} security strategy:{}", ip, groupId, ruleDO.getId(), "allow");
break;
}
if (passType == SecurityRulePassTypeEnum.DENY) {
allow = false;
log.info("[SecurityGroup] ip:{} groupId:{} ruleId:{} security strategy:{}", ip, groupId, ruleDO.getId(), "reject");
break;
}
}
// 当前IP没有匹配到任何一条规则则使用安全组默认规则
if (allow == null) {
allow = SecurityRulePassTypeEnum.ALLOW.getType().equals(groupDO.getDefaultPassType());
log.debug("[SecurityGroup] ip:{} groupId{} use security group default strategy:{}", ip, groupId, allow ? "allow" : "reject");
}
ipAllowControlCache.put(judgeAllowMapKey, allow);
return allow;
}
}
@@ -3,6 +3,7 @@ package org.dromara.neutrinoproxy.server.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.solon.annotation.Db;
import org.dromara.neutrinoproxy.core.util.DateUtil;
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
@@ -131,6 +132,7 @@ public class UserService {
public PageInfo<UserListRes> page(PageQuery pageQuery, UserListReq req) {
Page<UserDO> page = userMapper.selectPage(new Page<>(pageQuery.getCurrent(), pageQuery.getSize()), new LambdaQueryWrapper<UserDO>()
.like(StringUtils.isNotBlank(req.getName()), UserDO::getName, req.getName())
.orderByAsc(UserDO::getId)
);
List<UserListRes> respList = page.getRecords().stream().map(UserDO::toRes).collect(Collectors.toList());
@@ -0,0 +1,15 @@
package org.dromara.neutrinoproxy.server.service.bo;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author: aoshiguchen
* @date: 2023/12/15
*/
@Accessors(chain = true)
@Data
public class FlowLimitBO {
private Long upLimitRate;
private Long downLimitRate;
}
@@ -0,0 +1,40 @@
package org.dromara.neutrinoproxy.server.service.bo;
import lombok.Data;
import lombok.experimental.Accessors;
import org.dromara.neutrinoproxy.server.constant.HttpsStatusEnum;
/**
* 完整域名
* @author: mirac
* @date: 2024/8/8
*/
@Data
@Accessors(chain = true)
public class FullDomainNameBO {
/**
* 域名端口映射id
*/
private Integer id;
/**
* 端口映射id
*/
private Integer portMappingId;
/**
* 子域名
*/
private String subdomain;
/**
* 域名id
*/
private Integer domainNameId;
/**
* 域名
*/
private String domain;
/**
* 强制使用HTTPS(1 2)
* {@link HttpsStatusEnum}
*/
private Integer forceHttps;
}
@@ -1,24 +1,3 @@
/**
* Copyright (c) 2022 aoshiguchen
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.dromara.neutrinoproxy.server.util;
import java.math.BigInteger;
@@ -103,4 +103,20 @@ public class ParamCheckUtil {
}
}
/**
* 校验字节描述
* @param str
* @param params
*/
public static void checkBytesDesc(String str, Object... params) {
// 允许为空
if (StrUtil.isEmpty(str)) {
return;
}
Long bytes = StringUtil.parseBytes(str);
if (null == bytes || bytes <= 0) {
throw ServiceException.create(ExceptionConstant.BYTES_DESC_INVALID, params);
}
}
}
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollectionUtil;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.StringUtils;
import org.dromara.neutrinoproxy.core.ChannelAttribute;
import org.dromara.neutrinoproxy.core.Constants;
import org.dromara.neutrinoproxy.server.constant.NetworkProtocolEnum;
import org.dromara.neutrinoproxy.server.proxy.domain.CmdChannelAttachInfo;
import org.dromara.neutrinoproxy.server.proxy.domain.ProxyAttachment;
@@ -19,6 +18,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.stream.Collectors;
/**
*
@@ -32,7 +32,7 @@ public class ProxyUtil {
*/
private static final Map<Integer, Set<Integer>> licenseToServerPortMap = new HashMap<>();
/**
* 代理信息映射
* 代理信息映射 e.g.: 9104 -> 127.0.0.1:8848
*/
private static final Map<Integer, String> proxyInfoMap = new ConcurrentHashMap<>();
/**
@@ -61,9 +61,13 @@ public class ProxyUtil {
*/
private static Map<String, ProxyAttachment> proxyConnectAttachmentMap = new HashMap<>();
/**
* 域名 - 服务端端口映射
* 完整域名 - 服务端端口映射
*/
private static Map<String, Integer> subdomainToServerPort = new HashMap<>();
private static Map<String, Integer> fullDomainToServerPortMap = new ConcurrentHashMap<>();
/**
* 主域名 - 域名id映射
*/
private static Map<String, Integer> domainToDomainNameIdMap = new ConcurrentHashMap<>();
/**
* licenseId - 客户端Id映射
*/
@@ -339,32 +343,86 @@ public class ProxyUtil {
}
/**
* 设置域名到服务端端口的映射
* @param subdomain
* 设置完整域名到服务端端口的映射
* @param fullDomain
* @param serverPort
*/
public static void setSubdomainToServerPort(String subdomain, Integer serverPort) {
subdomainToServerPort.put(subdomain, serverPort);
public static void setFullDomainToServerPort(String fullDomain, Integer serverPort) {
fullDomainToServerPortMap.put(fullDomain, serverPort);
}
/**
* 删除域名到服务端端口的映射
* @param subdomain
* 删除完整域名到服务端端口的映射
* @param fullDomain
*/
public static void removeSubdomainToServerPort(String subdomain) {
subdomainToServerPort.remove(subdomain);
public static void removeFullDomainToServerPort(String fullDomain) {
fullDomainToServerPortMap.remove(fullDomain);
}
/**
* 通过服务器端口删除完整域名到服务端端口的映射
* @param serverPort
*/
public static void removeFullDomainToServerPortByServerPort(Integer serverPort) {
fullDomainToServerPortMap.entrySet().removeIf(entry -> Objects.equals(entry.getValue(), serverPort));
}
/**
* 根据域名获取外网端口
* @param subdomain
* 根据完整域名获取外网端口
* @param fullDomain
* @return
*/
public static Integer getServerPortBySubdomain(String subdomain) {
return subdomainToServerPort.get(subdomain);
public static Integer getServerPortByFullDomain(String fullDomain) {
return fullDomainToServerPortMap.get(fullDomain);
}
/**
/**
* 添加域名到域名id的映射
*/
public static void setDomainToDomainNameId(String domain, Integer domainNameId) {
domainToDomainNameIdMap.put(domain, domainNameId);
}
/**
* 删除域名到域名id的映射
*/
public static void removeDomainToDomainNameId(String domain) {
domainToDomainNameIdMap.remove(domain);
}
/**
* 通过主域名获取域名id
*/
public static Integer getDomainNameIdByDomain(String domain) {
return domainToDomainNameIdMap.get(domain);
}
/**
* 通过完整域名获取域名id
*/
public static Integer getDomainNameIdByFullDomain(String fullDomain) {
List<String> domains = domainToDomainNameIdMap.keySet().stream().sorted((a,b) -> b.length() - a.length()).filter(item -> fullDomain.endsWith(item)).collect(Collectors.toList());
// 不存在返回null
if (CollectionUtil.isEmpty(domains)) {
return null;
}
// 优先匹配最长的域名默认取第一个后续思考如何优化
return getDomainNameIdByDomain(domains.get(0));
}
/**
* 通过完整域名获取域名
*/
public static String getDomainNameByFullDomain(String fullDomain) {
List<String> domains = domainToDomainNameIdMap.keySet().stream().filter(item -> fullDomain.endsWith(item)).collect(Collectors.toList());
// 不存在 或者 有多条记录返回null
if (CollectionUtil.isEmpty(domains) || domains.size() > 1) {
return null;
}
return domains.getFirst();
}
/**
* 关闭http响应channel
* @param channel
* @return
@@ -0,0 +1,75 @@
package org.dromara.neutrinoproxy.server.util;
import cn.hutool.core.util.StrUtil;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author: aoshiguchen
* @date: 2023/12/15
*/
public class StringUtil {
private static final Integer BYTES_MUL_KB = 1024;
private static final Integer BYTES_MUL_MB = BYTES_MUL_KB * 1024;
private static final Integer BYTES_MUL_GB = BYTES_MUL_MB * 1024;
private static final String[] BYTES_UNIT_STR = {"B", "K", "KB", "M", "MB", "G", "GB"};
private static final Integer[] BYTES_UNIT_MUL = {1, BYTES_MUL_KB, BYTES_MUL_KB, BYTES_MUL_MB, BYTES_MUL_MB, BYTES_MUL_GB, BYTES_MUL_GB};
private static final String BYTES_DESC_REGEX = "\\s*(\\d+\\.*\\d*)\\s*(B|K|KB|M|MB|G|GB)\\s*";
private static final Pattern BYTES_DESC_PATTERN = Pattern.compile(BYTES_DESC_REGEX);
/**
* 校验是否符合字节描述
* @param desc
* @return
*/
public static boolean isBytesDesc(String desc) {
if (StrUtil.isBlank(desc)) {
return false;
}
return desc.toUpperCase().matches(BYTES_DESC_REGEX);
}
/**
* 解析字节数
* 支持BKKBMMBGGB 忽略大小写忽略首尾空格忽略数字与单位之间的空格
* @param desc
* @return
*/
public static Long parseBytes(String desc) {
try {
if (!isBytesDesc(desc)) {
return null;
}
Matcher matcher = BYTES_DESC_PATTERN.matcher(desc.toUpperCase());
boolean found = matcher.find();
if (!found) {
return null;
}
Double n = Double.parseDouble(matcher.group(1));
String unit = matcher.group(2);
Integer unitIndex = getBytesUnitIndex(unit);
if (null == unitIndex) {
return null;
}
return (long)(n * BYTES_UNIT_MUL[unitIndex]);
} catch (Exception e) {
// ignore
}
return null;
}
private static Integer getBytesUnitIndex(String unit) {
if (StrUtil.isBlank(unit)) {
return null;
}
for (int i = 0; i < BYTES_UNIT_STR.length; i++) {
if (unit.equals(BYTES_UNIT_STR[i])) {
return i;
}
}
return null;
}
}
@@ -0,0 +1,58 @@
server:
# 服务端web端口,用于支持HTTP接口,管理后台页面访问
port: ${WEB_PORT:8888}
# 日志级别
solon.logging:
logger:
"root":
level: info
appender:
file:
level: info
neutrino:
proxy:
# 隧道相关配置-用于维持服务端与客户端的通信
tunnel:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 2
work-thread-count: 10
# 隧道非SSL端口
port: ${OPEN_PORT:9000}
# 隧道SSL端口
ssl-port: ${SSL_PORT:9002}
# 隧道SSL证书配置
key-store-password: 123456
key-manager-password: 123456
jks-path: classpath:/test.jks
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
# 是否开启心跳日志
heartbeat-log-enable: false
server:
tcp:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 5
work-thread-count: 20
# http代理端口,默认80(不配置不支持)
http-proxy-port: ${HTTP_PROXY_PORT:80}
# https代理端口,默认443 (不配置不支持,同时需要配置域名、证书)
https-proxy-port: ${HTTPS_PROXY_PORT:443}
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
udp:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 5
work-thread-count: 20
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
data:
db:
# 数据库类型,目前支持h2、mysql、mariadb
type: h2
# 数据库连接URL
url: jdbc:h2:file:./data/db;MODE=MySQL;AUTO_SERVER=TRUE
# 数据库用户名
username:
# 数据库密码
password:
@@ -5,10 +5,9 @@ server:
solon:
app:
name: neutrino-proxy-server
version: 2.0.2
config:
add: ./app.yml
# aot:
# jvmArguments: --add-opens java.base/java.lang=ALL-UNNAMED
# 日志级别
solon.logging.appender:
console:
@@ -20,9 +19,7 @@ solon.logging.appender:
rolling: "logs/${solon.app.name}_%d{yyyy-MM-dd}_%i.log"
solon.logging.logger:
"root":
level: ${LOG_LEVEL:info}
# level: info
level: info
neutrino:
proxy:
@@ -57,15 +54,10 @@ neutrino:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 5
work-thread-count: 20
# http代理端口,默认80
# http代理端口,默认80(不配置不支持)
http-proxy-port: ${HTTP_PROXY_PORT:80}
# https代理端口,默认443 (需要配置域名、证书)
# https代理端口,默认443 不配置不支持,同时需要配置域名、证书)
https-proxy-port: ${HTTPS_PROXY_PORT:443}
# 如果不配置,则不支持域名映射
domain-name: ${DOMAIN_NAME:}
# https证书配置
key-store-password: ${HTTPS_STORE_PASS:}
jks-path: ${HTTPS_JKS_PATH:}
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
transfer-log-enable: ${SERVER_LOG:false}
udp:
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.neutrinoproxy.server.dal.DomainMapper">
<select id="selectFullDomainNameListByPortMappingIds" resultType="org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO">
SELECT dpm.id as id, pm.id AS portMappingId, dpm.subdomain as subdomain, dn.domain AS domain, dn.id as domainNameId, dn.force_https as forceHttps
FROM domain_port_mapping dpm
LEFT JOIN port_mapping pm ON pm.id = dpm.port_mapping_id
LEFT JOIN domain_name dn ON dn.id = dpm.domain_name_id
WHERE pm.id IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectFullDomainNameList"
resultType="org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO">
SELECT dpm.id as id, pm.id AS portMappingId, dpm.subdomain as subdomain, dn.domain AS domain, dn.id as domainNameId, dn.force_https as forceHttps
FROM domain_port_mapping dpm
LEFT JOIN port_mapping pm ON pm.id = dpm.port_mapping_id
LEFT JOIN domain_name dn ON dn.id = dpm.domain_name_id
</select>
<select id="selectFullDomainNameListByDomainNameIds"
resultType="org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO">
SELECT dpm.id as id, pm.id AS portMappingId, dpm.subdomain as subdomain, dn.domain AS domain, dn.id as domainNameId, dn.force_https as forceHttps
FROM domain_port_mapping dpm
LEFT JOIN port_mapping pm ON pm.id = dpm.port_mapping_id
LEFT JOIN domain_name dn ON dn.id = dpm.domain_name_id
WHERE dn.id IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.neutrinoproxy.server.dal.SecurityGroupMapper">
<select id="selectByCondition" resultType="org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO">
SELECT sg.* from security_group sg
<where>
<if test="req.name != null and req.name != '' ">
AND sg.name like #{req.name}
</if>
<if test="req.description != null and req.description != '' ">
AND sg.description like #{req.description}
</if>
<if test="req.defaultPassType != null">
AND sg.default_pass_type like #{req.defaultPassType}
</if>
<if test="req.enable != null">
AND sg.enable like #{req.enable}
</if>
</where>
order by sg.id DESC
</select>
</mapper>
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.neutrinoproxy.server.dal.SecurityRuleMapper">
<select id="selectByCondition" resultType="org.dromara.neutrinoproxy.server.dal.entity.SecurityRuleDO">
SELECT sr.* from security_rule sr
<where>
<if test="req.groupId != null">
AND sr.group_id = ${req.groupId}
</if>
<if test="req.name != null and req.name != '' ">
AND sr.name like #{req.name}
</if>
<if test="req.description != null and req.description != '' ">
AND sr.description like #{req.description}
</if>
<if test="req.passType != null">
AND sr.pass_type like #{req.passType}
</if>
<if test="req.enable != null">
AND sr.enable like #{req.enable}
</if>
</where>
order by sr.id DESC
</select>
</mapper>
@@ -45,6 +45,37 @@ CREATE TABLE IF NOT EXISTS `port_group` (
`create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL
);
#
CREATE TABLE IF NOT EXISTS `security_group` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`name` VARCHAR(20) NOT NULL,
`description` VARCHAR(255),
`user_id` INTEGER NOT NULL,
`enable` INTEGER NOT NULL,
`default_pass_type` INTEGER NOT NULL,
`create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL,
PRIMARY KEY (`id`)
);
#
CREATE TABLE IF NOT EXISTS `security_rule` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`group_id` INTEGER NOT NULL,
`name` VARCHAR(20) NOT NULL,
`description` VARCHAR(255) NOT NULL,
`rule` text NOT NULL,
`pass_type` INTEGER NOT NULL,
`priority` INTEGER NOT NULL,
`user_id` INTEGER NOT NULL,
`enable` INTEGER NOT NULL,
`create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL,
PRIMARY KEY (`id`)
);
CREATE INDEX IF NOT EXISTS I_security_rule_group_id ON security_rule(group_id);
##########################################################
#license表
CREATE TABLE IF NOT EXISTS `license` (
@@ -52,6 +83,8 @@ CREATE TABLE IF NOT EXISTS `license` (
`name` VARCHAR(50) NOT NULL,
`key` VARCHAR(100) NOT NULL,
`user_id` INTEGER NOT NULL,
`up_limit_rate` VARCHAR(20) DEFAULT NULL,
`down_limit_rate` VARCHAR(20) DEFAULT NULL,
`is_online` INTEGER(2) NOT NULL,
`enable` INTEGER(2) NOT NULL,
`create_time` TIMESTAMP NOT NULL,
@@ -64,20 +97,48 @@ CREATE TABLE IF NOT EXISTS `port_mapping` (
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
`license_id` INTEGER(20) NOT NULL,
`protocal` VARCHAR(10) NOT NULL DEFAULT 'TCP',
`subdomain` VARCHAR(50) DEFAULT NULL,
`server_port` INTEGER NOT NULL,
`client_ip` VARCHAR(20) NOT NULL,
`client_ip` VARCHAR(255) NOT NULL,
`client_port` INTEGER NOT NULL,
`up_limit_rate` VARCHAR(20) DEFAULT NULL,
`down_limit_rate` VARCHAR(20) DEFAULT NULL,
`is_online` INTEGER(2) NOT NULL,
`description` VARCHAR(100) DEFAULT NULL,
`proxy_responses` INTEGER(20) NOT NULL DEFAULT 0,
`proxy_timeout_ms` INTEGER(20) NOT NULL DEFAULT 0,
`enable` INTEGER(2) NOT NULL,
`security_group_id` INTEGER(20) NOT NULL DEFAULT 0,
`create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS I_port_mapping_server_port ON port_mapping (server_port ASC);
#
CREATE TABLE IF NOT EXISTS `domain_name` (
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
`domain` VARCHAR(50) NOT NULL,
`user_id` INTEGER NOT NULL,
`jks` BLOB DEFAULT NULL,
`key_store_password` varchar(255) DEFAULT NULL,
`is_default` INTEGER(2) NOT NULL,
`force_https` INTEGER(2) NOT NULL,
`enable` INTEGER(2) NOT NULL,
`create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS I_domain_name_domain ON domain_name (`domain` ASC);
#
CREATE TABLE IF NOT EXISTS `domain_port_mapping` (
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
`subdomain` VARCHAR(50) NOT NULL,
`domain_name_id` INTEGER NOT NULL,
`port_mapping_id` INTEGER NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS I_unique_domain_port_mapping ON domain_port_mapping (`domain_name_id` ASC, `subdomain` ASC);
CREATE INDEX IF NOT EXISTS I_domain_port_mapping_domain_name_id ON domain_port_mapping (`domain_name_id` ASC);
CREATE INDEX IF NOT EXISTS I_domain_port_mapping_port_mapping_id ON domain_port_mapping (`port_mapping_id` ASC);
##########################################################
#
CREATE TABLE IF NOT EXISTS `user_login_record` (
@@ -135,8 +196,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_minute` (
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
`user_id` INTEGER(20) NOT NULL,
`license_id` INTEGER(20) NOT NULL,
`write_bytes` INTEGER(20) NOT NULL,
`read_bytes` INTEGER(20) NOT NULL,
`write_bytes` bigint NOT NULL,
`read_bytes` bigint NOT NULL,
`date` TIMESTAMP NOT NULL,
`date_str` VARCHAR(20) NOT NULL,
`create_time` TIMESTAMP NOT NULL
@@ -151,8 +212,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_hour` (
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
`user_id` INTEGER(20) NOT NULL,
`license_id` INTEGER(20) NOT NULL,
`write_bytes` INTEGER(20) NOT NULL,
`read_bytes` INTEGER(20) NOT NULL,
`write_bytes` bigint NOT NULL,
`read_bytes` bigint NOT NULL,
`date` TIMESTAMP NOT NULL,
`date_str` VARCHAR(20) NOT NULL,
`create_time` TIMESTAMP NOT NULL
@@ -167,8 +228,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_day` (
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
`user_id` INTEGER(20) NOT NULL,
`license_id` INTEGER(20) NOT NULL,
`write_bytes` INTEGER(20) NOT NULL,
`read_bytes` INTEGER(20) NOT NULL,
`write_bytes` bigint NOT NULL,
`read_bytes` bigint NOT NULL,
`date` TIMESTAMP NOT NULL,
`date_str` VARCHAR(20) NOT NULL,
`create_time` TIMESTAMP NOT NULL
@@ -183,8 +244,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_month` (
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
`user_id` INTEGER(20) NOT NULL,
`license_id` INTEGER(20) NOT NULL,
`write_bytes` INTEGER(20) NOT NULL,
`read_bytes` INTEGER(20) NOT NULL,
`write_bytes` bigint NOT NULL,
`read_bytes` bigint NOT NULL,
`date` TIMESTAMP NOT NULL,
`date_str` VARCHAR(20) NOT NULL,
`create_time` TIMESTAMP NOT NULL
@@ -1,7 +1,7 @@
#port_mapping
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`,`client_ip`, `client_port`, `is_online`, `enable`,`description`,`create_time`, `update_time`) VALUES
(1, 1, 9101, 'HTTP', 'test1', '127.0.0.1', 8080, 2, 1,'test1', now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`,`description`, `create_time`, `update_time`) VALUES
(2, 1, 9102, 'TCP', '', '127.0.0.1', 3306, 2, 1,'test2', now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`,`description`, `create_time`, `update_time`) VALUES
(3, 1, 9103, 'HTTP', 'test2', '127.0.0.1', 8081, 2, 1,'test3', now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`,`client_ip`, `client_port`, `is_online`, `enable`,`description`,`create_time`, `update_time`) VALUES
(1, 1, 9101, 'HTTP', '127.0.0.1', 8080, 2, 1,'test1', now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`,`description`, `create_time`, `update_time`) VALUES
(2, 1, 9102, 'TCP', '127.0.0.1', 3306, 2, 1,'test2', now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`,`description`, `create_time`, `update_time`) VALUES
(3, 1, 9103, 'HTTP', '127.0.0.1', 8081, 2, 1,'test3', now(), now());
@@ -0,0 +1,38 @@
#
CREATE TABLE IF NOT EXISTS `security_group` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`name` VARCHAR(20) NOT NULL,
`description` VARCHAR(255),
`user_id` INTEGER NOT NULL,
`enable` INTEGER NOT NULL,
`default_pass_type` INTEGER NOT NULL,
`create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL,
PRIMARY KEY (`id`)
);
#
CREATE TABLE IF NOT EXISTS `security_rule` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`group_id` INTEGER NOT NULL,
`name` VARCHAR(20) NOT NULL,
`description` VARCHAR(255) NOT NULL,
`rule` text NOT NULL,
`pass_type` INTEGER NOT NULL,
`priority` INTEGER NOT NULL,
`user_id` INTEGER NOT NULL,
`enable` INTEGER NOT NULL,
`create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL,
PRIMARY KEY (`id`)
);
CREATE INDEX IF NOT EXISTS I_security_rule_group_id ON security_rule(group_id);
# port_mapping表增加字段
ALTER TABLE `port_mapping` ADD COLUMN `security_group_id` INTEGER DEFAULT 0;
ALTER TABLE `port_mapping` ADD COLUMN `up_limit_rate` varchar(20) DEFAULT NULL;
ALTER TABLE `port_mapping` ADD COLUMN `down_limit_rate` varchar(20) DEFAULT NULL;
# license表增加字段
ALTER TABLE `license` ADD COLUMN `up_limit_rate` varchar(20) DEFAULT NULL;
ALTER TABLE `license` ADD COLUMN `down_limit_rate` varchar(20) DEFAULT NULL;
@@ -0,0 +1,28 @@
#
CREATE TABLE IF NOT EXISTS `domain_name` (
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
`domain` VARCHAR(50) NOT NULL,
`user_id` INTEGER NOT NULL,
`jks` BLOB DEFAULT NULL,
`key_store_password` varchar(255) DEFAULT NULL,
`is_default` INTEGER(2) NOT NULL,
`force_https` INTEGER(2) NOT NULL,
`enable` INTEGER(2) NOT NULL,
`create_time` TIMESTAMP NOT NULL,
`update_time` TIMESTAMP NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS I_domain_name_domain ON domain_name (`domain` ASC);
#
CREATE TABLE IF NOT EXISTS `domain_port_mapping` (
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
`subdomain` VARCHAR(50) NOT NULL,
`domain_name_id` INTEGER NOT NULL,
`port_mapping_id` INTEGER NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS I_unique_domain_port_mapping ON domain_port_mapping (`domain_name_id` ASC, `subdomain` ASC);
CREATE INDEX IF NOT EXISTS I_domain_port_mapping_domain_name_id ON domain_port_mapping (`domain_name_id` ASC);
CREATE INDEX IF NOT EXISTS I_domain_port_mapping_port_mapping_id ON domain_port_mapping (`port_mapping_id` ASC);
# port_mapping表删除字段
ALTER TABLE `port_mapping` DROP COLUMN `subdomain`;
@@ -50,6 +50,36 @@ CREATE TABLE IF NOT EXISTS `port_group` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `security_group` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`name` varchar(20) NOT NULL COMMENT '安全组名称',
`description` varchar(255) COMMENT '安全组描述',
`user_id` int NOT NULL COMMENT '用户ID',
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`default_pass_type` int NOT NULL COMMENT '默认放行类型',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `security_rule` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`group_id` int NOT NULL COMMENT '关联安全组',
`name` varchar(20) NOT NULL COMMENT '规则名称',
`description` varchar(255) NOT NULL COMMENT '规则描述',
`rule` text NOT NULL COMMENT '规则内容',
`pass_type` int NOT NULL COMMENT '放行类型',
`priority` int(1) NOT NULL COMMENT '优先级',
`user_id` int NOT NULL COMMENT '用户ID',
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `I_security_rule_group_id_priority` (`group_id`, `priority`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
##########################################################
#license表
CREATE TABLE IF NOT EXISTS `license` (
@@ -57,6 +87,8 @@ CREATE TABLE IF NOT EXISTS `license` (
`name` varchar(50) NOT NULL COMMENT 'license名称',
`key` varchar(100) NOT NULL COMMENT 'license key',
`user_id` int NOT NULL COMMENT '用户ID',
`up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速',
`down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速',
`is_online` int NOT NULL COMMENT '是否在线(1、在线 2、离线)',
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
@@ -70,20 +102,50 @@ CREATE TABLE IF NOT EXISTS `port_mapping` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`license_id` int NOT NULL COMMENT 'licenseID',
`protocal` varchar(10) NOT NULL DEFAULT 'TCP' COMMENT '协议',
`subdomain` varchar(50) DEFAULT NULL COMMENT '子域名(仅HTTP时有效)',
`server_port` int NOT NULL COMMENT '服务端端口',
`client_ip` varchar(20) NOT NULL COMMENT '客户端IP',
`client_ip` varchar(255) NOT NULL COMMENT '客户端IP',
`client_port` int NOT NULL COMMENT '客户端端口',
`up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速',
`down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速',
`is_online` int NOT NULL COMMENT '是否在线(1、在线 2、离线)',
`description` varchar(100) DEFAULT NULL COMMENT '描述',
`proxy_responses` int NOT NULL DEFAULT 0 COMMENT '代理响应数据包数量',
`proxy_timeout_ms` int NOT NULL DEFAULT 0 COMMENT '代理超时毫秒数',
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`security_group_id` int DEFAULT 0 COMMENT '安全组Id',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `I_port_mapping_server_port` (`server_port`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `domain_name` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`domain` varchar(50) NOT NULL COMMENT '域名',
`user_id` int NOT NULL COMMENT '用户Id',
`jks` BLOB DEFAULT NULL COMMENT 'jks文件',
`key_store_password` varchar(255) DEFAULT NULL COMMENT 'jks密码',
`is_default` int(2) NOT NULL COMMENT '是否开启默认域名(1、开启 2、关闭)',
`force_https` int(2) NOT NULL COMMENT '是否启用强制https(1、开启 2、关闭)',
`enable` int(2) NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_time` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE INDEX `I_domain_name_domain` (`domain` ASC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `domain_port_mapping` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '创建时间',
`subdomain` varchar(50) NOT NULL COMMENT '子域名',
`domain_name_id` int NOT NULL COMMENT '域名Id',
`port_mapping_id` int NOT NULL COMMENT '端口映射Id',
PRIMARY KEY (`id`),
UNIQUE INDEX `I_unique_domain_port_mapping` (`domain_name_id` ASC, `subdomain` ASC),
INDEX `I_domain_port_mapping_domain_name_id` (`domain_name_id` ASC),
INDEX `I_domain_port_mapping_port_mapping_id` (`port_mapping_id` ASC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
##########################################################
#
CREATE TABLE IF NOT EXISTS `user_login_record` (
@@ -145,8 +207,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_minute` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` int NOT NULL COMMENT '用户ID',
`license_id` int NOT NULL COMMENT 'licenseId',
`write_bytes` int NOT NULL COMMENT '写入流量',
`read_bytes` int NOT NULL COMMENT '读取流量',
`write_bytes` bigint NOT NULL COMMENT '写入流量',
`read_bytes` bigint NOT NULL COMMENT '读取流量',
`date` datetime(3) NOT NULL COMMENT '时间',
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd HH:mm',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
@@ -162,8 +224,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_hour` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` int NOT NULL COMMENT '用户ID',
`license_id` int NOT NULL COMMENT 'licenseId',
`write_bytes` int NOT NULL COMMENT '写入流量',
`read_bytes` int NOT NULL COMMENT '读取流量',
`write_bytes` bigint NOT NULL COMMENT '写入流量',
`read_bytes` bigint NOT NULL COMMENT '读取流量',
`date` datetime(3) NOT NULL COMMENT '时间',
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd HH',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
@@ -179,8 +241,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_day` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` int NOT NULL COMMENT '用户ID',
`license_id` int NOT NULL COMMENT 'licenseId',
`write_bytes` int NOT NULL COMMENT '写入流量',
`read_bytes` int NOT NULL COMMENT '读取流量',
`write_bytes` bigint NOT NULL COMMENT '写入流量',
`read_bytes` bigint NOT NULL COMMENT '读取流量',
`date` datetime(3) NOT NULL COMMENT '时间',
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
@@ -196,8 +258,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_month` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` int NOT NULL COMMENT '用户ID',
`license_id` int NOT NULL COMMENT 'licenseId',
`write_bytes` int NOT NULL COMMENT '写入流量',
`read_bytes` int NOT NULL COMMENT '读取流量',
`write_bytes` bigint NOT NULL COMMENT '写入流量',
`read_bytes` bigint NOT NULL COMMENT '读取流量',
`date` datetime(3) NOT NULL COMMENT '时间',
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
@@ -1,7 +1,7 @@
#port_mapping
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(1, 1, 9101, 'HTTP', 'test1', '127.0.0.1', 8080, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(2, 1, 9102, 'TCP', '', '127.0.0.1', 3306, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(3, 1, 9103, 'HTTP', 'test2', '127.0.0.1', 8081, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(1, 1, 9101, 'HTTP', '127.0.0.1', 8080, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(2, 1, 9102, 'TCP', '127.0.0.1', 3306, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(3, 1, 9103, 'HTTP', '127.0.0.1', 8081, 2, 1, now(), now());
@@ -0,0 +1,3 @@
#
INSERT INTO domain_name(`id`, `domain`, `user_id`, `jks`, `key_store_password`, `is_default`, `force_https`, `enable`,`create_time`, `update_time`) VALUES
(1, 'default.fun', 1, null, null, 1, 2, 1, now(), now());
@@ -50,6 +50,36 @@ CREATE TABLE IF NOT EXISTS `port_group` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `security_group` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`name` varchar(20) NOT NULL COMMENT '安全组名称',
`description` varchar(255) COMMENT '安全组描述',
`user_id` int NOT NULL COMMENT '用户ID',
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`default_pass_type` int NOT NULL COMMENT '默认放行类型',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `security_rule` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`group_id` int NOT NULL COMMENT '关联安全组',
`name` varchar(20) NOT NULL COMMENT '规则名称',
`description` varchar(255) NOT NULL COMMENT '规则描述',
`rule` text NOT NULL COMMENT '规则内容',
`pass_type` int NOT NULL COMMENT '放行类型',
`priority` int(1) NOT NULL COMMENT '优先级',
`user_id` int NOT NULL COMMENT '用户ID',
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `I_security_rule_group_id_priority` (`group_id`, `priority`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
##########################################################
#license表
CREATE TABLE IF NOT EXISTS `license` (
@@ -57,6 +87,8 @@ CREATE TABLE IF NOT EXISTS `license` (
`name` varchar(50) NOT NULL COMMENT 'license名称',
`key` varchar(100) NOT NULL COMMENT 'license key',
`user_id` int NOT NULL COMMENT '用户ID',
`up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速',
`down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速',
`is_online` int NOT NULL COMMENT '是否在线(1、在线 2、离线)',
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
@@ -70,20 +102,50 @@ CREATE TABLE IF NOT EXISTS `port_mapping` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`license_id` int NOT NULL COMMENT 'licenseID',
`protocal` varchar(10) NOT NULL DEFAULT 'TCP' COMMENT '协议',
`subdomain` varchar(50) DEFAULT NULL COMMENT '子域名(仅HTTP时有效)',
`server_port` int NOT NULL COMMENT '服务端端口',
`client_ip` varchar(20) NOT NULL COMMENT '客户端IP',
`client_ip` varchar(255) NOT NULL COMMENT '客户端IP',
`client_port` int NOT NULL COMMENT '客户端端口',
`up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速',
`down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速',
`is_online` int NOT NULL COMMENT '是否在线(1、在线 2、离线)',
`description` varchar(100) DEFAULT NULL COMMENT '描述',
`proxy_responses` int NOT NULL DEFAULT 0 COMMENT '代理响应数据包数量',
`proxy_timeout_ms` int NOT NULL DEFAULT 0 COMMENT '代理超时毫秒数',
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`security_group_id` int DEFAULT 0 COMMENT '安全组Id',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `I_port_mapping_server_port` (`server_port`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `domain_name` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`domain` varchar(50) NOT NULL COMMENT '域名',
`user_id` int NOT NULL COMMENT '用户Id',
`jks` BLOB DEFAULT NULL COMMENT 'jks文件',
`key_store_password` varchar(255) DEFAULT NULL COMMENT 'jks密码',
`is_default` int(2) NOT NULL COMMENT '是否开启默认域名(1、开启 2、关闭)',
`force_https` int(2) NOT NULL COMMENT '是否启用强制https(1、开启 2、关闭)',
`enable` int(2) NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_time` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE INDEX `I_domain_name_domain` (`domain` ASC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `domain_port_mapping` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '创建时间',
`subdomain` varchar(50) NOT NULL COMMENT '子域名',
`domain_name_id` int NOT NULL COMMENT '域名Id',
`port_mapping_id` int NOT NULL COMMENT '端口映射Id',
PRIMARY KEY (`id`),
UNIQUE INDEX `I_unique_domain_port_mapping` (`domain_name_id` ASC, `subdomain` ASC),
INDEX `I_domain_port_mapping_domain_name_id` (`domain_name_id` ASC),
INDEX `I_domain_port_mapping_port_mapping_id` (`port_mapping_id` ASC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
##########################################################
#
CREATE TABLE IF NOT EXISTS `user_login_record` (
@@ -145,8 +207,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_minute` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` int NOT NULL COMMENT '用户ID',
`license_id` int NOT NULL COMMENT 'licenseId',
`write_bytes` int NOT NULL COMMENT '写入流量',
`read_bytes` int NOT NULL COMMENT '读取流量',
`write_bytes` bigint NOT NULL COMMENT '写入流量',
`read_bytes` bigint NOT NULL COMMENT '读取流量',
`date` datetime(3) NOT NULL COMMENT '时间',
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd HH:mm',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
@@ -162,8 +224,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_hour` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` int NOT NULL COMMENT '用户ID',
`license_id` int NOT NULL COMMENT 'licenseId',
`write_bytes` int NOT NULL COMMENT '写入流量',
`read_bytes` int NOT NULL COMMENT '读取流量',
`write_bytes` bigint NOT NULL COMMENT '写入流量',
`read_bytes` bigint NOT NULL COMMENT '读取流量',
`date` datetime(3) NOT NULL COMMENT '时间',
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd HH',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
@@ -179,8 +241,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_day` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` int NOT NULL COMMENT '用户ID',
`license_id` int NOT NULL COMMENT 'licenseId',
`write_bytes` int NOT NULL COMMENT '写入流量',
`read_bytes` int NOT NULL COMMENT '读取流量',
`write_bytes` bigint NOT NULL COMMENT '写入流量',
`read_bytes` bigint NOT NULL COMMENT '读取流量',
`date` datetime(3) NOT NULL COMMENT '时间',
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
@@ -196,8 +258,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_month` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` int NOT NULL COMMENT '用户ID',
`license_id` int NOT NULL COMMENT 'licenseId',
`write_bytes` int NOT NULL COMMENT '写入流量',
`read_bytes` int NOT NULL COMMENT '读取流量',
`write_bytes` bigint NOT NULL COMMENT '写入流量',
`read_bytes` bigint NOT NULL COMMENT '读取流量',
`date` datetime(3) NOT NULL COMMENT '时间',
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
@@ -207,3 +269,4 @@ CREATE TABLE IF NOT EXISTS `flow_report_month` (
KEY `I_flow_report_month_user_id` (`user_id`),
KEY `I_flow_report_month_license_id` (`license_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@@ -1,7 +1,7 @@
#port_mapping
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(1, 1, 9101, 'HTTP', 'test1', '127.0.0.1', 8080, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(2, 1, 9102, 'TCP', '', '127.0.0.1', 3306, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(3, 1, 9103, 'HTTP', 'test2', '127.0.0.1', 8081, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(1, 1, 9101, 'HTTP', '127.0.0.1', 8080, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(2, 1, 9102, 'TCP', '127.0.0.1', 3306, 2, 1, now(), now());
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
(3, 1, 9103, 'HTTP', '127.0.0.1', 8081, 2, 1, now(), now());
@@ -0,0 +1,8 @@
ALTER TABLE `flow_report_minute` MODIFY COLUMN `read_bytes` BIGINT NOT NULL COMMENT '读取流量';
ALTER TABLE `flow_report_minute` MODIFY COLUMN `write_bytes` BIGINT NOT NULL COMMENT '写入流量';
ALTER TABLE `flow_report_hour` MODIFY COLUMN `read_bytes` BIGINT NOT NULL COMMENT '读取流量';
ALTER TABLE `flow_report_hour` MODIFY COLUMN `write_bytes` BIGINT NOT NULL COMMENT '写入流量';
ALTER TABLE `flow_report_day` MODIFY COLUMN `read_bytes` BIGINT NOT NULL COMMENT '读取流量';
ALTER TABLE `flow_report_day` MODIFY COLUMN `write_bytes` BIGINT NOT NULL COMMENT '写入流量';
ALTER TABLE `flow_report_month` MODIFY COLUMN `read_bytes` BIGINT NOT NULL COMMENT '读取流量';
ALTER TABLE `flow_report_month` MODIFY COLUMN `write_bytes` BIGINT NOT NULL COMMENT '写入流量';
@@ -0,0 +1,38 @@
#
CREATE TABLE IF NOT EXISTS `security_group` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`name` varchar(20) NOT NULL COMMENT '安全组名称',
`description` varchar(255) COMMENT '安全组描述',
`user_id` int NOT NULL COMMENT '用户ID',
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`default_pass_type` int NOT NULL COMMENT '默认放行类型',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `security_rule` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`group_id` int NOT NULL COMMENT '关联安全组',
`name` varchar(20) NOT NULL COMMENT '规则名称',
`description` varchar(255) NOT NULL COMMENT '规则描述',
`rule` text NOT NULL COMMENT '规则内容',
`pass_type`int NOT NULL COMMENT '放行类型',
`priority` int(1) NOT NULL COMMENT '优先级',
`user_id` int NOT NULL COMMENT '用户ID',
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `I_security_rule_group_id_priority` (`group_id`, `priority`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
# port_mapping表增加字段
ALTER TABLE `port_mapping` ADD COLUMN `security_group_id` int DEFAULT 0 COMMENT '安全组Id';
ALTER TABLE `port_mapping` ADD COLUMN `up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速';
ALTER TABLE `port_mapping` ADD COLUMN `down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速';
# license表增加字段
ALTER TABLE `license` ADD COLUMN `up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速';
ALTER TABLE `license` ADD COLUMN `down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速';
@@ -0,0 +1,30 @@
#
CREATE TABLE IF NOT EXISTS `domain_name` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`domain` varchar(50) NOT NULL COMMENT '域名',
`user_id` int NOT NULL COMMENT '用户Id',
`jks` BLOB DEFAULT NULL COMMENT 'jks文件',
`key_store_password` varchar(255) DEFAULT NULL COMMENT 'jks密码',
`is_default` int(2) NOT NULL COMMENT '是否开启默认域名(1、开启 2、关闭)',
`force_https` int(2) NOT NULL COMMENT '是否启用强制https(1、开启 2、关闭)',
`enable` int(2) NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_time` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE INDEX `I_domain_name_domain` (`domain` ASC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
#
CREATE TABLE IF NOT EXISTS `domain_port_mapping` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '创建时间',
`subdomain` varchar(50) NOT NULL COMMENT '子域名',
`domain_name_id` int NOT NULL COMMENT '域名Id',
`port_mapping_id` int NOT NULL COMMENT '端口映射Id',
PRIMARY KEY (`id`),
UNIQUE INDEX `I_unique_domain_port_mapping` (`domain_name_id` ASC, `subdomain` ASC),
INDEX `I_domain_port_mapping_domain_name_id` (`domain_name_id` ASC),
INDEX `I_domain_port_mapping_port_mapping_id` (`port_mapping_id` ASC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
# port_mapping表删除字段
ALTER TABLE `port_mapping` DROP COLUMN `subdomain`;
@@ -30,8 +30,10 @@ module.exports = {
{text: '后台操作指南', link: '/pages/793dcc/'},
]
},
{text: '支持', link: '/pages/a3f096/'},
{text: '案例', link: '/pages/5d571c/'},
{text: '支持', link: '/pages/1ab20b/'},
{text: '更新记录', link: '/pages/ff3519/'},
{text: 'GitCode', link: 'https://gitcode.com/dromara/neutrino-proxy'},
{text: 'Gitee', link: 'https://gitee.com/dromara/neutrino-proxy'},
],
sidebarDepth: 2, // 侧边栏显示深度,默认1,最大2(显示到h3标题)
Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

@@ -6,13 +6,7 @@ article: false
---
::: tip
当前最新版本2.0.0,如果从之前的版本升级来,请注意以下变更
1、jdk版本升级为了jdk17,jar部署时请注意
2、去掉了默认的sqlite数据库,改为了h2。如果之前使用sqlite,请自行处理数据迁移
3、配置文件做了较大调整,请参照使用须知中的`服务端配置``客户端配置`进行更新
当前最新版本2.0.2。从之前的版本升级来,请参照:更新记录 > 版本记录
:::
## 1、快速上手须知
@@ -22,8 +16,7 @@ article: false
- 快速上手中涉及到的配置,仅仅是快速体验所必须的配置,完整的配置请参照使用须知中的`服务端配置``客户端配置`
## 2、部署服务
- 根据需要自行选择jar、docker、原生部署任意一种完成部署
- 三种方式分别参见对应的文档
- 根据需要自行选择jar、docker、原生部署、docker-compose任意一种完成部署,分别参见对应的文档
- 任何一种部署方式,不要求客户端与服务端一致。如:服务端采用docker部署,客户端可以用docker部署、也可以用jar、原生部署
- 管理后台说明
- 服务端部署成功后,访问http://{服务端IP}:8888打开后台管理页面。使用默认的管理员帐号登录:admin/123456
@@ -5,15 +5,15 @@ permalink: /pages/eebea1/
---
## 1、环境准备
- 首先确保已安装Java17运行环境
- 打开[发行版页面](https://gitee.com/dromara/neutrino-proxy/releases),下载最新的release包:`neutrino-proxy-server.jar``neutrino-proxy-client.jar`
- 首先确保已安装Java21运行环境
- 打开[发行版页面](https://gitee.com/dromara/neutrino-proxy/releases),下载最新的release包:`neutrino-proxy-server-jdk21-2.0.2-jar.zip``neutrino-proxy-client-jdk21-2.0.2-jar.zip`
## 2、部署服务端
- 在服务器上新建部署目录:`/work/projects/neutrino-proxy-server`
- 将` neutrino-proxy-server.jar`上传至服务器部署目录
- 将`neutrino-proxy-server-jdk21-2.0.2-jar.zip`上传至服务器部署目录,并解压
- 执行命令`java -Dfile.encoding=utf-8 -jar neutrino-proxy-server.jar`启动服务端完成部署,默认使用h2数据库。
- 若需要指定自己的mysql数据库,同样的需要在当前目录下新建`app.yml`文件,配置内容如下。执行命令`java -Dfile.encoding=utf-8 -jar neutrino-proxy-server.jar config=app.yml`启动服务端完成部署
- 若需要指定自己的mysql数据库,需要在当前目录下`app.yml`文件中,修改数据库配置如下:
```yml
neutrino:
@@ -32,8 +32,8 @@ neutrino:
- 可参照 https://gitee.com/dromara/neutrino-proxy/blob/master/scripts/unix/server_start.sh 使用shell脚本启动服务端。
## 3、部署客户端
- 客户端采用docker部署,使用代理时会存在更多的坑点,因此官方并不推荐
- 在本地`neutrino-proxy-client.jar`同级别目录下新建`app.yml`文件,并配置如下内容
- 本地解压`neutrino-proxy-client-jdk21-2.0.2-jar.zip`文件
- 修改`app.yml`文件中的server-ip为服务器公网ip,并配置license-key,以下是相关的部分配置
```yml
neutrino:
proxy:
@@ -51,5 +51,5 @@ neutrino:
# licenseKey,客户端凭证。此处需要配置刚刚从管理后台复制的LicenseKey
license-key: xxxx
```
- 执行命令`java -jar neutrino-proxy-client.jar config=app.yml`启动客户端
- 执行命令`java -jar neutrino-proxy-client.jar`启动客户端
@@ -5,6 +5,8 @@ permalink: /pages/5b9bef/
---
## 1、 部署服务端
- dockerHub镜像地址:aoshiguchen/neutrino-proxy-server:latest
- 阿里云镜像地址:registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:latest
### 使用默认h2数据库一键部署
```shell
docker run -it -p 9000-9200:9000-9200/tcp -p 8888:8888 \
@@ -12,7 +14,7 @@ docker run -it -p 9000-9200:9000-9200/tcp -p 8888:8888 \
-v /root/neutrino-proxy-server/config:/root/neutrino-proxy/config \
-v /root/neutrino-proxy-server/data:/root/neutrino-proxy/data \
-v /root/neutrino-proxy-server/logs:/root/neutrino-proxy/logs \
registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:latest
aoshiguchen/neutrino-proxy-server:latest
```
### 指定自己的mysql数据库
@@ -34,8 +36,10 @@ neutrino:
- 然后再执行上面的docker一键部署命令即可
## 2、部署客户端
- dockerHub镜像地址:aoshiguchen/neutrino-proxy-client:latest
- 阿里云镜像地址:registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy-client:latest
- 命令中的服务端ip、license请自行补充
- 若是首次使用,请仔细月度快速上手,以确定license从哪里取得
- 若是首次使用,请仔细阅读快速上手,以确定license从哪里取得
```shell
docker run -it -d --restart=always --name npclient -e SERVER_IP=xxxx -e LICENSE_KEY=xxxx \
aoshiguchen/neutrino-proxy-client:latest
@@ -3,3 +3,59 @@ title: 原生部署
date: 2023-10-26 13:51:44
permalink: /pages/69699a/
---
::: tip
1、目前的原生部署包支持mac、linux、windows三个平台
2、这三个平台的部署包均由作者分别测试通过
3、尽管如此,仍然可能存在有的机器不支持的情况,可自行拉取仓库源码编译出目标平台可执行文件、或换成其它部署方式
4、若linux/mac下提示文件没有执行权限,可执行`chmod +x {文件路径}`解决
5、若mac下运行提示移到废纸篓,可执行`sudo xattr -rd com.apple.quarantine {文件路径}`解决
:::
## 1、安装包下载
- 打开[发行版页面](https://gitee.com/dromara/neutrino-proxy/releases),下载所需的最新的release包:
- 比如服务器为linux则可下载`neutrino-proxy-server-linux-2.0.2-native.zip`文件,客户端为windows则可下载`neutrino-proxy-client-windows-2.0.2-native.zip`
## 2、部署服务端
- 将服务端安装包上传至服务器,并解压
- 服务端默认使用h2数据库,若需要改为mysql,则可修改安装包`app.yml`内的数据库配置,如下:
```yml
neutrino:
data:
db:
type: mysql
# 自己的数据库实例,创建一个空的名为'neutrino-proxy'的数据库即可,首次启动服务端会自动初始化
url: jdbc:mysql://xxxx:3306/neutrino-proxy?useUnicode=true&allowMultiQueries=true&useAffectedRows=true&useSSL=false
driver-class: com.mysql.jdbc.Driver
# 数据库帐号
username: xxx
# 数据库密码
password: xxx
```
- 然后直接启动服务端可执行程序即可
## 3、部署客户端
- 本地解压客户端安装包
- 修改`app.yml`文件中的server-ip为服务器公网ip,并配置license-key,以下是相关的部分配置:
```yml
neutrino:
proxy:
tunnel:
# ssl证书密钥(使用jjar包内自带的证书,则此处无需修改)
key-store-password: 123456
# ssl证书管理密钥(使用jjar包内自带的证书,则此处无需修改。自定义证书,则此处配置对应的路径)
jks-path: classpath:/test.jks
# 代理服务端IP
server-ip: xxxx
# 代理服务端IP, 若是非ssl端口,则ssl-enable需要配置为false
server-port: 9002
# 是否启用ssl
ssl-enable: true
# licenseKey,客户端凭证。此处需要配置刚刚从管理后台复制的LicenseKey
license-key: xxxx
```
- 然后直接启动客户端可执行程序即可
@@ -0,0 +1,30 @@
---
title: 使用docker-compose部署
date: 2024-12-07 14:40:50
permalink: /pages/2d4123/
---
## 1、 部署服务端
### 使用默认h2数据库一键部署
- 注意自行修改配置文件:config/app.yml
```shell
git clone https://gitee.com/dromara/neutrino-proxy.git
cd neutrino-proxy/scripts/docker-compose/neutrino-proxy-server-h2
docker-compose up -d
```
### 使用默认mysql数据库一键部署
- 注意自行修改配置文件:config/app.yml
```shell
git clone https://gitee.com/dromara/neutrino-proxy.git
cd neutrino-proxy/scripts/docker-compose/neutrino-proxy-server-mysql
docker-compose up -d
```
## 2、部署客户端
- 注意自行修改配置文件:config/app.yml
```shell
git clone https://gitee.com/dromara/neutrino-proxy.git
cd neutrino-proxy/scripts/docker-compose/neutrino-proxy-client
docker-compose up -d
```
@@ -17,8 +17,23 @@ article: false
# 代理配置
- License管理:License是客户端连接服务端的唯一合法凭证。一个License同时只能被一个客户端使用,一个License可以维护多条端口映射
- 端口映射:服务端IP+端口 -> 客户端IP+端口的四元组映射(因目前服务端单节点只有一个公网IP,所以不体现出来),是内网穿透的基本单元。
- 限速:
- 默认所有代理没有限速
- 对License限速,将使得License下的所有端口映射都被限速
- 若License设置了限速,License下的某条映射也设置了限速,则对于该映射优先采用端口映射上的限速规则
- 域名管理:用于管理服务器主域名和证书,用于支持域名映射。一个主域名域名可以创建多个域名映射(配置不同的子域名)。
<img :src="$withBase('/img/run-example/license2.png')"></img>
<img :src="$withBase('/img/run-example/port-mapping2.png')"></img>
# 安全组
一个端口映射可绑定一个安全组,通过安全组的默认放行类型 + 安全组下的安全规则 控制该端口映射的安全访问规则。
- 场景1: 内部服务,穿透出来自己使用,不希望被其他人访问。端口映射可关联一个默认放行类型为“拒绝”的安全组,安全组下新增安全规则,将本地的出口ip添加到允许放行规则中。
- 场景2:公网服务,穿透出来开放给大家使用,但是希望拒绝某些IP访问。端口映射可关联一个默认放行类型为“允许”的安全组,安全组下新增安全规则,将黑名单ip添加到拒绝放行规则中。
<img :src="$withBase('/img/run-example/security-group1.png')"></img>
<img :src="$withBase('/img/run-example/security-rule1.png')"></img>
<img :src="$withBase('/img/run-example/license1.png')"></img>
# 系统管理
- 用户管理:支持多用户,一个用户可持有多个License。由于项目目前主推个人版,所以暂是没有权限这一套,管理员之外的所有用户都属于游客。对于绝大多数操作,游客仅有只读权限。
@@ -44,4 +59,4 @@ article: false
- 登录日志:管理后端登录、退出登录的日志
- 客户端连接日志:客户端连接、断开的日志
<img :src="$withBase('/img/run-example/login-log1.png')"></img>
<img :src="$withBase('/img/run-example/login-log1.png')"></img>
@@ -6,6 +6,7 @@ permalink: /pages/269a2e/
# 什么是域名映射?
域名映射是将指定端口映射绑定到某一个子域名上,通过直接访问域名的方式,达到访问被代理服务的目的。
支持维护多个主域名并为多个主域名配置不同的子域名实现域名映射。
# 域名映射能解决什么问题?
- 1、当服务端端口需要经常变动的时候,可以通过固定域名的方式,使得开发调试能够长期稳定的进行,不用每次更改访问地址。
@@ -17,8 +18,8 @@ permalink: /pages/269a2e/
## 情况1:代理服务端使用80端口
- 1、DNS解析配置泛域名解析 proxy.asgc.fun 指向代理服务端IP
- 2、代理服务端app.yml配置域名:proxy.asgc.fun,部署
- 3、服务端管理后台新建端口映射,协议选择:HTTP设置好子域名,如:test1
- 2、服务端管理后台域名管理新建域名,如:asgc.fun
- 3、服务端管理后台新建端口映射,协议选择:HTTP(S),选择主域名并设置好子域名,如:test1.proxy
- 4、配置好客户端并启动,代理映射完成
- 5、通过访问: http://test1.proxy.asgc.fun 实现访问被代理服务
@@ -27,8 +28,8 @@ permalink: /pages/269a2e/
- 1、DNS解析配置泛域名解析 proxy.asgc.fun 指向代理服务端IP
- 2、nginx 80端口下将 *.proxy.asgc.fun 请求转到82端口,并附带原有请求头(特别是`Host`
- 3、代理服务端app.yml配置域名:proxy.asgc.fun,部署
- 4、服务端管理后台新建端口映射,协议选择:HTTP,设置好子域名,如:test1
- 3、服务端管理后台域名管理新建域名,如:asgc.fun
- 4、服务端管理后台新建端口映射,协议选择:HTTP(S),设置好子域名,如:test1.proxy
- 5、配置好客户端并启动,代理映射完成
- 6、通过访问: http://test1.proxy.asgc.fun 实现访问被代理服务
@@ -36,6 +37,13 @@ permalink: /pages/269a2e/
不行的。之所以能实现域名绑定,原因是HTTP请求附带了Host请求头,包含了请求的域名信息,代理服务端能根据请求的域名做分发。而TCP协议本身并不包含域名,因此无法实现。
所以,目前只有HTTP(涵盖HTTPS)协议能支持。
# 域名映射支持HTTPS吗?
支持的。在服务端管理后台-域名管理中新建域名并上传域名对应的服务器证书,可以选择强制HTTPS,这样会拦截所有HTTP请求,只支持通过HTTPS访问。
如果上传后的证书仍不支持HTTPS访问,请确保上传证书有效并且和配置的主域名或完整域名映射匹配。
# 上传服务器证书的文件有要求吗?
有的。目前只支持通过jks文件上传服务器证书,jks文件中只包含服务器证书(如:.cer文件),并设置密码。
# 代理服务端使用非80端口时,nginx配置示例
```
server {
@@ -18,7 +18,8 @@ permalink: /pages/99a300/
## HTTPS配置流程
- 按照域名映射流程,完成域名的配置
- 在服务端配置域名的HTTPS证书信息(此处应该是通配符证书)
- 在服务端管理后台上传对应域名的HTTPS证书信息(此处应该是通配符证书)
## HTTPS端口问题
- 与HTTP类似,HTTPS也有一个默认端口:443,默认情况下需要占用服务端443端口
@@ -1,12 +1,12 @@
---
title: 服务端配置
date: 2023-05-27 11:41:44
date: 2024-09-22 11:41:44
permalink: /pages/f2d0f1/
---
::: tip
1.9.0版本,服务端配置格式有所调整。从之前的版本升级的,需要注意
2.0.2版本,服务端配置格式有所调整。从之前的版本升级的,需要注意
:::
@@ -46,11 +46,6 @@ neutrino:
http-proxy-port: ${HTTP_PROXY_PORT:80}
# https代理端口,默认443 (需要配置域名、证书)
https-proxy-port: ${HTTPS_PROXY_PORT:443}
# 如果不配置,则不支持域名映射
domain-name: ${DOMAIN_NAME:}
# https证书配置
key-store-password: ${HTTPS_STORE_PASS:}
jks-path: ${HTTPS_JKS_PATH:}
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
transfer-log-enable: ${SERVER_LOG:false}
udp:
@@ -62,9 +57,9 @@ neutrino:
data:
db:
# 数据库类型,目前支持sqlite、mysql、mariadb
type: ${DB_TYPE:sqlite}
type: ${DB_TYPE:h2}
# 数据库连接URL
url: ${DB_URL:jdbc:sqlite:data.db}
url: ${DB_URL:jdbc:h2:file:./data/db;MODE=MySQL;AUTO_SERVER=TRUE}
# 数据库用户名
username: ${DB_USER:}
# 数据库密码
@@ -12,11 +12,13 @@ permalink: /pages/50ce10/
# 以下是最新的客户端配置格式(app.yml)
```yml
# 日志级别
solon.logging.logger:
"root":
level: info
neutrino:
proxy:
logger:
# 日志级别
level: ${LOG_LEVEL:info}
tunnel:
# 线程池相关配置,用于技术调优,可忽略
thread-count: 50
@@ -35,6 +37,8 @@ neutrino:
client-id: ${CLIENT_ID:}
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
transfer-log-enable: ${CLIENT_LOG:false}
# 是否开启心跳日志
heartbeat-log-enable: ${HEARTBEAT_LOG:false}
# 重连设置
reconnection:
# 重连间隔(秒)
@@ -0,0 +1,8 @@
---
title: 服务端原声包启动,db初始化异常
date: 2024-11-09 15:28:37
permalink: /pages/7dcba8/
---
## 1.1、报错“Data truncation: Data too long for column 'name' at row 1”
配置文件中配置的mysql连接地址,去掉“characterEncoding=UTF-8”参数
@@ -11,9 +11,9 @@ permalink: /pages/1ab20b/
|:-----|:-----|:----------------------|
| 任意金额 | - | 您将获得赞助者列表的永久留名。 |
| 30 | 一个月 | 您在群内反馈的问题将优先得到作者响应 |
| 80 | 三个月 | 获得微信一对一的咨询服务 |
| 180 | 个月 | 获得官网首页特别赞助席位一个,一次远程协助 |
| 更多金额 |-| 您将获得私人定制服务 |
| 120 | 三个月 | 获得微信一对一的咨询服务 |
| 399 | 个月 | 获得官网首页特别赞助席位一个,一次远程协助 |
| 更多金额 | - | 您将获得私人定制服务 |
> 注意1:服务项目是逐级叠加:如,您赞赏的金额是 80 员那么您将享受:任意金额、一个月、三个月的服务内容
@@ -36,8 +36,8 @@ permalink: /pages/a3f096/
- 注释完备,尤其每个新增的方法应按照Java文档规范标明方法说明、参数说明、返回值说明等信息,必要时请添加单元测试,如果愿意,也可以加上你的大名。
- 原则上,不允许自行添加第三方依赖库。若确有必要,请先和项目负责人沟通达成一致。
- 对现有代码的优化,请在注释中说明原因。
- 如果涉及到数据库的变更,则至少需要做到以下点:
- sqlite、mysql下均测试通过
- 如果涉及到数据库的变更,则至少需要做到以下点:
- h2、mysql下均测试通过
- 在`./neutrino-proxy-server/src/main/resource/sql`下维护更新对应的表结构sql文件
- 对于新增的表,维护必要的初始化数据
- 在对应的mysql、sqlite的update目录下,维护SQL变更记录,确保SQL执行测试通过
- 在对应的mysql、h2的update目录下,维护SQL变更记录,确保SQL执行测试通过
@@ -6,8 +6,24 @@ permalink: /pages/cded59/
| 日期 | 渠道 | 金额 |昵称| 备注 |
|:-----------|:---|:-----|:-|:-----------------|
|2023-10-11|微信红包|50|喜鸽小宝||
|2023-10-10|微信红包|20|海洋||
|2023-12-28|微信红包|50|雪猫|请大佬吃肯德基|
|2023-12-27|微信红包|50|D|请大佬喝杯茶|
|2023-12-25|微信赞赏码|30|Simen|伟大的项目,尽点绵薄之力|
|2023-12-25|微信红包|50|KAI|大佬加油|
|2023-12-22|微信赞赏|30|walking|好东西必须支持一下|
|2023-12-21|微信红包|100|洗最大的碗|中微子越来越强大,雨哥越来越富有|
|2023-12-15|Gitee捐助|10|一杯香梨||
|2023-12-12|微信红包|50|喜鸽小宝||
|2023-11-30|支付宝收款码|30|*平|大佬继续加油|
|2023-11-30|Gitee捐助|10|26263|感谢您的开源项目!|
|2023-11-30|微信红包|10|姫野永遠||
| 2023-11-26 |微信转账|180|Teacher Du||
| 2023-11-10 |微信红包|50|喜鸽小宝||
| 2023-11-01 |微信红包|20|Sun|感谢大佬,请你喝杯奶茶[微笑]|
| 2023-10-30 |微信赞赏|50|杨娃娃||
| 2023-10-16 |微信转账|50|Mark Isaac赵方丈|金额不大,开源感恩。|
| 2023-10-11 |微信红包|50|喜鸽小宝||
| 2023-10-10 |微信红包|20|海洋||
| 2023-07-31 |Gitee捐助| 50 |失败女神| 感谢您的开源项目! |
| 2023-07-28 |微信转账| 50 |AdrianPteLtd.com-咨询| |
| 2023-07-12 |微信红包| 100 |MaxKeyTop| 请大佬抽包烟 |
@@ -0,0 +1,28 @@
---
title: 2024年
date: 2024-04-16 19:22:05
permalink: /pages/acdf0a/
---
| 日期 | 渠道 | 金额 |昵称| 备注 |
|:-----------|:---|:-----|:-|:--------------------------------------|
| 2024-11-19|支付宝收款码|2|*亮||
| 2024-10-06 |Gitee捐助|100|碧云天|感谢您的开源项目!|
| 2024-10-14 |微信红包|5|泛微eteams刘新东17699059661|
| 2024-09-04 |Gitee捐助|8.88|lusen998|感谢您的开源项目!|
| 2024-08-30 | 微信转账|100|吴忧吴虑|
| 2024-07-29 |Gitee捐助|10|QuanJWS|感谢您的开源项目!看着很不错的样子,加油! |
| 2024-07-29 |微信赞赏码|120|陈某| |
| 2024-05-07 |微信转账|100|仲秀| |
| 2024-04-16 |微信转账|100|暮光:城中城| |
| 2024-04-03 |微信转账|100|仲秀| 大神,非常感谢 |
| 2024-03-24 |Gitee捐助|10|include|
| 2024-03-24 |微信赞赏码|9|宗| 麻烦了,最好能加一个返回公网IP。<br/>不知道有没有几乎通用的方案 |
| 2024-03-22 |微信红包|20|不允| 请你吃外卖 |
| 2024-03-12 |微信红包|50|喜鸽小宝|
| 2024-02-12 |微信红包|50|喜鸽小宝|
| 2024-02-02 |微信红包|38.88|不请自来君|
| 2024-01-24 |Gitee捐助|30|唐吉诃德| 感谢您的开源项目!是一个不错的项目!<br/>希望继续完善界面UI的设计。 |
| 2024-01-20 |微信红包|shiyongsway|8.88|
| 2024-01-17 |微信红包|50|喜鸽小宝| |
@@ -1,428 +0,0 @@
---
title: 案例
date: 2020-05-14 11:39:45
permalink: /pages/5d571c
# sidebar: false
article: false
---
## 特别用户
::: cardImgList 3
```yaml
config:
imgHeight: 140px
data:
# - img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20210729-233554@2x.22bdqeiem2sg.png
# link: https://docs.openharmony.cn/pages/000000/
# name: OpenHarmony
# desc: 开放原子开源基金会
# author: OpenHarmony
# avatar: https://www.openharmony.cn/static/img/core-card-item2.a72a0d10.png
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20211215-144040.hgt2875r2zc.webp
link: https://baomidou.com/
name: MyBatis-Plus官网
desc: 🚀为简化开发而生
author: 青苗
avatar: https://baomidou.com/img/logo.svg
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20210729-235804@2x.75e9lfd65t40.png
link: https://docs.deepin.org
name: Deepin 社区文档
desc: Deepin 应用开发技术分享、DTK开发经验等
author: Deepin
avatar: https://fastly.jsdelivr.net/gh/xmuli/xmuliPic@pic/2021/deepin.png
- img: https://ks3-cn-beijing.ksyuncs.com/vform-static/img/vform_website.png
link: http://www.vform666.com
name: VForm官网
desc: 低代码表单优选方案,拖拽式设计,一键生成源码
author: vformAdmin
avatar: https://www.vform666.com/vform-logo.png
- img: https://fastly.jsdelivr.net/gh/xugaoyi/blog-gitalk-comment@master/img/xxx.7feub7n1y0g0.png
link: https://liteflow.yomahub.com
name: LiteFlow官网
desc: 轻量,快速,稳定可编排的组件式规则引擎
author: 铂赛东
avatar: https://portrait.gitee.com/uploads/avatars/user/367/1102362_bryan31_1578940308.png!avatar60
- img: https://fastly.jsdelivr.net/gh/xugaoyi/blog-gitalk-comment@master/img/176866696-743faf44-4afd-4c12-9728-f982ea885836.2205nb3vf5mo.webp
link: https://easy-es.cn/
name: Easy-Es官网
desc: 傻瓜级ElasticSearch搜索引擎ORM框架
author: 老汉
avatar: https://iknow.hs.net/9fa0407f-30ff-4d8b-82da-a4990e41a04b.png
```
:::
## 知识库兼博客
::: cardImgList 4
```yaml
config:
imgHeight: 140px
data:
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200530114033.png
link: https://xugaoyi.com/
name: Evan's blog
desc: Web前端技术博客,积跬步以至千里,致敬每个爱学习的你。
author: Evan Xu
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200103123203.jpg
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200727170555.jpg
link: https://miluluyo.github.io/vdoingBlog/
name: 麋鹿鲁哟
desc: 运气交给锦鲤,</br>你只管努力就好。 (●ˇ∀ˇ●)
author: 麋鹿鲁哟
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200122153807.jpg
- img: https://i.loli.net/2020/07/26/BUCplirGIq9YTNA.png
link: https://lingze.xyz/
name: Lingze's blog
desc: 少侠, 别来无恙?
author: 令则
avatar: https://i.loli.net/2020/07/11/XhqR7Idnk5LD8bC.jpg
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20210730-000829@2x.6pjgy10flk00.png
link: https://www.xswsym.online/
name: summer's blog
desc: Devops运维技术博客,分享运维技术
author: 夏苏文
avatar: https://fastly.jsdelivr.net/gh/summerking1/image@main/tx.png
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20201110221457.png
link: https://gocifer.github.io
name: Gocifer's DB & Blog
desc: 一个中二少年,专注于计算机基础架构、云原生、网络、云计算的所学、所思、所行、所想。
author: gocifer.jay
avatar: https://gocifer.github.io/img/avatar/gocifer.png
- img: https://dra-m.com/images/thumbnail.png
link: https://dra-m.com/
name: Dra-M
desc: JAVA后端
author: 莫小龙
avatar: https://q1.qlogo.cn/g?b=qq&nk=975425198&s=640
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200905142134.png
link: https://www.coder163.com/
name: 跟着老侯玩编程
desc: 一个乐于编程知识分享的站点
author: 舞动的代码
avatar: https://www.coder163.com/img/qun.png
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20210119213748.jpg
link: https://haijunit.top/
name: 学习笔记
desc: 平时的技术积累|分享交流技术心得|温故而知新
author: 爱做梦的奋斗青年
avatar: https://haijunit.top/images/avatar.png
- img: https://fastly.jsdelivr.net/gh/yxw839841231/images/studying-icu/20210120110320.png
link: https://www.studying.icu/
name: 研究院
desc: 一万年太久,只争朝夕
author: xwyang
avatar: https://avatars1.githubusercontent.com/u/13757119?s=80&v=4
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20210704-230751@2x.3pw80u1fo6u0.png
link: https://blog.kimen.com.cn/
name: Kimen's Blog
desc: 全沾攻城狮
author: Kimen
avatar: https://avatars.githubusercontent.com/u/25970284?s=460&u=69b419ad6de33eaa1d6b73d7f065f710076d6c55&v=4
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20211101-165045-(1).4b4axinii160.png
link: https://lixianglong3210.gitee.io/xlong-vdoing/
name: XLONG's blog
desc: 蒸汽波、咖啡
author: lixianglong3210
avatar: http://www.lixianglong.cn/bg_store/img/avatar/default.jpg
- img: https://fastly.jsdelivr.net/gh/Awrtiger/mirrorfile/img/web.png
link: https://www.ool.cool/
name: 偷吃了鸡蛋的梨
desc: 捣鼓这,捣鼓那。
author: Awrtiger
avatar: https://fastly.jsdelivr.net/gh/Awrtiger/mirrorfile/img/avatar.jpg
- img: https://image-1302577725.cos.ap-beijing.myqcloud.com/img/20210402183053.png
link: https://f4de-bak.github.io/
name: Xinghai's Blog
desc: Web Security | Java Security
author: Xinghai
avatar: https://image-1302577725.cos.ap-beijing.myqcloud.com/img/20210328234543.jpg
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/eyjf.png
link: https://wiki.eryajf.net
name: 二丫讲梵
desc: 学习,记录,分享。(运维生活编程)
author: 二丫讲梵
avatar: https://wiki.eryajf.net/img/logo.png
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/ss.2tev477ruza0.png
link: https://masongsong.cn
name: 松松的一尺三分地
desc: 记录工作和学习中的所得
author: masongsong
avatar: https://fastly.jsdelivr.net/gh/MssText/learn@master/images/49203535.35emn5vryma0.png
- img: https://fastly.jsdelivr.net/gh/Kele-Bingtang/static/user/20211218235045.png
link: https://notes.youngkbt.cn/
name: Young Kbt Blog
desc: 记录学习Java, Web, 框架, 工具, 前端等相关知识, 记录生活和技术路程, 分享编程技巧。
author: Ship Liu
avatar: https://fastly.jsdelivr.net/gh/Kele-Bingtang/static/user/avatar2.png
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/123.57gcfayi85k0.webp
link: https://blog.dragon1573.wang/
name: 断桥烟雨の学习笔记
desc: 学习爱我,我爱学习~
author: べ断桥烟雨ミ
avatar: https://avatars.githubusercontent.com/u/49941141
- img: https://fastly.jsdelivr.net/gh/xugaoyi/blog-gitalk-comment@master/img/20220210094650.3q09d26tigc0.webp
link: https://chuck6.github.io/blog/
name: 梵一的博客
desc: 个人博客和知识分享
author: 梵一
avatar: https://chuck6.github.io/blog/img/paizhao.jpg
- img: https://fastly.jsdelivr.net/gh/niumoo/cdn-assets/2021/20220316145528.png
link: https://www.wdbyte.com
name: 未读代码
desc: Java 开发知识库,分享原创文章
author: 程序猿阿朗
avatar: https://avatars.githubusercontent.com/u/26371673?v=4
- img: https://fastly.jsdelivr.net/gh/simonzhangs/image-hosting@master/vue-plugin-example/blog.qg2buhe5h4g.webp
link: https://simonzhangs.github.io/
name: 松本松的博客儿
desc: Web前端技术博客,积跬步以至千里。
author: simonzhangs
avatar: https://fastly.jsdelivr.net/gh/simonzhangs/image-hosting@master/20220319/image.4x708q9wzse0.webp
- img: https://fastly.jsdelivr.net/gh/terwer/upload/img/image-20220422000045653.png
link: http://terwergreen.com
name: 远方的灯塔
desc: 专注于服务端技术分享
author: terwer
avatar: https://fastly.jsdelivr.net/gh/terwer/upload/img/photo.jpg
- img: https://fastly.jsdelivr.net/gh/nksuya/image_store@main/suyablog_home.5iou2ogjrm80.webp
link: https://suyaspace.com/
name: Suya's blog
desc: 个人博客,分享技术文章,学习笔记,植物相关知识等。
author: Suya
avatar: https://fastly.jsdelivr.net/gh/nksuya/image_store@master/tech/avatar.2tycyyc1ebr4.jpg
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store2@master/img/QQ20220526-224620@2x.44o82ibj9qq0.png
link: https://colorpanda.aifan.jp/
name: ColorPanda
desc: 日语中文英文学习网站
author: ColorPanda
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store2@master/img/image.3qr8m501tl20.png
- img: https://fastly.jsdelivr.net/gh/xugaoyi/blog-gitalk-comment@master/img/asdf.23jsekfejla8.jpeg
link: https://inannan423.github.io/
name: Zihanio
desc: Zihan的学习博客
author: Zihan
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/blog-gitalk-comment@master/img/xxx.67b3ygadagk0.jpeg
- img: https://user-images.githubusercontent.com/866409/175853573-28ded198-2348-4a82-8ddd-05088161e3fe.png
link: https://xingcxb.com
name: 不器小窝
desc: 但知行好事,莫要问前程
author: 不器
avatar: https://avatars.githubusercontent.com/u/866409?v=4
- img: https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/QQ20220722-141037.22uk9ow7ary.png
link: https://eryajf.github.io/vdoing-template/
name: Vdoing主题博客模板
desc: Vdoing主题博客模板
author: eryajf
avatar: https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/33259379.277tur21ir40.jpeg
- img: https://cdn.jsdelivr.net/gh/FireHH/github_img_repository/logo/微信截图_20220810164903.png
link: https://javaessay.cn/
name: Java essay
desc: Java散文知识库,Spring全家桶,SpringCloud全家桶,高可用高并发架构,面试等
author: Mr.Fire
avatar: https://cdn.jsdelivr.net/gh/FireHH/github_img_repository/logo/huge.jpg
- img: https://chendapeng.cn/images/about/blog_image.png
link: https://chendapeng.cn
name: 行百里er
desc: Java,个人技术博客,后端开发,技术架构,分布式技术,Spring Cloud Alibaba,Elasticsearch,Redis,算法,数据结构,Git
author: 行百里er
avatar: https://chendapeng.cn/images/about/avatar.png
- img: http://xyhwh-nav.cn/img/index.png
link: http://xyhwh-nav.cn
name: Captain
desc: 学习技术,Java基础、面试知识点、项目经验总结和一些学习笔记
author: Captain
avatar: http://xyhwh-nav.cn/img/logo.png
- img: https://xiaoxue-images.oss-cn-shenzhen.aliyuncs.com/blog/202212271108541.jpg
link: https://blog.xueqimiao.com/
name: 小薛博客
desc: 小薛博客,专注IT技术分享,助力人人成为架构师
author: xueqimiao
avatar: https://xiaoxue-images.oss-cn-shenzhen.aliyuncs.com/blog/202212271110209.png
- img: https://cdn.jsdelivr.net/gh/su-dd/cdn/博客/202301311644669.png
link: https://blog.addai.cn/
name: 呆呆的博客
desc: 个人博客
author: 呆呆
avatar: https://cdn.addai.cn/博客/网站使用/呆呆.webp
- img: https://raw.githubusercontent.com/jorgen-zhao/blog/master/images/snapshot.png
link: https://jorgen.website
name: Jorgen's blog
desc: 🚀个人知识库兼博客🚀
author: jorgen
avatar: https://jorgen.website/img/avatar.jpg
```
:::
## 知识库
::: cardImgList 4
```yaml
config:
imgHeight: 150px
data:
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200530114035.png
link: https://xugaoyi.github.io/vdoing-demo-repository/
name: 知识库演示
desc: Vdoing主题演示-知识库
author: Evan Xu
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200103123203.jpg
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20201219205536.jpg
link: https://wiki.router86.com/
name: X86软路由和NAS
desc: 记录X86软路由和NAS的一些知识
author: MonoLogueChi
avatar: https://blog.xxwhite.com/assets/img/avatar.jpg
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20201219205318.jpg
link: https://blog.northword.cn/dft-learning
name: 计算模拟学习笔记
desc: 《能源环境材料计算模拟方法》学习笔记,涉及密度泛函理论、第一性原理等和Materials Studio、VASP等的使用。
author: Northword
avatar: https://storage.live.com/items/28C1032A24A9C53B!25785?authkey=AHAx3GOYEKGqm8I
- img: https://singerwimg-1300001977.cos.accelerate.myqcloud.com/20211008/WccSrJ0s.png
link: https://repository.singerw.com
name: Singerw's Repository
desc: 技术的风花雪月之事,有个存档的地方,对于复盘,回忆,都是一个极好的方谭。
author: Singerw
avatar: https://singerwimg-1300001977.cos.accelerate.myqcloud.com/2021/09/20/76f29482ffc9b.png
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/QQ20220113-114927.5oha7j06c580.webp
link: https://hippox.cn
name: hippo4j
desc: 🔥 动态线程池框架,附带监控报警功能,轻量级的运维监控平台
author: Acmenlt
avatar: https://hippox.cn/img/web.png
- img: https://pics.landcover100.com/pics/624e63f4c82b8.png
link: https://www.gisrsdata.com
name: 地信遥感数据汇
desc: 解决目前地信遥感方向数据混杂,资源难以寻找的问题,构建一个地信遥感学习、讨论、交流的平台。
author: 锐多宝
avatar: https://pics.landcover100.com/pics/624e6469cbb8a.jpg
- img: https://img.de7v.com/img/site-pic.jpg
link: https://www.de7v.com
name: De7v
desc: 专注于安卓领域的技术传播
author: wresource
avatar: https://img.de7v.com/img/wresource.png
- img: https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/11123.1aljpnjyr074.png
link: https://eryajf.github.io/HowToStartOpenSource/
name: HowToStartOpenSource
desc: GitHub开源项目维护协作指南
author: eryajf
avatar: https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/33259379.277tur21ir40.jpeg
```
:::
## 社区类
:::cardImgList
```yaml
config:
imgHeight: 150px
data:
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200921220111.png
link: https://course.yiwiz.com/
name: 奕维投资教程站
desc: 股票投资
author: 奕维
avatar: https://course.yiwiz.com/img/logo.png
```
:::
## 博客类
::: cardImgList
```yaml
config:
imgHeight: 150px
data:
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200530114034.png
link: https://xugaoyi.github.io/vdoing-demo-blog/
name: Vdoing's blog
desc: Vdoing主题演示-博客
author: Evan Xu
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200103123203.jpg
- img: https://s4.ax1x.com/2022/02/25/bAjINF.png
link: https://fangweilong.github.io/
name: Teler的日常
desc: 好好学习,天天向上
author: Teler
avatar: https://s4.ax1x.com/2022/02/25/bAva8J.jpg
- img: https://user-images.githubusercontent.com/53399655/163007243-1b99b96b-cac3-49ca-9950-03a1e877a6d8.png
link: https://xustudyxu.github.io/
name: xustudyxu's Blog
desc: 一起学习编程!
author: xustudyxu
avatar: https://xustudyxu.github.io/img/01.png
```
:::
## 文档类
::: cardImgList 4
```yaml
config:
imgHeight: 150px
data:
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200530114036.png
link: https://xugaoyi.github.io/vuepress-theme-vdoing-doc/
name: vdoing(本站)
desc: 🚀一款简洁高效的VuePress 知识管理&博客 主题
author: Evan Xu
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200103123203.jpg
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20210925-124836@2x (1).6ogvf85maog0.png
link: https://justauth.plus/
name: JA Plus 开发者文档
desc: 一款开源的登录认证中间件
author: yadong,zhang
avatar: https://portrait.gitee.com/uploads/avatars/user/261/784199_yadong.zhang_1578932767.png!avatar200
- img: https://assets.imgradeone.com/docsdokimod-pv.png
link: https://docs.dokimod.cn
name: DokiMod 开发文档
desc: 为 DDLC Mod 开发提供的完善文档
author: imgradeone
avatar: https://docs.dokimod.cn/logo_128x128.png
# - img: http://yogoyun.oss-cn-beijing.aliyuncs.com/help/public/other/20200630125515.png
# link: http://help.yogoyun.com/
# name: 柚果云服务
# desc: 智能商业应用程序服务商。
# author: 柚果云服务
# avatar: http://yogoyun.oss-cn-beijing.aliyuncs.com/admin/console/logo.png
- img: https://jeesite.com/docs/img/docs.png
link: http://docs.jeesite.com
name: JeeSite 在线文档
desc: JeeSite 快速开发平台 - 在线文档
author: ThinkGem
avatar: https://jeesite.com/docs/img/logo.png
- img: https://fastly.jsdelivr.net/gh/dreamncn/picBed@master/uPic/2022_05_12_20_40_04_1652359204_1652359204449_9mVkaR.png
link: https://cleanphp.ankio.net/
name: CleanPHP
desc: CleanPHP开发者文档
author: ankio
avatar: https://fastly.jsdelivr.net/gh/dreamncn/picBed@master/uPic/2022_04_04_19_48_51_1649072931_1649072931346_h4BGpQ.jpg
- img: https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/28284d.56bkx9qvhc00.webp
link: https://jpom-docs.keepbx.cn/
name: Jpom
desc: 简而轻的低侵入式在线构建、自动部署、日常运维、项目监控软件
author: 不忘初心
avatar: https://jpom-docs.keepbx.cn/images/jpom_logo.png
- img: https://wumei.live/kerwincui/document/raw/branch/master/images/img.png
link: https://wumei.live/doc/
name: 物美智能
desc: 物美智能开源物联网平台,简单易用,可用于搭建物联网平台以及二次开发和学习。适用于智能家居、智慧办公、智慧社区、农业监测、水利监测、工业控制等。
author: 随遇而安 / kerwincui
avatar: https://portrait.gitee.com/uploads/avatars/user/611/1834441_kerwincui_1581523162.png!avatar200
- img: https://pic.imgdb.cn/item/637c92ef16f2c2beb11293c7.jpg
link: https://trace-recorder.xusc.cn
name: trace-recorder官网
desc: 简单的, 可伸缩的, 高性能的跟踪记录仪
author: 蔡旺
avatar: https://pic.imgdb.cn/item/637c933516f2c2beb112ed43.jpg
```
:::
</br></br>
## 申请加入案例
::: tip 你想在这个页面展示你的站点吗?
欢迎使用Vdoing主题的小伙伴到 [**这里**](https://github.com/xugaoyi/vuepress-theme-vdoing/issues/new?assignees=&labels=&template=+join_case.md) 留下你的站点信息,你的站点将有机会出现在这个页面里~
:::
@@ -0,0 +1,21 @@
---
title: 企业登记案例
date: 2020-05-14 11:39:45
permalink: /pages/5d571c
---
## 企业登记
如果您所在的企业使用到了中微子代理,麻烦抽出宝贵的时间[点击这里](https://gitee.com/dromara/neutrino-proxy/issues/I6WC71)进行登记,这将会助力中微子代理走得更远。
## 案例展示
|企业名称| logo | 官网地址 | 使用人数 |用途|
|:-|:-----------------------------------------------------------------------------------------------------------|:-------------------------|:-----|:-|
|北京吉威空间信息股份有限公司| ![logo](https://foruda.gitee.com/images/1681717113043198586/b7f0b6b3_8006959.png) | http://www.geoway.com.cn | 10 |开发环境的session会话同步与开发环境的对接测试华为云与微信等云端回调接口|
|悦邻供应链科技有限公司|![logo](https://foruda.gitee.com/images/1684996781645413637/277d0b9b_5234431.png)| https://yinghecloud.com | 10 |开发及生产环境内网服务器VPN搭建,本地开发服务端口调试|
|阿依瓦(北京)技术有限公司|![logo](https://foruda.gitee.com/images/1684998300312143862/74a96cec_4788807.png)| https://www.alva.com.cn | 50 |开发及生产环境内网服务器VPN搭建,本地开发服务端口调试,云端同步数据等|
|常州裕景信息科技有限公司|![logo](https://foruda.gitee.com/images/1688542732735699110/bb238481_2342807.jpeg)| 无 | 5 |远程管理虚拟机,接口、数据库等功能调试|
|湖北楚商联盟金融信息服务有限公司|![logo](https://foruda.gitee.com/images/1675831034400302128/3621dd88_9993534.png)| http://www.chually.cn | 10 |开发及生产环境内网服务器VPN搭建,本地开发服务端口调试,云端同步数据等|
|中科元景智能(深圳)有限公司|![logo](https://foruda.gitee.com/images/1689584776864189267/d66c78a8_9373604.png)| https://yjupi.com | 20 |本地开发连接测试环境及生产环境内网服务器,包含数据库、redis、模块服务等|
|长沙小蜂科技有限公司|![logo](https://foruda.gitee.com/images/1692156755102754023/c7d82730_1207310.png)| 无 | 1~3人 |主要用于测试环境内网服务器,包含数据库,远程桌面等|
|江西六湛科技|![logo](https://foruda.gitee.com/images/1694073479398767455/0f7570a7_10166803.png)| http://www.liuzhankj.com | 12 |主要用于部署一些使用时长较短的项目|
|杭州艾佳智能科技有限公司|![logo](https://foruda.gitee.com/images/1695608742879653626/314c72a4_5720492.png)| http://www.ajaiot.com | 12-16人 |公司部分设备是通过udp通信的,对接调试设备,搭建测试环境服务网关的时候需要|
@@ -3,6 +3,33 @@ title: 2.x
date: 2023-10-26 17:43:43
permalink: /pages/ff3519/
---
## 2.0.2
- bug修复
- 解决安全组在ipv6场景下误拦截导致域名映射访问不通的问题
- 解决native编译后,端口池批量删除报错的问题
- 解决客户端docker方式部署环境变量指定参数不生效的问题
- 服务端解决native下清理日志定时任务报错的问题
- 解决后台分页查询的已知问题
- 端口映射中的客户端ip字段加长一点,解决配置阿里云数据库域名字段不够的问题
- 解决服务端native部署时,访问后台用户列表,日志警告“you should use: nativeMetadata.registerField(field) at aot runtime”的问题
- 新增功能
- 新增后台域名管理,⽀持新增、修改、删除、禁⽤主域名,支持添加多级域名。
- 域名管理支持上传域名对应的SSL证书、⽀持设置强制HTTPS、⽀持域名映射⾃动加载对应的服务器证书。
- 端口映射支持选择切换不同的主域名,⽀持绑定多个⼦域名,单个端⼝⽀持绑定多个不同的主域名。
- 升级须知:
- **域名和SSL证书的配置由配置文件配置改为后台域名管理页面配置。**
- 去掉了配置文件声明服务器端域名和证书的方式,改为通过页面进行管理,请注意自行进行数据迁移。
- 数据库新增`域名表``域名映射中间表`,修改了`端口映射表`,涉及到表结构变更,执行[增量SQL](https://gitee.com/dromara/neutrino-proxy/blob/master/neutrino-proxy-server/src/main/resources/sql/mysql/update/UPDATE-20240808.SQL)
## 2.0.1
- jdk版本升级为21
- 新增安全组模块,支持黑名单、白名单限制
- 支持对用户、license限速
- 修复HTTP(S)映射时使用tcp端口访问正常,使用域名访问偶现一直loading的问题
- 修复HTTP(S)映射时使用映射的域名上传文件时,连接中断的问题
- 升级须知:
- jdk版本升级为了jdk21,jar部署时请注意
- 涉及到表结构变更,执行[增量SQL](https://gitee.com/dromara/neutrino-proxy/blob/master/neutrino-proxy-server/src/main/resources/sql/mysql/update/UPDATE-20231215.SQL)
## 2.0.0
- solon版本升级为`2.5.11`
@@ -3,7 +3,8 @@ title: 里程碑
date: 2023-10-26 17:41:26
permalink: /pages/e406dd/
---
- 2024-12-10 2.0.2版本发布,新增域名管理,端口映射支持绑定多个域名
- 2023-12-21 2.0.1版本发布,jdk版本升级到21,支持安全组(黑/白名单IP限制)、限速
- 2023-10-31 2.0.0版本发布,升级jdk版本至jdk17、支持原生编译、去掉sqlite改为默认H2数据库
- 2023-09-25 中微子代理Gitee Star数突破1000
- 2023-09-22 1.9.0版本发布,端口映射支持UDP协议
+16 -8
View File
@@ -13,12 +13,12 @@ features: # 可选的
details: 首页图表、报表管理多维度流量监控。全方位掌握实时、历史代理数据。
- title: 域名映射
details: HTTP代理绑定子域名,开发调试三方回调更方便。
- title: 用户/License
details: 支持多用户、多客户端使用。后台禁用实时生效。
- title: 端口池
details: 对外端口统一管理,支持用户、License独占端口
- title: 端口映射
details: 新增、编辑、删除、禁用实时生效。
- title: 管理后台
details: 使用端口池统一管理对外代理端口,支持多用户、多客户端使用。端口/用户/License/端口映射在后台禁用实时生效。
- title: 安全组
details: 安全组模块支持黑/白名单IP访问限制
- title: 限速
details: 支持对License、端口映射限制上传、下载速率
- title: Docker
details: 服务端/客户端支持Docker一键部署。
- title: 隧道SSL加密
@@ -146,9 +146,17 @@ postList: none
<div class="cardListContainer">
<div class="card-list">
<a href="https://www.xigexb.com" target="_blank" class="card-item row-3" style="background-color:#102863;--random-color:#102863;color:#FFFFFF;">
<a href="https://www.xigexb.com?from=neutrino-proxy" target="_blank" class="card-item row-3" style="background-color:#102863;--random-color:#102863;color:#FFFFFF;">
<img src="img/sponsor/xigexiaobao.jpg" class="no-zoom">
<div><p class="name">喜鸽小宝</p> <p class="desc">一个爱好写代码的同学</p></div>
<div><p class="name">喜鸽小宝</p> <p class="desc">一个爱好写代码的同学。<br/>&nbsp;</p></div>
</a>
<a href="https://7bu.top?from=neutrino-proxy" target="_blank" class="card-item row-3" style="background-color:#c6ddff;--random-color:#c6ddff;color:#000000;">
<img src="img/sponsor/7bu.ico" class="no-zoom">
<div><p class="name">去不图床</p> <p class="desc">杜老师说旗下付费图片外链平台。<br/>&nbsp;</p></div>
</a>
<a href="http://doc.zyplayer.com/#/integrate/zyplayer-doc?utm=neutrino-proxy" target="_blank" class="card-item row-3" style="background-color:#486898;--random-color:#c6ddff;color:#FFFFFF;">
<img src="img/sponsor/zyplayer-doc.png" class="no-zoom">
<div><p class="name">zyplayer-doc</p> <p class="desc">私有化部署的企业级文档管理与知识库AI问答平台。</p></div>
</a>
</div>
</div>
+2 -2
View File
@@ -4,8 +4,8 @@
"scripts": {
"dev": "vuepress dev docs",
"build": "vuepress build docs",
"buildAndDeploy": "vuepress build docs && bash deploy.sh",
"deploy": "bash deploy.sh",
"buildAndDeploy": "vuepress build docs && bash deploy/deploy1.sh",
"deploy": "bash deploy/deploy1.sh",
"updateTheme": "yarn remove vuepress-theme-vdoing && rm -rf node_modules && yarn && yarn add vuepress-theme-vdoing -D",
"editFm": "node utils/editFrontmatter.js"
},
+7 -6
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>solon-parent</artifactId>
<version>2.5.11</version>
<version>2.7.6</version>
<relativePath />
</parent>
@@ -26,11 +26,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<revision>1.1-SNAPSHOT</revision>
<revision>2.0.2</revision>
<native.version>0.9.28</native.version>
<java.version>17</java.version>
<java.version>21</java.version>
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
<maven-flatten.version>1.1.0</maven-flatten.version>
</properties>
@@ -110,6 +110,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -121,8 +122,8 @@
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.noear</groupId>
<artifactId>solon-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -216,7 +217,7 @@
<plugin>
<groupId>org.noear</groupId>
<artifactId>solon-maven-plugin</artifactId>
<version>${solon-maven-plugin.version}</version>
<version>${solon.version}</version>
<executions>
<execution>
<id>process-aot</id>
+35
View File
@@ -0,0 +1,35 @@
## 项目简介
- [中微子代理(neutrino-proxy)](https://gitee.com/dromara/neutrino-proxy) 是一款基于Solon、Netty的内网穿透神器。该项目采用最为宽松的MIT协议,因此您可以对它进行复制、修改、传播并用于任何个人或商业行为。
- 市面上基于内网穿透的常见产品有:花生壳、TeamView、cpolar等。
- 常见的使用场景:
- 本地开发调试第三方回调
- 本地开发异地接口连调
- 远程登录内网windows机器
- 将本地服务映射到外网,用于演示
- Gitee仓库:https://gitee.com/dromara/neutrino-proxy
- GitCode仓库:https://gitcode.com/dromara/neutrino-proxy
- GitHub仓库:https://github.com/dromara/neutrino-proxy
- 官网地址: https://neutrino-proxy.dromara.org
## 主要特点:
- 1、流量监控:首页图表、报表管理多维度流量监控。全方位掌握实时、历史代理数据。
- 2、用户/License:支持多用户、多客户端使用。后台禁用实时生效。
- 3、端口池:对外端口统一管理,支持用户、License独占端口。
- 4、端口映射:新增、编辑、删除、禁用实时生效。
- 5、Docker:服务端/客户端支持Docker一键部署。
- 6、SSL证书:隧道通信支持SSL加密,保护您的数据安全。
- 7、域名映射:支持绑定子域名,方便本地调试三方回调
- 8、多种协议:支持代理TCP、HTTP、HTTPS、UDP协议
- 9、原生部署:支持编译为原生可执行文件,更低部署门槛、更少内存占用
- 10、安全组:支持黑/白名单IP访问限制
- 11、限速:支持对License、端口映射限制上传/下载速度
- 12、采用最为宽松的MIT协议,免去你的后顾之忧
## 镜像版本&地址
- 版本:当前最新版本为`2.0.1`,可直接使用`latest`拉取最新镜像
- neutrino-proxy-server
- DockerHub镜像地址:aoshiguchen/neutrino-proxy-server:latest
- 阿里云镜像地址:neutrino-proxy registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:latest
- neutrino-proxy-client
- DockerHub镜像地址:aoshiguchen/neutrino-proxy-client:latest
- 阿里云镜像地址:registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy-client:latest
@@ -0,0 +1,41 @@
solon.logging.logger:
"root":
level: info
neutrino:
proxy:
tunnel:
# 线程池相关配置,用于技术调优,可忽略
thread-count: 50
# 隧道SSL证书配置
key-store-password: 123456
jks-path: classpath:/test.jks
# 服务端IP
server-ip: host.docker.internal
# 服务端端口(对应服务端app.yml中的tunnel.port、tunnel.ssl-port)
server-port: 9002
# 是否启用SSL(注意:该配置必须和server-port对应上)
ssl-enable: true
# 客户端连接唯一凭证
license-key: b0a907332b474b25897c4dcb31fc7eb6
# 客户端唯一身份标识(可忽略,若不设置首次启动会自动生成)
client-id:
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
# 是否开启心跳日志
heartbeat-log-enable: false
# 重连设置
reconnection:
# 重连间隔(秒)
interval-seconds: 10
# 是否开启无限重连(未开启时,客户端license不合法会自动停止应用,开启了则不会,请谨慎开启)
unlimited: false
client:
udp:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 5
work-thread-count: 20
# udp傀儡端口范围
puppet-port-range: 10000-10500
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
@@ -0,0 +1,21 @@
version: '3.8'
networks:
npClient:
driver: bridge
services:
npClient:
image: aoshiguchen/neutrino-proxy-client:latest
container_name: compose-npClient
hostname: npClient
restart: always
environment:
TZ: Asia/Shanghai
LANG: zh_CN.UTF-8
volumes:
- ./config:/root/neutrino-proxy/config
- ./logs:/root/neutrino-proxy/logs
ports:
- "10000-10500:10000-10500/udp"
networks:
- npClient
@@ -0,0 +1,58 @@
server:
# 服务端web端口,用于支持HTTP接口,管理后台页面访问
port: 8888
# 日志级别
solon.logging:
logger:
"root":
level: info
appender:
file:
level: info
neutrino:
proxy:
# 隧道相关配置-用于维持服务端与客户端的通信
tunnel:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 2
work-thread-count: 10
# 隧道非SSL端口
port: 9000
# 隧道SSL端口
ssl-port: 9002
# 隧道SSL证书配置
key-store-password: 123456
key-manager-password: 123456
jks-path: classpath:/test.jks
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
# 是否开启心跳日志
heartbeat-log-enable: false
server:
tcp:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 5
work-thread-count: 20
# http代理端口,默认80(不配置不支持)
http-proxy-port: 80
# https代理端口,默认443 (不配置不支持,同时需要配置域名、证书)
https-proxy-port: 443
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
udp:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 5
work-thread-count: 20
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
data:
db:
# 数据库类型,目前支持h2、mysql、mariadb
type: h2
# 数据库连接URL
url: jdbc:h2:file:./data/db;MODE=MySQL;AUTO_SERVER=TRUE
# 数据库用户名
username:
# 数据库密码
password:
@@ -0,0 +1,25 @@
version: '3.8'
networks:
npServer:
driver: bridge
services:
npServer:
image: aoshiguchen/neutrino-proxy-server:latest
container_name: compose-npServer
hostname: npServer
restart: always
environment:
TZ: Asia/Shanghai
LANG: zh_CN.UTF-8
volumes:
- ./config:/root/neutrino-proxy/config
- ./data:/root/neutrino-proxy/data
- ./logs:/root/neutrino-proxy/logs
ports:
- "8888:8888"
- "9000:9000"
- "9002:9002"
- "9101-9120:9101-9120"
networks:
- npServer
@@ -0,0 +1,58 @@
server:
# 服务端web端口,用于支持HTTP接口,管理后台页面访问
port: 8888
# 日志级别
solon.logging:
logger:
"root":
level: info
appender:
file:
level: info
neutrino:
proxy:
# 隧道相关配置-用于维持服务端与客户端的通信
tunnel:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 2
work-thread-count: 10
# 隧道非SSL端口
port: 9000
# 隧道SSL端口
ssl-port: 9002
# 隧道SSL证书配置
key-store-password: 123456
key-manager-password: 123456
jks-path: classpath:/test.jks
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
# 是否开启心跳日志
heartbeat-log-enable: false
server:
tcp:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 5
work-thread-count: 20
# http代理端口,默认80(不配置不支持)
http-proxy-port: 80
# https代理端口,默认443 (不配置不支持,同时需要配置域名、证书)
https-proxy-port: 443
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
udp:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 5
work-thread-count: 20
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
transfer-log-enable: false
data:
db:
# 数据库类型,目前支持h2、mysql、mariadb
type: mysql
# 数据库连接URL
url: jdbc:mysql://mysql:3306/neutrino-proxy?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useAffectedRows=true&useSSL=false
# 数据库用户名
username: root
# 数据库密码
password: 123456
@@ -0,0 +1,21 @@
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- this file works for MySQL.
set names utf8mb4;
create database if not exists `neutrino-proxy` default charset utf8mb4 collate utf8mb4_general_ci;
commit;
@@ -0,0 +1,48 @@
version: '3.8'
networks:
npServer:
driver: bridge
services:
mysql:
image: mysql:8
container_name: compose-mysql
hostname: mysql
restart: always
healthcheck:
test: ['CMD-SHELL', 'mysqladmin ping -h 127.0.0.1 --silent']
interval: 3s
retries: 5
start_period: 3m
ports:
- "3308:3306"
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: 123456
volumes:
- ./data/mysqldata:/var/lib/mysql/
- ./config/sql:/docker-entrypoint-initdb.d/
networks:
- npServer
npServer:
image: aoshiguchen/neutrino-proxy-server:latest
container_name: compose-npServer
hostname: npServer
restart: always
environment:
TZ: Asia/Shanghai
LANG: zh_CN.UTF-8
depends_on:
mysql:
condition: service_healthy
volumes:
- ./config:/root/neutrino-proxy/config
- ./data:/root/neutrino-proxy/data
- ./logs:/root/neutrino-proxy/logs
ports:
- "8888:8888"
- "9000:9000"
- "9002:9002"
- "9101-9120:9101-9120"
networks:
- npServer
+13 -7
View File
@@ -1,7 +1,8 @@
#!/bin/sh
# 中微子代理客户端编译打包脚本,基础参数请自行修改
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-17.0.8+7.1/Contents/Home
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
#export JAVA_HOME=/Users/yangwen/my/service/jdk/jdk17/jdk-17.0.4.1.jdk/Contents/Home
export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1
export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
@@ -11,15 +12,20 @@ clientDeployDir=$deployDir"/client"
#切到项目根目录
cd ../..
#初始化文件夹
#if [ ! -d "$deployDir" ];then
# mkdir $deployDir
#fi
#if [ ! -d "$clientDeployDir" ];then
# mkdir $clientDeployDir
#fi
mkdir -p $clientDeployDir
rm -rf $clientDeployDir/neutrino-proxy-client.jar
rm -rf $clientDeployDir/neutrino-proxy-client-jar
rm -rf $clientDeployDir/neutrino-proxy-client-jar.zip
#客户端打包
mvn clean install -U -pl neutrino-proxy-client -am -Dmaven.test.skip=true
# 拷贝到deploy目录下
cp ./neutrino-proxy-client/target/neutrino-proxy-client.jar $clientDeployDir/neutrino-proxy-client.jar
#打zip包,用于发版
cd $clientDeployDir
mkdir neutrino-proxy-client-jar
cp ../../neutrino-proxy-client/target/neutrino-proxy-client.jar ./neutrino-proxy-client-jar/neutrino-proxy-client.jar
cp ../../neutrino-proxy-client/src/main/resources/app-copy.yml ./neutrino-proxy-client-jar/app.yml
zip -r neutrino-proxy-client-jar.zip ./neutrino-proxy-client-jar
rm -rf $clientDeployDir/neutrino-proxy-client-jar
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
# 镜像版本,每次更新版本时需要调整
ImageVer=2.0.0
ImageVer=2.0.2
ImageName=neutrino-proxy-client
DockerFilePath=$PWD/../../neutrino-proxy-client
+33 -8
View File
@@ -1,12 +1,15 @@
#!/bin/sh
# 中微子代理客户端编译打包脚本,基础参数请自行修改
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-17.0.8+7.1/Contents/Home
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1
export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
MODULE_NAME=neutrino-proxy-client
deployDir="deploy"
clientDeployDir=$deployDir"/client"
machine=macos
VER=2.0.2
#切到项目根目录
cd ../..
@@ -14,16 +17,38 @@ cd ../..
mkdir -p $clientDeployDir
# 删除原来的编译文件
rm -rf $clientDeployDir/neutrino-proxy-client.jar
rm -rf $clientDeployDir/neutrino-proxy-client
rm -rf $clientDeployDir/$MODULE_NAME.jar
rm -rf $clientDeployDir/$MODULE_NAME
rm -rf $clientDeployDir/$MODULE_NAME-jdk21-$VER-jar
rm -rf $clientDeployDir/$MODULE_NAME-jdk21-$VER-jar.zip
rm -rf $clientDeployDir/$MODULE_NAME-$machine-$VER-native
rm -rf $clientDeployDir/$MODULE_NAME-$machine-$VER-native.zip
#客户端打包
mvn clean install -U -pl neutrino-proxy-client -am -Dmaven.test.skip=true
cd neutrino-proxy-client
mvn clean install -U -pl $MODULE_NAME -am -Dmaven.test.skip=true
cd $MODULE_NAME
mvn clean native:compile -P native -DskipTests
cd ..
# 拷贝到deploy目录下
cp ./neutrino-proxy-client/target/neutrino-proxy-client.jar $clientDeployDir/neutrino-proxy-client.jar
cp ./neutrino-proxy-client/target/neutrino-proxy-client $clientDeployDir/neutrino-proxy-client
# 给执行权限
chmod +x ./$MODULE_NAME/target/$MODULE_NAME
# 拷贝到deploy目录下
cp ./$MODULE_NAME/target/$MODULE_NAME.jar $clientDeployDir/$MODULE_NAME.jar
cp ./$MODULE_NAME/target/$MODULE_NAME $clientDeployDir/$MODULE_NAME
#打zip包,用于发版
cd $clientDeployDir
## jar
mkdir $MODULE_NAME-jdk21-$VER-jar
cp ../../$MODULE_NAME/target/$MODULE_NAME.jar ./$MODULE_NAME-jdk21-$VER-jar/$MODULE_NAME.jar
cp ../../$MODULE_NAME/src/main/resources/app-copy.yml ./$MODULE_NAME-jdk21-$VER-jar/app.yml
zip -r $MODULE_NAME-jdk21-$VER-jar.zip ./$MODULE_NAME-jdk21-$VER-jar
rm -rf ./$MODULE_NAME-jdk21-$VER-jar
## native
mkdir $MODULE_NAME-$machine-$VER-native
cp ../../$MODULE_NAME/target/$MODULE_NAME ./$MODULE_NAME-$machine-$VER-native/$MODULE_NAME
cp ../../$MODULE_NAME/src/main/resources/app-copy.yml ./$MODULE_NAME-$machine-$VER-native/app.yml
zip -r $MODULE_NAME-$machine-$VER-native.zip ./$MODULE_NAME-$machine-$VER-native
rm -rf ./$MODULE_NAME-$machine-$VER-native
+1 -1
View File
@@ -2,7 +2,7 @@
# 中微子代理客户端启动脚本,基础参数请自行修改
JAVA_OPS="-server -Xms256m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/work/$NAME/heapError/"
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-17.0.8+7.1/Contents/Home
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
export PATH=:$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
mkdir -p /work/$NAME/heapError/
+12 -7
View File
@@ -1,7 +1,8 @@
#!/bin/sh
# 中微子代理服务端编译打包脚本,基础参数请自行修改
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-17.0.8+7.1/Contents/Home
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
#export JAVA_HOME=/Users/yangwen/my/service/jdk/jdk17/jdk-17.0.4.1.jdk/Contents/Home
export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1
export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
@@ -11,16 +12,20 @@ serverDeployDir=$deployDir"/server"
#切到项目根目录
cd ../..
#初始化文件夹
#if [ ! -d "$deployDir" ];then
# mkdir $deployDir
#fi
#if [ ! -d "$serverDeployDir" ];then
# mkdir $serverDeployDir
#fi
mkdir -p $serverDeployDir
rm -rf $serverDeployDir/neutrino-proxy-server.jar
rm -rf $serverDeployDir/neutrino-proxy-server-jar
rm -rf $serverDeployDir/neutrino-proxy-server-jar.zip
#服务端打包
mvn clean install -U -pl neutrino-proxy-server -am -Dmaven.test.skip=true
# 拷贝到deploy目录下
cp ./neutrino-proxy-server/target/neutrino-proxy-server.jar $serverDeployDir/neutrino-proxy-server.jar
#打zip包,用于发版
cd $serverDeployDir
mkdir neutrino-proxy-server-jar
cp ../../neutrino-proxy-server/target/neutrino-proxy-server.jar ./neutrino-proxy-server-jar/neutrino-proxy-server.jar
cp ../../neutrino-proxy-server/src/main/resources/app-copy.yml ./neutrino-proxy-server-jar/app.yml
zip -r neutrino-proxy-server-jar.zip ./neutrino-proxy-server-jar
rm -rf $serverDeployDir/neutrino-proxy-server-jar
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
# 镜像版本,每次更新版本时需要调整
ImageVer=2.0.0
ImageVer=2.0.2
ImageName=neutrino-proxy
DockerFilePath=$PWD/../../neutrino-proxy-server
+33 -8
View File
@@ -1,12 +1,15 @@
#!/bin/sh
# 中微子代理服务端编译打包脚本,基础参数请自行修改
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-17.0.8+7.1/Contents/Home
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1
export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
MODULE_NAME=neutrino-proxy-server
deployDir="deploy"
serverDeployDir=$deployDir"/server"
machine=macos
VER=2.0.2
#切到项目根目录
cd ../..
@@ -14,8 +17,12 @@ cd ../..
mkdir -p $serverDeployDir
# 删除原来的编译文件
rm -rf $serverDeployDir/neutrino-proxy-server.jar
rm -rf $serverDeployDir/neutrino-proxy-server
rm -rf $serverDeployDir/$MODULE_NAME.jar
rm -rf $serverDeployDir/$MODULE_NAME
rm -rf $serverDeployDir/$MODULE_NAME-jdk21-$VER-jar
rm -rf $serverDeployDir/$MODULE_NAME-jdk21-$VER-jar.zip
rm -rf $serverDeployDir/$MODULE_NAME-$machine-$VER-native
rm -rf $serverDeployDir/$MODULE_NAME-$machine-$VER-native.zip
# 不需要每次都重新编译一次前端代码,如果前端代码有变更,编译前需要手动执行`admin_build_docker.sh`
##前端页面打包
@@ -27,12 +34,30 @@ rm -rf $serverDeployDir/neutrino-proxy-server
#cp -rf ./neutrino-proxy-admin/dist/ ./neutrino-proxy-server/src/main/resources/static
#服务端打包
mvn clean install -U -pl neutrino-proxy-server -am -Dmaven.test.skip=true
cd neutrino-proxy-server
mvn clean install -U -pl $MODULE_NAME -am -Dmaven.test.skip=true
cd $MODULE_NAME
mvn clean native:compile -P native -DskipTests
cd ..
# 拷贝到deploy目录下
cp ./neutrino-proxy-server/target/neutrino-proxy-server.jar $serverDeployDir/neutrino-proxy-server.jar
cp ./neutrino-proxy-server/target/neutrino-proxy-server $serverDeployDir/neutrino-proxy-server
# 给执行权限
chmod +x ./$MODULE_NAME/target/$MODULE_NAME
# 拷贝到deploy目录下
cp ./$MODULE_NAME/target/$MODULE_NAME.jar $serverDeployDir/$MODULE_NAME.jar
cp ./$MODULE_NAME/target/$MODULE_NAME $serverDeployDir/$MODULE_NAME
#打zip包,用于发版
cd $serverDeployDir
## jar
mkdir $MODULE_NAME-jdk21-$VER-jar
cp ../../$MODULE_NAME/target/$MODULE_NAME.jar ./$MODULE_NAME-jdk21-$VER-jar/$MODULE_NAME.jar
cp ../../$MODULE_NAME/src/main/resources/app-copy.yml ./$MODULE_NAME-jdk21-$VER-jar/app.yml
zip -r $MODULE_NAME-jdk21-$VER-jar.zip ./$MODULE_NAME-jdk21-$VER-jar
rm -rf ./$MODULE_NAME-jdk21-$VER-jar
## native
mkdir $MODULE_NAME-$machine-$VER-native
cp ../../$MODULE_NAME/target/$MODULE_NAME ./$MODULE_NAME-$machine-$VER-native/$MODULE_NAME
cp ../../$MODULE_NAME/src/main/resources/app-copy.yml ./$MODULE_NAME-$machine-$VER-native/app.yml
zip -r $MODULE_NAME-$machine-$VER-native.zip ./$MODULE_NAME-$machine-$VER-native
rm -rf ./$MODULE_NAME-$machine-$VER-native
+1 -1
View File
@@ -2,7 +2,7 @@
# 中微子代理服务端启动脚本,基础参数请自行修改
JAVA_OPS="-server -Xms256m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/work/$NAME/heapError/"
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-17.0.8+7.1/Contents/Home
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
export PATH=:$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
mkdir -p /work/$NAME/heapError/
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
echo 'hello'
-29
View File
@@ -1,29 +0,0 @@
@echo off
@rem basic params
set ENV=dev
set NODE_VERSION=v13.12.0
set MODULE_NAME=neutrino-proxy-admin
@rem 判断当前node版本是否符合,如果不符合切换node版本
for /f "tokens=1" %%v in ('node -v') do set v=%%v
if not "%v%" == "%NODE_VERSION%" (
echo Node.js version is not %NODE_VERSION%.
@rem 判断是否安装nvm
set "nvm_home=%NVM_HOME%"
set "nvm_symlink=%NVM_SYMLINK%"
if not defined nvm_home (
echo nvm is not installed,then use nvm to install node %NODE_VERSION%.
) else if not defined nvm_symlink (
echo nvm is not installed,then use nvm to install node %NODE_VERSION%.
) else (
echo nvm is installed.
nvm use %NODE_VERSION%
)
)
cd %~dp0 && cd ../../%MODULE_NAME%
@rem 检查dist文件夹是否存在,存在就删除,/s选项表示将目录及其所有子目录一起删除,/q选项表示不需要确认操作
if exist dist (
rmdir /s /q dist
)
@rem 等待npm执行完毕
call npm install
npm run build:%ENV% && pause
+13 -2
View File
@@ -24,6 +24,17 @@ cd %~dp0 && cd ../../%MODULE_NAME%
if exist dist (
rmdir /s /q dist
)
@rem 等待npm执行完毕
@rem 编译
call npm install
npm run build:%ENV% && pause
call npm run build:%ENV%
echo 开始拷贝
@rem 拷贝
cd ..
del /Q /F .\neutrino-proxy-server\src\main\resources\static
rd /S /Q .\neutrino-proxy-server\src\main\resources\static
mkdir .\neutrino-proxy-server\src\main\resources\static
xcopy /S /E neutrino-proxy-admin\dist neutrino-proxy-server\src\main\resources\static
@rem 回到脚本目录
cd scripts\win
+63
View File
@@ -0,0 +1,63 @@
@echo off
@rem console output code changed to UTF-8
chcp 65001
@rem basic params
set MODULE_NAME=neutrino-proxy-client
@rem step
cd %~dp0 && cd ../../
SET VS_HOME=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519
SET JAVA_HOME=C:\my\package\jdk\graalvm-community-openjdk-21.0.2
SET MAVEN_HOME=C:\my\package\maven\apache-maven-3.9.6
SET WIN_RAR_HOME=C:\Program Files\WinRAR
SET PATH=%PATH%;%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%VS_HOME%\bin;%WIN_RAR_HOME%
SET INCLUDE=%INCLUDE%;%VS_HOME%\include;
SET LIB=%LIB%;%VS_HOME%\lib;
SET deployDir=deploy
SET clientDeployDir=%deployDir%\client
SET machine=windows
SET VER=2.0.1
@rem 初始化文件夹
mkdir -p %clientDeployDir%
@rem 删除原来的编译文件
del /S /Q /F %clientDeployDir%\%MODULE_NAME%.jar
del /S /Q /F %clientDeployDir%\%MODULE_NAME%.exe
del /S /Q /F %clientDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar
del /S /Q /F %clientDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar.zip
del /S /Q /F %clientDeployDir%\%MODULE_NAME%-%machine%-%VER%-native
del /S /Q /F %clientDeployDir%\%MODULE_NAME%-%machine%-%VER%-native.zip
rd /S /Q %clientDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar
rd /S /Q %clientDeployDir%\%MODULE_NAME%-%machine%-%VER%-native
@rem 客户端打包
call mvn clean install -U -pl %MODULE_NAME% -am -Dmaven.test.skip=true
cd %MODULE_NAME%
call mvn clean native:compile -P native -DskipTests
cd ..
@rem 拷贝到deploy目录下
copy .\%MODULE_NAME%\target\%MODULE_NAME%.jar .\%clientDeployDir%\%MODULE_NAME%.jar
copy .\%MODULE_NAME%\target\%MODULE_NAME%.exe .\%clientDeployDir%\%MODULE_NAME%.exe
@rem 打zip包,用于发版
cd %clientDeployDir%
@rem jar
mkdir %MODULE_NAME%-jdk21-%VER%-jar
copy %MODULE_NAME%.jar %MODULE_NAME%-jdk21-%VER%-jar
copy ..\..\%MODULE_NAME%\src\main\resources\app-copy.yml %MODULE_NAME%-jdk21-%VER%-jar\app.yml
Rar a %MODULE_NAME%-jdk21-%VER%-jar.zip %MODULE_NAME%-jdk21-%VER%-jar
@rem native
mkdir %MODULE_NAME%-%machine%-%VER%-native
copy %MODULE_NAME%.exe %MODULE_NAME%-%machine%-%VER%-native
copy ..\..\%MODULE_NAME%\src\main\resources\app-copy.yml %MODULE_NAME%-%machine%-%VER%-native\app.yml
Rar a %MODULE_NAME%-%machine%-%VER%-native.zip %MODULE_NAME%-%machine%-%VER%-native
@rem 删除临时文件
@rem 回到脚本目录
cd ..\..\scripts\win
+63
View File
@@ -0,0 +1,63 @@
@echo off
@rem console output code changed to UTF-8
chcp 65001
@rem basic params
set MODULE_NAME=neutrino-proxy-server
@rem step
cd %~dp0 && cd ../../
SET VS_HOME=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519
SET JAVA_HOME=C:\my\package\jdk\graalvm-community-openjdk-21.0.2
SET MAVEN_HOME=C:\my\package\maven\apache-maven-3.9.6
SET WIN_RAR_HOME=C:\Program Files\WinRAR
SET PATH=%PATH%;%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%VS_HOME%\bin;%WIN_RAR_HOME%
SET INCLUDE=%INCLUDE%;%VS_HOME%\include;
SET LIB=%LIB%;%VS_HOME%\lib;
SET deployDir=deploy
SET serverDeployDir=%deployDir%\server
SET machine=windows
SET VER=2.0.1
@rem 初始化文件夹
mkdir -p %serverDeployDir%
@rem 删除原来的编译文件
del /S /Q /F %serverDeployDir%\%MODULE_NAME%.jar
del /S /Q /F %serverDeployDir%\%MODULE_NAME%.exe
del /S /Q /F %serverDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar
del /S /Q /F %serverDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar.zip
del /S /Q /F %serverDeployDir%\%MODULE_NAME%-%machine%-%VER%-native
del /S /Q /F %serverDeployDir%\%MODULE_NAME%-%machine%-%VER%-native.zip
rd /S /Q %serverDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar
rd /S /Q %serverDeployDir%\%MODULE_NAME%-%machine%-%VER%-native
@rem 服务端打包
call mvn clean install -U -pl %MODULE_NAME% -am -Dmaven.test.skip=true
cd %MODULE_NAME%
call mvn clean native:compile -P native -DskipTests
cd ..
@rem 拷贝到deploy目录下
copy .\%MODULE_NAME%\target\%MODULE_NAME%.jar .\%serverDeployDir%\%MODULE_NAME%.jar
copy .\%MODULE_NAME%\target\%MODULE_NAME%.exe .\%serverDeployDir%\%MODULE_NAME%.exe
@rem 打zip包,用于发版
cd %serverDeployDir%
@rem jar
mkdir %MODULE_NAME%-jdk21-%VER%-jar
copy %MODULE_NAME%.jar %MODULE_NAME%-jdk21-%VER%-jar
copy ..\..\%MODULE_NAME%\src\main\resources\app-copy.yml %MODULE_NAME%-jdk21-%VER%-jar\app.yml
Rar a %MODULE_NAME%-jdk21-%VER%-jar.zip %MODULE_NAME%-jdk21-%VER%-jar
@rem native
mkdir %MODULE_NAME%-%machine%-%VER%-native
copy %MODULE_NAME%.exe %MODULE_NAME%-%machine%-%VER%-native
copy ..\..\%MODULE_NAME%\src\main\resources\app-copy.yml %MODULE_NAME%-%machine%-%VER%-native\app.yml
Rar a %MODULE_NAME%-%machine%-%VER%-native.zip %MODULE_NAME%-%machine%-%VER%-native
@rem 删除临时文件
@rem 回到脚本目录
cd ..\..\scripts\win
+21 -51
View File
@@ -1,54 +1,21 @@
# 1.x规划
- Bug
- 优化
- 添加端口映射时,验证端口是否被其他服务占用
- 拉下搜索license,支持模糊搜索
- license下拉用户搜索,支持模糊搜索
- UDP支持
- 官网文档完善
- HTTPS配置说明
- 协议重构
- 代码重构
# 1.8.6
- [x] 端口映射选择端口支持分页
- [x] 新增/更新端口映射,增加端口占用检测
- [x] 拉下搜索license,支持模糊搜索
- [x] license下拉用户搜索,支持模糊搜索
- [x] 端口映射编辑时,如果端口号没有变动,则不验证。避免出现端口映射正在使用时,无法更新端口映射其他信息的问题
- [x] 端口映射HTTP(S)新增打开网页按钮
- [x] 客户端断开连接时,记录日志空指针异常问题修复
# 1.9.0
- [x] 支持UDP
- 服务端
- 原`neutrino.proxy.server`配置移到`neutrino.proxy.server.tcp`
- 客户端
- 原`neutrino.proxy.client`配置移到`neutrino.proxy.tunnel`
- [x] 端口映射HTTP(S)新增打开网页按钮,优先使用域名打开
- [x] 新增/编辑端口映射时端口占用检测功能屏蔽,解决docker下使用的各种问题
# 1.9.1
- [ ] 如果UDP映射服务端端口变动,流量统计似乎不准,转发功能或许也受到影响,需要评估、测试、思考如何优化
- [ ] 增加服务端/客户端jar式一键部署脚本
- [ ] 排查解决问题:https://gitee.com/dromara/neutrino-proxy/issues/I7LGLB
- [ ] 访问白名单
- [ ] 端口映射分组
# Bug
- 指令通达被close的问题,org.dromara.neutrinoproxy.server.proxy.core.ProxyTunnelChannelHandler.channelInactive
- windows环境下直接运行发布版的jar包,日志输出乱码
- 代理mysql时,使用未开启远程访问的账号走代理访问mysql,代理客户端出现断开现象
- 客户端连接映射某个端口以后,如果在服务器端禁用了,没有立刻反映出来,要灯客户端重连以后才会屏蔽被禁用的端口。
# 2.x规划
- 插件开发
- [ ] neutrino-proxy-solon-plugin
- [ ] neutrino-proxy-jetbrains-plugin
- [ ] neutrino-proxy-starter (SpringBoot)
- 思考
- 流量编排
- 插件化定制
- 重构
- 代码重构
- 多租户支持
- 多个代理服务端节点支持
- 协议重构
- 支持多个隧道协议,支持扩展(TCP、KCP、QUIC)
- 支持不同语言客户端、服务端接入
- 基础优化
- [ ] 访问白名单
- [ ] 端口映射分组
- [ ] 支持批量端口映射
- [ ] 代理协议规范化,方便后续更好扩展、支持不同语言客户端接入
- [ ] 如果UDP映射服务端端口变动,流量统计似乎不准,转发功能或许也受到影响,需要评估、测试、思考如何优化
- [ ] 排查解决问题:https://gitee.com/dromara/neutrino-proxy/issues/I7LGLB
- 监控运维
- [ ] 监控服务端状态
- [ ] 支持调整服务端端口、证书
@@ -56,11 +23,14 @@
- [ ] 服务端日志
- [ ] 支持持管理后台动态调整日志级别。
- [ ] 动态调整转发、报文、心跳输出
- client+计划启动
- [ ] 安卓客户端
- [ ] 基于electron-egg的多平台客户端
# 3.x规划
- [ ] 支持针对用户限速、限流
- [ ] 支持P2P穿透
- [ ] 支持原生编译
- 插件开发
- [ ] neutrino-proxy-solon-plugin
- [ ] neutrino-proxy-jetbrains-plugin
- [ ] neutrino-proxy-starter (SpringBoot)
- client+计划启动
- [ ] 安卓客户端
- [ ] 基于electron-egg的多平台客户端
-7
View File
@@ -1,7 +0,0 @@
以下为部分使用中机构/组织/个人:
---
|单位/组织名称| 主营业务描述 |使用中微子的主要用途|
|:----|:----------|:--------|
|常州裕景信息科技有限公司| 高校数字化软件建设 |统筹管理个单位的服务器|