1
0
Fork 0
mirror of https://github.com/proxysu/ProxySU.git synced 2025-04-10 12:40:55 +00:00

Compare commits

...

579 commits

Author SHA1 Message Date
test
201d3da3a5 update config issue 2023-11-09 10:34:31 +08:00
test
03f015f8d4 fix xray不支持xtls-rprx-vision,none 2023-11-08 12:00:21 +08:00
test
2047f3d480 update ssh.net 2023 2023-11-08 09:40:44 +08:00
MisCusi2023
ba5629bd49
Update README.md 2023-05-19 06:10:16 -07:00
MisCusi2023
97a1f45abc
Update README.md 2023-05-13 18:16:58 -07:00
MisCusi2023
5cfe086d50
Update README.md 2023-05-13 18:15:51 -07:00
MisCusi2023
2d5a589bcb
Update README.md 2023-05-09 03:32:10 -07:00
MisCusi2023
332f54224f update flow control 2023-05-07 20:17:03 -07:00
MisCusi2023
be74f42f19 UI tweaks 2023-05-04 06:39:59 -07:00
MisCusi2023
d9d9393c5f Merge branch 'master' of https://github.com/proxysu/ProxySU 2023-05-04 01:57:01 -07:00
MisCusi2023
6e4b3f7c01 Added login with encrypted private key 2023-05-04 01:56:57 -07:00
MisCusi2023
703183274b
Update README.md 2023-05-04 01:30:08 -07:00
MisCusi2023
1907061064 Fix a series of bugs in MTProto Go 2023-05-03 18:23:53 -07:00
MisCusi2023
6177ea99d1 Language Display Adjustment-2 2023-05-02 06:51:06 -07:00
MisCusi2023
ef3542f338 Language Display Adjustment 2023-05-02 06:39:40 -07:00
MisCusi2023
5cc6229437
Update README.md 2023-04-14 19:46:11 -07:00
MisCusi2023
705b0df116
Update README.md 2023-04-14 19:45:26 -07:00
MisCusi2023
8d1863729a
Fixed QUIC port display error 2023-04-14 19:38:44 -07:00
MisCusi2023
8ea6af4018
Fixed QUIC port display error 2023-04-14 19:37:24 -07:00
MisCusi2023
280dacabac
Fixed quic port
Fixed the problem that the firewall could not open the quic port
2023-04-14 19:33:44 -07:00
test
62403f68ca merge languate 2023-04-01 11:41:46 +08:00
test
eabd976de8 Merge branch 'master' of https://github.com/proxysu/ProxySU 2023-04-01 11:29:04 +08:00
test
6a67a3e685 merge hysteria 2023-04-01 11:29:01 +08:00
next-autumn
1e1cad2ad7
Merge pull request #340 from DanielBlackBeard/master
add Persian language
2023-04-01 08:48:59 +08:00
test
f371277362 add hysteria editor 2023-02-27 17:26:55 +08:00
Persian Prince
b9ebd8700c add Persian language 2023-01-06 12:01:47 +03:30
123
07c8d9bb2b . 2022-12-17 11:25:22 +08:00
123
1a5a7219e3 update 2022-12-17 11:25:09 +08:00
123
5db61a02b5 hysterial model 2022-12-17 10:41:46 +08:00
next-autumn
ac003d476b
下版本添加 【Hysteria】
下版本添加 【Hysteria】
2022-11-27 10:23:25 +08:00
autumn
91827f47ee update v4.1.7 2022-11-24 21:54:52 +08:00
autumn
433883c3bf update quic 2022-11-24 21:07:34 +08:00
autumn
e86db631c5 add quic 2022-11-23 22:06:09 +08:00
autumn
4c0d3a0cf4 update ui 2022-11-21 23:39:25 +08:00
autumn
db6a399ca9 add uTLS settings. 2022-11-21 16:42:47 +08:00
autumn
1110f8291e update xray editor ui 2022-11-21 15:24:48 +08:00
autumn
89649d136f update ... 2022-11-20 23:00:16 +08:00
123
89af852433 Merge branch 'master' of https://github.com/proxysu/ProxySU 2022-11-15 09:59:56 +08:00
123
13e5edf50d update packages 2022-11-15 09:59:46 +08:00
next-autumn
5a79ceccba
忙... 近期更新。 2022-11-14 09:42:12 +08:00
autumn
10c8c0f74e fix ip.sb 2022-04-22 09:52:43 +08:00
next-autumn
2567635002
Update README.md
update
2022-02-28 10:11:08 +08:00
abc
1e96735db6 merge 2022-02-28 10:09:13 +08:00
abc
4d9890c797 update v4.1.5 2022-02-28 10:07:34 +08:00
next-autumn
d815152d2d
Update README.md 2021-12-08 15:10:06 +08:00
next-autumn
ef5bb6d977
Update README.md 2021-11-29 10:28:25 +08:00
proxysu
9f7a4b8626 Merge branch 'master' of https://github.com/proxysu/ProxySU 2021-11-27 11:53:10 +08:00
proxysu
dade426ff7 update 2021-11-27 11:50:58 +08:00
proxysu
eaca464f9c update... 2021-11-27 11:47:31 +08:00
next-autumn
bd32650fa9
Update README.md 2021-10-27 16:42:26 +08:00
next-autumn
9f4edca5d4
Update README.md 2021-10-27 14:58:34 +08:00
next-autumn
3fc01e8f2f
Update README.md 2021-10-26 17:07:03 +08:00
next-autumn
c2b764a7c9
Update README.md 2021-10-26 17:06:52 +08:00
next-autumn
84674d15ac
Update README.md 2021-10-26 17:05:27 +08:00
next-autumn
460b9a9abc
Update README.md 2021-10-26 17:05:14 +08:00
next-autumn
6b10682060
Update README.md 2021-10-26 17:03:31 +08:00
next-autumn
1b8240b460
Update README.md 2021-10-26 17:02:39 +08:00
next-autumn
4f23cd735c
Update README.md 2021-10-26 17:02:23 +08:00
next-autumn
b185e4f64e
Update README.md 2021-10-26 17:01:31 +08:00
next-autumn
0937e8083d
Update README.md 2021-10-26 16:55:38 +08:00
next-autumn
aaf899ea73
Update README.md 2021-10-26 16:54:51 +08:00
next-autumn
14c622b272
Update README.md 2021-10-26 16:53:22 +08:00
next-autumn
d87e4ddb96
Update README.md 2021-10-26 16:52:12 +08:00
next-autumn
62c2ad7be8
Update README.md 2021-10-26 16:51:02 +08:00
next-autumn
9cec097baa
Update README.md 2021-10-26 16:50:27 +08:00
next-autumn
fcaa50b248
Update README.md 2021-10-26 16:49:19 +08:00
next-autumn
d628147bdb
Update README.md 2021-10-26 16:46:30 +08:00
next-autumn
983e15f98f
Update README.md 2021-10-26 16:44:08 +08:00
next-autumn
361bdb4e2d
Update README.md 2021-10-26 16:43:23 +08:00
next-autumn
e7da4962e8
Update README.md 2021-10-26 16:42:30 +08:00
next-autumn
ba48b34c9a
Update README.md 2021-09-23 14:46:29 +08:00
next-autumn
38784d1e4e
Update README.md 2021-09-23 14:45:34 +08:00
next-autumn
682ceadd5e
Update README.md 2021-09-16 12:09:05 +08:00
next-autumn
751b0d19ca
Update README.md 2021-09-16 12:07:35 +08:00
next-autumn
10a62f55eb
Update README.md 2021-09-16 12:06:33 +08:00
next-autumn
535998f233
Update README.md 2021-09-16 12:04:53 +08:00
next-autumn
d30ead12af
Update README.md 2021-09-16 12:03:11 +08:00
next-autumn
9a552edbeb
Update README.md 2021-09-16 11:30:49 +08:00
next-autumn
f0905945f6
Update README.md 2021-09-16 11:29:40 +08:00
next-autumn
bc903cbf4a
Update README.md 2021-09-16 11:29:15 +08:00
autumn
8bc507ef43 Merge branch 'master' of https://github.com/proxysu/ProxySU 2021-09-14 10:32:04 +08:00
autumn
dbadab1499 trojan-go disabled log 2021-09-14 10:31:37 +08:00
next-autumn
96ed54702b
Update README.md 2021-09-14 09:49:46 +08:00
next-autumn
a637e6fc54
Update README.md 2021-09-14 09:49:27 +08:00
next-autumn
d3619fadd7
Update README.md 2021-09-14 09:49:13 +08:00
next-autumn
725d202b38
Update README.md 2021-09-14 09:48:14 +08:00
next-autumn
fb8a0de49d
Update README.md 2021-09-10 16:55:56 +08:00
next-autumn
e1b92a499e
Update README.md 2021-09-10 10:49:44 +08:00
next-autumn
9ae318c01f
Update README.md 2021-09-10 10:49:13 +08:00
next-autumn
ca01190672
Update README.md 2021-09-10 10:03:59 +08:00
next-autumn
57b222bc5b
Update README.md 2021-09-10 10:01:40 +08:00
next-autumn
87f01d180d
Update README.md 2021-09-10 09:59:12 +08:00
next-autumn
34fb030b95
Update README.md 2021-09-10 09:58:42 +08:00
next-autumn
1792c6912a
Update README.md 2021-09-10 09:58:07 +08:00
autumn
3e71d14424 port issue 2021-09-07 17:52:13 +08:00
autumn
e4bd5a9167 naiveproxy闪退 2021-09-02 18:56:01 +08:00
autumn
fc131ededd Merge branch 'master' of https://github.com/proxysu/ProxySU 2021-08-27 16:37:56 +08:00
autumn
2cffa483aa mg 2021-08-27 16:37:46 +08:00
next-autumn
524c341e9a
Update README.md 2021-08-27 16:07:48 +08:00
autumn
d5e1125c36 fix issue 188 2021-08-25 11:12:47 +08:00
autumn
819b8dd440 Merge branch 'master' of https://github.com/proxysu/ProxySU 2021-08-25 10:05:02 +08:00
autumn
81ae945e4f update v2rayinstallview title 2021-08-25 10:04:41 +08:00
next-autumn
553cb7b431
Update README.md 2021-08-24 11:07:40 +08:00
next-autumn
2b1e65adb4
Update README.md 2021-08-24 10:49:32 +08:00
next-autumn
7869e77126
Update README.md 2021-08-24 10:44:24 +08:00
autumn
6e61ef1ff6 MTProxy -> MTProto | 修复ssh私钥带密码登陆 2021-08-24 10:36:41 +08:00
autumn
be9ae4a8de MTProxy-Go 2021-08-23 15:59:34 +08:00
autumn
7b7251279f MTProxy-Go 2021-08-23 12:00:39 +08:00
autumn
eab70cc48c add sort 2021-08-21 11:56:20 +08:00
autumn
6c79b07d3c update 2021-08-20 18:01:16 +08:00
autumn
995d9ff435 v2ray 2021-08-20 11:52:45 +08:00
autumn
b0d0e761de update service 2021-08-19 17:54:23 +08:00
autumn
e85a0b93bf fix bugs 2021-08-19 12:06:05 +08:00
autumn
69b29fce21 save. 2021-08-18 17:34:32 +08:00
autumn
389f80f655 Merge branch 'master' of https://github.com/proxysu/ProxySU 2021-08-16 18:34:22 +08:00
next-autumn
bbf6cf64fe
Update README.md 2021-08-16 18:29:26 +08:00
autumn
4fe8b03daa review 2021-08-16 18:25:43 +08:00
autumn
bbc508557b fix xray port 2021-08-04 10:57:15 +08:00
autumn
f39c1e70ae Merge branch 'master' of https://github.com/proxysu/ProxySU 2021-08-02 11:37:25 +08:00
autumn
2ca98258b8 merge 2021-08-02 11:37:16 +08:00
next-autumn
0296c2be89
Update README.md 2021-07-16 09:45:26 +08:00
next-autumn
db3d4491bb
Update README.md 2021-07-16 09:44:28 +08:00
autumn
860dfb6520 update 4.0.4 2021-07-13 11:05:10 +08:00
autumn
b9b41b6554 4.0.4 2021-07-13 10:12:15 +08:00
autumn
2378f0c416 update new version 2021-07-12 17:58:51 +08:00
autumn
6be1fdb84a 优化Caddy安装 2021-07-10 11:57:56 +08:00
autumn
c33de96563 enable root account 2021-07-08 18:37:32 +08:00
autumn
0859efb2dd brook complated 2021-07-07 16:56:53 +08:00
autumn
399c852857 merge 2021-07-07 12:01:41 +08:00
autumn
d5878079f1 merge 2021-07-06 18:30:14 +08:00
autumn
5bd7529bec add brook 2021-07-02 18:35:25 +08:00
autumn
a2b27076b1 grpc share link and multi user 2021-06-30 18:36:27 +08:00
autumn
fe94157c7b fix grpc 2021-06-30 11:56:13 +08:00
autumn
b82e857edd update grpc settings 2021-06-29 18:43:15 +08:00
autumn
9923437691 add grpc params 2021-06-29 17:43:48 +08:00
autumn
2f0f9fb09d merge 2021-06-29 16:08:45 +08:00
autumn
395d01aea8 update 2021-06-19 11:57:16 +08:00
autumn
63c7f8b7a7 4.0.3 2021-06-18 20:53:46 +08:00
autumn
95dccb1c6c Merge branch 'master' of https://github.com/proxysu/ProxySU 2021-06-17 18:54:21 +08:00
autumn
11021fac1a 4.0.2 update 2021-06-17 18:54:07 +08:00
next-autumn
e05e9cff3d
Update README.md 2021-06-16 10:34:58 +08:00
autumn
316453c89b Merge branch 'master' of https://github.com/proxysu/ProxySU 2021-06-11 11:24:57 +08:00
autumn
424e0945db caddy arm issue 2021-06-11 11:00:57 +08:00
next-autumn
7f7c92d22b
Update README.md 2021-06-08 10:27:03 +08:00
next-autumn
3f397dbbf7 fix config port issue 2021-06-04 16:48:05 +08:00
next-autumn
3395876380 Merge branch 'master' of https://github.com/proxysu/ProxySU 2021-06-02 17:51:35 +08:00
next-autumn
7263459a74 sharelink 2021-06-02 17:51:27 +08:00
next-autumn
ca2bc405f5
Update README.md 2021-05-31 17:25:18 +08:00
next-autumn
b7e44dbdca
Update README.md 2021-05-31 17:24:54 +08:00
next-autumn
2c9e2777bd
Update README.md 2021-05-31 17:23:49 +08:00
next-autumn
05f96fc790 cmt 2021-05-29 11:43:06 +08:00
next-autumn
dc7abb66b2 fix install cert issue 2021-05-26 19:12:13 +08:00
next-autumn
b614bc676c v4.0.1 release 2021-05-26 16:50:19 +08:00
next-autumn
880494a331 Merge branch 'master' of https://github.com/proxysu/ProxySU 2021-05-26 16:22:31 +08:00
next-autumn
b20be2ac75 fix acme.sh update cert issue 2021-05-26 16:22:18 +08:00
next-autumn
433bcf34ee
Update README.md 2021-05-25 18:37:59 +08:00
next-autumn
97ae49c60c release 4.0.1 2021-05-25 18:28:37 +08:00
next-autumn
888e981d41 save trojanGO 2021-05-24 18:57:17 +08:00
nuxt-autumn
3f75fbf003 save trogan-go 2021-05-23 17:40:06 +08:00
nuxt-autumn
b71d1f2bc2 fix some issue 2021-05-23 14:24:13 +08:00
nuxt-autumn
970843f561 save 2021-05-22 17:14:27 +08:00
next-autumn
cb7d7e5f21 save 2021-05-22 11:48:44 +08:00
next-autumn
5f209b7c1d save 2021-05-22 11:12:26 +08:00
next-autumn
4cd4509cb9 save install xray/trojan-go 2021-05-21 18:03:40 +08:00
next-autumn
5093082fc4 save 2021-05-20 18:32:17 +08:00
nuxt-autumn
eeada87602 update 2021-05-16 16:29:37 +08:00
nuxt-autumn
3b79a7ca44 update 2021-05-16 09:12:47 +08:00
nuxt-autumn
5e1e9e90cf save local 2021-05-15 16:45:36 +08:00
next-autumn
405d8377da save 2021-05-15 11:58:05 +08:00
next-autumn
8d531a2930 save mvvmcross 2021-05-14 19:07:19 +08:00
next-autumn
a6221c330a mvvmcross 2021-05-13 09:58:45 +08:00
next-autumn
22e060e14a mvvmcross 2021-05-08 18:52:59 +08:00
next-autumn
c35d2d5434 add trojan-go project 2021-05-08 11:45:46 +08:00
next-autumn
5b547b87f9 v3.1.3 2021-04-30 14:42:20 +08:00
next-autumn
7c6820f0f7 save english 2021-04-30 12:02:56 +08:00
next-autumn
5a21895442 add english 2021-04-30 11:33:58 +08:00
next-autumn
66d9f3b81a multi language 2021-04-26 10:43:50 +08:00
next-autumn
7ea78170d1 review 2021-04-26 10:24:36 +08:00
next-autumn
83962fe0f0 v3.1.2 2021-04-19 16:51:43 +08:00
next-autumn
b4ad1bde74 add shareLink to qrcode 2021-04-19 16:02:13 +08:00
next-autumn
95380c5e47 review 2021-04-19 12:12:23 +08:00
nuxt-autumn
5957f49537 fix some issue. 2021-04-18 20:14:31 +08:00
nuxt-autumn
6962ed4bb8 merge 2021-04-18 20:09:07 +08:00
nuxt-autumn
b08251a0bc fix vless kcp security type 2021-04-18 18:13:40 +08:00
nuxt-autumn
41e3c85d01 merge 2021-04-18 18:11:35 +08:00
nuxt-autumn
379edc265f review add add grpc 2021-04-17 20:58:15 +08:00
next-autumn
5948ca6efd review code. 2021-04-17 11:50:31 +08:00
next-autumn
b1bc74104d enable caddy 2021-04-13 10:41:33 +08:00
nuxt-autumn
dc38de67d5 release v3.1.1
fix acme issue
2021-04-05 10:22:43 +08:00
nuxt-autumn
f27ae4d70c v3.1.0 2021-03-28 09:11:10 +08:00
nuxt-autumn
ce239978c8 Merge branch 'master' of https://github.com/proxysu/ProxySU 2021-03-27 22:19:09 +08:00
nuxt-autumn
83d6d04578 fix issue 2021-03-27 22:18:56 +08:00
next-autumn
aadd003fbc
Delete version.json 2021-03-27 20:16:22 +08:00
next-autumn
f4f9eceb6a
Update version.json 2021-03-27 19:32:11 +08:00
next-autumn
f84dc13ec7
Update version.json 2021-03-27 19:27:06 +08:00
next-autumn
f81f79367f
Create version.json 2021-03-27 19:19:41 +08:00
next-autumn
6d1d45e945 submit kcp ss. 2021-03-27 11:47:02 +08:00
next-autumn
754aff18a4 refactoring 2021-03-26 18:13:32 +08:00
next-autumn
0c146f176d add uninstall xray
fix text issue
2021-03-26 11:28:41 +08:00
next-autumn
34f4addd91 fix vless ws config issue 2021-03-18 15:54:45 +08:00
next-autumn
6427f8de3d merge icon 2021-03-18 15:21:56 +08:00
next-autumn
628d11bd5a publish v 3.0.1 2021-03-18 15:17:07 +08:00
next-autumn
66b7191394 add new protocol 2021-03-17 19:36:35 +08:00
next-autumn
d6242fb49b update subscrible and share link 2021-03-17 11:58:56 +08:00
next-autumn
737deb7ca5 update vmess share link 2021-03-16 17:22:00 +08:00
next-autumn
4d5e15afb3 update share link 2021-03-15 17:58:20 +08:00
next-autumn
3dfee31081 disabled access log 2021-03-12 16:16:41 +08:00
next-autumn
0072c9c99c bbr and domain validation 2021-03-12 15:59:20 +08:00
next-autumn
f6d28efac9 add update xray settings 2021-03-11 14:31:18 +08:00
next-autumn
14401058dc merge 2021-03-11 12:05:50 +08:00
next-autumn
ae1c06f6af fix ui text error 2021-03-10 15:34:07 +08:00
next-autumn
4d3ad778a6 merge 2021-03-10 10:50:34 +08:00
next-autumn
25f322d35c fix centos install caddy issue 2021-03-09 19:02:14 +08:00
next-autumn
b5978e738d merge 2021-03-09 18:18:29 +08:00
next-autumn
c5ac770d27 update nuget 2021-03-09 18:05:45 +08:00
next-autumn
816c304249 完善安装步骤 2021-03-09 17:52:09 +08:00
nuxt-autumn
177c09896c fix config.json issue 2021-03-08 23:15:18 +08:00
next-autumn
77cf7737f7 save client info 2021-03-06 17:26:17 +08:00
next-autumn
b6e77b88b4 fix xray config issue 2021-03-05 10:34:39 +08:00
next-autumn
8199b3d9d2 add config files 2021-03-04 18:25:52 +08:00
next-autumn
e548affd70 midify new 2021-03-04 16:25:36 +08:00
next-autumn
2fd76baf2f merge 2021-02-28 18:22:21 +08:00
next-autumn
d04553034a add config files 2021-02-28 14:19:26 +08:00
next-autumn
bdac51e8ea add proxysu core 2021-02-25 09:59:06 +08:00
next-autumn
7034a1dc22 fix 申请证书失败问题 2021-02-02 20:07:11 +08:00
ProxySU
e4971f286f acme.sh 申请证书显示更详细信息 2020-12-01 08:35:46 +08:00
ProxySU
67976be62b v2.5.2 2020-11-29 09:19:12 +08:00
proxysu
6f8e68e121
Update README.md 2020-11-28 11:37:34 +08:00
ProxySU
8220544c09 修复多协议方案中vmess ws显示错误 2020-11-28 11:19:55 +08:00
proxysu
52ac035195
Update README.md 2020-11-28 09:05:21 +08:00
ProxySU
c2d7792f8e 修正Xray自签证书方案错误 2020-11-27 22:05:27 +08:00
proxysu
386fc0d484
Update README.md 2020-11-27 13:38:01 +08:00
ProxySU
55c7abf01c v2.5.1 2020-11-27 11:25:15 +08:00
proxysu
e79607be2e
Update README.md 2020-11-27 00:20:16 +08:00
proxysu
4a119f9823
Update README.md 2020-11-27 00:19:28 +08:00
ProxySU
6ebd3750d3 fix something5 2020-11-26 23:41:09 +08:00
ProxySU
46680de002 fix something4 2020-11-26 23:20:59 +08:00
ProxySU
de18dcb063 fix something3 2020-11-26 23:00:17 +08:00
ProxySU
1c0290c57d fix something2 2020-11-26 22:26:45 +08:00
ProxySU
471e919161 fix something 2020-11-26 21:22:31 +08:00
ProxySU
250f90e9cf 解除V2Ray版本锁定 2020-11-26 21:10:46 +08:00
ProxySU
1425ce28a1 添加Xray 2020-11-26 21:07:35 +08:00
ProxySU
ab9021e8a6 优化xz组件安装 2020-11-24 16:19:23 +08:00
proxysu
21c9bf5176
Update README.md 2020-11-21 13:29:57 +08:00
ProxySU
bb222c41b6 v2ray版本锁定在v4.32.1 2020-11-20 22:00:03 +08:00
ProxySU
b8dce714c1 fix a bug 2020-11-20 09:12:57 +08:00
ProxySU
f445395fda 除去caddy.service中的线程限制 2020-11-19 11:02:07 +08:00
proxysu
90adece940
Update README.md 2020-11-18 13:50:57 +08:00
proxysu
1dad199084
Update README.md 2020-11-18 13:49:44 +08:00
ProxySU
06a08004e8 -v2.4.23 2020-11-16 14:33:21 +08:00
ProxySU
19bf6a0fb0 v2.4.23 2020-11-16 14:31:17 +08:00
ProxySU
72f71983bc 优化设置与删除Nat64网关 2020-11-16 14:09:40 +08:00
ProxySU
1823d8b4da 优化删除Nat64网关 2020-11-16 12:35:32 +08:00
proxysu
05c58d33f6
Update README.md 2020-11-16 09:10:44 +08:00
ProxySU
a898314bb6 优化域名测试流程,stats-->null 2020-11-15 11:05:11 +08:00
proxysu
17d40011c9
Update README.md 2020-11-14 19:44:25 +08:00
ProxySU
c641daa969 v2.4.22 2020-11-14 10:39:22 +08:00
ProxySU
0180a8cbb4 修复在纯ipv6主机Centos7中的NAT64网关设置bug 2020-11-14 10:19:44 +08:00
proxysu
775fd7209d
Update README.md 2020-11-13 12:56:10 +08:00
proxysu
6c2fd95f6e
Update README.md 2020-11-13 12:53:33 +08:00
proxysu
256e31dbed
Update README.md 2020-11-13 09:57:27 +08:00
proxysu
b3c455c753
Update README.md 2020-11-11 18:38:51 +08:00
proxysu
23fcbe49f8
Update README.md 2020-11-11 18:37:32 +08:00
proxysu
eb682bc04c
Update README.md 2020-11-11 18:34:25 +08:00
ProxySU
2f2978cad8 add direct on ui 2020-11-11 12:54:12 +08:00
ProxySU
b2b652385f v2.4.21 2020-11-09 20:03:45 +08:00
ProxySU
28e1056cb4 fix bug 2020-11-09 12:23:00 +08:00
ProxySU
3cdba7f7bc 修正可能出现的一些干扰信息 2020-11-08 16:10:32 +08:00
ProxySU
4b89568ddd 修正v2ray多协议共存结果显示错误2 2020-11-08 09:55:18 +08:00
ProxySU
7736d9f4b5 修正v2ray多协议共存结果显示错误 2020-11-08 09:36:07 +08:00
ProxySU
2dcbcd1b16 增加Trojan over TCP with TLS 2020-11-07 21:16:17 +08:00
ProxySU
5b2cf29e6f xtls-rprx-origin-->xtls-rprx-direct 2020-11-07 14:57:16 +08:00
proxysu
b571c469c3
Update README.md 2020-11-07 08:09:07 +08:00
proxysu
9ca6b918a1
Update README.md 2020-11-07 08:07:41 +08:00
proxysu
9ba74dc2f1
Update README.md 2020-11-07 08:02:10 +08:00
ProxySU
b3a081c6c3 v2.4.20 2020-11-07 07:54:26 +08:00
ProxySU
c006967c9a 增加操作功能小气泡提示 2020-11-06 14:15:54 +08:00
ProxySU
ca451b391b 优化伪装网址预处理并提醒伪装网址格式 2020-11-06 10:26:07 +08:00
ProxySU
01af863260 优化伪装网址预处理 2020-11-05 22:54:12 +08:00
proxysu
7b3a8627c0
Update README.md 2020-11-05 18:35:12 +08:00
proxysu
1682e7d268
Update README.md 2020-11-05 18:34:36 +08:00
proxysu
4a9cf2b104
Update README.md 2020-11-05 18:33:33 +08:00
proxysu
350060f276
Update README.md 2020-11-05 18:33:12 +08:00
proxysu
d3bee1a52d
Update README.md 2020-11-05 18:32:02 +08:00
proxysu
10423c92d0
Update README.md 2020-11-05 18:31:12 +08:00
proxysu
685675c731
Update README.md 2020-11-05 18:30:43 +08:00
proxysu
5c8a9b181b
Update README.md 2020-11-05 18:30:23 +08:00
proxysu
ae0f3e4208
Update README.md 2020-11-05 18:29:48 +08:00
ProxySU
c646ff7e07 v2.4.19 2020-11-05 07:56:20 +08:00
proxysu
6f09444581
Update README.md 2020-11-05 05:51:12 +08:00
ProxySU
ebf9feb651 CentOS7 防火墙firewall运行状态判断 2020-11-05 05:45:28 +08:00
ProxySU
78d299f5c7 优化 CentOS7 防火墙下acme.sh可能出现的潜在错误 2020-11-04 21:36:07 +08:00
ProxySU
cb55c6f92d 优化v2ray.service低端口绑定错误 2020-11-04 14:50:05 +08:00
proxysu
c37ec2598d
Update README.md 2020-11-04 10:36:24 +08:00
proxysu
cc7374e3fd
Update README.md 2020-11-04 10:27:28 +08:00
proxysu
0f701a3b34
Update README.md 2020-11-04 10:25:53 +08:00
proxysu
c6be38f1e6
Update README.md 2020-11-04 10:25:15 +08:00
ProxySU
84578e16cd 修复Trojan-go分享链接错误 2020-11-04 10:19:30 +08:00
ProxySU
df98787e6c 优化caddy.service 2020-11-04 09:23:08 +08:00
ProxySU
b404c3e6c9 优化curl超时设置 2020-11-03 11:54:25 +08:00
proxysu
93bed9f261
Update README.md 2020-11-03 07:27:39 +08:00
proxysu
61baafa7af
Update README.md 2020-11-03 07:24:47 +08:00
proxysu
f226b13b0a
Update README.md 2020-11-03 07:23:56 +08:00
proxysu
687ee342db
Update README.md 2020-11-03 07:23:27 +08:00
ProxySU
91e981062a 修复校对时间界面中的选择错误 2020-11-02 16:09:40 +08:00
ProxySU
81f39e6db3 优化下载脚本名称及强制安装提示 2020-11-02 13:10:32 +08:00
ProxySU
e93abb5a1d 修复安装MTProto下载脚本错误3 2020-11-02 09:45:49 +08:00
ProxySU
8f83b57dd4 修复安装MTProto下载脚本错误2 2020-11-02 09:36:47 +08:00
proxysu
15bdfc5a87
Update README.md 2020-11-02 08:34:27 +08:00
ProxySU
b69acc5094 修复安装MTProto下载脚本错误 2020-11-02 08:29:17 +08:00
proxysu
abac17d512
Update README.md 2020-11-01 21:50:38 +08:00
ProxySU
a0b241a608 添加常见问题标签2 2020-11-01 19:42:45 +08:00
ProxySU
e2c105b148 添加常见问题标签 2020-11-01 19:34:10 +08:00
ProxySU
927a468222 优化NaiveProxy安装与卸载 2020-11-01 08:50:25 +08:00
ProxySU
d5c6b8c616 Caddy安装优化2 2020-10-31 23:45:25 +08:00
ProxySU
56dff5ed4f Caddy安装优化 2020-10-31 23:44:28 +08:00
ProxySU
cdc1a2b7e9 优化卸载过程 2020-10-31 23:28:13 +08:00
ProxySU
b491fe19df 优化acme.sh的使用与卸载 2020-10-31 14:47:56 +08:00
ProxySU
35b6a741ff 纯ipv6主机安装caddy,优化网络 2020-10-31 11:15:53 +08:00
ProxySU
7bf01377cb 显示更多的安装信息 2020-10-31 11:02:54 +08:00
ProxySU
4815a71ce9 Nat64网关是否可以连通github的测试 2020-10-30 23:45:10 +08:00
ProxySU
73a1d2c7ed 优化MTProto客户端生成流程 2020-10-30 15:26:16 +08:00
ProxySU
d3acd25ab9 关闭Trojan-go启动检测fallback port 2020-10-30 11:36:15 +08:00
ProxySU
a40776d5a9 代码优化,潜在bug修复 2020-10-30 11:25:41 +08:00
ProxySU
3166814acf 增加伪装网站配置项 2020-10-29 19:32:35 +08:00
ProxySU
56f6f6f976 添加Trojan-go的Mux设置 2020-10-29 15:38:23 +08:00
proxysu
d34ecbd81f
Update README.md 2020-10-28 21:10:47 +08:00
proxysu
bebfe4dfb6
Update README.md 2020-10-28 21:10:12 +08:00
ProxySU
62a4eb9c66 添加VLESS的mKCP模式 2020-10-28 20:58:32 +08:00
ProxySU
cf529a2a4d 优化启用BBR显示进度 2020-10-27 10:14:50 +08:00
ProxySU
2cac6c63ed 优化纯ipv6安装,自动查找最快Nat64网关2 2020-10-26 23:00:48 +08:00
ProxySU
066103adf4 优化纯ipv6安装,自动查找最快Nat64网关 2020-10-26 22:56:20 +08:00
ProxySU
0734887044 增加安装日志另存为文件功能 2020-10-26 12:50:35 +08:00
ProxySU
944929d162 优化Shell命令执行错误的判断与回显 2020-10-26 11:32:13 +08:00
proxysu
f54da666ca
Update README.md 2020-10-26 09:47:14 +08:00
proxysu
dc6ff2e7c3
Update README.md 2020-10-26 09:44:38 +08:00
proxysu
ef29ab812e
Update README.md 2020-10-26 09:40:03 +08:00
proxysu
048a8df6de
Update README.md 2020-10-26 09:39:25 +08:00
proxysu
189d37d22f
Update README.md 2020-10-26 09:38:46 +08:00
proxysu
935de5f846
Update README.md 2020-10-26 09:38:17 +08:00
proxysu
4cd49ab0fb
Update README.md 2020-10-26 09:37:50 +08:00
proxysu
34e055e25a
Update README.md 2020-10-26 07:50:29 +08:00
proxysu
f6779d2c36
Update README.md 2020-10-25 23:54:18 +08:00
proxysu
d8e2580db8
Update README.md 2020-10-25 22:03:08 +08:00
proxysu
83020b9df7
Update README.md 2020-10-25 22:01:06 +08:00
ProxySU
6aadbf65d2 调整NaiveProxy服务端配置 2020-10-25 20:22:28 +08:00
proxysu
20db996f1f
Update README.md 2020-10-25 15:09:20 +08:00
ProxySU
eefa37c099 添加启用root证书密钥登录 2020-10-25 13:37:54 +08:00
proxysu
a9bd37bd27
Update README.md 2020-10-25 09:59:05 +08:00
proxysu
a1b0b3a697
Update README.md 2020-10-25 09:51:31 +08:00
proxysu
f56b54132d
Update README.md 2020-10-24 09:18:13 +08:00
ProxySU
a1a47c98b1 添加启用root密码登录 2020-10-24 02:00:07 +08:00
proxysu
ebfdcf0fec
Update README.md 2020-10-23 14:08:44 +08:00
proxysu
f34ac43341
Update README.md 2020-10-23 14:07:51 +08:00
proxysu
45c1f9cc20
Update README.md 2020-10-23 14:07:19 +08:00
ProxySU
80323e4c6f 添加免翻资源 2020-10-22 19:44:35 +08:00
proxysu
9e25c10b18
Update README.md 2020-10-22 15:24:17 +08:00
ProxySU
b5263c3a80 增加对纯IPv6主机的支持 2020-10-22 15:13:33 +08:00
ProxySU
769df6f2dc 修复可能出现的文件路径错误 2020-10-22 10:03:21 +08:00
ProxySU
fd646363f5 修复MTProto可能潜在的Bug 2020-10-22 01:10:25 +08:00
proxysu
bf39e88ace
Update README.md 2020-10-21 23:11:43 +08:00
ProxySU
249282012d 优化代码结构 2020-10-21 23:08:58 +08:00
proxysu
238eaf13c8
Update README.md 2020-10-15 08:40:09 +08:00
ProxySU
36972317d0 增加更多的错误提示信息 2020-10-14 08:48:03 +08:00
ProxySU
2e9a49db5c 修复证书权限2 2020-10-13 23:51:07 +08:00
ProxySU
36dfea5e9a 修复证书权限 2020-10-13 23:46:33 +08:00
ProxySU
cb224d03f5 优化MTProto生成客户配置 2020-10-13 09:37:30 +08:00
ProxySU
3724028af8 优化代码结构 2020-10-12 19:00:45 +08:00
proxysu
6508808dde
Update README.md 2020-10-10 17:24:45 +08:00
ProxySU
3d0a177cd6 更新跟进Trojan-go最新分享链接标准 2020-10-10 13:08:03 +08:00
proxysu
7e9fb342db
Update README.md 2020-10-10 12:54:02 +08:00
ProxySU
82d458cbce add MTProto+TLS fix some bugs 2020-10-09 21:25:59 +08:00
proxysu
251782a410
Update README.md 2020-10-09 20:14:35 +08:00
ProxySU
5eeb2bfd48 添加VLESS VMESS XTLS TLS WS 复合方案 2020-10-04 22:44:57 +08:00
ProxySU
dc05f990d8 fix bugs 2020-10-01 17:21:33 +08:00
proxysu
a884d850b4
Update README.md 2020-09-30 19:54:55 +08:00
proxysu
7519da27e1
Update README.md 2020-09-30 19:51:59 +08:00
proxysu
e541b933a6
Update README.md 2020-09-30 15:14:36 +08:00
proxysu
0abd5641f6
Update README.md 2020-09-30 15:12:34 +08:00
ProxySU
373747753f edit readme 2020-09-30 14:57:49 +08:00
ProxySU
dcec3a78ac 添加VLESS相关模式,优化代码结构2 2020-09-30 09:40:33 +08:00
ProxySU
7e187bbdd4 添加VLESS相关模式,优化代码结构 2020-09-30 09:39:09 +08:00
ProxySU
b1a7c2149b edit readme 2020-09-28 14:39:56 +08:00
ProxySU
ad06899a6f 添加卸载功能 2020-09-28 14:18:25 +08:00
ProxySU
3ec67daa35 调整配置文件结构,对Padavan路由固件设置 2020-09-27 20:36:59 +08:00
proxysu
d1e42fb734
Update README.md 2020-09-27 00:43:22 +08:00
proxysu
d361b3cb30
Update README.md 2020-09-26 07:59:22 +08:00
ProxySU
5d9a711d36 fix bugs2 2020-09-24 09:39:59 +08:00
ProxySU
aa4631e46e fix bugs 2020-09-24 09:11:58 +08:00
ProxySU
22cae3d15c fix a bug 2020-09-24 09:06:02 +08:00
ProxySU
d4ffe57347 edit 2020-09-24 08:32:08 +08:00
ProxySU
2eab7f026e 解决unzip可能出现的问题 2020-09-23 23:33:22 +08:00
ProxySU
7072d2afd0 编辑SS的说明 2020-09-23 23:27:05 +08:00
ProxySU
8a213cc058 添加SS及插件一键安装,进度条显示百分比 2020-09-23 21:19:02 +08:00
proxysu
ce8b242bfe
Update README.md 2020-09-14 09:25:38 +08:00
proxysu
4b1691c82c
Update README.md 2020-09-14 09:23:16 +08:00
proxysu
78bb263790
Update README.md 2020-09-14 09:22:23 +08:00
proxysu
14ca2a0d4a
Update README.md 2020-09-13 23:01:15 +08:00
proxysu
e267b254ed
Update README.md 2020-09-08 20:32:41 +08:00
proxysu
13db944051
Update README.md 2020-09-08 20:30:49 +08:00
proxysu
cb54bec2da
Update README.md 2020-09-08 20:27:56 +08:00
proxysu
638b7e7ad7
Update README.md 2020-09-08 20:20:40 +08:00
proxysu
fc3f21ba37
Update README.md 2020-09-08 20:19:04 +08:00
ProxySU
c42b105fd6 添加SSR+TLS+Caddy方案 2020-09-08 19:54:18 +08:00
ProxySU
0cb54080a4 Add SSR+TLS+Caddy 01 2020-09-08 00:36:13 +08:00
ProxySU
577ca29156 添加新版本提示 2020-09-05 20:26:00 +08:00
proxysu
1421ef51e0
Update README.md 2020-09-02 17:30:01 +08:00
ProxySU
3bbe0d74bd fallback to fallbacks 2020-09-02 09:03:42 +08:00
ProxySU
81a598caec 适配v2rayN的mKCP Seed 2020-09-01 11:09:46 +08:00
proxysu
7e2a0249aa
Update README.md 2020-08-31 10:15:00 +08:00
proxysu
46982331b6
Update README.md 2020-08-31 10:12:45 +08:00
proxysu
efd9eda6d4
Update README.md 2020-08-31 10:06:12 +08:00
ProxySU
30980e70bc 完善英文界面,增加正体(繁体)语言界面 2020-08-31 10:03:35 +08:00
ProxySU
d1d4a4c35e 添加英文界面03 2020-08-31 00:17:39 +08:00
ProxySU
d7dbf124fe 添加英文界面02 2020-08-28 15:32:46 +08:00
ProxySU
6c601cd545 添加英文版界面01 2020-08-28 09:03:56 +08:00
ProxySU
50b4fc7694 修复Bug 2020-08-25 12:06:26 +08:00
ProxySU
3693703447 修复Bug1 2020-08-25 11:48:57 +08:00
ProxySU
6a72b85785 修复Bug 2020-08-25 10:09:50 +08:00
proxysu
7cf19e7dc5
Update README.md 2020-08-25 08:24:18 +08:00
ProxySU
6475544bbf 增加vless+tcp+tls+web,修复几处Bug,代码结构优化 2020-08-25 07:59:16 +08:00
ProxySU
e7afe102b3 调整Trojan参数设置界面 2020-08-21 12:20:14 +08:00
ProxySU
c6f927f4a5 修复错误 2020-08-20 21:03:08 +08:00
ProxySU
e18a6fbd0c 为V2Ray\Trojan\Trojan-go添加安装过程显示窗口 2020-08-20 20:07:37 +08:00
ProxySU
b916412957 为NaiveProxy添加安装过程显示窗口 2020-08-19 20:33:58 +08:00
proxysu
a70ff5146f
Update README.md 2020-08-18 12:51:07 +08:00
proxysu
38f29cfddf
Update README.md 2020-08-18 12:46:13 +08:00
ProxySU
9861e0a918 修复一些小Bug(#4) 2020-08-18 08:58:00 +08:00
proxysu
e5c06a82cf
Update README.md 2020-08-17 17:56:22 +08:00
ProxySU
5ec0e54a48 修复一些小Bug(#4 #6) 2020-08-17 17:35:29 +08:00
ProxySU
d91e6fb667 V2Ray,Trojan\Trojan-Go,Naiveproxy安装优化,全面适配Caddy2 2020-08-17 15:23:08 +08:00
ProxySU
0127ec60dc 修复安装Trojan-go的一些Bug 2020-08-16 16:37:35 +08:00
ProxySU
6a2a003e98 Trojan-go更新安装脚本和配置文件 2020-08-16 12:58:37 +08:00
proxysu
bc6e515898
Update README.md 2020-08-14 15:16:15 +08:00
proxysu
98de3732fd
Update README.md 2020-08-14 15:15:34 +08:00
ProxySU
c68a8ff872 为升级到caddy2做准备 2020-08-14 00:26:41 +08:00
proxysu
5656153aeb
Update README.md 2020-08-11 10:29:37 +08:00
proxysu
d3eacae03c
Update README.md 2020-08-11 10:24:53 +08:00
ProxySU
1665104f67 移除NaiveProxy客户端配置中的padding项 2020-06-18 08:16:11 +08:00
ProxySU
ca7db9d944 适配V2Ray最新安装脚本 2020-06-17 20:04:17 +08:00
proxysu
e5f55c3757
Update README.md 2020-06-13 17:03:25 +08:00
proxysu
f53d01dbac
Update README.md 2020-06-13 17:02:19 +08:00
proxysu
59c662b6ee
Update README.md 2020-06-11 19:43:23 +08:00
proxysu
37a2be70c7
Update README.md 2020-06-11 19:43:04 +08:00
ProxySU
fd6d35a44d mKCP添加密钥,加强搞识别能力 2020-06-11 19:37:37 +08:00
proxysu
e614f82913
Update README.md 2020-06-06 10:59:23 +08:00
proxysu
877996ac73
Update README.md 2020-06-06 10:49:17 +08:00
ProxySU
0e37f01254 添加Trojan-Go的WebSocket模式 2020-06-06 10:35:24 +08:00
ProxySU
db1ccfed9b 添加Trojan-Go一键安装 2020-06-05 23:27:53 +08:00
proxysu
8b45bdd222
Update README.md 2020-06-05 22:59:45 +08:00
proxysu
85bbf22db2
Update README.md 2020-06-05 22:21:18 +08:00
ProxySU
a6ff33e007 修复BBR启用时的BUG 2020-06-03 22:49:22 +08:00
proxysu
bbc9219e35
Update README.md 2020-05-31 20:12:49 +08:00
ProxySU
082fe80995 添加非root账户登录提示,优化代码2 2020-05-30 12:04:20 +08:00
ProxySU
4f1018935e 添加非root账户登录提示,优化代码 2020-05-30 10:55:17 +08:00
ProxySU
ee8857c969 添加升级Trojan服务端版本 2020-05-28 09:36:47 +08:00
ProxySU
80fd2a431d 修复设置ufw防墙卡住的Bug 2020-05-27 20:53:37 +08:00
proxysu
5e8bf57da0
Update README.md 2020-05-27 19:58:18 +08:00
ProxySU
299f35f03e 添加三合一代理共存 2020-05-27 19:33:09 +08:00
ProxySU
7512153f9a 添加V2ray版本升级 2020-05-24 10:58:21 +08:00
ProxySU
8e02622e23 添加V2ray版本升级功能 2020-05-24 10:44:06 +08:00
proxysu
d746ce549f
Update README.md 2020-05-20 13:01:11 +08:00
ProxySU
bfdc8f4194 添加NaiveGUI的URL支持 2020-05-19 18:57:03 +08:00
proxysu
7e052b8b35
Update README.md 2020-05-19 18:54:15 +08:00
proxysu
c83737cde2
Update README.md 2020-05-19 18:53:33 +08:00
proxysu
93060aa007
Update README.md 2020-05-19 18:52:50 +08:00
proxysu
eb3b4ddc7c
Update README.md 2020-05-19 18:51:49 +08:00
proxysu
e622fc3e80
Update README.md 2020-05-18 17:28:28 +08:00
ProxySU
b55f6f4a60 修正CentOS8下安装NavieProxy防火墙开端口错误 2020-05-11 23:33:37 +08:00
proxysu
85d4070788
Update README.md 2020-05-07 08:11:39 +08:00
proxysu
8a00815590
Update README.md 2020-05-06 12:24:59 +08:00
ProxySU
e8a64380a1 生成Beta版 2020-05-06 12:23:15 +08:00
ProxySU
f327f1c232 生成Bete版 2020-05-06 12:20:35 +08:00
proxysu
45a5daeb7f
Update README.md 2020-05-06 12:17:56 +08:00
ProxySU
6f1eacfa30 生成ReleaseBete 2020-05-06 12:15:09 +08:00
ProxySU
c48aac6422 调整文件结构 2020-05-06 12:08:26 +08:00
ProxySU
23054bbf50 rm 2020-05-06 10:13:44 +08:00
ProxySU
59563bb9eb uploaded 2020-05-06 10:00:45 +08:00
ProxySU
8240e8fcbd upload 2020-05-06 09:59:20 +08:00
ProxySU
a92ea9fcca rm 2020-05-06 09:56:07 +08:00
ProxySU
77c7127cbf rm 2020-05-06 09:53:56 +08:00
ProxySU
1662935530 优化NaiveProxy网络参数,若符合条件,并启用BBR 2020-05-06 09:49:52 +08:00
ProxySU
504a93e455 优化NaiveProxy网络参数,若符合条件,并自动启用BBR 2020-05-06 09:46:45 +08:00
ProxySU
b1ccd74b40 优化NaiveProxy网络参数,若符合条件,自动启用BBR 2020-05-06 08:49:40 +08:00
proxysu
f0aa7bc793
Update README.md 2020-05-05 17:54:49 +08:00
proxysu
9e1ae3729a
Update README.md 2020-05-01 08:30:14 +08:00
ProxySU
8aec179f93 添加一键启用BBR 2020-04-30 20:21:28 +08:00
proxysu
098ab63b62
Update README.md 2020-04-30 09:39:03 +08:00
proxysu
8727a9578c
Update README.md 2020-04-29 17:49:15 +08:00
proxysu
afff125b00
Update README.md 2020-04-29 17:43:04 +08:00
proxysu
5c5306074e
Update README.md 2020-04-29 17:41:53 +08:00
proxysu
cc47d00900
Update README.md 2020-04-29 17:41:15 +08:00
proxysu
181012c7ca
Update README.md 2020-04-29 17:40:35 +08:00
proxysu
452f547514
Update README.md 2020-04-29 17:40:00 +08:00
proxysu
a662bc6562
Update README.md 2020-04-29 17:37:12 +08:00
proxysu
3826951394
Update README.md 2020-04-29 17:36:25 +08:00
proxysu
51054861b2
Update README.md 2020-04-29 17:31:45 +08:00
proxysu
5651f5e029
Update README.md 2020-04-29 17:30:26 +08:00
proxysu
b20f05152a
Update README.md 2020-04-29 17:29:36 +08:00
proxysu
b5915900e7
Update README.md 2020-04-29 17:28:50 +08:00
proxysu
45b7760cf3
Update README.md 2020-04-29 17:27:47 +08:00
proxysu
36f9baf668
Update README.md 2020-04-29 14:21:22 +08:00
ProxySU
f6919a7edf 生成Releas 2020-04-29 14:02:09 +08:00
ProxySU
064b1020a3 生成Releas 2020-04-29 13:58:44 +08:00
ProxySU
6e19150faf 添加NaiveProxy一键安装04 2020-04-29 13:56:56 +08:00
ProxySU
4217d11c43 添加NaiveProxy一键安装03 2020-04-27 22:30:47 +08:00
ProxySU
409f717db7 添加NaiveProxy一键安装02 2020-04-26 23:59:27 +08:00
ProxySU
eec8b46ea6 添加NaiveProxy一键安装01 2020-04-26 13:43:24 +08:00
proxysu
d26768232a
Update README.md 2020-04-24 10:17:14 +08:00
proxysu
e835c8b266
Update README.md 2020-04-24 10:16:34 +08:00
proxysu
aeb6ac319a
Update README.md 2020-04-24 09:31:48 +08:00
proxysu
b007719881
Update README.md 2020-04-24 09:29:45 +08:00
proxysu
d4bd8ecc3c
Update README.md 2020-04-24 09:20:37 +08:00
ProxySU
1ffdc57ad9 添加安卓客户端信息 2020-04-23 20:57:28 +08:00
proxysu
9427052a88
Update README.md 2020-04-23 20:36:59 +08:00
proxysu
08500cd703
Update README.md 2020-04-23 12:27:45 +08:00
ProxySU
a0a0a96f66 完善Trojan一键安装 2020-04-23 09:56:54 +08:00
proxysu
7a74bcb122
Update README.md 2020-04-23 09:52:36 +08:00
proxysu
7bd832b234
Update README.md 2020-04-23 09:51:38 +08:00
proxysu
eff2034360
Update README.md 2020-04-23 09:51:06 +08:00
proxysu
30ca3fd160
Update README.md 2020-04-23 09:50:41 +08:00
proxysu
34ffd6626c
Update README.md 2020-04-23 09:47:38 +08:00
ProxySU
77b18dc2fe 添加Trojan一键安装3 2020-04-23 09:27:49 +08:00
ProxySU
194ecc78c1 添加Trojan一键安装2 2020-04-22 21:13:59 +08:00
ProxySU
57291b5397 Merge branch 'master' of https://github.com/proxysu/windows 2020-04-22 11:42:03 +08:00
ProxySU
e88db198f1 添加Trojan一键安装1 2020-04-22 11:41:24 +08:00
proxysu
05f5b39641
Update README.md 2020-04-21 20:27:12 +08:00
ProxySU
6f8c4ba234 修复caddy所用Email的生成bug 2020-04-20 18:35:18 +08:00
ProxySU
fe6a424255 修复域名测试bug 2020-04-20 17:15:42 +08:00
proxysu
1829de1e48
Update README.md 2020-04-19 13:48:08 +08:00
proxysu
ee8f62326f
Update README.md 2020-04-19 13:39:54 +08:00
proxysu
1da20ac627
Update README.md 2020-04-19 13:39:11 +08:00
proxysu
4173a36b56
Update README.md 2020-04-19 13:37:19 +08:00
proxysu
da2ecda0bc
Update README.md 2020-04-19 13:36:52 +08:00
proxysu
92919994de
Update README.md 2020-04-19 13:35:37 +08:00
proxysu
86bf3d8fb9
Update README.md 2020-04-19 13:34:22 +08:00
ProxySU
e2d32aa764 upload AppPreview Pic 2020-04-19 13:29:57 +08:00
proxysu
c174a9beaa
Update README.md 2020-04-19 11:50:22 +08:00
proxysu
f8d45d2147
Update README.md 2020-04-19 10:49:47 +08:00
proxysu
5d1fb5fd01
Update README.md 2020-04-19 07:57:56 +08:00
proxysu
a828410964
Update README.md 2020-04-19 07:56:38 +08:00
proxysu
fbddd6dc1b
Update README.md 2020-04-19 07:53:15 +08:00
proxysu
a3a93f6f57
Update README.md 2020-04-19 07:48:51 +08:00
proxysu
5c44985769
Update README.md 2020-04-19 07:48:09 +08:00
proxysu
a4df8208f2
Update README.md 2020-04-19 07:47:37 +08:00
proxysu
c4c0342db8
Update README.md 2020-04-18 21:48:04 +08:00
proxysu
f732231ad4
Update README.md 2020-04-18 21:45:06 +08:00
proxysu
02a2679962
Update README.md 2020-04-18 21:42:56 +08:00
ProxySU
67f31e39ff 排查bug2 2020-04-18 21:21:44 +08:00
ProxySU
2390a2b12e 排查bug1 2020-04-17 23:56:17 +08:00
proxysu
298123e661
Update README.md 2020-04-16 22:09:17 +08:00
proxysu
55ce6f63e4
Update README.md 2020-04-16 21:45:10 +08:00
ProxySU
e498e7bec8 增加http2(自签证书)模式 2020-04-16 21:43:53 +08:00
ProxySU
c694dede84 生成Release 2020-04-16 21:13:05 +08:00
proxysu
6d189ac82d
Update README.md 2020-04-16 21:10:45 +08:00
ProxySU
ec7094b7f6 Merge branch 'master' of https://github.com/proxysu/windows 2020-04-16 21:09:30 +08:00
ProxySU
040e03cbd0 增加HTTP2+TLS+Web模式 2020-04-16 21:08:47 +08:00
proxysu
a868ee6f2a
Update README.md 2020-04-16 14:07:03 +08:00
proxysu
bd781058cf
Update README.md 2020-04-16 14:03:08 +08:00
proxysu
e98f746042
Update README.md 2020-04-16 14:02:29 +08:00
ProxySU
e22f15159c 增加WebSocket+TLS(自签证书) 2020-04-16 14:00:26 +08:00
proxysu
d4e4e95e99
Update README.md 2020-04-15 10:49:02 +08:00
ProxySU
89d287b2d6 Merge branch 'master' of https://github.com/proxysu/windows 2020-04-15 10:47:46 +08:00
ProxySU
8a2dbd5c2c 增加tcp+TLS(自签证书) 2020-04-15 10:47:22 +08:00
proxysu
55c44ff265
Update README.md 2020-04-15 07:36:35 +08:00
proxysu
d155f558d8
Update README.md 2020-04-15 07:35:04 +08:00
proxysu
a1953f22a1
Update README.md 2020-04-15 07:34:06 +08:00
proxysu
84d1229655
Update README.md 2020-04-15 07:32:36 +08:00
proxysu
43e7c3cea0
Update README.md 2020-04-15 07:31:15 +08:00
proxysu
610b2d5d7f
Update README.md 2020-04-15 07:27:34 +08:00
proxysu
9455823c47
Update README.md 2020-04-15 07:26:59 +08:00
proxysu
446ef47711
Update README.md 2020-04-15 07:23:49 +08:00
proxysu
68ac9415eb
Update README.md 2020-04-15 07:21:56 +08:00
proxysu
e5d4b1a94e
Update README.md 2020-04-15 07:21:03 +08:00
ProxySU
ec88a916d2 Merge branch 'master' of https://github.com/proxysu/windows 2020-04-14 23:06:29 +08:00
ProxySU
6f36ee87e1 实现模板选择中各个选项卡中RadioButton的唯一选择 2020-04-14 23:05:55 +08:00
proxysu
5b45be2446
Update README.md 2020-04-13 17:37:51 +08:00
ProxySU
1dcd30377c Merge branch 'master' of https://github.com/proxysu/windows 2020-04-13 12:44:36 +08:00
ProxySU
4ce221f398 更改模板库显示布局 2020-04-13 12:43:47 +08:00
299 changed files with 16233 additions and 32737 deletions

4
.editorconfig Normal file
View file

@ -0,0 +1,4 @@
[*.cs]
# Default severity for all analyzer diagnostics
dotnet_analyzer_diagnostic.severity = none

4
.gitignore vendored
View file

@ -13,7 +13,7 @@
# Build results
[Dd]ebug/
[Dd]ebugPublic/
# [Rr]elease/
[Rr]elease/
[Rr]eleases/
x64/
x86/
@ -198,3 +198,5 @@ FakesAssemblies/
# vs code
.vscode/*
/ProxySU_Core/Data/Record.json
/ProxySuper.WPF/bin

View file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelStore">
<e p="C:\Users\huife\AppData\Local\JetBrains\Rider2020.2\extResources" t="IncludeRecursive" />
<e p="C:\Users\huife\AppData\Local\JetBrains\Rider2020.2\resharper-host\Local\Transient\Rider\v202\SolutionCaches\_ProxySU.1010492592.00" t="ExcludeRecursive" />
<e p="E:\dev\ProxySU" t="IncludeFlat">
<e p="packages" t="ExcludeRecursive" />
<e p="ProxySU" t="IncludeRecursive">
<e p="ProxySU.csproj" t="IncludeRecursive" />
</e>
<e p="ProxySU.sln" t="IncludeFlat" />
<e p="WpfApp1" t="IncludeRecursive">
<e p="App.xaml" t="Include" />
<e p="App.xaml.cs" t="Include" />
<e p="AssemblyInfo.cs" t="Include" />
<e p="bin" t="ExcludeRecursive" />
<e p="MainWindow.xaml" t="Include" />
<e p="MainWindow.xaml.cs" t="Include" />
<e p="obj" t="ExcludeRecursive">
<e p="Debug" t="Include">
<e p="netcoreapp3.1-windows" t="Include">
<e p="App.g.cs" t="Include" />
<e p="MainWindow.g.cs" t="Include" />
<e p="WpfApp1.AssemblyInfo.cs" t="Include" />
</e>
</e>
</e>
<e p="WpfApp1.csproj" t="IncludeRecursive" />
</e>
</e>
</component>
</project>

4
.idea/.idea.ProxySU/.idea/encodings.xml generated Normal file
View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelUserStore">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

8
.idea/.idea.ProxySU/.idea/modules.xml generated Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.ProxySU/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.ProxySU/riderModule.iml" />
</modules>
</component>
</project>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="vcsConfiguration" value="2" />
</component>
</project>

6
.idea/.idea.ProxySU/.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

121
.idea/.idea.ProxySU/.idea/workspace.xml generated Normal file
View file

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoGeneratedRunConfigurationManager">
<projectFile>ProxySU/ProxySU.csproj</projectFile>
<projectFile>WpfApp1/WpfApp1.csproj</projectFile>
</component>
<component name="ChangeListManager">
<list default="true" id="669dc0ab-dc83-4456-b675-b70a2f5f75b2" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/ProxySU.sln" beforeDir="false" afterPath="$PROJECT_DIR$/ProxySU.sln" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ProxySU/bin/Beta/Beta.zip" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$PROJECT_DIR$/ProxySU/MainWindow.xaml" root0="SKIP_HIGHLIGHTING" />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/WpfApp1/MainWindow.xaml" />
</list>
</option>
</component>
<component name="ProjectId" id="1lRuJq6UGgT2UlI6dsaBIqwjatG" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="dart.analysis.tool.window.visible" value="false" />
<property name="vue.rearranger.settings.migration" value="true" />
</component>
<component name="RunManager" selected=".NET Project.WpfApp1">
<configuration name="ProxySU" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/ProxySU/ProxySU.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="Console" />
<option name="PROJECT_TFM" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration name="WpfApp1" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/WpfApp1/WpfApp1.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="669dc0ab-dc83-4456-b675-b70a2f5f75b2" name="Default Changelist" comment="" />
<created>1607572158648</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1607572158648</updated>
<workItem from="1607572166623" duration="517000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="UnityProjectConfiguration" hasMinimizedUI="null" />
<component name="UnityUnitTestConfiguration" currentTestLauncher="NUnit" />
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
</component>
<component name="WindowStateProjectService">
<state width="1877" height="275" key="GridCell.Tab.0.bottom" timestamp="1607572691215">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="275" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1607572691215" />
<state width="1877" height="275" key="GridCell.Tab.0.center" timestamp="1607572691215">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="275" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1607572691215" />
<state width="1877" height="275" key="GridCell.Tab.0.left" timestamp="1607572691215">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="275" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1607572691215" />
<state width="1877" height="275" key="GridCell.Tab.0.right" timestamp="1607572691215">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="275" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1607572691215" />
<state x="552" y="252" key="Rider.ProjectTemplateDialog.Size" timestamp="1607572543584">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="552" y="252" key="Rider.ProjectTemplateDialog.Size/0.0.1920.1040@0.0.1920.1040" timestamp="1607572543584" />
</component>
</project>

7
.idea/.idea.ProxySU/riderModule.iml generated Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RIDER_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../.." />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -1,9 +1,13 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1022
# Visual Studio Version 17
VisualStudioVersion = 17.0.31606.5
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxySU", "ProxySU\ProxySU.csproj", "{DD5505BC-E7F1-4D03-ABC7-B636E893FC09}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libs", "Libs", "{CE908112-DB46-4B91-8236-9139A19D66E9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxySuper.WPF", "ProxySuper.WPF\ProxySuper.WPF.csproj", "{B083EBFD-2925-46C9-8B00-E2C1300CEBA1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxySuper.Core", "ProxySuper.Core\ProxySuper.Core.csproj", "{15779EE6-D8CA-44BF-BFE2-941E155EEF3F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -11,14 +15,22 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD5505BC-E7F1-4D03-ABC7-B636E893FC09}.Release|Any CPU.Build.0 = Release|Any CPU
{B083EBFD-2925-46C9-8B00-E2C1300CEBA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B083EBFD-2925-46C9-8B00-E2C1300CEBA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B083EBFD-2925-46C9-8B00-E2C1300CEBA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B083EBFD-2925-46C9-8B00-E2C1300CEBA1}.Release|Any CPU.Build.0 = Release|Any CPU
{15779EE6-D8CA-44BF-BFE2-941E155EEF3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{15779EE6-D8CA-44BF-BFE2-941E155EEF3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15779EE6-D8CA-44BF-BFE2-941E155EEF3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{15779EE6-D8CA-44BF-BFE2-941E155EEF3F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{B083EBFD-2925-46C9-8B00-E2C1300CEBA1} = {CE908112-DB46-4B91-8236-9139A19D66E9}
{15779EE6-D8CA-44BF-BFE2-941E155EEF3F} = {CE908112-DB46-4B91-8236-9139A19D66E9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A3F3B8D6-7FED-42D9-9994-E913BD32E025}
EndGlobalSection

View file

@ -1,9 +0,0 @@
<Application x:Class="ProxySU.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ProxySU"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

View file

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
namespace ProxySU
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
}
}

View file

@ -1,224 +0,0 @@
<Window x:Class="ProxySU.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="ProxySU" Height="600" Width="900">
<!--以下样式参考自https://yq.aliyun.com/articles/331878
https://docs.microsoft.com/en-us/dotnet/desktop-wpf/fundamentals/styles-templates-overview-->
<Window.Resources>
<Style BasedOn="{StaticResource {x:Type TextBox}}"
TargetType="TextBox"
x:Key="TitleText">
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Text" Value=""/>
<Condition Property="TextBox.IsFocused" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border BorderThickness="1" BorderBrush="Gray" Margin="0">
<TextBlock x:Name="MainTextBlock" Text="{TemplateBinding TextBox.Tag}" Width="{TemplateBinding TextBox.ActualWidth}" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</MultiTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<TabControl>
<!--<TabItem Header="V2ray配置生成器" Width="110" Height="30">
<Grid>
</Grid>
</TabItem>-->
<TabItem Header="应用布署" Width="110" Height="30">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30" ></RowDefinition>
<RowDefinition ></RowDefinition>
<RowDefinition ></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="主机名" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="0" Grid.Row="0"></TextBlock>
<TextBlock Text="端口" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="0"></TextBlock>
<TextBox x:Name="TextBoxHost" Text="" Style="{StaticResource TitleText}" Tag="IP或域名(不可为空)" Margin="5" Grid.Column="1" Grid.Row="0"></TextBox>
<TextBox x:Name="TextBoxPort" CommandManager.PreviewExecuted="TextBoxPort_PreviewExecuted" Text="22" Margin="5" Grid.Column="3" Grid.Row="0" PreviewTextInput="TextBoxPort_PreviewTextInput"/>
<TextBlock Text="用户名:" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="0" Grid.Row="1"></TextBlock>
<TextBlock x:Name="TextBlockPassword" Text="密码:" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="1"></TextBlock>
<TextBox x:Name="TextBoxUserName" Text="root" Margin="5" Grid.Column="1" Grid.Row="1"></TextBox>
<PasswordBox x:Name="PasswordBoxHostPassword" Password="" Margin="5" Grid.Column="3" Grid.Row="1"></PasswordBox>
<RadioButton x:Name="RadioButtonPasswordLogin" GroupName="CertIsYesNo" Content="密码登录" Grid.Column="0" Grid.Row="2" Checked="RadioButtonPasswordLogin_Checked"></RadioButton>
<RadioButton x:Name="RadioButtonCertLogin" GroupName="CertIsYesNo" Content="密钥登录" Grid.Column="1" Grid.Row="2" Checked="RadioButtonCertLogin_Checked"></RadioButton>
<Button x:Name="ButtonOpenFileDialog" Content="浏览..." Margin="8" Grid.Column="2" Grid.Row="2" Click="ButtonOpenFileDialog_Click"></Button>
<TextBox x:Name="TextBoxCertFilePath" Text="" Style="{StaticResource TitleText}" Tag="密钥文件存放路径(不可为空)" Margin="10" Grid.Column="3" Grid.Row="2"></TextBox>
<!--代理设置-->
<Grid Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="4">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<RadioButton x:Name="RadioButtonNoProxy" GroupName="ProxyIsYesNo" Content="无代理" Grid.Column="0" Grid.Row="0" Checked="RadioButtonNoProxy_Checked" Unchecked="RadioButtonNoProxy_Unchecked"/>
<RadioButton x:Name="RadioButtonHttp" GroupName="ProxyIsYesNo" Content="Http代理" Grid.Column="1" Grid.Row="0"/>
<RadioButton x:Name="RadioButtonSocks5" GroupName="ProxyIsYesNo" Content="Socks5代理" Grid.Column="2" Grid.Row="0"/>
<RadioButton x:Name="RadioButtonSocks4" GroupName="ProxyIsYesNo" Content="Socks4代理" Grid.Column="3" Grid.Row="0" />
</Grid>
<TextBlock x:Name="TextBlockProxyHost" IsEnabled="False" Text="代理地址" HorizontalAlignment="Left" Margin="5,10,0,5" Grid.Column="0" Grid.Row="4"/>
<TextBlock x:Name="TextBlockProxyPort" IsEnabled="False" Text="端口" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="4"></TextBlock>
<TextBox x:Name="TextBoxProxyHost" IsEnabled="False" Text="127.0.0.1" Margin="5" Grid.Column="1" Grid.Row="4"></TextBox>
<TextBox x:Name="TextBoxProxyPort" IsEnabled="False" CommandManager.PreviewExecuted="TextBoxPort_PreviewExecuted" Text="1080" Margin="5" Grid.Column="3" Grid.Row="4" PreviewTextInput="TextBoxPort_PreviewTextInput"/>
<!--代理用户名密码设置-->
<RadioButton x:Name="RadioButtonProxyNoLogin" Content="不需登录" GroupName="proxyYesNOLogin" Grid.Column="0" Grid.Row="5" Checked="RadioButtonProxyNoLogin_Checked"></RadioButton>
<RadioButton x:Name="RadiobuttonProxyYesLogin" Content="需要登录" GroupName="proxyYesNOLogin" Grid.Column="1" Grid.Row="5" Checked="RadiobuttonProxyYesLogin_Checked"></RadioButton>
<TextBlock x:Name="TextBlockProxyUser" IsEnabled="False" Text="用户名:" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="0" Grid.Row="6"></TextBlock>
<TextBlock x:Name="TextBlockProxyPassword" IsEnabled="False" Text="密码:" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="6"></TextBlock>
<TextBox x:Name="TextBoxProxyUserName" IsEnabled="False" Text="" Margin="5" Grid.Column="1" Grid.Row="6"></TextBox>
<PasswordBox x:Name="PasswordBoxProxyPassword" IsEnabled="False" Password="" Margin="5" Grid.Column="3" Grid.Row="6"></PasswordBox>
<!--<StatusBar x:Name="StatusBarStatusMonitoring" Grid.Column="0" Grid.Row="7" Grid.ColumnSpan="4"></StatusBar>-->
<TextBlock x:Name="TextBlockSetUpProcessing" Text="等待安装布署" Foreground="Blue" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="0" Grid.Row="7" Grid.ColumnSpan="4"></TextBlock>
<ProgressBar x:Name="ProgressBarSetUpProcessing" Minimum="0" Maximum="100" Value="0" IsIndeterminate="False" Margin="7" Grid.Column="0" Grid.Row="8" Grid.ColumnSpan="4"></ProgressBar>
<TabControl Grid.Column="0" Grid.Row="9" Grid.ColumnSpan="4" Grid.RowSpan="2">
<TabItem Header="V2ray配置" Width="150" Height="30">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Button x:Name="ButtonGuideConfiguration" Visibility="Visible" Content="启用向导" Grid.Column="0" Grid.Row="0" Click="ButtonGuideConfiguration_Click"></Button>
<TextBlock Text="通过向导生成配置文件" Visibility="Visible" Grid.Column="0" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Center"></TextBlock>
<Button x:Name="ButtonTemplateConfiguration" Content="打开模板库" Grid.Column="1" Grid.Row="0" Click="ButtonTemplateConfiguration_Click"></Button>
<TextBlock Text="模板库" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Center"></TextBlock>
<Button x:Name="ButtonAdvancedConfiguration" Visibility="Visible" Content="配置编辑器" Grid.Column="2" Grid.Row="0" Click="ButtonAdvancedConfiguration_Click"></Button>
<TextBlock Text="配置文件高级生成器&#x0a;(有经验用户可以使用)" Visibility="Visible" Grid.Column="2" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Center"></TextBlock>
<!--<RadioButton x:Name="RadioButtonGuideConfiguration" Content="向导生成配置" Grid.Column="0" Grid.Row="0"></RadioButton>
<RadioButton x:Name="RadioButtonTemplateConfiguration" Content="模板配置" Grid.Column="0" Grid.Row="1"></RadioButton>
<RadioButton x:Name="RadioButtonAdvancedConfiguration" Content="高级配置" Grid.Column="0" Grid.Row="2"></RadioButton>
<TextBox x:Name="TextBoxJsonPath" Margin="10" Grid.Column="1" Grid.Row="1"></TextBox>
<Button x:Name="ButtonSetConfiguration" Margin="6" Content="配置" Grid.Column="2" Grid.Row="2" Click="ButtonSetConfiguration_Click"></Button>-->
</Grid>
</TabItem>
<TabItem Header="系统工具" Width="150" Height="30">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Button x:Name="ButtonProofreadTime" Content="校对时间" Grid.Column="0" Grid.Row="0" Margin="5" Click="ButtonProofreadTime_Click"/>
<Button x:Name="ButtonClearOccupiedPorts" Content="释放80/443端口" Grid.Column="1" Grid.Row="0" Margin="5" Click="ButtonClearOccupiedPorts_Click"></Button>
</Grid>
</TabItem>
<TabItem Header="测试面板" Visibility="Visible" Width="150" Height="30">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<!--<Button Content="更改SELinux模式" Grid.Column="0" Grid.Row="0" Margin="10" Click="Button_Click"></Button>-->
<!--<Button x:Name="testresultClientInform" Content="测试结果窗口" Grid.Column="0" Grid.Row="1" Margin="5" Click="TestresultClientInform_Click"></Button>
<Button x:Name="testPortOccupy" Content="测试端口占用" Grid.Column="0" Grid.Row="2" Margin="5" Click="TestPortOccupy_Click"></Button>
<Button x:Name="testInstalledV2ray" Content="测试是否安装V2ray" Grid.Column="1" Grid.Row="0" Margin="5" Click="TestInstalledV2ray_Click"></Button>
<Button x:Name="testsshCmd" Content="测试ssh命令" Grid.Column="1" Grid.Row="1" Margin="5" Click="TestsshCmd_Click"></Button>-->
</Grid>
</TabItem>
</TabControl>
<Button x:Name="Button_Login" Content="布署安装" Grid.ColumnSpan="2" Margin="10" Grid.Column="0" Grid.Row="11" Click="Button_Login_Click"></Button>
<Button x:Name="Button_canel" Content="取消" Grid.ColumnSpan="2" Margin="10" Grid.Column="2" Grid.Row="11" Click="Button_canel_Click"></Button>
</Grid>
</TabItem>
<TabItem Header="资源工具" Width="110" Height="30">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Button x:Name="ButtonWebBrowserHomePage" Content="主页" Grid.Column="0" Grid.Row="0" Margin="5" Click="ButtonWebBrowserHomePage_Click"></Button>
<Button x:Name="ButtonWebBrowserForward" Content="前进" Grid.Column="2" Grid.Row="0" Margin="5" Click="ButtonWebBrowserForward_Click"></Button>
<Button x:Name="ButtonWebBrowserBack" Content="后退" Grid.Column="1" Grid.Row="0" Margin="5" Click="ButtonWebBrowserBack_Click"/>
<TextBlock Text="由于众所周知的原因,在某些时候,加载缓慢,请耐心等待一下" Grid.Column="4" Grid.Row="0" Grid.ColumnSpan="4" Margin="5"></TextBlock>
<!--<TextBox x:Name="TextBoxWebBrowserProxyUrl" Style="{StaticResource TitleText}" Tag="粘贴被墙的网址到这里点击 GO(下面被墙网址右击==复制快捷方式)" Grid.Column="3" Grid.Row="0" Grid.ColumnSpan="5" Margin="5"></TextBox>
<Button x:Name="ButtonWebBrowserProxyGo" Content="Go" Grid.Column="8" Grid.Row="0" Margin="5" Click="ButtonWebBrowserProxyGo_Click"></Button>-->
<WebBrowser x:Name="WebBrowserResourcesAndTools" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="9" Grid.RowSpan="13" Source="https://github.com/proxysu/windows/wiki/ResourcesAndTools" />
</Grid>
</TabItem>
</TabControl>
</Grid>
</Window>

File diff suppressed because it is too large Load diff

View file

@ -1,36 +0,0 @@
<Window x:Class="ProxySU.ProofreadTimeWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="ProofreadTimeWindow" Height="450" Width="600">
<Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<RadioButton x:Name="RadioButtonNetworkTime" IsChecked="True" Content="同步网络时间" Grid.Column="0" Grid.Row="0" Margin="40"></RadioButton>
<TextBlock Text="将远程主机时间校正为网络时间注意本机电脑的时间必须也是与网络时间同步的否则本机电脑V2ray有可能连接出错&#x0a;&#x0a;推荐:优先使用此方法校对时间" TextWrapping="Wrap" Grid.Column="0" Grid.Row="1" Grid.RowSpan="2" Margin="20"></TextBlock>
<RadioButton x:Name="RadioButtonLocalTime" Content="同步本机时间" Grid.Column="1" Grid.Row="0" Margin="40"></RadioButton>
<TextBlock Text="将远程主机时间同步为本地时间,注意:本机电脑的时间必须是准确的,与网络时间同步的,否则其他客户端中,有可能连接出错&#x0a;&#x0a;使用网络校时无法校对时间时,使用此种方法" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Margin="20"></TextBlock>
<RadioButton x:Name="RadioButtonUpDateLocalTime" Content="更新本机时间" Grid.Column="2" Grid.Row="0" Margin="40"></RadioButton>
<TextBlock Text="将本机电脑时间与网络时间同步。&#x0a;&#x0a;注意:使用此项功能,必须以管理员身份运行本程序" TextWrapping="Wrap" Grid.Column="2" Grid.Row="1" Grid.RowSpan="2" Margin="20"></TextBlock>
<Button x:Name="ButtonTestTime" Content="检测时间误差" Grid.Column="0" Grid.Row="3" Margin="30" Click="ButtonTestTime_Click"/>
<Button x:Name="ButtonProofreading" Content="校对时间" Grid.Column="2" Grid.Row="3" Margin="30" Click="ButtonProofreading_Click"></Button>
<!--<Button x:Name="ButtonTEST" Content="测试命令" Grid.Column="1" Grid.Row="3" Margin="30" Click="ButtonTEST_Click"></Button>-->
</Grid>
</Grid>
</Window>

View file

@ -1,252 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using Renci.SshNet;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System.Drawing;
using QRCoder;
using System.Net;
using System.Net.Sockets;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.Runtime;
using System.Globalization;
namespace ProxySU
{
/// <summary>
/// ProofreadTimeWindow.xaml 的交互逻辑
/// </summary>
public partial class ProofreadTimeWindow : Window
{
public static ConnectionInfo ProfreadTimeReceiveConnectionInfo { get; set; }
//ProfreadTimeReceiveParameters
public ProofreadTimeWindow()
{
InitializeComponent();
}
private void ButtonTestTime_Click(object sender, RoutedEventArgs e)
{
using (var client = new SshClient(ProfreadTimeReceiveConnectionInfo))
{
client.Connect();
client.RunCommand("rm -f /etc/localtime");
client.RunCommand("ln -s /usr/share/zoneinfo/UTC /etc/localtime");
//获取远程主机的时间戳
long timeStampVPS = Convert.ToInt64(client.RunCommand("date +%s").Result.ToString());
//MessageBox.Show(timesStampVPS.ToString());
//获取本地时间戳
TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
long timeStampLocal = Convert.ToInt64(ts.TotalSeconds);
client.Disconnect();
if (Math.Abs(timeStampLocal - timeStampVPS) >= 90)
{
MessageBox.Show("本地时间与远程主机时间相差超过限制(90秒)V2ray无法建立连接");
//currentStatus = "时间较对失败......";
//textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
//Thread.Sleep(1000);
return;
}
else
{
MessageBox.Show("误差为:" + Math.Abs(timeStampLocal - timeStampVPS).ToString()+" 可以连接");
}
}
}
private void ButtonProofreading_Click(object sender, RoutedEventArgs e)
{
if (RadioButtonUpDateLocalTime.IsChecked == true)
{
//将本机电脑与网络时间同步
DateTime netUTCtime = NetTime.GetUTCTime();
if (!DateTime.Equals(netUTCtime, new DateTime(1970, 1, 1, 0, 0, 0, 0)))
{
DateTime localTime = netUTCtime.ToLocalTime();
bool setD = UpdateTime.SetDate(localTime);
if (setD == true)
{
MessageBox.Show("本机时间已经更新为网络时间(国家授时中心获取)");
}
else
{
MessageBox.Show("更新失败,请重试。");
}
}
return;
}
using (var client = new SshClient(ProfreadTimeReceiveConnectionInfo))
{
client.Connect();
//设置vps为UTC时区
client.RunCommand("rm -f /etc/localtime");
client.RunCommand("ln -s /usr/share/zoneinfo/UTC /etc/localtime");
if (RadioButtonLocalTime.IsChecked == true)
{
//以本地时间为准,校正远程主机时间
//获取本地时间戳
TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
long timeStampLocal = Convert.ToInt64(ts.TotalSeconds);
//string stampTime = timeStampLocal.ToString();
string sshCmd = $"date --set=\"$(date \"+%Y-%m-%d %H:%M:%S\" -d @{timeStampLocal.ToString()})\"";
//MessageBox.Show(sshCmd);
//string sshCmd = $"date --set=\"$(date \"+%Y-%m-%d %H:%M:%S\" -d @1489739011)\"";
//MessageBox.Show(sshCmd);
client.RunCommand(sshCmd);
MessageBox.Show("同步本地时间校时完毕");
}
else
{
//以网络时间为准,校正远程主机时间
TimeSpan utcTS = NetTime.GetUTCTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
long timeStampVPS = Convert.ToInt64(utcTS.TotalSeconds);
if (timeStampVPS!=0)
{
//MessageBox.Show(timeStampVPS.ToString());
string sshCmd = $"date --set=\"$(date \"+%Y-%m-%d %H:%M:%S\" -d @{timeStampVPS.ToString()})\"";
//MessageBox.Show(sshCmd);
client.RunCommand(sshCmd);
MessageBox.Show("同步网络时间校时完毕");
}
//else
//{
// MessageBox.Show(timeStampVPS.ToString());
// MessageBox.Show("同步网络时间失败");
//}
}
client.Disconnect();
}
}
//private void ButtonTEST_Click(object sender, RoutedEventArgs e)
//{
// //NetTime netTime = new NetTime();
// string netDatetime = NetTime.GetUTCTime().ToString();
// MessageBox.Show(netDatetime);
// //NetTime netTime = new NetTime();
// //UpdateTime updateTime = new UpdateTime();
// //DateTime netDateTime = netTime.GetBeijingTime();
// //MessageBox.Show(netDateTime.ToString());
//}
}
/// <summary>
/// 网络时间 代码从网上复制原网址https://www.codeleading.com/article/23791981303/
/// </summary>
public class NetTime
{
/// <summary>
/// 从国家授时中心获取标准GMT时间读取https://www.tsa.cn
/// GMT时间与UTC时间没有差别可以UTC=GMT
/// </summary>
/// <returns>返回网络时间</returns>
public static DateTime GetUTCTime()
{
DateTime time;
////Thread.Sleep(5000);
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.tsa.cn");
request.Method = "HEAD";
request.AllowAutoRedirect = false;
HttpWebResponse reponse = (HttpWebResponse)request.GetResponse();
string cc = reponse.GetResponseHeader("date");
reponse.Close();
bool s = GMTStrParse(cc, out time);
return time;
}
catch (Exception ex1)
{
if (ex1.ToString().Contains("403"))
{
MessageBox.Show("校时操作太频繁,请稍等片刻再操作!");
}
else
{
MessageBox.Show(ex1.Message);
}
return time = new DateTime(1970, 1, 1, 0, 0, 0, 0);
}
//return time.AddHours(8); //GMT要加8个小时才是北京时间
}
public static bool GMTStrParse(string gmtStr, out DateTime gmtTime) //抓取的date是GMT格式的字符串这里转成datetime
{
CultureInfo enUS = new CultureInfo("en-US");
bool s = DateTime.TryParseExact(gmtStr, "r", enUS, DateTimeStyles.None, out gmtTime);
return s;
}
}
/// <summary>
/// 更新系统时间代码从网上复制原网址https://www.open-open.com/code/view/1430552965599
/// </summary>
public class UpdateTime
{
//设置系统时间的API函数
[DllImport("kernel32.dll")]
private static extern bool SetLocalTime(ref SYSTEMTIME time);
[StructLayout(LayoutKind.Sequential)]
private struct SYSTEMTIME
{
public short year;
public short month;
public short dayOfWeek;
public short day;
public short hour;
public short minute;
public short second;
public short milliseconds;
}
/// <summary>
/// 设置系统时间
/// </summary>
/// <param name="dt">需要设置的时间</param>
/// <returns>返回系统时间设置状态true为成功false为失败</returns>
public static bool SetDate(DateTime dt)
{
SYSTEMTIME st;
st.year = (short)dt.Year;
st.month = (short)dt.Month;
st.dayOfWeek = (short)dt.DayOfWeek;
st.day = (short)dt.Day;
st.hour = (short)dt.Hour;
st.minute = (short)dt.Minute;
st.second = (short)dt.Second;
st.milliseconds = (short)dt.Millisecond;
bool rt = SetLocalTime(ref st);
return rt;
}
}
}

View file

@ -1,158 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DD5505BC-E7F1-4D03-ABC7-B636E893FC09}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>ProxySU</RootNamespace>
<AssemblyName>ProxySU</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>ProxySU.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\json.net\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="QRCoder">
<HintPath>..\qrcoder\net40\QRCoder.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet">
<HintPath>..\ssh.net\net40\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ProofreadTimeWindow.xaml.cs">
<DependentUpon>ProofreadTimeWindow.xaml</DependentUpon>
</Compile>
<Compile Include="ResultClientInformation.xaml.cs">
<DependentUpon>ResultClientInformation.xaml</DependentUpon>
</Compile>
<Compile Include="TemplateConfiguration.xaml.cs">
<DependentUpon>TemplateConfiguration.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="ProofreadTimeWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ResultClientInformation.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="TemplateConfiguration.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="ProxySU.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del "$(TargetDir)*.xml"
del "$(TargetDir)*.pdb"
del "$(TargetDir)*.zip"
"D:\Program Files\7-Zip\7z.exe" a $(TargetDir)Release.zip $(TargetDir) -xr!config</PostBuildEvent>
</PropertyGroup>
</Project>

View file

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory />
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>zh-CN</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>

View file

@ -1,85 +0,0 @@
<Window x:Class="ProxySU.ResultClientInformation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="ResultClientInformation" Height="650" Width="600">
<Grid>
<GroupBox Header="服务器连接配置">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="地址(address)" Grid.Column="0" Grid.Row="0" Margin="8"></TextBlock>
<TextBox x:Name="TextBoxHostAddress" IsReadOnly="True" Grid.Column="1" Grid.Row="0" Margin="8"></TextBox>
<TextBlock Text="说明" Grid.Column="2" Grid.Row="0"></TextBlock>
<TextBlock Text="端口(port)" Grid.Column="0" Grid.Row="1" Margin="8"></TextBlock>
<TextBox x:Name="TextBoxPort" IsReadOnly="True" Grid.Column="1" Grid.Row="1" Margin="8"></TextBox>
<TextBlock Text="说明" Grid.Column="2" Grid.Row="1"></TextBlock>
<TextBlock Text="用户ID(uuid)" Grid.Column="0" Grid.Row="2" Margin="8"></TextBlock>
<TextBox x:Name="TextBoxUUID" IsReadOnly="True" Grid.Column="1" Grid.Row="2" Margin="8"></TextBox>
<TextBlock Text="说明" Grid.Column="2" Grid.Row="2"></TextBlock>
<TextBlock Text="额外ID" Grid.Column="0" Grid.Row="3" Margin="8"></TextBlock>
<TextBox x:Name="TextBoxUUIDextra" IsReadOnly="False" Grid.Column="1" Grid.Row="3" Margin="8"></TextBox>
<TextBlock Text="默认16可以填不超过64的值客户端没有此选项可不填" TextWrapping="Wrap" Grid.Column="2" Grid.Row="3"></TextBlock>
<TextBlock Text="加密方式" Grid.Column="0" Grid.Row="4" Margin="8"></TextBlock>
<TextBox x:Name="TextBoxEncryption" IsReadOnly="True" Grid.Column="1" Grid.Row="4" Margin="8"></TextBox>
<TextBlock Text="默认auto" Grid.Column="2" Grid.Row="4"></TextBlock>
<TextBlock Text="传输协议" Grid.Column="0" Grid.Row="5" Margin="8"></TextBlock>
<TextBox x:Name="TextBoxTransmission" IsReadOnly="True" Grid.Column="1" Grid.Row="5" Margin="8"></TextBox>
<TextBlock Text="说明" Grid.Column="2" Grid.Row="5"></TextBlock>
<TextBlock Text="伪装类型" Grid.Column="0" Grid.Row="6" Margin="8"></TextBlock>
<TextBox x:Name="TextBoxCamouflageType" IsReadOnly="True" Grid.Column="1" Grid.Row="6" Margin="8"></TextBox>
<TextBlock Text="说明" Grid.Column="2" Grid.Row="6"></TextBlock>
<TextBlock x:Name="TextBlocTLSonOrNo" Text="是否使用TLS" Grid.Column="0" Grid.Row="7" Margin="8"></TextBlock>
<TextBox x:Name="TextBoxTLS" IsReadOnly="True" Grid.Column="1" Grid.Row="7" Margin="8"></TextBox>
<TextBlock x:Name="TextBlocTLSonOrNoExplain" Text="说明" Grid.Column="2" Grid.Row="7"></TextBlock>
<TextBlock x:Name="TextBlockPath" Text="路径(Path)" Grid.Column="0" Grid.Row="8" Margin="8"></TextBlock>
<TextBox x:Name="TextBoxPath" IsReadOnly="True" Grid.Column="1" Grid.Row="8" Margin="8"></TextBox>
<TextBlock x:Name="TextBlockPathExplain" Text="说明" Grid.Column="2" Grid.Row="8"></TextBlock>
<TextBlock x:Name="TextBlockQuicKey" Text="QUIC密钥" Grid.Column="0" Grid.Row="9" Margin="8"></TextBlock>
<TextBox x:Name="TextBoxQuicKey" IsReadOnly="True" Grid.Column="1" Grid.Row="9" Margin="8"></TextBox>
<TextBlock x:Name="TextBlockQuicKeyExplain" Text="说明" Grid.Column="2" Grid.Row="9"></TextBlock>
<TextBlock Text="以上参数可以手动输入客户端用于V2ray官方客户端的配置文件已经存放入config目录下点击确定可打开" Grid.Column="0" Grid.Row="10" Grid.ColumnSpan="2" TextWrapping="Wrap"></TextBlock>
<Button x:Name="ButtonOpenSaveDir" Content="确定" Grid.Column="2" Grid.Row="10" Grid.RowSpan="1" Margin="5" Click="ButtonOpenSaveDir_Click"></Button>
<Grid Grid.Column="0" Grid.Row="11" Grid.ColumnSpan="2" Grid.RowSpan="7">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="85"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="二维码和vmess链接可用于&#x0a;&#x0a;v2rayN(windows)&#x0a;&#x0a;Shadowrocket(ios)&#x0a;&#x0a;v2rayNG(Android)&#x0a;&#x0a;导入v2ray节点" TextWrapping="Wrap" Grid.Column="0"></TextBlock>
<Image x:Name="ImageShareQRcode" Grid.Column="1"></Image>
</Grid>
</Grid>
<TextBox x:Name="TextBoxvVmessUrl" TextWrapping="Wrap" Grid.Column="2" Grid.Row="11" Grid.RowSpan="7"></TextBox>
</Grid>
</GroupBox>
</Grid>
</Window>

View file

@ -1,387 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;
using Renci.SshNet;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System.Drawing;
using QRCoder;
namespace ProxySU
{
/// <summary>
/// ResultClientInformation.xaml 的交互逻辑
/// </summary>
public partial class ResultClientInformation : Window
{
private string saveFileFolder = "";
public ResultClientInformation()
{
InitializeComponent();
//主机端口
TextBoxPort.Text = MainWindow.ReceiveConfigurationParameters[1];
//用户ID(uuid)
TextBoxUUID.Text = MainWindow.ReceiveConfigurationParameters[2];
//额外ID
TextBoxUUIDextra.Text = "16";
//路径Path
TextBoxPath.Text = MainWindow.ReceiveConfigurationParameters[3];
//主机地址
TextBoxHostAddress.Text = MainWindow.ReceiveConfigurationParameters[4];
//加密方式一般都为auto
TextBoxEncryption.Text = "auto";
//伪装类型
TextBoxCamouflageType.Text = MainWindow.ReceiveConfigurationParameters[5];
//QUIC密钥
TextBoxQuicKey.Text = MainWindow.ReceiveConfigurationParameters[6];
if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS2Web"))
{
TextBoxTransmission.Text = "ws";
TextBoxCamouflageType.Text = "none";
ShowPathAndTLS();
HideQuicKey();
TextBoxTLS.Text = "tls";
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCPhttp"))
{
TextBoxTransmission.Text = "tcp";
TextBoxCamouflageType.Text = "http";
TextBoxTLS.Text = "none";
HidePathAndTLS();
HideQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "MkcpNone"))
{
TextBoxTransmission.Text = "kcp";
TextBoxCamouflageType.Text = "none";
TextBoxTLS.Text = "none";
HidePathAndTLS();
HideQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2SRTP"))
{
TextBoxTransmission.Text = "kcp";
TextBoxCamouflageType.Text = "srtp";
TextBoxTLS.Text = "none";
HidePathAndTLS();
HideQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPuTP"))
{
TextBoxTransmission.Text = "kcp";
TextBoxCamouflageType.Text = "utp";
TextBoxTLS.Text = "none";
HidePathAndTLS();
HideQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WechatVideo"))
{
TextBoxTransmission.Text = "kcp";
TextBoxCamouflageType.Text = "wechat-video";
TextBoxTLS.Text = "none";
HidePathAndTLS();
HideQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2DTLS"))
{
TextBoxTransmission.Text = "kcp";
TextBoxCamouflageType.Text = "dtls";
TextBoxTLS.Text = "none";
HidePathAndTLS();
HideQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
{
TextBoxTransmission.Text = "kcp";
TextBoxCamouflageType.Text = "wireguard";
TextBoxTLS.Text = "none";
HidePathAndTLS();
HideQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicNone"))
{
TextBoxTransmission.Text = "quic";
TextBoxCamouflageType.Text = "none";
TextBoxQuicKey.Text = MainWindow.ReceiveConfigurationParameters[6];
TextBoxTLS.Text = "none";
HidePathAndTLS();
ShowQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicSRTP"))
{
TextBoxTransmission.Text = "quic";
TextBoxCamouflageType.Text = "srtp";
TextBoxQuicKey.Text = MainWindow.ReceiveConfigurationParameters[6];
TextBoxTLS.Text = "none";
HidePathAndTLS();
ShowQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "Quic2uTP"))
{
TextBoxTransmission.Text = "quic";
TextBoxCamouflageType.Text = "utp";
TextBoxQuicKey.Text = MainWindow.ReceiveConfigurationParameters[6];
TextBoxTLS.Text = "none";
HidePathAndTLS();
ShowQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicWechatVideo"))
{
TextBoxTransmission.Text = "quic";
TextBoxCamouflageType.Text = "wechat-video";
TextBoxQuicKey.Text = MainWindow.ReceiveConfigurationParameters[6];
TextBoxTLS.Text = "none";
HidePathAndTLS();
ShowQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicDTLS"))
{
TextBoxTransmission.Text = "quic";
TextBoxCamouflageType.Text = "dtls";
TextBoxQuicKey.Text = MainWindow.ReceiveConfigurationParameters[6];
TextBoxTLS.Text = "none";
HidePathAndTLS();
ShowQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "QuicWireGuard"))
{
TextBoxTransmission.Text = "quic";
TextBoxCamouflageType.Text = "wireguard";
TextBoxQuicKey.Text = MainWindow.ReceiveConfigurationParameters[6];
TextBoxTLS.Text = "none";
HidePathAndTLS();
ShowQuicKey();
}
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "Http2"))
{
TextBoxTransmission.Text = "h2";
TextBoxCamouflageType.Text = "none";
ShowPathAndTLS();
HideQuicKey();
TextBoxTLS.Text = "tls";
}
//else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TLS"))
//{
// TextBoxTransmission.Text = "tcp";
// TextBoxCamouflageType.Text = "none";
// TextBoxTLS.Text = "tls";
// HidePathAndTLS();
// HideQuicKey();
//}
else
{
TextBoxTransmission.Text = "tcp";
TextBoxCamouflageType.Text = "none";
TextBoxTLS.Text = "none";
HidePathAndTLS();
HideQuicKey();
}
CheckDir("config");
//if (!Directory.Exists("config"))//如果不存在就创建file文件夹     
//{
// Directory.CreateDirectory("config");//创建该文件夹  
//}
GenerateV2rayShareQRcodeAndBase64Url();
}
private void HidePathAndTLS()
{
TextBlockPath.Visibility = Visibility.Collapsed;
TextBoxPath.Visibility = Visibility.Collapsed;
TextBlockPathExplain.Visibility = Visibility.Collapsed;
//TextBlocTLSonOrNo.Visibility = Visibility.Collapsed;
//TextBoxTLS.Visibility = Visibility.Collapsed;
//TextBlocTLSonOrNoExplain.Visibility = Visibility.Collapsed;
}
private void ShowPathAndTLS()
{
TextBlockPath.Visibility = Visibility.Visible;
TextBoxPath.Visibility = Visibility.Visible;
TextBlockPathExplain.Visibility = Visibility.Visible;
//TextBlocTLSonOrNo.Visibility = Visibility.Visible;
//TextBoxTLS.Visibility = Visibility.Visible;
//TextBlocTLSonOrNoExplain.Visibility = Visibility.Visible;
}
private void HideQuicKey()
{
TextBlockQuicKey.Visibility = Visibility.Collapsed;
TextBoxQuicKey.Visibility = Visibility.Collapsed;
TextBlockQuicKeyExplain.Visibility = Visibility.Collapsed;
//TextBlocTLSonOrNo.Visibility = Visibility.Collapsed;
//TextBoxTLS.Visibility = Visibility.Collapsed;
//TextBlocTLSonOrNoExplain.Visibility = Visibility.Collapsed;
}
private void ShowQuicKey()
{
TextBlockQuicKey.Visibility = Visibility.Visible;
TextBoxQuicKey.Visibility = Visibility.Visible;
TextBlockQuicKeyExplain.Visibility = Visibility.Visible;
//TextBlocTLSonOrNo.Visibility = Visibility.Visible;
//TextBoxTLS.Visibility = Visibility.Visible;
//TextBlocTLSonOrNoExplain.Visibility = Visibility.Visible;
}
//生成v2rayN客户端导入文件
private void GenerateV2rayShareQRcodeAndBase64Url()
{
//生成v2rayN的json文件
string v2rayNjsonFile = @"
{
""v"": """",
""ps"": """",
""add"": """",
""port"": """",
""id"": """",
""aid"": """",
""net"": """",
""type"": """",
""host"": """",
""path"": """",
""tls"": """"
}";
//MessageBox.Show(v2rayNjsonFile);
JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
v2rayNjsonObject["v"] = "2";
v2rayNjsonObject["add"] = TextBoxHostAddress.Text; //设置域名
v2rayNjsonObject["port"] = TextBoxPort.Text; //设置端口
v2rayNjsonObject["id"] = TextBoxUUID.Text; //设置uuid
v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text; //设置额外ID
v2rayNjsonObject["net"] = TextBoxTransmission.Text; //设置传输模式
v2rayNjsonObject["type"] = TextBoxCamouflageType.Text; //设置伪装类型
if (TextBoxTransmission.Text.Contains("quic")==true)
{
v2rayNjsonObject["path"] = TextBoxQuicKey.Text;//设置quic密钥
v2rayNjsonObject["host"] = "chacha20-poly1305";
}
else
{
v2rayNjsonObject["path"] = TextBoxPath.Text; //设置路径
v2rayNjsonObject["host"] = "";
}
v2rayNjsonObject["tls"] = TextBoxTLS.Text; //设置是否启用TLS
v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
//MessageBox.Show(v2rayNjsonObject["v"].ToString());
string saveFileFolderFirst = v2rayNjsonObject["ps"].ToString();
int num = 1;
saveFileFolder = saveFileFolderFirst;
while (Directory.Exists(@"config\" + saveFileFolder))
{
saveFileFolder = saveFileFolderFirst + "_copy_" + num.ToString();
num++;
}
CheckDir(@"config\" + saveFileFolder);
//MessageBox.Show(v2rayNjsonObject.ToString());
string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
TextBoxvVmessUrl.Text = vmessUrl;
using (StreamWriter sw = new StreamWriter($"config\\{saveFileFolder}\\url.txt"))
{
sw.WriteLine(vmessUrl);
}
CreateQRCode(vmessUrl);
if (File.Exists(@"config\config.json"))
{
File.Move(@"config\config.json", @"config\" + saveFileFolder + @"\config.json");
//File.Delete(@"config\config.json");//删除该文件
}
using (StreamWriter sw = new StreamWriter($"config\\{saveFileFolder}\\说明.txt"))
{
sw.WriteLine("config.json");
sw.WriteLine("此文件为v2ray官方程序所使用的客户端配置文件配置为全局模式socks5地址127.0.0.1:1080http代理地址127.0.0.1:1081");
sw.WriteLine("v2ray官方网站https://www.v2ray.com/");
sw.WriteLine("v2ray官方程序下载地址https://github.com/v2ray/v2ray-core/releases");
sw.WriteLine("下载相应版本Windows选择v2ray-windows-64.zip或者v2ray-windows-32.zip解压后提取v2ctl.exe和v2ray.exe。与config.json放在同一目录运行v2ray.exe即可。");
sw.WriteLine("-----------------------------------------");
sw.WriteLine("QR.bmp");
sw.WriteLine("此文件为v2rayN、v2rayNG(Android)、Shadowrocket(ios)扫码导入节点");
sw.WriteLine("v2rayN下载网址https://github.com/2dust/v2rayN/releases");
sw.WriteLine("v2rayNG(Android)下载网址https://github.com/2dust/v2rayNG/releases");
sw.WriteLine("v2rayNG(Android)在Google Play下载网址https://play.google.com/store/apps/details?id=com.v2ray.ang");
sw.WriteLine("Shadowrocket(ios)下载,需要使用国外区的AppleID。请自行谷歌方法。");
sw.WriteLine("-----------------------------------------");
sw.WriteLine("url.txt");
sw.WriteLine("此文件为v2rayN、v2rayNG(Android)、Shadowrocket(ios)复制粘贴导入节点的vmess网址");
sw.WriteLine("-----------------------------------------\n");
sw.WriteLine("服务器通用连接配置参数");
sw.WriteLine($"地址(address){TextBoxHostAddress.Text}");
sw.WriteLine($"端口(Port){TextBoxPort.Text}");
sw.WriteLine($"用户ID(uuid){TextBoxUUID.Text}");
sw.WriteLine($"额外ID{TextBoxUUIDextra.Text}");
sw.WriteLine($"加密方式:{TextBoxEncryption.Text}");
sw.WriteLine($"传输协议:{TextBoxTransmission.Text}");
sw.WriteLine($"伪装类型:{TextBoxCamouflageType.Text}");
sw.WriteLine($"是否使用TLS{TextBoxTLS.Text}");
sw.WriteLine($"路径(Path){TextBoxPath.Text}");
sw.WriteLine($"QUIC密钥{TextBoxQuicKey.Text}");
}
}
//生成base64
private string ToBase64Encode(string text)
{
if (String.IsNullOrEmpty(text))
{
return text;
}
byte[] textBytes = Encoding.UTF8.GetBytes(text);
return Convert.ToBase64String(textBytes);
}
//生成QRcoder图片
private void CreateQRCode(string varBase64)
{
//string varBase64 = varBase64;
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(varBase64, QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrCode.GetGraphic(20);
IntPtr myImagePtr = qrCodeImage.GetHbitmap();
BitmapSource imgsource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(myImagePtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
ImageShareQRcode.Source = imgsource;
//DeleteObject(myImagePtr);
qrCodeImage.Save($"config\\{saveFileFolder}\\QR.bmp");
//ImageShareQRcode.Source = @"config\v2rayN.bmp";
}
//判断目录是否存在,不存在则创建
private static bool CheckDir(string folder)
{
try
{
if (!Directory.Exists(folder))//如果不存在就创建file文件夹
Directory.CreateDirectory(folder);//创建该文件夹  
return true;
}
catch (Exception)
{
return false;
}
}
private void ButtonOpenSaveDir_Click(object sender, RoutedEventArgs e)
{
string openFolderPath = @"config\" + saveFileFolder;
System.Diagnostics.Process.Start("explorer.exe", openFolderPath);
this.Close();
}
}
}

View file

@ -1,155 +0,0 @@
<Window x:Name="TemplateConfiguration" x:Class="ProxySU.WindowTemplateConfiguration"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="TemplateConfiguration" Height="600" Width="850">
<Window.Resources>
<Style BasedOn="{StaticResource {x:Type TextBox}}"
TargetType="TextBox"
x:Key="TitleText">
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="Text" Value=""/>
<Condition Property="TextBox.IsFocused" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border BorderThickness="1" BorderBrush="Gray" Margin="0">
<TextBlock x:Name="MainTextBlock" Text="{TemplateBinding TextBox.Tag}" Width="{TemplateBinding TextBox.ActualWidth}" Foreground="Gray" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</MultiTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<GroupBox Header="模板库" Grid.Row="0" Grid.RowSpan="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<RadioButton x:Name="RadioButtonTCP" Content="TCP" Grid.Column="0" Grid.Row="0" Checked="RadioButtonTCP_Checked"></RadioButton>
<TextBlock Text="数据加密传输会被识别为未知的tcp流量" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonTCPhttp" Content="TCP+Http伪装" Grid.Column="0" Grid.Row="1" Checked="RadioButtonTCPhttp_Checked" ></RadioButton>
<TextBlock Text="数据加密传输并做http伪装会被识别为http流量但并不是真正的http访问" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonWebSocketTLS2Web" Content="WebSocket+TLS+Web" Grid.Column="0" Grid.Row="2" Checked="RadioButtonWebSocketTLS2Web_Checked"></RadioButton>
<TextBlock Text="稳定性强使用Caddy做前置会被识别为访问网站的https流量抗封锁识别最强" TextWrapping="Wrap" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonHTTP2" Content="HTTP/2" Grid.Column="0" Grid.Row="3" Checked="RadioButtonHTTP2_Checked"></RadioButton>
<TextBlock Text="基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonMkcpNoCamouflage" Content="mKCP(无伪装)" Grid.Column="0" Grid.Row="5" Checked="RadioButtonTCP_Checked"></RadioButton>
<TextBlock Text="数据加密传输以增加流量消耗来加速减少延迟udp协议,无伪装会被识别为udp流量" Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButton2mKCP2SRTP" Content="mKCP+SRTP" Grid.Column="0" Grid.Row="6" Checked="RadioButtonTCP_Checked"></RadioButton>
<TextBlock Text="同mKCP(无伪装),增加伪装成 SRTP 数据包,会被识别为视频通话数据(如 FaceTime" Grid.Column="1" Grid.Row="6" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButton2mKCPuTP" Content="mKCP+uTP" Grid.Column="0" Grid.Row="7" Checked="RadioButtonTCP_Checked"></RadioButton>
<TextBlock Text="同mKCP(无伪装),增加伪装成 uTP 数据包,会被识别为 BT 下载数据" Grid.Column="1" Grid.Row="7" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButton2mKCP2WechatVideo" Content="mKCP+WechatVideo" Grid.Column="0" Grid.Row="8" Checked="RadioButtonTCP_Checked"></RadioButton>
<TextBlock Text="同mKCP(无伪装),增加伪装成微信视频通话的数据包" Grid.Column="1" Grid.Row="8" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButton2mKCP2DTLS" Content="mKCP+DTLS 1.2" Grid.Column="0" Grid.Row="9" Checked="RadioButtonTCP_Checked"></RadioButton>
<TextBlock Text="同mKCP(无伪装),增加伪装成 DTLS 1.2 数据包" Grid.Column="1" Grid.Row="9" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButton2mKCP2WireGuard" Content="mKCP+WireGuard" Grid.Column="0" Grid.Row="10" Checked="RadioButtonTCP_Checked"></RadioButton>
<TextBlock Text="同mKCP(无伪装),增加伪装成 WireGuard 数据包。(并不是真正的 WireGuard 协议)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="10" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonQuicNone" Content="QUIC(无伪装)" Grid.Column="0" Grid.Row="12" Checked="RadioButtonQuicNone_Checked"></RadioButton>
<TextBlock Text="数据加密传输无伪装会被识别为udp流量谷歌出品优点:减少延迟、多路复用、连接迁移" Grid.Column="1" Grid.Row="12" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonQuicSRTP" Content="QUIC+SRTP" Grid.Column="0" Grid.Row="13" Checked="RadioButtonQuicNone_Checked"></RadioButton>
<TextBlock Text="同QUIC(无伪装),增加伪装成 SRTP 数据包,会被识别为视频通话数据(如 FaceTime" Grid.Column="1" Grid.Row="13" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonQuic2uTP" Content="QUIC+uTP" Grid.Column="0" Grid.Row="14" Checked="RadioButtonQuicNone_Checked"></RadioButton>
<TextBlock Text="同QUIC(无伪装),增加伪装成 uTP 数据包,会被识别为 BT 下载数据" Grid.Column="1" Grid.Row="14" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonQuicWechatVideo" Content="QUIC+WechatVideo" Grid.Column="0" Grid.Row="15" Checked="RadioButtonQuicNone_Checked"></RadioButton>
<TextBlock Text="同QUIC(无伪装),增加伪装成微信视频通话的数据包" Grid.Column="1" Grid.Row="15" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonQuicDTLS" Content="QUIC+DTLS 1.2" Grid.Column="0" Grid.Row="16" Checked="RadioButtonQuicNone_Checked"></RadioButton>
<TextBlock Text="同QUIC(无伪装),增加伪装成 DTLS 1.2 数据包" Grid.Column="1" Grid.Row="16" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonQuicWireGuard" Content="QUIC+WireGuard" Grid.Column="0" Grid.Row="17" Checked="RadioButtonQuicNone_Checked"></RadioButton>
<TextBlock Text="同QUIC(无伪装),增加伪装成 WireGuard 数据包。(并不是真正的 WireGuard 协议)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="17" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="提醒Shadowrocket目前暂不支持QUIC的传输模式。" Foreground="Red" Grid.Column="0" Grid.Row="18" Grid.ColumnSpan="5"></TextBlock>
</Grid>
</GroupBox>
<GroupBox Header="其他设置" Grid.Row="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition ></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock x:Name="TextBlockServerListenPort" Text="服务端口:" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"></TextBlock>
<TextBox x:Name="TextBoxServerListenPort" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="3" Margin="3"></TextBox>
<Button x:Name="ButtonServerListenPort" Content="随机选择" Grid.Column="4" Grid.Row="0" Margin="2" Click="ButtonServerListenPort_Click"></Button>
<TextBlock x:Name="TextBlockNewUUID" Text="UUID" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2"></TextBlock>
<TextBox x:Name="TextBoxNewUUID" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" Margin="3"></TextBox>
<Button x:Name="ButtonNewUUID" Content="更新" Grid.Column="4" Grid.Row="1" Margin="2" Click="ButtonNewUUID_Click"></Button>
<TextBlock Text="使用已有UUID直接粘贴到框中" TextWrapping="Wrap" Grid.Column="5" Grid.Row="1" Grid.ColumnSpan="2" Margin="0"></TextBlock>
<TextBlock x:Name="TextBlockQuicUUID" Text="QUIC密钥" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2"></TextBlock>
<TextBox x:Name="TextBoxQuicUUID" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3" Margin="3"></TextBox>
<Button x:Name="ButtonQuicUUID" Content="更新" Grid.Column="4" Grid.Row="2" Margin="2" Click="ButtonQuicUUID_Click"></Button>
<TextBlock x:Name="TextBlockPath" Text="路径:" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2"></TextBlock>
<TextBox x:Name="TextBoxPath" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3" Margin="3"></TextBox>
<Button x:Name="ButtonPath" Content="随机" Grid.Column="4" Grid.Row="3" Margin="2" Click="ButtonPath_Click"></Button>
<TextBlock x:Name="TextBlockDomain" Text="域名:" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="2"></TextBlock>
<TextBox x:Name="TextBoxDomain" Style="{StaticResource TitleText}" Tag="不可为空" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="3" Margin="3"></TextBox>
<Button x:Name="ButtonDomain" Content="检测" Visibility="Collapsed" Grid.Column="4" Grid.Row="4" Margin="2" Click="ButtonDomain_Click"></Button>
<TextBlock x:Name="TextBlockMaskSites" Text="伪装网站:" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="2"></TextBlock>
<TextBox x:Name="TextBoxMaskSites" Style="{StaticResource TitleText}" Tag="设置此项可增加代理的隐蔽(可为空)" Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="3" Margin="3"></TextBox>
<Button x:Name="ButtondDecide" Content="确定" Grid.Column="1" Grid.Row="6" Margin="2" Click="ButtondDecide_Click"></Button>
<Button x:Name="ButtondCancel" Content="取消" Grid.Column="3" Grid.Row="6" Margin="2" Click="ButtondCancel_Click"></Button>
</Grid>
</GroupBox>
</Grid>
</Window>

View file

@ -1,348 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ProxySU
{
/// <summary>
/// WindowTemplateConfiguration.xaml 的交互逻辑
/// </summary>
public partial class WindowTemplateConfiguration : Window
{
public WindowTemplateConfiguration()
{
InitializeComponent();
RadioButtonTCP.IsChecked = true;
}
private void ButtondDecide_Click(object sender, RoutedEventArgs e)
{
if (RadioButtonTCP.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "TCP";
}
else if (RadioButtonTCPhttp.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "TCPhttp";
MainWindow.ReceiveConfigurationParameters[5] = "http";
}
else if (RadioButtonWebSocketTLS2Web.IsChecked == true)
{
if (string.IsNullOrEmpty(TextBoxDomain.Text.ToString()) == true)
{
MessageBox.Show("域名不能为空!");
return;
}
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS2Web";
//传递路径
MainWindow.ReceiveConfigurationParameters[3] = TextBoxPath.Text.ToString();
//传递域名
MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString();
//传递伪装网站
MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.ToString();
string testDomain = TextBoxMaskSites.Text.Substring(0, 7);
if (String.Equals(testDomain, "https:/") || String.Equals(testDomain, "http://"))
{
//MessageBox.Show(testDomain);
MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/");
}
else
{
MainWindow.ReceiveConfigurationParameters[7] = "http:\\/\\/" + TextBoxMaskSites.Text;
}
}
else if (RadioButtonHTTP2.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "Http2";
//传递路径
MainWindow.ReceiveConfigurationParameters[3] = TextBoxPath.Text.ToString();
//传递域名
MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString();
}
else if (RadioButtonMkcpNoCamouflage.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "MkcpNone";
MainWindow.ReceiveConfigurationParameters[5] = "none";
}
else if (RadioButton2mKCP2SRTP.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2SRTP";
MainWindow.ReceiveConfigurationParameters[5] = "srtp";
}
else if (RadioButton2mKCPuTP.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "mKCPuTP";
MainWindow.ReceiveConfigurationParameters[5] = "utp";
}
else if (RadioButton2mKCP2WechatVideo.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WechatVideo";
MainWindow.ReceiveConfigurationParameters[5] = "wechat-video";
}
else if (RadioButton2mKCP2DTLS.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2DTLS";
MainWindow.ReceiveConfigurationParameters[5] = "dtls";
}
else if (RadioButton2mKCP2WireGuard.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WireGuard";
MainWindow.ReceiveConfigurationParameters[5] = "wireguard";
}
else if (RadioButtonQuicNone.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "QuicNone";
MainWindow.ReceiveConfigurationParameters[5] = "none";
MainWindow.ReceiveConfigurationParameters[6] = TextBoxQuicUUID.Text;
}
else if (RadioButtonQuicSRTP.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "QuicSRTP";
MainWindow.ReceiveConfigurationParameters[5] = "srtp";
MainWindow.ReceiveConfigurationParameters[6] = TextBoxQuicUUID.Text;
}
else if (RadioButtonQuic2uTP.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "Quic2uTP";
MainWindow.ReceiveConfigurationParameters[5] = "utp";
MainWindow.ReceiveConfigurationParameters[6] = TextBoxQuicUUID.Text;
}
else if (RadioButtonQuicWechatVideo.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "QuicWechatVideo";
MainWindow.ReceiveConfigurationParameters[5] = "wechat-video";
MainWindow.ReceiveConfigurationParameters[6] = TextBoxQuicUUID.Text;
}
else if (RadioButtonQuicDTLS.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "QuicDTLS";
MainWindow.ReceiveConfigurationParameters[5] = "dtls";
MainWindow.ReceiveConfigurationParameters[6] = TextBoxQuicUUID.Text;
}
else if (RadioButtonQuicWireGuard.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "QuicWireGuard";
MainWindow.ReceiveConfigurationParameters[5] = "wireguard";
MainWindow.ReceiveConfigurationParameters[6] = TextBoxQuicUUID.Text;
}
else
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "TCP";
}
//传递服务端口
MainWindow.ReceiveConfigurationParameters[1] = TextBoxServerListenPort.Text.ToString();
//传递uuid
MainWindow.ReceiveConfigurationParameters[2] = TextBoxNewUUID.Text.ToString();
this.Close();
}
private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
#region
private void RadioButtonTCP_Checked(object sender, RoutedEventArgs e)
{
//TextBlockServerListenPort.Visibility = Visibility.Visible;
//TextBoxServerListenPort.Visibility = Visibility.Visible;
//ButtonServerListenPort.Visibility = Visibility.Visible;
//隐藏QUIC密钥
TextBlockQuicUUID.Visibility = Visibility.Collapsed;
TextBoxQuicUUID.Visibility = Visibility.Collapsed;
ButtonQuicUUID.Visibility = Visibility.Collapsed;
//隐藏Path
TextBlockPath.Visibility = Visibility.Collapsed;
TextBoxPath.Visibility = Visibility.Collapsed;
ButtonPath.Visibility = Visibility.Collapsed;
//隐藏域名
TextBlockDomain.Visibility = Visibility.Collapsed;
TextBoxDomain.Visibility = Visibility.Collapsed;
ButtonDomain.Visibility = Visibility.Collapsed;
//隐藏伪装网站
TextBlockMaskSites.Visibility = Visibility.Collapsed;
TextBoxMaskSites.Visibility = Visibility.Collapsed;
Guid uuid = Guid.NewGuid();
TextBoxNewUUID.Text = uuid.ToString();
Random random = new Random();
int randomServerPort = random.Next(10000, 50000);
TextBoxServerListenPort.Text = randomServerPort.ToString();
}
private void RadioButtonWebSocketTLS2Web_Checked(object sender, RoutedEventArgs e)
{
//TextBlockServerListenPort.Visibility = Visibility.Visible;
//TextBoxServerListenPort.Visibility = Visibility.Visible;
//ButtonServerListenPort.Visibility = Visibility.Visible;
TextBoxServerListenPort.Text = "443";
//显示Path
TextBlockPath.Visibility = Visibility.Visible;
TextBoxPath.Visibility = Visibility.Visible;
TextBoxPath.Text = "/ray";
ButtonPath.Visibility = Visibility.Visible;
//显示域名
TextBlockDomain.Visibility = Visibility.Visible;
TextBoxDomain.Visibility = Visibility.Visible;
//ButtonDomain.Visibility = Visibility.Visible;
//隐藏QUIC密钥
TextBlockQuicUUID.Visibility = Visibility.Collapsed;
TextBoxQuicUUID.Visibility = Visibility.Collapsed;
ButtonQuicUUID.Visibility = Visibility.Collapsed;
//显示伪装网站
TextBlockMaskSites.Visibility = Visibility.Visible;
TextBoxMaskSites.Visibility = Visibility.Visible;
Guid uuid = Guid.NewGuid();
TextBoxNewUUID.Text = uuid.ToString();
}
private void RadioButtonHTTP2_Checked(object sender, RoutedEventArgs e)
{
//TextBlockServerListenPort.Visibility = Visibility.Visible;
//TextBoxServerListenPort.Visibility = Visibility.Visible;
//ButtonServerListenPort.Visibility = Visibility.Visible;
TextBoxServerListenPort.Text = "443";
//显示Path
TextBlockPath.Visibility = Visibility.Visible;
TextBoxPath.Visibility = Visibility.Visible;
TextBoxPath.Text = "/ray";
ButtonPath.Visibility = Visibility.Visible;
//显示域名
TextBlockDomain.Visibility = Visibility.Visible;
TextBoxDomain.Visibility = Visibility.Visible;
//ButtonDomain.Visibility = Visibility.Visible;
//隐藏QUIC密钥
TextBlockQuicUUID.Visibility = Visibility.Collapsed;
TextBoxQuicUUID.Visibility = Visibility.Collapsed;
ButtonQuicUUID.Visibility = Visibility.Collapsed;
//隐藏伪装网站
TextBlockMaskSites.Visibility = Visibility.Collapsed;
TextBoxMaskSites.Visibility = Visibility.Collapsed;
Guid uuid = Guid.NewGuid();
TextBoxNewUUID.Text = uuid.ToString();
}
private void RadioButtonTCPhttp_Checked(object sender, RoutedEventArgs e)
{
//TextBlockServerListenPort.Visibility = Visibility.Visible;
//TextBoxServerListenPort.Visibility = Visibility.Visible;
//ButtonServerListenPort.Visibility = Visibility.Visible;
TextBoxServerListenPort.Text = "80";
//隐藏Path
TextBlockPath.Visibility = Visibility.Collapsed;
TextBoxPath.Visibility = Visibility.Collapsed;
ButtonPath.Visibility = Visibility.Collapsed;
//隐藏域名
TextBlockDomain.Visibility = Visibility.Collapsed;
TextBoxDomain.Visibility = Visibility.Collapsed;
ButtonDomain.Visibility = Visibility.Collapsed;
//隐藏QUIC密钥
TextBlockQuicUUID.Visibility = Visibility.Collapsed;
TextBoxQuicUUID.Visibility = Visibility.Collapsed;
ButtonQuicUUID.Visibility = Visibility.Collapsed;
//隐藏伪装网站
TextBlockMaskSites.Visibility = Visibility.Collapsed;
TextBoxMaskSites.Visibility = Visibility.Collapsed;
Guid uuid = Guid.NewGuid();
TextBoxNewUUID.Text = uuid.ToString();
}
private void RadioButtonQuicNone_Checked(object sender, RoutedEventArgs e)
{
//显示QUIC密钥
TextBlockQuicUUID.Visibility = Visibility.Visible;
TextBoxQuicUUID.Visibility = Visibility.Visible;
ButtonQuicUUID.Visibility = Visibility.Visible;
//隐藏Path
TextBlockPath.Visibility = Visibility.Collapsed;
TextBoxPath.Visibility = Visibility.Collapsed;
ButtonPath.Visibility = Visibility.Collapsed;
//隐藏域名
TextBlockDomain.Visibility = Visibility.Collapsed;
TextBoxDomain.Visibility = Visibility.Collapsed;
ButtonDomain.Visibility = Visibility.Collapsed;
//隐藏伪装网站
TextBlockMaskSites.Visibility = Visibility.Collapsed;
TextBoxMaskSites.Visibility = Visibility.Collapsed;
Guid uuid = Guid.NewGuid();
TextBoxNewUUID.Text = uuid.ToString();
uuid = Guid.NewGuid();
TextBoxQuicUUID.Text = uuid.ToString();
Random random = new Random();
int randomServerPort = random.Next(10000, 50000);
TextBoxServerListenPort.Text = randomServerPort.ToString();
}
#endregion
//产生随机的uuid
private void ButtonNewUUID_Click(object sender, RoutedEventArgs e)
{
Guid uuid = Guid.NewGuid();
TextBoxNewUUID.Text = uuid.ToString();
}
//产生QUIC密钥所用的UUID
private void ButtonQuicUUID_Click(object sender, RoutedEventArgs e)
{
Guid uuid = Guid.NewGuid();
TextBoxQuicUUID.Text = uuid.ToString();
}
//产生随机服务端口
private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e)
{
Random random = new Random();
int randomServerPort = random.Next(10000, 50000);
TextBoxServerListenPort.Text = randomServerPort.ToString();
}
//产生随机的Path
private void ButtonPath_Click(object sender, RoutedEventArgs e)
{
Random random = new Random();
int randomSerialNum = random.Next(0, 4);
Guid uuid = Guid.NewGuid();
string[] pathArray = uuid.ToString().Split('-');
string path = pathArray[randomSerialNum];
TextBoxPath.Text = $"/{path}";
//MessageBox.Show(path);
}
private void ButtonDomain_Click(object sender, RoutedEventArgs e)
{
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,52 +0,0 @@
{
"inbounds": [
{
"protocol": "http",
"port": 1081
},
{
"port": 1080,
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth"
}
}
],
"outbounds": [
{
"protocol": "vmess",
"settings": {
"vnext": [
{
"address":null,
"port":null,
"users":[
{
"id":null,
"alterId":16,
"security":"auto"
}
]
}
]
},
"streamSettings":{
"network":"ws",
"security":"tls",
"wsSettings":{
"path":null
}
},
"mux": {
"enabled": true
}
}
]
}

View file

@ -1,9 +0,0 @@
##domain## {
root /var/www
tls off
##sites##
proxy ##path## localhost:10000 {
websocket
header_upstream -Origin
}
}

View file

@ -1,29 +0,0 @@
{
"inbounds": [
{
"port": 10000,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": null
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View file

@ -1,52 +0,0 @@
{
"inbounds": [
{
"protocol": "http",
"port": 1081
},
{
"port": 1080,
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth"
}
}
],
"outbounds": [
{
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": null,
"port": null,
"users": [
{
"id": null,
"alterId": 16,
"security": "auto"
}
]
}
]
},
"streamSettings": {
"network": "h2",
"security": "tls",
"httpSettings": {
"path": null
}
},
"mux": {
"enabled": true
}
}
]
}

View file

@ -1,37 +0,0 @@
{
"inbounds": [
{
"port": null,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
},
"streamSettings": {
"network": "h2",
"security": "tls",
"tlsSettings": {
"certificates": [
{
"certificateFile": "/etc/v2ray/ssl/v2ray-h2-ssl.pem",
"keyFile": "/etc/v2ray/ssl/v2ray-h2-ssl.key"
}
]
},
"httpSettings": {
"path": null
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View file

@ -1,60 +0,0 @@
{
"inbounds": [
{
"protocol": "http",
"port": 1081
},
{
"port": 1080,
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth"
}
}
],
"outbounds": [
{
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": null,
"port": null,
"users": [
{
"id": null,
"alterId": 16,
"security": "auto"
}
]
}
]
},
"streamSettings": {
"network": "kcp",
"kcpSettings": {
"mtu": 1350,
"tti": 50,
"uplinkCapacity": 5,
"downlinkCapacity": 100,
"congestion": true,
"readBufferSize": 2,
"writeBufferSize": 2,
"header": {
"type": null
}
}
},
"mux": {
"enabled": true
}
}
]
}

View file

@ -1,33 +0,0 @@
{
"inbounds": [
{
"port": null,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
},
"streamSettings": {
"network": "mkcp",
"kcpSettings": {
"uplinkCapacity": 100,
"downlinkCapacity": 100,
"congestion": true,
"header": {
"type": null
}
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View file

@ -1,51 +0,0 @@
{
"inbounds": [
{
"protocol": "http",
"port": 1081
},
{
"port": 1080,
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth"
}
}
],
"outbounds": [
{
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": null,
"port": null,
"users": [
{
"id": null,
"alterId": 16
}
]
}
]
},
"streamSettings": {
"network": "quic",
"quicSettings": {
"security": "chacha20-poly1305",
"key": null,
"header": {
"type": null
}
}
}
}
]
}

View file

@ -1,33 +0,0 @@
{
"inbounds": [
{
"port": null,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
},
"streamSettings": {
"network": "quic",
"quicSettings": {
"security": "chacha20-poly1305",
"key": null,
"header": {
"type": null
}
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View file

@ -1,48 +0,0 @@
{
"inbounds": [
{
"protocol": "http",
"port": 1081
},
{
"port": 1080,
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth"
}
}
],
"outbounds": [
{
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": null,
"port": null,
"users": [
{
"id": null,
"alterId": 16,
"security": "auto"
}
]
}
]
},
"streamSettings": {
"network": "tcp"
},
"mux": {
"enabled": true
}
}
]
}

View file

@ -1,75 +0,0 @@
{
"inbounds": [
{
"protocol": "http",
"port": 1081
},
{
"port": 1080,
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"settings": {
"auth": "noauth"
}
}
],
"outbounds": [
{
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": null,
"port": null,
"users": [
{
"id": null,
"alterId": 16
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"tcpSettings": {
"header": {
"type": "http",
"request": {
"version": "1.1",
"method": "GET",
"path": [
"/"
],
"headers": {
"Host": [
"www.cloudflare.com",
"www.amazon.com",
"www.microsoft.com",
"www.intel.com"
],
"User-Agent": [
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36",
"Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/53.0.2785.109 Mobile/14A456 Safari/601.1.46"
],
"Accept-Encoding": [
"gzip, deflate"
],
"Connection": [
"keep-alive"
],
"Pragma": "no-cache"
}
}
}
}
}
}
]
}

View file

@ -1,50 +0,0 @@
{
"inbounds": [
{
"port": null,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
},
"streamSettings": {
"network": "tcp",
"tcpSettings": {
"header": {
"type": "http",
"response": {
"version": "1.1",
"status": "200",
"reason": "OK",
"headers": {
"Content-Type": [
"application/octet-stream",
"application/x-msdownload",
"text/html",
"application/x-shockwave-flash"
],
"Transfer-Encoding": [
"chunked"
],
"Connection": [
"keep-alive"
],
"Pragma": "no-cache"
}
}
}
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View file

@ -1,23 +0,0 @@
{
"inbounds": [
{
"port": null,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

13
ProxySuper.Core/App.cs Normal file
View file

@ -0,0 +1,13 @@
using MvvmCross.ViewModels;
using ProxySuper.Core.ViewModels;
namespace ProxySuper.Core
{
public class App : MvxApplication
{
public override void Initialize()
{
RegisterAppStart<HomeViewModel>();
}
}
}

View file

@ -0,0 +1,22 @@
using ProxySuper.Core.Models.Hosts;
using System;
using System.Globalization;
using System.Windows.Data;
namespace ProxySuper.Core.Converters
{
public class LoginSecretTypeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value.Equals(parameter);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (parameter == null) return LoginSecretType.Password;
return parameter;
}
}
}

View file

@ -0,0 +1,29 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace ProxySuper.Core.Converters
{
public class ProxyTypeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value != null && value.Equals(parameter);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return Binding.DoNothing;
}
if (!value.Equals(true))
{
return Binding.DoNothing;
}
return parameter;
}
}
}

View file

@ -0,0 +1,30 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace ProxySuper.Core.Converters
{
public class VisibleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value.Equals(true) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
{
return false;
}
if (value.Equals(Visibility.Visible))
{
return true;
}
return false;
}
}
}

View file

@ -0,0 +1,82 @@

using System;
using System.Globalization;
using System.Net;
using System.Runtime.InteropServices;
namespace ProxySuper.Core.Helpers
{
public static class DateTimeUtils
{
/// <summary>
/// 从国家授时中心获取标准GMT时间读取https://www.tsa.cn
/// GMT时间与UTC时间没有差别可以UTC=GMT
/// </summary>
/// <returns>返回网络时间</returns>
public static DateTime GetUTCTime()
{
DateTime time;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.tsa.cn");
request.Method = "HEAD";
request.AllowAutoRedirect = false;
HttpWebResponse reponse = (HttpWebResponse)request.GetResponse();
string cc = reponse.GetResponseHeader("date");
reponse.Close();
bool s = GMTStrParse(cc, out time);
return time;
}
catch
{
return new DateTime(1970, 1, 1, 0, 0, 0, 0);
}
}
public static bool GMTStrParse(string gmtStr, out DateTime gmtTime) //抓取的date是GMT格式的字符串这里转成datetime
{
CultureInfo enUS = new CultureInfo("en-US");
bool s = DateTime.TryParseExact(gmtStr, "r", enUS, DateTimeStyles.None, out gmtTime);
return s;
}
//设置系统时间的API函数
[DllImport("kernel32.dll")]
private static extern bool SetLocalTime(ref SYSTEMTIME time);
[StructLayout(LayoutKind.Sequential)]
private struct SYSTEMTIME
{
public short year;
public short month;
public short dayOfWeek;
public short day;
public short hour;
public short minute;
public short second;
public short milliseconds;
}
/// <summary>
/// 设置系统时间
/// </summary>
/// <param name="dt">需要设置的时间</param>
/// <returns>返回系统时间设置状态true为成功false为失败</returns>
public static bool SetDate(DateTime dt)
{
SYSTEMTIME st;
st.year = (short)dt.Year;
st.month = (short)dt.Month;
st.dayOfWeek = (short)dt.DayOfWeek;
st.day = (short)dt.Day;
st.hour = (short)dt.Hour;
st.minute = (short)dt.Minute;
st.second = (short)dt.Second;
st.milliseconds = (short)dt.Millisecond;
bool rt = SetLocalTime(ref st);
return rt;
}
}
}

View file

@ -0,0 +1,40 @@
using Newtonsoft.Json;
using System;
using System.Linq;
namespace ProxySuper.Core.Services
{
public class Utils
{
public static string Base64Encode(string plainText)
{
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
return System.Convert.ToBase64String(plainTextBytes);
}
public static string Base64Decode(string base64EncodedData)
{
var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData);
return System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
}
public static T DeepClone<T>(T obj) where T : class
{
var serialized = JsonConvert.SerializeObject(obj);
return JsonConvert.DeserializeObject<T>(serialized);
}
public static string GetTickID()
{
return DateTime.Now.Ticks.ToString();
}
private static Random random = new Random();
public static string RandomString(int length)
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return new string(Enumerable.Repeat(chars, length)
.Select(s => s[random.Next(s.Length)]).ToArray());
}
}
}

View file

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.Models
{
public static class Caddy
{
public static string Service = @"
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
#User=caddy
#Group=caddy
User=root
Group=root
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
#LimitNOFILE=1048576
#LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
#AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
";
public static string DefaultCaddyFile = @"
:80 {
respond ""Hello world!"";
}
";
}
}

View file

@ -0,0 +1,57 @@
using Microsoft.Win32;
using MvvmCross.Commands;
using Newtonsoft.Json;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.Models.Hosts
{
public class Host
{
public Host()
{
Proxy = new LocalProxy();
}
public string Tag { get; set; }
public string Address { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public int Port { get; set; } = 22;
public string PrivateKeyPath { get; set; }
public string PrivateKeyPassPhrase { get; set; }
public LocalProxy Proxy { get; set; }
public LoginSecretType SecretType { get; set; }
public IMvxCommand UploadPrivateKeyCommand => new MvxCommand(UploadPrivateKey);
private void UploadPrivateKey()
{
var fileDialog = new OpenFileDialog();
fileDialog.FileOk += OnFileOk;
fileDialog.ShowDialog();
}
private void OnFileOk(object sender, CancelEventArgs e)
{
var file = sender as OpenFileDialog;
PrivateKeyPath = file.FileName;
Task.Delay(300).ContinueWith((t) =>
{
MessageBox.Show("上传成功", "提示");
});
}
}
}

View file

@ -0,0 +1,20 @@
using Renci.SshNet;
namespace ProxySuper.Core.Models.Hosts
{
public class LocalProxy
{
public string Address { get; set; } = "127.0.0.1";
public int Port { get; set; } = 1080;
public ProxyTypes Type { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
}
}

View file

@ -0,0 +1,8 @@
namespace ProxySuper.Core.Models.Hosts
{
public enum LoginSecretType
{
Password = 0,
PrivateKey = 1
}
}

View file

@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.Models
{
public class ProjectProgress
{
private string _step;
private string _desc;
private int _percentage;
private string _logs;
public ProjectProgress()
{
_step = "步骤";
_desc = "步骤描述";
_percentage = 0;
_logs = string.Empty;
StepUpdate = () => { };
}
public Action StepUpdate { get; set; }
public Action LogsUpdate { get; set; }
public string Desc
{
get { return _desc; }
set
{
_desc = value;
StepUpdate();
_logs += _desc + "\n";
LogsUpdate();
}
}
public string Step
{
get { return _step; }
set
{
_step = value;
StepUpdate();
_logs += Step + "\n";
LogsUpdate();
}
}
public int Percentage
{
get { return _percentage; }
set
{
_percentage = value;
StepUpdate();
}
}
public string Logs
{
get { return _logs; }
set
{
_logs = value;
LogsUpdate();
}
}
}
}

View file

@ -0,0 +1,34 @@
using System.Collections.Generic;
namespace ProxySuper.Core.Models.Projects
{
public class BrookSettings : IProjectSettings
{
public string Domain { get; set; }
public string IP { get; set; }
public string Password { get; set; }
public BrookType BrookType { get; set; }
public int Port { get; set; } = 443;
public List<int> FreePorts
{
get
{
if (Port == 443)
{
return new List<int> { 80, 443 };
}
return new List<int> { Port };
}
}
public string Email => "server@brook.com";
public ProjectType Type { get; set; } = ProjectType.Brook;
}
}

View file

@ -0,0 +1,10 @@
namespace ProxySuper.Core.Models.Projects
{
public enum BrookType
{
server,
wsserver,
wssserver,
socks5
}
}

View file

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.Models.Projects
{
public class HysteriaSettings : IProjectSettings
{
public string Domain { get; set; } = "";
public string Obfs { get; set; } = "";
public string Email { get; set; } = "";
public string Protocol { get; set; } = "udp";
public int Port { get; set; } = 36712;
public int UpMbps { get; set; } = 300;
public int DownMbps { get; set; } = 300;
public List<int> FreePorts
{
get
{
return new List<int> { Port, 80 };
}
}
}
}

View file

@ -0,0 +1,32 @@
using System.Collections.Generic;
namespace ProxySuper.Core.Models.Projects
{
public interface IProjectSettings
{
/// <summary>
/// 端口
/// </summary>
int Port { get; set; }
/// <summary>
/// 域名
/// </summary>
string Domain { get; set; }
/// <summary>
/// 额外需要开放的端口
/// </summary>
List<int> FreePorts { get; }
/// <summary>
/// 类型
/// </summary>
//ProjectType Type { get; set; }
/// <summary>
/// 邮箱
/// </summary>
string Email { get; }
}
}

View file

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.Models.Projects
{
public class MTProtoGoSettings : IProjectSettings
{
public MTProtoGoSettings()
{
Port = 443;
Domain = string.Empty;
Cleartext = "bing.com";
SecretText = string.Empty;
}
public int Port { get; set; }
public string Domain { get; set; }
public List<int> FreePorts => new List<int> { Port };
public string Email => "";
public string Cleartext { get; set; }
public string SecretText { get; set; }
}
}

View file

@ -0,0 +1,53 @@
using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
namespace ProxySuper.Core.Models.Projects
{
public class NaiveProxySettings : IProjectSettings
{
public NaiveProxySettings()
{
Port = 443;
}
public List<int> FreePorts
{
get
{
return new List<int> { 80, 443, Port }.Distinct().ToList();
}
}
public ProjectType Type { get; set; } = ProjectType.NaiveProxy;
public int Port { get; set; }
public string Domain { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string MaskDomain { get; set; }
[JsonIgnore]
public string Email
{
get
{
if (!string.IsNullOrEmpty(Domain))
{
var arr = Domain.Split('.');
if (arr.Length == 3)
{
return $"{arr[0]}@{arr[1]}.{arr[2]}";
}
}
return $"{UserName + Port.ToString()}@gmail.com";
}
}
}
}

View file

@ -0,0 +1,13 @@
namespace ProxySuper.Core.Models.Projects
{
public enum ProjectType
{
Xray = 0,
TrojanGo = 1,
NaiveProxy = 2,
Brook = 3,
V2ray = 4,
MTProtoGo = 5,
Hysteria = 6,
}
}

View file

@ -0,0 +1,32 @@
namespace ProxySuper.Core.Models.Projects
{
public enum RayType
{
// 入口
VLESS_TCP_XTLS = 100,
// VLESS 101开头
VLESS_TCP = 101,
VLESS_WS = 102,
VLESS_H2 = 103,
VLESS_KCP = 104,
VLESS_QUIC = 105,
VLESS_gRPC = 110,
// VMESS 201开头
VMESS_TCP = 201,
VMESS_WS = 202,
VMESS_H2 = 203,
VMESS_KCP = 204,
VMESS_QUIC = 205,
// Trojan 301开头
Trojan_TCP = 301,
Trojan_WS = 302,
// SS
ShadowsocksAEAD = 401
}
}

View file

@ -0,0 +1,91 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
namespace ProxySuper.Core.Models.Projects
{
public class TrojanGoSettings : IProjectSettings
{
public TrojanGoSettings()
{
WithTLS = true;
Port = 443;
WebSocketPath = "/ws";
Password = Guid.NewGuid().ToString();
}
public List<int> FreePorts
{
get
{
return new List<int> { 80, 443, Port }.Distinct().ToList();
}
}
public ProjectType Type { get; set; } = ProjectType.TrojanGo;
/// <summary>
/// 是否安装TLS证书
/// </summary>
public bool WithTLS { get; set; }
/// <summary>
/// 域名
/// </summary>
public string Domain { get; set; }
/// <summary>
/// 端口
/// </summary>
public int Port { get; set; }
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; }
/// <summary>
/// 伪装域名
/// </summary>
public string MaskDomain { get; set; }
/// <summary>
/// 是否开启WebSocket
/// </summary>
[JsonIgnore]
public bool EnableWebSocket
{
get
{
return !string.IsNullOrEmpty(WebSocketPath);
}
}
/// <summary>
/// websocket路径
/// </summary>
public string WebSocketPath { get; set; }
[JsonIgnore]
public string Email
{
get
{
if (!string.IsNullOrEmpty(Domain))
{
var arr = Domain.Split('.');
if (arr.Length == 3)
{
return $"{arr[0]}@{arr[1]}.{arr[2]}";
}
}
var prefix = Password.Length > 7 ? Password.Substring(0, 7) : Password;
return $"{prefix}@gmail.com";
}
}
}
}

View file

@ -0,0 +1,187 @@
using Newtonsoft.Json;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
namespace ProxySuper.Core.Models.Projects
{
public partial class V2raySettings : IProjectSettings
{
public static List<string> DisguiseTypes = new List<string> {
"none",
"srtp",
"utp",
"wechat-video",
"dtls",
"wireguard",
};
public V2raySettings()
{
WithTLS = true;
var guid = Guid.NewGuid().ToString();
Port = 443;
VLESS_KCP_Port = 2001;
VLESS_QUIC_Port = 2002;
VLESS_gRPC_Port = 2003;
VMESS_KCP_Port = 3001;
VMESS_QUIC_Port = 3002;
ShadowSocksPort = 4001;
UUID = guid;
Types = new List<RayType>();
VLESS_WS_Path = "/" + Utils.RandomString(6);
VLESS_KCP_Type = "none";
VLESS_KCP_Seed = guid;
VLESS_QUIC_Key = "";
VLESS_QUIC_Type = "none";
VLESS_QUIC_Security = "none";
VLESS_QUIC_Type = "none";
VLESS_gRPC_ServiceName = Utils.RandomString(7);
VMESS_WS_Path = "/" + Utils.RandomString(8);
VMESS_TCP_Path = "/" + Utils.RandomString(9);
VMESS_KCP_Seed = guid;
VMESS_QUIC_Key = "";
VMESS_KCP_Type = "none";
VMESS_QUIC_Security = "none";
VMESS_QUIC_Type = "none";
TrojanPassword = guid;
ShadowSocksPassword = guid;
ShadowSocksMethod = "aes-128-gcm";
}
[JsonIgnore]
public bool IsIPAddress
{
get
{
return IPAddress.TryParse(Domain, out _);
}
}
[JsonIgnore]
public List<int> FreePorts
{
get
{
var list = new List<int>();
list.Add(80);
list.Add(Port);
if (Types.Contains(RayType.VLESS_KCP))
{
list.Add(VLESS_KCP_Port);
}
if (Types.Contains(RayType.VLESS_QUIC))
{
list.Add(VLESS_QUIC_Port);
}
if (Types.Contains(RayType.VMESS_KCP))
{
list.Add(VMESS_KCP_Port);
}
if (Types.Contains(RayType.VMESS_QUIC))
{
list.Add(VMESS_QUIC_Port);
}
if (Types.Contains(RayType.ShadowsocksAEAD))
{
list.Add(ShadowSocksPort);
}
if (Types.Contains(RayType.VLESS_gRPC))
{
list.Add(VLESS_gRPC_Port);
}
return list.Distinct().ToList();
}
}
/// <summary>
/// 是否安装证书,
/// 上传自有证书时选False则不会自动安装证书。
/// </summary>
public bool WithTLS { get; set; }
/// <summary>
/// 端口
/// </summary>
public int Port { get; set; }
/// <summary>
/// 域名
/// </summary>
public string Domain { get; set; }
/// <summary>
/// UUID
/// </summary>
public string UUID { get; set; }
/// <summary>
/// 多用户
/// </summary>
public List<string> MulitUUID { get; set; } = new List<string>();
/// <summary>
/// 伪装域名
/// </summary>
public string MaskDomain { get; set; }
[JsonIgnore]
public string Email
{
get
{
if (!string.IsNullOrEmpty(Domain))
{
var arr = Domain.Split('.');
if (arr.Length == 3)
{
return $"{arr[0]}@{arr[1]}.{arr[2]}";
}
}
return $"{UUID.Substring(2, 6)}@gmail.com";
}
}
/// <summary>
/// 安装类型
/// </summary>
public List<RayType> Types { get; set; } = new List<RayType>();
/// <summary>
/// 根据xray类型获取路径
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public string GetPath(RayType type)
{
switch (type)
{
case RayType.VLESS_WS:
return VLESS_WS_Path;
case RayType.VMESS_TCP:
return VMESS_TCP_Path;
case RayType.VMESS_WS:
return VMESS_WS_Path;
default:
return string.Empty;
}
}
}
}

View file

@ -0,0 +1,33 @@
using ProxySuper.Core.Services;
namespace ProxySuper.Core.Models.Projects
{
public partial class V2raySettings
{
/// <summary>
/// ss password
/// </summary>
public string ShadowSocksPassword { get; set; }
/// <summary>
/// ss method
/// </summary>
public string ShadowSocksMethod { get; set; }
/// <summary>
/// ss port
/// </summary>
public int ShadowSocksPort { get; set; }
/// <summary>
/// share link
/// </summary>
public string ShadowSocksShareLink
{
get
{
return ShareLink.Build(RayType.ShadowsocksAEAD, this);
}
}
}
}

View file

@ -0,0 +1,17 @@
using ProxySuper.Core.Services;
namespace ProxySuper.Core.Models.Projects
{
public partial class V2raySettings
{
public string TrojanPassword { get; set; }
public string Trojan_TCP_ShareLink
{
get
{
return ShareLink.Build(RayType.Trojan_TCP, this);
}
}
}
}

View file

@ -0,0 +1,115 @@
using ProxySuper.Core.Services;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Documents;
namespace ProxySuper.Core.Models.Projects
{
public partial class V2raySettings
{
/// <summary>
/// vless tcp shareLink
/// </summary>
public string VLESS_TCP_ShareLink
{
get
{
return ShareLink.Build(RayType.VLESS_TCP, this);
}
}
/// <summary>
/// websocket path
/// </summary>
public string VLESS_WS_Path { get; set; }
/// <summary>
/// VLESS WS ShareLink
/// </summary>
public string VLESS_WS_ShareLink
{
get
{
return ShareLink.Build(RayType.VLESS_WS, this);
}
}
/// <summary>
/// kcp seed
/// </summary>
public string VLESS_KCP_Seed { get; set; }
/// <summary>
/// kcp type
/// </summary>
public string VLESS_KCP_Type { get; set; }
/// <summary>
/// kcp port
/// </summary>
public int VLESS_KCP_Port { get; set; }
/// <summary>
/// VLESS KCP ShareLink
/// </summary>
public string VLESS_KCP_ShareLink
{
get
{
return ShareLink.Build(RayType.VLESS_KCP, this);
}
}
/// <summary>
/// vless quic security
/// </summary>
public string VLESS_QUIC_Security { get; set; }
/// <summary>
/// vless quic type
/// </summary>
public string VLESS_QUIC_Type { get; set; }
/// <summary>
/// vless quic port
/// </summary>
public int VLESS_QUIC_Port { get; set; }
/// <summary>
/// vless quic key
/// </summary>
public string VLESS_QUIC_Key { get; set; }
/// <summary>
/// vless quic ShareLink
/// </summary>
public string VLESS_QUIC_ShareLink
{
get
{
return ShareLink.Build(RayType.VLESS_QUIC, this);
}
}
/// <summary>
/// grpc port
/// </summary>
public int VLESS_gRPC_Port { get; set; }
/// <summary>
/// grpc service name
/// </summary>
public string VLESS_gRPC_ServiceName { get; set; }
/// <summary>
/// vless grpc share link
/// </summary>
public string VLESS_gRPC_ShareLink
{
get
{
return ShareLink.Build(RayType.VLESS_gRPC, this);
}
}
}
}

View file

@ -0,0 +1,96 @@
using ProxySuper.Core.Services;
namespace ProxySuper.Core.Models.Projects
{
public partial class V2raySettings
{
/// <summary>
/// vmess websocket path
/// </summary>
public string VMESS_WS_Path { get; set; }
/// <summary>
/// vmess ws sharelink
/// </summary>
public string VMESS_WS_ShareLink
{
get
{
return ShareLink.Build(RayType.VMESS_WS, this);
}
}
/// <summary>
/// mvess tcp path
/// </summary>
public string VMESS_TCP_Path { get; set; }
/// <summary>
/// vmess tcp ShareLink
/// </summary>
public string VMESS_TCP_ShareLink
{
get
{
return ShareLink.Build(RayType.VMESS_TCP, this);
}
}
/// <summary>
/// vmess kcp seed
/// </summary>
public string VMESS_KCP_Seed { get; set; }
/// <summary>
/// vmess kcp type
/// </summary>
public string VMESS_KCP_Type { get; set; }
/// <summary>
/// vmess kcp port
/// </summary>
public int VMESS_KCP_Port { get; set; }
/// <summary>
/// vmess kcp ShareLink
/// </summary>
public string VMESS_KCP_ShareLink
{
get
{
return ShareLink.Build(RayType.VMESS_KCP, this);
}
}
/// <summary>
/// vmess quic security
/// </summary>
public string VMESS_QUIC_Security { get; set; }
/// <summary>
/// vmess quic type
/// </summary>
public string VMESS_QUIC_Type { get; set; }
/// <summary>
/// vmess quic port
/// </summary>
public int VMESS_QUIC_Port { get; set; }
/// <summary>
/// vmess quic key
/// </summary>
public string VMESS_QUIC_Key { get; set; }
/// <summary>
/// vmess quic ShareLink
/// </summary>
public string VMESS_QUIC_ShareLink
{
get
{
return ShareLink.Build(RayType.VMESS_QUIC, this);
}
}
}
}

View file

@ -0,0 +1,32 @@
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.Models.Projects
{
public class XraySettings : V2raySettings
{
public static List<string> UTLSList = new List<string> { "", "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized" };
//流控参数在服务端只有两种 "none", "xtls-rprx-vision",客户端可以选择三种:"none", "xtls-rprx-vision", "xtls-rprx-vision-udp443",但是选择了XTLS模式就是默认flow不为空或者"none",所以这里不再填加"none"这一项。
public static List<string> FlowList = new List<string> { "xtls-rprx-vision", "xtls-rprx-vision-udp443" }; //{ "xtls-rprx-origin", "xtls-rprx-origin-udp443", "xtls-rprx-direct", "xtls-rprx-direct-udp443", "xtls-rprx-splice", "xtls-rprx-splice-udp443" };
public string UTLS { get; set; } = UTLSList[1];
public string Flow { get; set; } = FlowList[0];
/// <summary>
/// vless xtls shareLink
/// </summary>
public string VLESS_TCP_XTLS_ShareLink
{
get
{
return ShareLink.Build(RayType.VLESS_TCP_XTLS, this);
}
}
}
}

View file

@ -0,0 +1,134 @@
using MvvmCross.ViewModels;
using Newtonsoft.Json;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Text;
namespace ProxySuper.Core.Models
{
[JsonObject]
public class Record : MvxViewModel
{
public Record()
{
_isChecked = false;
}
private Host _host;
private bool _isChecked;
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("host")]
public Host Host
{
get { return _host; }
set
{
_host = value;
RaisePropertyChanged("Host");
}
}
[JsonProperty("v2raySettings")]
public V2raySettings V2raySettings { get; set; }
[JsonProperty("settings")]
public XraySettings XraySettings { get; set; }
[JsonProperty("trojanGoSettings")]
public TrojanGoSettings TrojanGoSettings { get; set; }
[JsonProperty("naiveProxySettings")]
public NaiveProxySettings NaiveProxySettings { get; set; }
[JsonProperty("brook")]
public BrookSettings BrookSettings { get; set; }
[JsonProperty("mtProtoGoSettings")]
public MTProtoGoSettings MTProtoGoSettings { get; set; }
[JsonProperty]
public HysteriaSettings HysteriaSettings { get; set; }
[JsonIgnore]
public ProjectType Type
{
get
{
if (XraySettings != null) return ProjectType.Xray;
if (V2raySettings != null) return ProjectType.V2ray;
if (TrojanGoSettings != null) return ProjectType.TrojanGo;
if (NaiveProxySettings != null) return ProjectType.NaiveProxy;
if (MTProtoGoSettings != null) return ProjectType.MTProtoGo;
if (HysteriaSettings != null) return ProjectType.Hysteria;
return ProjectType.Brook;
}
}
[JsonIgnore]
public bool IsChecked
{
get
{
return _isChecked;
}
set
{
_isChecked = value;
RaisePropertyChanged("IsChecked");
}
}
[JsonIgnore]
public Action OnSave { get; set; } = () => { };
public string GetShareLink()
{
if (Type == ProjectType.V2ray)
{
StringBuilder strBuilder = new StringBuilder();
V2raySettings.Types.ForEach(type =>
{
var link = ShareLink.Build(type, V2raySettings);
strBuilder.AppendLine(link);
});
return strBuilder.ToString();
}
if (Type == ProjectType.Xray)
{
StringBuilder strBuilder = new StringBuilder();
XraySettings.Types.ForEach(type =>
{
var link = ShareLink.Build(type, XraySettings);
strBuilder.AppendLine(link);
});
return strBuilder.ToString();
}
if (Type == ProjectType.TrojanGo)
{
return ShareLink.BuildTrojanGo(TrojanGoSettings);
}
if (Type == ProjectType.NaiveProxy)
{
return ShareLink.BuildNaiveProxy(NaiveProxySettings);
}
return string.Empty;
}
}
}

View file

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ProxySuper.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ProxySuper.Core")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("15779ee6-d8ca-44bf-bfe2-941e155eef3f")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{15779EE6-D8CA-44BF-BFE2-941E155EEF3F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ProxySuper.Core</RootNamespace>
<AssemblyName>ProxySuper.Core</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.7.0.0\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="MvvmCross, Version=8.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MvvmCross.8.0.2\lib\net461\MvvmCross.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\json.net\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="QRCoder, Version=1.4.3.0, Culture=neutral, PublicKeyToken=c4ed5b9ae8358a28, processorArchitecture=MSIL">
<HintPath>..\packages\QRCoder.1.4.3\lib\net40\QRCoder.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet, Version=2023.0.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2023.0.0\lib\net462\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Console, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Console.4.3.1\lib\net46\System.Console.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="App.cs" />
<Compile Include="Converters\LoginSecretTypeConverter.cs" />
<Compile Include="Converters\ProxyTypeConverter.cs" />
<Compile Include="Converters\VisibleConverter.cs" />
<Compile Include="Helpers\DateTimeUtils.cs" />
<Compile Include="Models\Caddy.cs" />
<Compile Include="Models\Hosts\Host.cs" />
<Compile Include="Models\Hosts\LoginSecretType.cs" />
<Compile Include="Models\ProjectProgress.cs" />
<Compile Include="Models\Projects\BrookSettings.cs" />
<Compile Include="Models\Projects\BrookType.cs" />
<Compile Include="Models\Projects\HysteriaSettings.cs" />
<Compile Include="Models\Projects\IProjectSettings.cs" />
<Compile Include="Models\Hosts\LocalProxy.cs" />
<Compile Include="Models\Projects\MTProtoGoSettings.cs" />
<Compile Include="Models\Projects\NaiveProxySettings.cs" />
<Compile Include="Models\Projects\ProjectType.cs" />
<Compile Include="Models\Projects\TrojanGoSettings.cs" />
<Compile Include="Models\Projects\V2raySettings_SS.cs" />
<Compile Include="Models\Projects\V2raySettings_Trojan.cs" />
<Compile Include="Models\Projects\V2raySettings_VLESS.cs" />
<Compile Include="Models\Projects\V2raySettings.cs" />
<Compile Include="Models\Projects\V2raySettings_VMESS.cs" />
<Compile Include="Models\Projects\XraySettings.cs" />
<Compile Include="Models\Projects\RayType.cs" />
<Compile Include="Models\Record.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Helpers\Utils.cs" />
<Compile Include="Services\BrookService.cs" />
<Compile Include="Services\HysteriaService.cs" />
<Compile Include="Services\MTProtoGoService.cs" />
<Compile Include="Services\NaiveProxyService.cs" />
<Compile Include="Services\ServiceBase.cs" />
<Compile Include="Services\ShareLink.cs" />
<Compile Include="Services\TrojanGoConfigBuilder.cs" />
<Compile Include="Services\TrojanGoService.cs" />
<Compile Include="Services\V2rayConfigBuilder.cs" />
<Compile Include="Services\V2rayService.cs" />
<Compile Include="Services\XrayConfigBuilder.cs" />
<Compile Include="Services\XrayService.cs" />
<Compile Include="ViewModels\BrookConfigViewModel.cs" />
<Compile Include="ViewModels\BrookEditorViewModel.cs" />
<Compile Include="ViewModels\BrookInstallViewModel.cs" />
<Compile Include="ViewModels\EnableRootViewModel.cs" />
<Compile Include="ViewModels\HomeViewModel.cs" />
<Compile Include="ViewModels\HysteriaConfigViewModel.cs" />
<Compile Include="ViewModels\HysteriaEditorViewModel.cs" />
<Compile Include="ViewModels\HysteriaInstallViewModel.cs" />
<Compile Include="ViewModels\MTProtoGoConfigViewModel.cs" />
<Compile Include="ViewModels\MTProtoGoEditorViewModel.cs" />
<Compile Include="ViewModels\MTProtoGoInstallViewModel.cs" />
<Compile Include="ViewModels\NaiveProxyConfigViewModel.cs" />
<Compile Include="ViewModels\NaiveProxyEditorViewModel.cs" />
<Compile Include="ViewModels\NaiveProxyInstallViewModel.cs" />
<Compile Include="ViewModels\ShareLinkViewModel.cs" />
<Compile Include="ViewModels\TrojanGoConfigViewModel.cs" />
<Compile Include="ViewModels\TrojanGoEditorViewModel.cs" />
<Compile Include="ViewModels\TrojanGoInstallViewModel.cs" />
<Compile Include="ViewModels\V2rayConfigViewModel.cs" />
<Compile Include="ViewModels\V2rayEditorViewModel.cs" />
<Compile Include="ViewModels\V2rayInstallViewModel.cs" />
<Compile Include="ViewModels\XrayConfigViewModel.cs" />
<Compile Include="ViewModels\XrayEditorViewModel.cs" />
<Compile Include="ViewModels\XrayInstallViewModel.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -0,0 +1,171 @@
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.Services
{
public class BrookService : ServiceBase<BrookSettings>
{
private string brookServiceTemp = @"
[Unit]
Description=brook service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
ExecStart=##run_cmd##
[Install]
WantedBy=multi-user.target";
public BrookService(Host host, BrookSettings settings) : base(host, settings)
{
}
public void Install()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "安装Brook";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "安装必要的系统工具";
InstallSystemTools();
Progress.Percentage = 40;
Progress.Desc = "配置防火墙";
ConfigFirewalld();
Progress.Percentage = 50;
Progress.Step = "检测网络环境";
EnsureNetwork();
Progress.Percentage = 60;
if (Settings.BrookType == BrookType.wssserver)
{
Progress.Desc = "检测域名是否绑定本机IP";
ValidateDomain();
Progress.Percentage = 80;
}
Progress.Step = "安装Brook服务";
InstallBrook();
Progress.Percentage = 100;
Progress.Step = "安装Brook成功";
Progress.Desc = "安装Brook成功";
AppendCommand("分享连接:");
AppendCommand(ShareLink.BuildBrook(Settings));
NavigationService.Navigate<BrookConfigViewModel, BrookSettings>(Settings);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void InstallBrook()
{
Progress.Desc = "执行Brook安装文件";
string url = "https://github.com/txthinking/brook/releases/latest/download/brook_linux_amd64";
if (ArchType == ArchType.arm)
{
url = url.Replace("brook_linux_amd64", "brook_linux_arm7");
}
RunCmd($"curl -L {url} -o /usr/bin/brook");
RunCmd("chmod +x /usr/bin/brook");
Progress.Desc = "设置Brook服务";
var brookService = brookServiceTemp.Replace("##run_cmd##", GetRunBrookCommand());
RunCmd("rm -rf /etc/systemd/system/brook.service");
RunCmd("touch /etc/systemd/system/brook.service");
RunCmd($"echo \"{brookService}\" > /etc/systemd/system/brook.service");
RunCmd("sudo chmod 777 /etc/systemd/system/brook.service");
Progress.Desc = "启动Brook服务";
RunCmd("systemctl enable brook");
RunCmd("systemctl restart brook");
}
private string GetRunBrookCommand()
{
var runBrookCmd = string.Empty;
if (Settings.BrookType == BrookType.server)
{
return $"/usr/bin/brook server --listen :{Settings.Port} --password {Settings.Password}";
}
if (Settings.BrookType == BrookType.wsserver)
{
return $"/usr/bin/brook wsserver --listen :{Settings.Port} --password {Settings.Password}";
}
if (Settings.BrookType == BrookType.wssserver)
{
return $"/usr/bin/brook wssserver --domain {Settings.Domain} --password {Settings.Password}";
}
if (Settings.BrookType == BrookType.socks5)
{
var ip = IsOnlyIPv6 ? IPv6 : IPv4;
return $"/usr/bin/brook socks5 --socks5 {ip}:{Settings.Port}";
}
return runBrookCmd;
}
public void Uninstall()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "卸载Brook";
Progress.Percentage = 0;
Progress.Desc = "停止Brook服务";
RunCmd("systemctl stop brook");
RunCmd("systemctl disable brook");
Progress.Percentage = 30;
Progress.Desc = "删除Brook相关文件";
RunCmd("rm -rf /etc/systemd/system/brook.service");
RunCmd("rm -rf /usr/bin/brook");
Progress.Percentage = 80;
Progress.Desc = "重置防火墙设置";
ResetFirewalld();
Progress.Percentage = 100;
Progress.Desc = "卸载完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
}
}

View file

@ -0,0 +1,172 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using Renci.SshNet.Messages;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.Services
{
public class HysteriaService : ServiceBase<HysteriaSettings>
{
public HysteriaService(Host host, HysteriaSettings settings) : base(host, settings)
{
}
public void Install()
{
try
{
Task.Factory.StartNew(() =>
{
Progress.Step = "安装Hysteria";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "安装必要的系统工具";
InstallSystemTools();
Progress.Percentage = 40;
Progress.Desc = "配置防火墙";
ConfigFirewalld();
Progress.Percentage = 50;
Progress.Step = "检测网络环境";
EnsureNetwork();
Progress.Percentage = 60;
Progress.Desc = "检测域名是否绑定本机IP";
ValidateDomain();
Progress.Percentage = 80;
Progress.Step = "上传Hysteria配置文件";
UploadConfigFile();
Progress.Step = "安装Hysteria服务";
InstallHysteria();
Progress.Percentage = 100;
Progress.Step = "安装Hysteria成功";
Progress.Desc = "安装Hysteria成功";
});
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
public void Uninstall()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "卸载Hysteria";
Progress.Percentage = 0;
Progress.Desc = "停止Hysteria服务";
RunCmd("systemctl stop Hysteria");
RunCmd("systemctl disable Hysteria");
Progress.Percentage = 30;
Progress.Desc = "删除Hysteria相关文件";
RunCmd("rm -rf /etc/systemd/system/Hysteria.service");
RunCmd("rm -rf /usr/bin/Hysteria");
Progress.Percentage = 80;
Progress.Desc = "重置防火墙设置";
ResetFirewalld();
Progress.Percentage = 100;
Progress.Desc = "卸载完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private string HysteriaServiceTemp = @"
[Unit]
Description=hysteria service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
ExecStart=##run_cmd##
[Install]
WantedBy=multi-user.target";
private void InstallHysteria()
{
Progress.Desc = "执行Hysteria安装文件";
string url = "https://github.com/apernet/hysteria/releases/download/v1.3.4/hysteria-linux-386";
string targetPath = "/usr/bin/hysteria/hysteria-linux-386";
if (ArchType == ArchType.arm)
{
url = url.Replace("hysteria-linux-386", "hysteria-linux-arm");
targetPath = targetPath.Replace("hysteria-linux-386", "hysteria-linux-arm");
}
RunCmd($"curl -L {url} -o {targetPath}");
RunCmd($"chmod +x {targetPath}");
Progress.Desc = "设置Hysteria服务";
var cmd = targetPath + " -c /usr/bin/hysteria/config.json server";
var hysteriaService = HysteriaServiceTemp.Replace("##run_cmd##", cmd);
RunCmd("rm -rf /etc/systemd/system/hysteria.service");
RunCmd("touch /etc/systemd/system/hysteria.service");
RunCmd($"echo \"{hysteriaService}\" > /etc/systemd/system/hysteria.service");
RunCmd("sudo chmod 777 /etc/systemd/system/hysteria.service");
Progress.Desc = "启动Hysteria服务";
RunCmd("systemctl enable hysteria");
RunCmd("systemctl restart hysteria");
}
private const string ConfigFilePath = @"Templates\Hysteria\config.json";
private void UploadConfigFile()
{
var text = File.ReadAllText(ConfigFilePath, Encoding.UTF8);
var json = JsonConvert.DeserializeObject(text);
var obj = JToken.FromObject(json) as dynamic;
obj["listen"] = $":{Settings.Port}";
obj["acme"]["domains"][0] = Settings.Domain;
obj["email"] = Settings.Email;
obj["obfs"] = Settings.Obfs;
var configJson = JsonConvert.SerializeObject(
obj,
Formatting.Indented,
new JsonSerializerSettings()
{
NullValueHandling = NullValueHandling.Ignore
});
RunCmd("mkdir /usr/bin/hysteria");
WriteToFile(configJson, "/usr/bin/hysteria/config.json");
}
}
}

View file

@ -0,0 +1,160 @@
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.Services
{
public class MTProtoGoService : ServiceBase<MTProtoGoSettings>
{
public MTProtoGoService(Host host, MTProtoGoSettings settings) : base(host, settings)
{
}
public void Install()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "1. 检测系统环境";
Progress.Percentage = 0;
EnsureRootUser();
EnsureSystemEnv();
Progress.Percentage = 15;
Progress.Step = "2. 安装必要的系统工具";
InstallSystemTools();
Progress.Percentage = 25;
Progress.Step = "3. 配置防火墙";
ConfigFirewalld();
Progress.Percentage = 35;
Progress.Step = "4. 安装docker";
InstallDocker();
Progress.Percentage = 50;
Progress.Step = "5. 生成密钥";
//RunCmd("docker pull nineseconds/mtg:2"); //拉取v2版本命令但是似乎不用也可以。
//下面的命令是v1版本的命令格式。可以保留。将来如启用v1可用。
//Settings.SecretText = RunCmd($"docker run nineseconds/mtg:1 generate-secret -c {Settings.Cleartext} tls").TrimEnd('\n');
Settings.SecretText = RunCmd($"docker run nineseconds/mtg:2 generate-secret {Settings.Cleartext}").TrimEnd('\n');
Progress.Percentage = 65;
Progress.Step = "6. 生成配置文件";
Progress.Desc = "创建配置";
RunCmd("touch /etc/mtg.toml");
Progress.Desc = "写入配置内容";
RunCmd($"echo \"secret=\\\"{Settings.SecretText}\\\"\" > /etc/mtg.toml");
RunCmd($"echo \"bind-to=\\\"0.0.0.0:{Settings.Port}\\\"\" >> /etc/mtg.toml");
Progress.Percentage = 80;
Progress.Step = "7. 启动MTProto服务";
RunCmd($"docker run -d -v /etc/mtg.toml:/config.toml --name=mtg --restart=always -p {Settings.Port + ":" + Settings.Port} nineseconds/mtg:2");
Progress.Desc = "设置自启动MTProto服务";
Progress.Step = "安装完成";
Progress.Percentage = 100;
AppendCommand("Host: " + Settings.Domain);
AppendCommand("Port: " + Settings.Port);
AppendCommand("Secret: " + Settings.SecretText);
NavigationService.Navigate<MTProtoGoConfigViewModel, MTProtoGoSettings>(Settings);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void Uninstall()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Percentage = 0;
Progress.Step = "卸载MTProto";
Progress.Desc = "检测系统环境";
EnsureRootUser();
Progress.Percentage = 30;
Progress.Desc = "删除docker容器";
var cid = RunCmd("docker ps -q --filter name=mtg");
RunCmd($"docker stop {cid}");
RunCmd($"docker rm {cid}");
Progress.Percentage = 100;
Progress.Desc = "卸载完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UpdateSettings()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Percentage = 0;
Progress.Step = "更新MTProto配置";
Progress.Desc = "暂停MTProto服务";
var cid = RunCmd("docker ps -q --filter name=mtg");
RunCmd($"docker stop {cid}");
Progress.Percentage = 50;
Progress.Desc = "生成密钥";
//Settings.SecretText = RunCmd($"docker run nineseconds/mtg:1 generate-secret -c {Settings.Cleartext} tls").TrimEnd('\n'); //v1版本
Settings.SecretText = RunCmd($"docker run nineseconds/mtg:2 generate-secret {Settings.Cleartext}").TrimEnd('\n');
Progress.Percentage = 65;
Progress.Desc = "修改配置文件";
RunCmd($"echo \"secret=\\\"{Settings.SecretText}\\\"\" > /etc/mtg.toml");
RunCmd($"echo \"bind-to=\\\"0.0.0.0:{Settings.Port}\\\"\" >> /etc/mtg.toml");
Progress.Percentage = 80;
Progress.Desc = "重启MTProto服务";
RunCmd($"docker restart {cid}");
Progress.Percentage = 100;
Progress.Desc = "更新配置成功";
AppendCommand("Host: " + Settings.Domain);
AppendCommand("Port: " + Settings.Port);
AppendCommand("Secret: " + Settings.SecretText);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void InstallDocker()
{
Progress.Desc = "执行docker安装脚本";
RunCmd("yes | curl https://get.docker.com | sh");
if (!FileExists("/usr/bin/docker"))
{
Progress.Desc = "docker安装失败";
throw new Exception("docker安装失败");
}
}
}
}

View file

@ -0,0 +1,282 @@
using Microsoft.Win32;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.ViewModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.Services
{
public class NaiveProxyService : ServiceBase<NaiveProxySettings>
{
public NaiveProxyService(Host host, NaiveProxySettings settings) : base(host, settings)
{
}
public void Install()
{
Task.Factory.StartNew(() =>
{
try
{
var index = 1;
Progress.Step = $"{index++}. 检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Step = $"{index++}. 安装系统必要工具";
InstallSystemTools();
Progress.Percentage = 30;
Progress.Step = $"{index++}. 配置防火墙";
ConfigFirewalld();
Progress.Percentage = 40;
Progress.Step = $"{index++}. 检测网络环境";
EnsureNetwork();
Progress.Percentage = 50;
Progress.Step = $"{index++}. 检测域名是否绑定到本机";
ValidateDomain();
Progress.Percentage = 60;
Progress.Step = $"{index++}. 安装NaiveProxy";
InstallNaiveProxy();
Progress.Percentage = 80;
Progress.Step = $"{index++}. 优化网络参数";
ConfigNetwork();
Progress.Percentage = 90;
Progress.Step = $"{index++}. 启动BBR";
EnableBBR();
Progress.Desc = "重启Caddy服务";
RunCmd("systemctl restart caddy");
Progress.Percentage = 100;
Progress.Step = "NaiveProxy安装成功";
Progress.Desc = string.Empty;
AppendCommand("分享连接:");
AppendCommand(ShareLink.BuildNaiveProxy(Settings));
NavigationService.Navigate<NaiveProxyConfigViewModel, NaiveProxySettings>(Settings);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void Uninstall()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "卸载NaiveProxy";
Progress.Percentage = 0;
Progress.Desc = "正在卸载...";
RunCmd("rm -rf caddy_install.sh");
Progress.Percentage = 10;
RunCmd("curl -o caddy_install.sh https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh");
Progress.Percentage = 20;
RunCmd("yes | bash caddy_install.sh uninstall");
Progress.Percentage = 80;
RunCmd("rm -rf caddy_install.sh");
Progress.Percentage = 100;
Progress.Step = "卸载NaiveProxy成功";
Progress.Desc = "卸载NaiveProxy成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UpdateSettings()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "更新配置";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Percentage = 30;
UploadCaddySettings();
Progress.Desc = "重启Caddy服务";
RunCmd("systemctl restart caddy");
Progress.Percentage = 100;
Progress.Step = "更新配置成功";
Progress.Desc = string.Empty;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UploadWeb()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadWeb;
fileDialog.ShowDialog();
}
#region
private void DoUploadWeb(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Step = "上传静态网站";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "创建网站目录";
if (!FileExists("/usr/share/caddy"))
{
RunCmd("mkdir /usr/share/caddy");
}
RunCmd("rm -rf /usr/share/caddy/*");
Progress.Percentage = 40;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
UploadFile(stream, "/usr/share/caddy/caddy.zip");
RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
RunCmd("chmod -R 777 /usr/share/caddy");
Progress.Percentage = 700;
}
Progress.Desc = "上传Caddy配置文件";
UploadCaddySettings(useCustomWeb: true);
Progress.Percentage = 90;
Progress.Desc = "重启caddy服务";
RunCmd("systemctl restart caddy");
Progress.Percentage = 100;
Progress.Desc = "上传静态网站成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void InstallNaiveProxy()
{
Progress.Desc = "下载NaiveProxy安装文件";
RunCmd(@"curl https://raw.githubusercontent.com/proxysu/shellscript/master/Caddy-Naive/caddy-naive-install.sh yes | bash");
Progress.Desc = "设置NaiveProxy开机启动";
RunCmd("systemctl enable caddy");
Progress.Desc = "上传配置文件";
UploadCaddySettings(false);
}
private void ConfigNetwork()
{
RunCmd(@"bash -c 'echo ""fs.file-max = 51200"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.rmem_max = 67108864"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.wmem_max = 67108864"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.rmem_default = 65536"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.wmem_default = 65536"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.netdev_max_backlog = 4096"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.core.somaxconn = 4096"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_syncookies = 1"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_tw_reuse = 1"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_tw_recycle = 0"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_fin_timeout = 30"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_keepalive_time = 1200"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.ip_local_port_range = 10000 65000"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_max_syn_backlog = 4096"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_max_tw_buckets = 5000"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_rmem = 4096 87380 67108864"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_wmem = 4096 65536 67108864"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_mtu_probing = 1"" >> /etc/sysctl.conf'");
RunCmd(@"sysctl -p");
}
private void UploadCaddySettings(bool useCustomWeb = false)
{
Progress.Desc = "生成配置文件";
var caddyStr = BuildConfig(useCustomWeb);
if (FileExists("/etc/caddy/Caddyfile"))
{
RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
}
Progress.Desc = "上传配置文件";
WriteToFile(caddyStr, "/etc/caddy/Caddyfile");
}
private string BuildConfig(bool useCustomWeb = false)
{
var jsonStr = File.ReadAllText("Templates/NaiveProxy/naive_server.caddyfile");
jsonStr = jsonStr.Replace("##port##", Settings.Port.ToString());
jsonStr = jsonStr.Replace("##domain##", Settings.Domain);
jsonStr = jsonStr.Replace("##basicauth##", $"basic_auth {Settings.UserName} {Settings.Password}");
if (!useCustomWeb && !string.IsNullOrEmpty(Settings.MaskDomain))
{
var prefix = "http://";
if (Settings.MaskDomain.StartsWith("https://"))
{
prefix = "https://";
}
var domain = Settings.MaskDomain
.TrimStart("http://".ToCharArray())
.TrimStart("https://".ToCharArray());
jsonStr = jsonStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
}
else
{
jsonStr = jsonStr.Replace("##reverse_proxy##", "");
jsonStr = jsonStr.Replace("#file_server", "file_server");
}
return jsonStr;
}
#endregion
}
}

View file

@ -0,0 +1,843 @@
using MvvmCross;
using MvvmCross.Navigation;
using ProxySuper.Core.Helpers;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using Renci.SshNet;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Navigation;
namespace ProxySuper.Core.Services
{
public enum ArchType
{
x86,
arm
}
public enum CmdType
{
None,
Yum,
Apt,
Dnf
}
public abstract class ServiceBase<TSettings> where TSettings : IProjectSettings
{
private Host _host;
private SshClient _sshClient;
private ProjectProgress _progress;
public ServiceBase(Host host, TSettings settings)
{
_host = host;
Settings = settings;
var connection = CreateConnectionInfo();
if (connection != null)
{
_sshClient = new SshClient(connection);
}
_progress = new ProjectProgress();
ArchType = ArchType.x86;
CmdType = CmdType.None;
IPv4 = string.Empty;
IPv6 = string.Empty;
IsOnlyIPv6 = false;
NavigationService = Mvx.IoCProvider.Resolve<IMvxNavigationService>();
}
public string RunCmd(string command)
{
AppendCommand(command);
string result;
if (_sshClient.IsConnected)
{
result = _sshClient.CreateCommand(command).Execute();
}
else
{
result = "连接已断开";
}
AppendCommand(result);
return result;
}
public ProjectProgress Progress => _progress;
public TSettings Settings { get; set; }
public ArchType ArchType { get; set; }
public CmdType CmdType { get; set; }
public string IPv4 { get; set; }
public string IPv6 { get; set; }
public bool IsOnlyIPv6 { get; set; }
public IMvxNavigationService NavigationService { get; set; }
#region
public void Connect()
{
Task.Run(() =>
{
if (_sshClient == null)
{
MessageBox.Show("无法建立连接,连接参数有误!");
return;
}
if (_sshClient.IsConnected == false)
{
Progress.Desc = ("正在与服务器建立连接");
try
{
_sshClient.Connect();
Progress.Desc = ("建立连接成功");
}
catch (Exception e)
{
Progress.Desc = ("连接失败," + e.Message);
}
}
});
}
public void Disconnect()
{
Task.Run(() =>
{
_sshClient?.Disconnect();
});
}
protected void WriteToFile(string text, string path)
{
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(text)))
{
using (var sftp = new SftpClient(_sshClient.ConnectionInfo))
{
try
{
sftp.Connect();
sftp.UploadFile(stream, path, true);
}
catch (Exception ex)
{
throw ex;
}
finally
{
sftp.Disconnect();
}
}
}
}
protected bool FileExists(string path)
{
var cmdStr = $"if [[ -f {path} ]];then echo '1';else echo '0'; fi";
var cmd = RunCmd(cmdStr);
return cmd.Trim() == "1";
}
protected void SyncTimeDiff()
{
RunCmd("rm -f /etc/localtime");
RunCmd("ln -s /usr/share/zoneinfo/UTC /etc/localtime");
var result = RunCmd("date +%s");
var vpsSeconds = Convert.ToInt64(result);
var localSeconds = (int)(DateTime.Now.ToUniversalTime() - DateTime.Parse("1970-01-01")).TotalSeconds;
if (Math.Abs(vpsSeconds - localSeconds) >= 90)
{
// 同步本地时间
var netUtcTime = DateTimeUtils.GetUTCTime();
DateTimeUtils.SetDate(netUtcTime.ToLocalTime());
// 同步VPS时间
var utcTS = DateTimeUtils.GetUTCTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
long timeStampVPS = Convert.ToInt64(utcTS.TotalSeconds);
RunCmd($"date --set=\"$(date \"+%Y-%m-%d %H:%M:%S\" -d @{timeStampVPS.ToString()})\"");
}
}
protected void ValidateDomain()
{
var domainIP = RunCmd($"ping \"{Settings.Domain}\" -c 1" + @" | sed '1{s/[^(]*(//;s/).*//;q}'")
.Trim('\r', '\n');
if (IsOnlyIPv6)
{
Progress.Desc = ($"本机IP({IPv6})");
if (IPv6 != domainIP)
{
//throw new Exception("域名解析地址与服务器IP不匹配");
}
}
else
{
Progress.Desc = ($"本机IP({IPv4})");
Progress.Desc = ($"域名IP({domainIP})");
if (IPv4 != domainIP)
{
//throw new Exception("域名解析地址与服务器IP不匹配");
}
}
}
protected void EnableBBR()
{
Progress.Desc = ("检查系统是否满足启动BBR条件");
var osVersion = RunCmd("uname -r");
var canInstallBBR = CheckKernelVersionBBR(osVersion.Split('-')[0]);
var bbrInfo = RunCmd("sysctl net.ipv4.tcp_congestion_control | grep bbr");
var installed = bbrInfo.Contains("bbr");
if (canInstallBBR && !installed)
{
RunCmd(@"bash -c 'echo ""net.core.default_qdisc=fq"" >> /etc/sysctl.conf'");
RunCmd(@"bash -c 'echo ""net.ipv4.tcp_congestion_control=bbr"" >> /etc/sysctl.conf'");
RunCmd(@"sysctl -p");
if (IsOnlyIPv6)
{
RemoveNat64();
}
Progress.Desc = ("启动BBR成功");
}
if (!canInstallBBR)
{
Progress.Desc = ("系统不满足启用BBR条件启动失败。");
}
}
/// <summary>
/// 安装证书
/// </summary>
/// <param name="certPath"></param>
/// <param name="keyPath"></param>
protected void InstallCert(string dirPath, string certName, string keyName)
{
string certPath = dirPath + "/" + certName;
string keyPath = dirPath + "/" + keyName;
Progress.Desc = ("安装Acme软件");
#region Acme
// 安装依赖
RunCmd(GetInstallCmd("socat"));
// 解决搬瓦工CentOS缺少问题
RunCmd(GetInstallCmd("automake autoconf libtool"));
// 安装Acme
var result = RunCmd($"curl https://get.acme.sh yes | sh");
if (!result.Contains("nstall success"))
{
throw new Exception("安装 Acme 失败,请联系开发者!");
}
RunCmd("alias acme.sh=~/.acme.sh/acme.sh");
#endregion
#region
Progress.Desc = ("正在申请证书");
// 申请证书
var cmd = $"/root/.acme.sh/acme.sh --force --debug --issue --standalone -d {Settings.Domain} {(IsOnlyIPv6 ? "--listen-v6" : "")} --pre-hook \"systemctl stop caddy\" --post-hook \"systemctl start caddy\" --server letsencrypt";
result = RunCmd(cmd);
if (result.Contains("success"))
{
Progress.Desc = ("申请证书成功");
}
else
{
Progress.Desc = ("申请证书失败,如果申请次数过多请更换二级域名,或联系开发者!");
throw new Exception("申请证书失败,如果申请次数过多请更换二级域名,或联系开发者!");
}
#endregion
// 安装证书
Progress.Desc = ("安装TLS证书");
RunCmd($"mkdir -p {dirPath}");
RunCmd($"/root/.acme.sh/acme.sh --installcert -d {Settings.Domain} --certpath {certPath} --keypath {keyPath} --capath {certPath}");
result = RunCmd($@"if [ ! -f ""{keyPath}"" ]; then echo ""0""; else echo ""1""; fi | head -n 1");
if (result.Contains("1"))
{
Progress.Desc = ("安装证书成功");
}
else
{
Progress.Desc = ("安装证书失败,请联系开发者!");
throw new Exception("安装证书失败,请联系开发者!");
}
RunCmd($"chmod 755 {dirPath}");
}
protected void UploadFile(Stream stream, string path)
{
using (var sftp = new SftpClient(_sshClient.ConnectionInfo))
{
sftp.Connect();
sftp.UploadFile(stream, path, true);
sftp.Disconnect();
}
}
public void EnsureRootUser()
{
// 禁止一些可能产生的干扰信息
RunCmd(@"sed -i 's/echo/#echo/g' ~/.bashrc");
RunCmd(@"sed -i 's/echo/#echo/g' ~/.profile");
var result = RunCmd("id -u");
if (!result.Equals("0\n"))
{
throw new Exception("请使用Root权限账户登录");
}
}
public void UninstallCaddy()
{
Progress.Desc = "关闭Caddy服务";
RunCmd("systemctl stop caddy");
RunCmd("systemctl disable caddy");
Progress.Desc = "彻底删除Caddy文件";
RunCmd("rm -rf /etc/systemd/system/caddy.service");
RunCmd("rm -rf /usr/bin/caddy");
RunCmd("rm -rf /usr/share/caddy");
RunCmd("rm -rf /etc/caddy");
}
public void EnsureSystemEnv()
{
// cpu架构
Progress.Desc = ("检测CPU架构");
EnsureCPU();
// 安装命令类型
Progress.Desc = ("检测系统安装命令");
EnsureCmdType();
// systemctl
Progress.Desc = ("检测Systemctl");
EnsureSystemctl();
// SELinux
Progress.Desc = ("检测SELinux");
ConfigSELinux();
}
public void InstallSystemTools()
{
Progress.Desc = ("更新安装包");
RunUpdateCmd();
Progress.Desc = ("安装sudo工具");
InstallSoftware("sudo");
Progress.Desc = ("安装curl工具");
InstallSoftware("curl");
Progress.Desc = ("安装wget工具");
InstallSoftware("wget");
Progress.Desc = ("安装ping工具");
InstallSoftware("ping");
Progress.Desc = ("安装unzip工具");
InstallSoftware("unzip");
Progress.Desc = ("安装cron工具");
InstallSoftware("cron");
Progress.Desc = ("安装lsof工具");
InstallSoftware("lsof");
Progress.Desc = ("安装systemd工具");
InstallSoftware("systemd");
}
public void ConfigFirewalld()
{
Progress.Desc = ("释放被占用的端口");
Settings.FreePorts.ForEach(port => SetPortFree(port));
Progress.Desc = ("开放需要的端口");
OpenPort(Settings.FreePorts.ToArray());
}
public void ResetFirewalld()
{
ClosePort(Settings.FreePorts.ToArray());
}
public void EnsureNetwork()
{
string cmd;
Progress.Desc = ("检测IPv4");
cmd = RunCmd(@"curl -4 ip.sb");
IPv4 = cmd.TrimEnd('\r', '\n');
Progress.Desc = ($"IPv4地址为{IPv4}");
if (!string.IsNullOrEmpty(IPv4))
{
IsOnlyIPv6 = false;
}
else
{
Progress.Desc = ("检测IPv6");
cmd = RunCmd(@"curl -6 ip.sb");
IPv6 = cmd.TrimEnd('\r', '\n');
Progress.Desc = ($"IPv6地址为{IPv6}");
IsOnlyIPv6 = true;
SetNat64();
}
if (string.IsNullOrEmpty(IPv4) && string.IsNullOrEmpty(IPv6))
{
throw new Exception("未检测到服务器公网IP请检查网络或重试。");
}
}
public void InstallCaddy()
{
RunCmd("rm -rf caddy.tar.gz");
RunCmd("rm -rf /etc/caddy");
RunCmd("rm -rf /usr/share/caddy");
var url = "https://github.com/caddyserver/caddy/releases/download/v2.4.3/caddy_2.4.3_linux_amd64.tar.gz";
if (ArchType == ArchType.arm)
{
url = "https://github.com/caddyserver/caddy/releases/download/v2.4.3/caddy_2.4.3_linux_armv7.tar.gz";
}
RunCmd($"wget -O caddy.tar.gz {url}");
RunCmd("mkdir /etc/caddy");
RunCmd("tar -zxvf caddy.tar.gz -C /etc/caddy");
RunCmd("cp -rf /etc/caddy/caddy /usr/bin");
WriteToFile(Caddy.DefaultCaddyFile, "/etc/caddy/Caddyfile");
WriteToFile(Caddy.Service, "/etc/systemd/system/caddy.service");
RunCmd("systemctl daemon-reload");
RunCmd("systemctl enable caddy");
RunCmd("mkdir /usr/share/caddy");
RunCmd("chmod 775 /usr/share/caddy");
if (!FileExists("/usr/bin/caddy"))
{
throw new Exception("Caddy服务器安装失败请联系开发者");
}
}
#endregion
#region System环境
private void EnsureCPU()
{
var result = RunCmd("uname -m");
if (result.Contains("x86"))
{
ArchType = ArchType.x86;
}
else if (result.Contains("arm") || result.Contains("arch"))
{
ArchType = ArchType.arm;
}
}
private void EnsureCmdType()
{
var result = string.Empty;
if (CmdType == CmdType.None)
{
result = RunCmd("command -v apt");
if (!string.IsNullOrEmpty(result))
{
CmdType = CmdType.Apt;
}
}
if (CmdType == CmdType.None)
{
result = RunCmd("command -v dnf");
if (!string.IsNullOrEmpty(result))
{
CmdType = CmdType.Dnf;
}
}
if (CmdType == CmdType.None)
{
result = RunCmd("command -v yum");
if (!string.IsNullOrEmpty(result))
{
CmdType = CmdType.Yum;
}
}
if (CmdType == CmdType.None)
{
throw new Exception("未检测到正确的系统安装命令请尝试使用ProxySU推荐的系统版本安装");
}
}
private void EnsureSystemctl()
{
var result = RunCmd("command -v systemctl");
if (string.IsNullOrEmpty(result))
{
throw new Exception("系统缺少 systemctl 组件请尝试使用ProxySU推荐的系统版本安装");
}
}
private void ConfigSELinux()
{
// SELinux
var result = RunCmd("command -v getenforce");
var isSELinux = !string.IsNullOrEmpty(result);
// 判断是否启用了SELinux,如果启用了并且工作在Enforcing模式下则改为Permissive模式
if (isSELinux)
{
result = RunCmd("getenforce");
// 检测到系统启用SELinux且工作在严格模式下需改为宽松模式
if (result.Contains("Enforcing"))
{
RunCmd("setenforce 0");
RunCmd(@"sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config");
}
}
}
#endregion
#region
protected void SetNat64()
{
var dns64List = FilterFastestIP();
if (dns64List.Count == 0)
{
throw new Exception("未找到有效的Nat64网关");
}
var exists = FileExists("/etc/resolv.conf.proxysu");
if (!exists)
{
var cmdStr = @"mv /etc/resolv.conf /etc/resolv.conf.proxysu";
RunCmd(cmdStr);
}
foreach (var gateip in dns64List)
{
RunCmd($"echo \"nameserver {gateip}\" > /etc/resolv.conf");
}
}
protected void RemoveNat64()
{
RunCmd("rm /etc/resolv.conf");
RunCmd("mv /etc/resolv.conf.proxysu /etc/resolv.conf");
}
protected void AppendCommand(string command)
{
if (!command.EndsWith("\n"))
{
command += "\n";
}
Progress.Logs += command;
}
private List<string> FilterFastestIP()
{
string[] gateNat64 = {
"2a01:4f9:c010:3f02::1",
"2001:67c:2b0::4",
"2001:67c:2b0::6",
"2a09:11c0:f1:bbf0::70",
"2a01:4f8:c2c:123f::1",
"2001:67c:27e4:15::6411",
"2001:67c:27e4::64",
"2001:67c:27e4:15::64",
"2001:67c:27e4::60",
"2a00:1098:2b::1",
"2a03:7900:2:0:31:3:104:161",
"2a00:1098:2c::1",
"2a09:11c0:100::53",
};
Dictionary<string, float> dns64List = new Dictionary<string, float>();
foreach (var gateip in gateNat64)
{
var cmdStr = $"ping6 -c4 {gateip} | grep avg | awk '{{print $4}}'|cut -d/ -f2";
var cmd = RunCmd(cmdStr);
if (!string.IsNullOrEmpty(cmd))
{
if (float.TryParse(cmd, out float delay))
{
dns64List.Add(gateip, delay);
}
}
}
return dns64List.Keys.ToList();
}
private bool CheckKernelVersionBBR(string kernelVer)
{
string[] linuxKernelCompared = kernelVer.Split('.');
if (int.Parse(linuxKernelCompared[0]) > 4)
{
return true;
}
else if (int.Parse(linuxKernelCompared[0]) < 4)
{
return false;
}
else if (int.Parse(linuxKernelCompared[0]) == 4)
{
if (int.Parse(linuxKernelCompared[1]) >= 9)
{
return true;
}
else if (int.Parse(linuxKernelCompared[1]) < 9)
{
return false;
}
}
return false;
}
private void SetPortFree(int port)
{
string result = RunCmd($"lsof -n -P -i :{port} | grep LISTEN");
if (!string.IsNullOrEmpty(result))
{
string[] process = result.Split(' ');
RunCmd($"systemctl stop {process[0]}");
RunCmd($"systemctl disable {process[0]}");
RunCmd($"pkill {process[0]}");
}
}
private void OpenPort(params int[] portList)
{
string cmd;
cmd = RunCmd("command -v firewall-cmd");
if (!string.IsNullOrEmpty(cmd))
{
//有很奇怪的vps主机在firewalld未运行时端口是关闭的无法访问。所以要先启动firewalld
//用于保证acme.sh申请证书成功
cmd = RunCmd("firewall-cmd --state");
if (cmd.Trim() != "running")
{
RunCmd("systemctl restart firewalld");
}
// 保持 ssh 端口开放
RunCmd($"firewall-cmd --add-port={_host.Port}/tcp --permanent");
foreach (var port in portList)
{
RunCmd($"firewall-cmd --add-port={port}/tcp --permanent");
RunCmd($"firewall-cmd --add-port={port}/udp --permanent");
}
RunCmd("yes | firewall-cmd --reload");
}
else
{
cmd = RunCmd("command -v ufw");
if (string.IsNullOrEmpty(cmd))
{
RunCmd(GetInstallCmd("ufw"));
RunCmd("echo y | ufw enable");
}
// 保持 ssh 端口开放
RunCmd($"ufw allow {_host.Port}/tcp");
foreach (var port in portList)
{
RunCmd($"ufw allow {port}/tcp");
RunCmd($"ufw allow {port}/udp");
}
RunCmd("yes | ufw reload");
}
}
private void ClosePort(params int[] portList)
{
string cmd;
cmd = RunCmd("command -v firewall-cmd");
if (!string.IsNullOrEmpty(cmd))
{
//有很奇怪的vps主机在firewalld未运行时端口是关闭的无法访问。所以要先启动firewalld
//用于保证acme.sh申请证书成功
cmd = RunCmd("firewall-cmd --state");
if (cmd.Trim() != "running")
{
RunCmd("systemctl restart firewalld");
}
foreach (var port in portList)
{
RunCmd($"firewall-cmd --remove-port={port}/tcp --permanent");
RunCmd($"firewall-cmd --remove-port={port}/udp --permanent");
}
RunCmd("yes | firewall-cmd --reload");
}
else
{
cmd = RunCmd("command -v ufw");
if (!string.IsNullOrEmpty(cmd))
{
foreach (var port in portList)
{
RunCmd($"ufw delete allow {port}/tcp");
RunCmd($"ufw delete allow {port}/udp");
}
RunCmd("yes | ufw reload");
}
}
}
private void InstallSoftware(string software)
{
var result = RunCmd($"command -v {software}");
if (string.IsNullOrEmpty(result))
{
RunCmd(GetInstallCmd(software));
}
}
private string GetInstallCmd(string soft)
{
if (CmdType == CmdType.Apt)
{
return $"apt install -y {soft}";
}
else if (CmdType == CmdType.Yum)
{
return $"yum install -y {soft}";
}
else
{
return $"dnf install -y {soft}";
}
}
private void RunUpdateCmd()
{
if (CmdType == CmdType.Apt)
{
RunCmd($"apt update -y");
}
else if (CmdType == CmdType.Yum)
{
RunCmd($"yum update -y");
}
else
{
RunCmd($"dnf update -y");
}
}
private ConnectionInfo CreateConnectionInfo()
{
try
{
var authMethods = new List<AuthenticationMethod>();
if (_host.SecretType == LoginSecretType.Password)
{
authMethods.Add(new PasswordAuthenticationMethod(_host.UserName, _host.Password));
}
if (_host.SecretType == LoginSecretType.PrivateKey)
{
PrivateKeyFile keyFile;
if (string.IsNullOrEmpty(_host.PrivateKeyPassPhrase))
{
keyFile = new PrivateKeyFile(_host.PrivateKeyPath);
}
else
{
keyFile = new PrivateKeyFile(_host.PrivateKeyPath, _host.PrivateKeyPassPhrase);
}
authMethods.Add(new PrivateKeyAuthenticationMethod(_host.UserName, keyFile));
}
if (_host.Proxy.Type == ProxyTypes.None)
{
return new ConnectionInfo(
host: _host.Address,
username: _host.UserName,
port: _host.Port,
authenticationMethods: authMethods.ToArray());
}
return new ConnectionInfo(
host: _host.Address,
port: _host.Port,
username: _host.UserName,
proxyType: _host.Proxy.Type,
proxyHost: _host.Proxy.Address,
proxyPort: _host.Proxy.Port,
proxyUsername: _host.Proxy.UserName, proxyPassword: _host.Proxy.Password,
authenticationMethods: authMethods.ToArray());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return null;
}
}
#endregion
}
}

View file

@ -0,0 +1,287 @@
using Newtonsoft.Json;
using ProxySuper.Core.Models.Projects;
using System;
using System.Text;
using System.Web;
namespace ProxySuper.Core.Services
{
public class ShareLink
{
public static string BuildBrook(BrookSettings settings)
{
var password = HttpUtility.UrlEncode(settings.Password);
if (settings.BrookType == BrookType.server)
{
var address = HttpUtility.UrlEncode($"{settings.IP}:{settings.Port}");
return $"brook://server?password={password}&server={address}";
}
if (settings.BrookType == BrookType.wsserver)
{
var address = HttpUtility.UrlEncode($"ws://{settings.IP}:{settings.Port}");
return $"brook://wsserver?password={password}&wsserver={address}";
}
if (settings.BrookType == BrookType.wssserver)
{
var address = HttpUtility.UrlEncode($"wss://{settings.Domain}:{settings.Port}");
return $"brook://wssserver?password={password}&wssserver={address}";
}
if (settings.BrookType == BrookType.socks5)
{
var address = HttpUtility.UrlEncode($"socks5://{settings.IP}:{settings.Port}");
return $"brook://socks5?password={password}&socks5={address}";
}
return string.Empty;
}
public static string BuildNaiveProxy(NaiveProxySettings settings)
{
StringBuilder strBuilder = new StringBuilder();
strBuilder.Append("naive+https://");
strBuilder.Append($"{settings.UserName}:{settings.Password}");
strBuilder.Append($"@{settings.Domain}:{settings.Port}");
strBuilder.Append("?padding=true#naive_proxy");
return strBuilder.ToString();
}
public static string BuildTrojanGo(TrojanGoSettings settings)
{
StringBuilder strBuilder = new StringBuilder();
strBuilder.Append("trojan-go://");
strBuilder.Append($"{HttpUtility.UrlEncode(settings.Password)}@{settings.Domain}:{settings.Port}/?");
if (settings.EnableWebSocket)
{
strBuilder.Append($"type=ws&path={HttpUtility.UrlEncode(settings.WebSocketPath)}&");
}
else
{
strBuilder.Append("type=original&");
}
strBuilder.Append($"#{HttpUtility.UrlEncode("trojan-go")}");
return strBuilder.ToString();
}
public static string Build(RayType xrayType, V2raySettings settings)
{
switch (xrayType)
{
case RayType.VLESS_TCP:
case RayType.VLESS_TCP_XTLS:
case RayType.VLESS_WS:
case RayType.VLESS_KCP:
case RayType.VLESS_QUIC:
case RayType.VLESS_gRPC:
case RayType.Trojan_TCP:
return BuildVlessShareLink(xrayType, settings);
case RayType.VMESS_TCP:
case RayType.VMESS_WS:
case RayType.VMESS_KCP:
case RayType.VMESS_QUIC:
return BuildVmessShareLink(xrayType, settings);
case RayType.ShadowsocksAEAD:
return BuildShadowSocksShareLink(settings);
default:
return string.Empty;
}
}
private static string BuildShadowSocksShareLink(V2raySettings settings)
{
var _method = settings.ShadowSocksMethod;
var _password = settings.ShadowSocksPassword;
var _server = settings.Domain;
var _port = settings.ShadowSocksPort;
var base64URL = Utils.Base64Encode($"{_method}:{_password}@{_server}:{_port}");
return "ss://" + base64URL + "#ShadowSocks";
}
private static string BuildVmessShareLink(RayType xrayType, V2raySettings settings)
{
var vmess = new Vmess
{
v = "2",
add = settings.Domain,
port = settings.Port.ToString(),
id = settings.UUID,
aid = "0",
net = "",
type = "none",
host = "",
path = "",
tls = "tls",
ps = "",
};
switch (xrayType)
{
case RayType.VMESS_TCP:
vmess.ps = "vmess-tcp-tls";
vmess.net = "tcp";
vmess.type = "http";
vmess.path = settings.VMESS_TCP_Path;
break;
case RayType.VMESS_WS:
vmess.ps = "vmess-ws-tls";
vmess.net = "ws";
vmess.type = "none";
vmess.path = settings.VMESS_WS_Path;
break;
case RayType.VMESS_KCP:
vmess.ps = "vmess-mKCP";
vmess.port = settings.VMESS_KCP_Port.ToString();
vmess.net = "kcp";
vmess.type = settings.VMESS_KCP_Type;
vmess.path = settings.VMESS_KCP_Seed;
vmess.tls = "";
break;
case RayType.VMESS_QUIC:
vmess.ps = "vmess-quic";
vmess.port = settings.VMESS_QUIC_Port.ToString();
vmess.net = "quic";
vmess.type = settings.VMESS_QUIC_Type;
vmess.path = settings.VMESS_QUIC_Key;
vmess.host = settings.VMESS_QUIC_Security;
vmess.tls = "tls";
break;
default:
return string.Empty;
}
var base64Url = Utils.Base64Encode(JsonConvert.SerializeObject(vmess));
return $"vmess://" + base64Url;
}
private static string BuildVlessShareLink(RayType xrayType, V2raySettings settings)
{
var _protocol = string.Empty;
var _uuid = settings.UUID;
var _domain = settings.Domain;
var _port = settings.Port;
var _type = string.Empty;
var _encryption = "none";
var _security = "tls";
var _path = "/";
var _host = settings.Domain;
var _descriptiveText = string.Empty;
switch (xrayType)
{
case RayType.VLESS_TCP:
_protocol = "vless";
_type = "tcp";
_descriptiveText = "vless-tcp-tls";
break;
case RayType.VLESS_TCP_XTLS:
_protocol = "vless";
_type = "tcp";
_security = "tls";
_descriptiveText = "vless-tcp-xtls";
break;
case RayType.VLESS_WS:
_protocol = "vless";
_type = "ws";
_path = settings.VLESS_WS_Path;
_descriptiveText = "vless-ws-tls";
break;
case RayType.VLESS_KCP:
_protocol = "vless";
_type = "kcp";
_port = settings.VLESS_KCP_Port;
_security = "none";
_descriptiveText = "vless-mKCP";
break;
case RayType.VLESS_QUIC:
_protocol = "vless";
_port = settings.VLESS_QUIC_Port;
_type = "quic";
_security = "tls";
_descriptiveText = "vless-quic";
break;
case RayType.VLESS_gRPC:
_protocol = "vless";
_type = "grpc";
_port = settings.VLESS_gRPC_Port;
_descriptiveText = "vless-gRPC";
break;
case RayType.Trojan_TCP:
_protocol = "trojan";
_uuid = settings.TrojanPassword;
_descriptiveText = "trojan-tcp";
break;
default:
throw new Exception("暂未实现的协议");
}
string parametersURL = string.Empty;
if (xrayType != RayType.Trojan_TCP)
{
// 4.3 传输层相关段
parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&path={HttpUtility.UrlEncode(_path)}";
// kcp
if (xrayType == RayType.VLESS_KCP)
{
parametersURL += $"&seed={settings.VLESS_KCP_Seed}&headerType={settings.VLESS_KCP_Type}";
}
if (xrayType == RayType.VLESS_QUIC)
{
parametersURL += $"&quicSecurity={settings.VLESS_QUIC_Security}";
if (settings.VLESS_QUIC_Security != "none")
{
parametersURL += $"&key={HttpUtility.UrlEncode(settings.VLESS_QUIC_Key)}";
}
parametersURL += $"&headerType={settings.VLESS_QUIC_Type}";
}
// 4.4 TLS 相关段
if (settings is XraySettings)
{
if (xrayType == RayType.VLESS_TCP_XTLS)
{
var xraySettings = settings as XraySettings;
parametersURL += $"&flow={xraySettings.Flow}";
}
}
if (xrayType == RayType.VLESS_gRPC)
{
parametersURL += $"&serviceName={settings.VLESS_gRPC_ServiceName}&mode=gun";
}
}
return $"{_protocol}://{HttpUtility.UrlEncode(_uuid)}@{_domain}:{_port}{parametersURL}#{HttpUtility.UrlEncode(_descriptiveText)}";
}
}
class Vmess
{
public string v { get; set; }
public string ps { get; set; }
public string add { get; set; }
public string port { get; set; }
public string id { get; set; }
public string aid { get; set; }
public string net { get; set; }
public string type { get; set; }
public string host { get; set; }
public string path { get; set; }
public string tls { get; set; }
}
}

View file

@ -0,0 +1,66 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ProxySuper.Core.Models.Projects;
using System.IO;
namespace ProxySuper.Core.Services
{
public class TrojanGoConfigBuilder
{
public static readonly int WebPort = 8088;
public static readonly string TrojanGoSettingPath = @"Templates\trojan-go\trojan-go.json";
public static readonly string CaddyFilePath = @"Templates\trojan-go\base.caddyfile";
public static string BuildTrojanGoConfig(TrojanGoSettings parameters)
{
var jsonStr = File.ReadAllText(TrojanGoSettingPath);
var settings = JToken.FromObject(JsonConvert.DeserializeObject(jsonStr));
settings["remote_port"] = WebPort;
settings["password"][0] = parameters.Password;
settings["ssl"]["sni"] = parameters.Domain;
if (parameters.EnableWebSocket)
{
settings["websocket"]["enabled"] = true;
settings["websocket"]["path"] = parameters.WebSocketPath;
settings["websocket"]["host"] = parameters.Domain;
}
return JsonConvert.SerializeObject(settings, Formatting.Indented, new JsonSerializerSettings()
{
NullValueHandling = NullValueHandling.Ignore
});
}
public static string BuildCaddyConfig(TrojanGoSettings parameters, bool useCustomWeb = false)
{
var caddyStr = File.ReadAllText(CaddyFilePath);
caddyStr = caddyStr.Replace("##domain##", parameters.Domain);
caddyStr = caddyStr.Replace("##port##", WebPort.ToString());
if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
{
var prefix = "http://";
if (parameters.MaskDomain.StartsWith("https://"))
{
prefix = "https://";
}
var domain = parameters.MaskDomain
.TrimStart("http://".ToCharArray())
.TrimStart("https://".ToCharArray());
caddyStr = caddyStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
}
else
{
caddyStr = caddyStr.Replace("##reverse_proxy##", "");
}
return caddyStr;
}
}
}

View file

@ -0,0 +1,401 @@
using Microsoft.Win32;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.ViewModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.Services
{
public class TrojanGoService : ServiceBase<TrojanGoSettings>
{
public TrojanGoService(Host host, TrojanGoSettings settings) : base(host, settings)
{
}
public void Install()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Percentage = 0;
Progress.Step = "安装TrojanGo";
Progress.Desc = "安装TrojanGo";
EnsureRootUser();
if (FileExists("/usr/local/bin/trojan-go"))
{
var btnResult = MessageBox.Show("已经安装Trojan-Go是否需要重装", "提示", MessageBoxButton.YesNo);
if (btnResult == MessageBoxResult.No)
{
MessageBox.Show("安装终止", "提示");
return;
}
}
var index = 1;
Progress.Step = $"{index++}. 检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 10;
Progress.Step = $"{index++}. 安装必要的系统工具";
InstallSystemTools();
Progress.Percentage = 30;
Progress.Step = $"{index++}. 配置防火墙";
ConfigFirewalld();
Progress.Percentage = 40;
Progress.Step = $"{index++}. 检测网络环境";
EnsureNetwork();
Progress.Percentage = 50;
Progress.Step = $"{index++}. 检测域名是否解析到本机";
ValidateDomain();
Progress.Percentage = 60;
Progress.Step = $"{index++}. 安装Caddy服务";
InstallCaddy();
Progress.Percentage = 70;
Progress.Step = $"{index++}. 安装TrojanGo";
InstallTrojanGo();
Progress.Percentage = 80;
Progress.Step = $"{index++}. 上传Caddy配置文件";
UploadCaddySettings();
Progress.Percentage = 90;
Progress.Step = $"{index++}. 启动BBR";
EnableBBR();
Progress.Step = $"{index++}. 重启caddy服务";
RunCmd("systemctl restart caddy");
Progress.Desc = "启用Trojan-Go开机启动";
RunCmd("systemctl enable trojan-go");
RunCmd("systemctl restart trojan-go");
AppendCommand("分享连接:");
AppendCommand(ShareLink.BuildTrojanGo(Settings));
Progress.Percentage = 100;
Progress.Step = "安装成功";
Progress.Desc = string.Empty;
if (!Settings.WithTLS)
{
Progress.Step = "安装成功,请上传您的 TLS 证书。";
}
else
{
NavigationService.Navigate<TrojanGoConfigViewModel, TrojanGoSettings>(Settings);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void Uninstall()
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Step = "卸载Trojgan-Go";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "停止Trojan—Go服务";
RunCmd("systemctl stop trojan-go");
Progress.Percentage = 40;
Progress.Desc = "卸载Caddy";
UninstallCaddy();
Progress.Percentage = 60;
Progress.Desc = "卸载Trojan-Go";
RunCmd("rm -rf /usr/local/bin/trojan-go");
RunCmd("rm -rf /usr/local/etc/trojan-go");
Progress.Percentage = 90;
Progress.Desc = "删除 acme.sh";
RunCmd("acme.sh --uninstall");
RunCmd("rm -r ~/.acme.sh");
Progress.Percentage = 100;
Progress.Step = "卸载Trojan-Go成功";
Progress.Desc = string.Empty;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UpdateSettings()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "更新配置文件";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Percentage = 30;
Progress.Desc = "更新配置文件";
UploadTrojanGoSettings();
Progress.Percentage = 70;
Progress.Desc = "重启caddy服务";
RunCmd("systemctl restart caddy");
Progress.Percentage = 80;
Progress.Desc = "重启Trojan-Go服务器";
RunCmd("systemctl restart trojan-go");
Progress.Percentage = 100;
Progress.Desc = "更新配置成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UploadWeb()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadWeb;
fileDialog.ShowDialog();
}
public void UploadCert()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadCert;
fileDialog.ShowDialog();
}
public void ApplyForCert()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "续签证书";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "安装TLS证书";
InstallCert(
dirPath: "/usr/local/etc/trojan-go",
certName: "trojan-go.crt",
keyName: "trojan-go.key");
Progress.Percentage = 90;
Progress.Desc = "重启Trojan-go服务";
RunCmd("systemctl restart trojan-go");
Progress.Percentage = 100;
Progress.Step = "续签证书成功";
Progress.Desc = "续签证书成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
#region
private void DoUploadCert(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Percentage = 0;
Progress.Step = "上传自有证书";
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
var oldFileName = $"ssl_{DateTime.Now.Ticks}";
RunCmd($"mv /usr/local/etc/trojan-go/ssl /usr/local/etc/trojan-go/{oldFileName}");
RunCmd("mkdir /usr/local/etc/trojan-go/ssl");
UploadFile(stream, "/usr/local/etc/trojan-go/ssl/ssl.zip");
RunCmd("unzip /usr/local/etc/trojan-go/ssl/ssl.zip -d /usr/local/etc/trojan-go/ssl");
}
var crtFiles = RunCmd("find /usr/local/etc/trojan-go/ssl/*.crt").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var keyFiles = RunCmd("find /usr/local/etc/trojan-go/ssl/*.key").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (crtFiles.Length > 0 && keyFiles.Length > 0)
{
RunCmd($"mv {crtFiles[0]} /usr/local/etc/trojan-go/ssl/trojan-go.crt");
RunCmd($"mv {keyFiles[0]} /usr/local/etc/trojan-go/ssl/trojan-go.key");
}
else
{
Progress.Step = "上传失败";
Progress.Desc = "上传证书失败,缺少 .crt 和 .key 文件";
return;
}
Progress.Desc = "重启trojan-go服务";
RunCmd("systemctl restart trojan-go");
Progress.Percentage = 100;
Progress.Desc = "上传证书完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void DoUploadWeb(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Step = "上传静态网站";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "创建网站目录";
if (!FileExists("/usr/share/caddy"))
{
RunCmd("mkdir /usr/share/caddy");
}
RunCmd("rm -rf /usr/share/caddy/*");
Progress.Percentage = 40;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
UploadFile(stream, "/usr/share/caddy/caddy.zip");
RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
RunCmd("chmod -R 777 /usr/share/caddy");
Progress.Percentage = 700;
}
Progress.Desc = "上传Caddy配置文件";
UploadCaddySettings(useCustomWeb: true);
Progress.Percentage = 90;
Progress.Desc = "重启caddy服务";
RunCmd("systemctl restart caddy");
Progress.Percentage = 100;
Progress.Desc = "上传静态网站成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void UploadCaddySettings(bool useCustomWeb = false)
{
var config = TrojanGoConfigBuilder.BuildCaddyConfig(Settings, useCustomWeb);
var stream = new MemoryStream(Encoding.UTF8.GetBytes(config));
if (FileExists("/etc/caddy/Caddyfile"))
{
RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
}
UploadFile(stream, "/etc/caddy/Caddyfile");
}
private void InstallTrojanGo()
{
RunCmd(@"curl https://raw.githubusercontent.com/proxysu/shellscript/master/trojan-go.sh yes | bash");
var success = FileExists("/usr/local/bin/trojan-go");
if (success == false)
{
throw new Exception("trojan-go 安装失败,请联系开发者!");
}
Progress.Desc = "设置Trojan-Go权限";
RunCmd($"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/trojan-go.service");
RunCmd($"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/trojan-go.service");
RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/trojan-go.service");
RunCmd($"systemctl daemon-reload");
if (Settings.WithTLS)
{
Progress.Desc = "安装TLS证书";
InstallCert(
dirPath: "/usr/local/etc/trojan-go/ssl",
certName: "trojan-go.crt",
keyName: "trojan-go.key");
}
Progress.Desc = "上传Trojan-Go配置文件";
UploadTrojanGoSettings();
}
private void UploadTrojanGoSettings()
{
// 上传配置
Progress.Desc = "生成配置文件";
var settings = TrojanGoConfigBuilder.BuildTrojanGoConfig(Settings);
var stream = new MemoryStream(Encoding.UTF8.GetBytes(settings));
Progress.Desc = "正在上传配置文件";
UploadFile(stream, "/usr/local/etc/trojan-go/config.json");
}
#endregion
}
}

View file

@ -0,0 +1,287 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ProxySuper.Core.Models.Projects;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.Services
{
public class V2rayConfigBuilder
{
private const string ServerLogDir = @"Templates\v2ray\server\00_log";
private const string ServerApiDir = @"Templates\v2ray\server\01_api";
private const string ServerDnsDir = @"Templates\v2ray\server\02_dns";
private const string ServerRoutingDir = @"Templates\v2ray\server\03_routing";
private const string ServerPolicyDir = @"Templates\v2ray\server\04_policy";
private const string ServerInboundsDir = @"Templates\v2ray\server\05_inbounds";
private const string ServerOutboundsDir = @"Templates\v2ray\server\06_outbounds";
private const string ServerTransportDir = @"Templates\v2ray\server\07_transport";
private const string ServerStatsDir = @"Templates\v2ray\server\08_stats";
private const string ServerReverseDir = @"Templates\v2ray\server\09_reverse";
private const string CaddyFileDir = @"Templates\v2ray\caddy";
public static int VLESS_TCP_Port = 1110;
public static int VLESS_WS_Port = 1111;
public static int VLESS_H2_Port = 1112;
public static int VMESS_TCP_Port = 1210;
public static int VMESS_WS_Port = 1211;
public static int VMESS_H2_Port = 1212;
public static int Trojan_TCP_Port = 1310;
public static int Trojan_WS_Port = 1311;
public static int FullbackPort = 8080;
public static dynamic LoadV2rayConfig()
{
dynamic logObj = LoadJsonObj(Path.Combine(ServerLogDir, "00_log.json"));
dynamic apiObj = LoadJsonObj(Path.Combine(ServerApiDir, "01_api.json"));
dynamic dnsObj = LoadJsonObj(Path.Combine(ServerDnsDir, "02_dns.json"));
dynamic routingObj = LoadJsonObj(Path.Combine(ServerRoutingDir, "03_routing.json"));
dynamic policyObj = LoadJsonObj(Path.Combine(ServerPolicyDir, "04_policy.json"));
dynamic inboundsObj = LoadJsonObj(Path.Combine(ServerInboundsDir, "05_inbounds.json"));
dynamic outboundsObj = LoadJsonObj(Path.Combine(ServerOutboundsDir, "06_outbounds.json"));
dynamic transportObj = LoadJsonObj(Path.Combine(ServerTransportDir, "07_transport.json"));
dynamic statsObj = LoadJsonObj(Path.Combine(ServerStatsDir, "08_stats.json"));
dynamic reverseObj = LoadJsonObj(Path.Combine(ServerReverseDir, "09_reverse.json"));
return new
{
log = logObj["log"],
//api = apiObj["api"], api不能为空
dns = dnsObj["dns"],
routing = routingObj["routing"],
policy = policyObj["policy"],
inbounds = inboundsObj["inbounds"],
outbounds = outboundsObj["outbounds"],
transport = transportObj["transport"],
stats = statsObj["stats"],
reverse = reverseObj["reverse"]
};
}
public static string BuildCaddyConfig(V2raySettings parameters, bool useCustomWeb = false)
{
var caddyStr = File.ReadAllText(Path.Combine(CaddyFileDir, "base.caddyfile"));
caddyStr = caddyStr.Replace("##domain##", parameters.IsIPAddress ? "" : parameters.Domain);
caddyStr = caddyStr.Replace("##port##", FullbackPort.ToString());
if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
{
var prefix = "http://";
if (parameters.MaskDomain.StartsWith("https://"))
{
prefix = "https://";
}
var domain = parameters.MaskDomain
.TrimStart("http://".ToCharArray())
.TrimStart("https://".ToCharArray());
caddyStr = caddyStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
}
else
{
caddyStr = caddyStr.Replace("##reverse_proxy##", "");
}
return caddyStr;
}
private static void SetClients(dynamic bound, List<string> uuidList)
{
bound.settings.clients.Clear();
uuidList.ForEach(id =>
{
object obj;
obj = new { id = id };
bound.settings.clients.Add(JToken.FromObject(obj));
});
}
public static string BuildV2rayConfig(V2raySettings parameters)
{
var uuidList = new List<string>();
uuidList.Add(parameters.UUID);
uuidList.AddRange(parameters.MulitUUID);
var xrayConfig = LoadV2rayConfig();
var baseBound = GetBound("VLESS_TCP_TLS.json");
baseBound.port = parameters.Port;
baseBound.settings.fallbacks.Add(JToken.FromObject(new
{
dest = FullbackPort
}));
xrayConfig.inbounds.Add(baseBound);
SetClients(baseBound, uuidList);
#region Fullbacks
if (parameters.Types.Contains(RayType.VLESS_WS))
{
var wsInbound = GetBound("VLESS_WS.json");
wsInbound.port = VLESS_WS_Port;
SetClients(wsInbound, uuidList);
wsInbound.streamSettings.wsSettings.path = parameters.VLESS_WS_Path;
baseBound.settings.fallbacks.Add(JToken.FromObject(new
{
dest = VLESS_WS_Port,
path = parameters.VLESS_WS_Path,
xver = 1,
}));
xrayConfig.inbounds.Add(JToken.FromObject(wsInbound));
}
if (parameters.Types.Contains(RayType.VMESS_TCP))
{
var mtcpBound = GetBound("VMESS_TCP.json");
mtcpBound.port = VMESS_TCP_Port;
SetClients(mtcpBound, uuidList);
mtcpBound.streamSettings.tcpSettings.header.request.path = parameters.VMESS_TCP_Path;
baseBound.settings.fallbacks.Add(JToken.FromObject(new
{
dest = VMESS_TCP_Port,
path = parameters.VMESS_TCP_Path,
xver = 1,
}));
xrayConfig.inbounds.Add(JToken.FromObject(mtcpBound));
}
if (parameters.Types.Contains(RayType.VMESS_WS))
{
var mwsBound = GetBound("VMESS_WS.json");
mwsBound.port = VMESS_WS_Port;
SetClients(mwsBound, uuidList);
mwsBound.streamSettings.wsSettings.path = parameters.VMESS_WS_Path;
baseBound.settings.fallbacks.Add(JToken.FromObject(new
{
dest = VMESS_WS_Port,
path = parameters.VMESS_WS_Path,
xver = 1,
}));
xrayConfig.inbounds.Add(JToken.FromObject(mwsBound));
}
if (parameters.Types.Contains(RayType.Trojan_TCP))
{
var trojanTcpBound = GetBound("Trojan_TCP.json");
trojanTcpBound.port = Trojan_TCP_Port;
trojanTcpBound.settings.clients[0].password = parameters.TrojanPassword;
trojanTcpBound.settings.fallbacks[0].dest = FullbackPort;
baseBound.settings.fallbacks[0] = JToken.FromObject(new
{
dest = Trojan_TCP_Port,
xver = 1,
});
xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
}
#endregion
#region VLESS GRPC
if (parameters.Types.Contains(RayType.VLESS_gRPC))
{
var gRPCInBound = GetBound("VLESS_gRPC.json");
gRPCInBound.port = parameters.VLESS_gRPC_Port;
SetClients(gRPCInBound, uuidList);
gRPCInBound.streamSettings.grpcSettings.serviceName = parameters.VLESS_gRPC_ServiceName;
gRPCInBound.streamSettings.tlsSettings.serverName = parameters.Domain;
xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound));
}
#endregion
#region VLESS KCP
if (parameters.Types.Contains(RayType.VLESS_KCP))
{
var kcpBound = GetBound("VLESS_KCP.json");
kcpBound.port = parameters.VLESS_KCP_Port;
SetClients(kcpBound, uuidList);
kcpBound.streamSettings.kcpSettings.header.type = parameters.VLESS_KCP_Type;
kcpBound.streamSettings.kcpSettings.seed = parameters.VLESS_KCP_Seed;
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
}
#endregion
#region VLESS QUIC
if (parameters.Types.Contains(RayType.VLESS_QUIC))
{
var quicBound = GetBound("VLESS_QUIC.json");
quicBound.port = parameters.VLESS_QUIC_Port;
SetClients(quicBound, uuidList);
quicBound.streamSettings.quicSettings.security = parameters.VLESS_QUIC_Security;
quicBound.streamSettings.quicSettings.key = parameters.VLESS_QUIC_Key;
quicBound.streamSettings.quicSettings.header.type = parameters.VLESS_QUIC_Type;
xrayConfig.inbounds.Add(JToken.FromObject(quicBound));
}
#endregion
#region VMESS KCP
if (parameters.Types.Contains(RayType.VMESS_KCP))
{
var kcpBound = GetBound("VMESS_KCP.json");
kcpBound.port = parameters.VMESS_KCP_Port;
SetClients(kcpBound, uuidList);
kcpBound.streamSettings.kcpSettings.header.type = parameters.VMESS_KCP_Type;
kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed;
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
}
#endregion
#region VMESS QUIC
if (parameters.Types.Contains(RayType.VMESS_QUIC))
{
var quicBound = GetBound("VMESS_QUIC.json");
quicBound.port = parameters.VMESS_QUIC_Port;
SetClients(quicBound, uuidList);
quicBound.streamSettings.quicSettings.security = parameters.VMESS_QUIC_Security;
quicBound.streamSettings.quicSettings.key = parameters.VMESS_QUIC_Key;
quicBound.streamSettings.quicSettings.header.type = parameters.VMESS_QUIC_Type;
xrayConfig.inbounds.Add(JToken.FromObject(quicBound));
}
#endregion
#region Shadowsocks
if (parameters.Types.Contains(RayType.ShadowsocksAEAD))
{
var ssBound = GetBound("Shadowsocks-AEAD.json");
ssBound.port = parameters.ShadowSocksPort;
ssBound.settings.password = parameters.ShadowSocksPassword;
ssBound.settings.method = parameters.ShadowSocksMethod;
xrayConfig.inbounds.Add(JToken.FromObject(ssBound));
}
#endregion
return JsonConvert.SerializeObject(
xrayConfig,
Formatting.Indented,
new JsonSerializerSettings()
{
NullValueHandling = NullValueHandling.Ignore
});
}
private static dynamic GetBound(string name)
{
return LoadJsonObj(Path.Combine(ServerInboundsDir, name));
}
private static dynamic LoadJsonObj(string path)
{
if (File.Exists(path))
{
var jsonStr = File.ReadAllText(path, Encoding.UTF8);
return JToken.FromObject(JsonConvert.DeserializeObject(jsonStr));
}
return null;
}
}
}

View file

@ -0,0 +1,449 @@
using Microsoft.Win32;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.ViewModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.Services
{
public class V2rayService : ServiceBase<V2raySettings>
{
public V2rayService(Host host, V2raySettings settings) : base(host, settings)
{
}
public void Install()
{
Task.Factory.StartNew(() =>
{
try
{
int index = 1;
EnsureRootUser();
if (FileExists("/usr/local/bin/v2ray"))
{
var btnResult = MessageBox.Show("已经安装v2ray是否需要重装", "提示", MessageBoxButton.YesNo);
if (btnResult == MessageBoxResult.No)
{
MessageBox.Show("安装终止", "提示");
return;
}
}
Progress.Step = $"{index++}. 检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 5;
Progress.Step = $"{index++}. 安装必要的系统工具";
InstallSystemTools();
Progress.Percentage = 15;
Progress.Step = $"{index++}. 配置防火墙";
ConfigFirewalld();
Progress.Percentage = 20;
Progress.Step = $"{index++}. 检测网络环境";
EnsureNetwork();
if (Settings.IsIPAddress)
{
Progress.Desc = ("检查域名是否解析正确");
ValidateDomain();
}
Progress.Percentage = 25;
Progress.Step = $"{index}. 同步系统和本地时间";
SyncTimeDiff();
Progress.Percentage = 30;
Progress.Step = $"{index++}. 安装Caddy服务器";
InstallCaddy();
Progress.Percentage = 50;
Progress.Step = $"{index++}. 安装V2ray-Core";
InstallV2ray();
Progress.Percentage = 80;
Progress.Step = $"{index++}. 上传Web服务器配置";
UploadCaddyFile();
Progress.Percentage = 90;
Progress.Step = $"{index++}. 启动BBR";
EnableBBR();
Progress.Desc = "重启V2ray服务";
RunCmd("systemctl restart caddy");
RunCmd("systemctl restart v2ray");
Progress.Percentage = 100;
Progress.Step = "安装成功";
Progress.Desc = string.Empty;
if (!Settings.WithTLS)
{
Progress.Step = "安装成功,请上传您的 TLS 证书。";
}
else
{
NavigationService.Navigate<V2rayConfigViewModel, V2raySettings>(Settings);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UpdateSettings()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "更新V2ray配置";
Progress.Percentage = 0;
EnsureRootUser();
var index = 0;
Progress.Desc = $"{index++}. 检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = $"{index++}. 配置防火墙";
RunCmd("systemctl stop v2ray");
RunCmd("systemctl stop caddy");
ConfigFirewalld();
Progress.Percentage = 40;
Progress.Desc = $"{index++}. 上传V2ray配置文件";
var configJson = V2rayConfigBuilder.BuildV2rayConfig(Settings);
WriteToFile(configJson, "/usr/local/etc/v2ray/config.json");
Progress.Percentage = 70;
Progress.Desc = $"{index++}. 上传Caddy配置文件";
UploadCaddyFile();
Progress.Percentage = 90;
Progress.Desc = $"{index++}. 重启v2ray服务";
RunCmd("systemctl restart caddy");
RunCmd("systemctl restart v2ray");
Progress.Percentage = 100;
Progress.Desc = ("更新配置成功");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UpdateV2rayCore()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "更新V2ray-Core";
Progress.Percentage = 0;
EnsureRootUser();
Progress.Percentage = 20;
Progress.Desc = "下载最新版本V2ray-Core";
EnsureSystemEnv();
Progress.Percentage = 40;
RunCmd("bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)");
RunCmd("systemctl restart v2ray");
Progress.Percentage = 100;
Progress.Desc = "更新V2ray-Core成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void Uninstall()
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
var index = 1;
Progress.Percentage = 0;
Progress.Step = $"{index++}. 检测系统环境";
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Step = $"{index++}. 卸载Caddy服务";
UninstallCaddy();
Progress.Percentage = 40;
Progress.Step = $"{index++}. 卸载V2ray服务";
UninstallV2ray();
Progress.Percentage = 60;
Progress.Step = $"{index++}. 卸载Acme证书申请服务";
UninstallAcme();
Progress.Percentage = 80;
Progress.Step = $"{index++}. 重置防火墙端口";
ResetFirewalld();
Progress.Percentage = 100;
Progress.Step = "卸载完成";
Progress.Desc = "卸载完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UploadCert()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadCert;
fileDialog.ShowDialog();
}
public void UploadWeb()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadWeb;
fileDialog.ShowDialog();
}
public void ApplyForCert()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Percentage = 0;
Progress.Step = "续签证书";
Progress.Desc = "检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Desc = "安装证书";
InstallCert(
dirPath: "/usr/local/etc/v2ray/ssl",
certName: "v2ray_ssl.crt",
keyName: "v2ray_ssl.key");
Progress.Percentage = 90;
Progress.Desc = "重启服务";
RunCmd("systemctl restart v2ray");
Progress.Percentage = 100;
Progress.Desc = "续签证书成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
#region
private void DoUploadCert(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Percentage = 0;
Progress.Step = "上传自有证书";
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
var oldFileName = $"ssl_{DateTime.Now.Ticks}";
RunCmd($"mv /usr/local/etc/v2ray/ssl /usr/local/etc/v2ray/{oldFileName}");
RunCmd("mkdir /usr/local/etc/v2ray/ssl");
UploadFile(stream, "/usr/local/etc/v2ray/ssl/ssl.zip");
RunCmd("unzip /usr/local/etc/v2ray/ssl/ssl.zip -d /usr/local/etc/v2ray/ssl");
}
var crtFiles = RunCmd("find /usr/local/etc/v2ray/ssl/*.crt").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var keyFiles = RunCmd("find /usr/local/etc/v2ray/ssl/*.key").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (crtFiles.Length > 0 && keyFiles.Length > 0)
{
RunCmd($"mv {crtFiles[0]} /usr/local/etc/v2ray/ssl/v2ray_ssl.crt");
RunCmd($"mv {keyFiles[0]} /usr/local/etc/v2ray/ssl/v2ray_ssl.key");
}
else
{
Progress.Step = "上传失败";
Progress.Desc = "上传证书失败,缺少 .crt 和 .key 文件";
return;
}
Progress.Desc = "重启V2ray服务";
RunCmd("systemctl restart v2ray");
Progress.Percentage = 100;
Progress.Desc = "上传证书完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void DoUploadWeb(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Step = "上传静态网站";
Progress.Desc = "上传静态网站";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "创建网站目录";
if (!FileExists("/usr/share/caddy"))
{
RunCmd("mkdir /usr/share/caddy");
}
RunCmd("rm -rf /usr/share/caddy/*");
Progress.Percentage = 40;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
UploadFile(stream, "/usr/share/caddy/caddy.zip");
RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
}
RunCmd("chmod -R 777 /usr/share/caddy");
Progress.Percentage = 80;
Progress.Desc = "上传Web配置文件";
UploadCaddyFile(useCustomWeb: true);
Progress.Percentage = 90;
Progress.Desc = "重启caddy服务";
RunCmd("systemctl restart caddy");
Progress.Percentage = 100;
Progress.Desc = "上传静态网站成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void InstallV2ray()
{
Progress.Desc = ("开始安装V2ray-Core");
RunCmd("bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)");
if (!FileExists("/usr/local/bin/v2ray"))
{
Progress.Desc = ("V2ray-Core安装失败请联系开发者");
throw new Exception("V2ray-Core安装失败请联系开发者");
}
Progress.Desc = ("设置V2ray-Core权限");
RunCmd($"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/v2ray.service");
RunCmd($"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/v2ray.service");
RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/v2ray.service");
RunCmd($"systemctl daemon-reload");
RunCmd("systemctl enable v2ray");
if (FileExists("/usr/local/etc/v2ray/config.json"))
{
RunCmd(@"mv /usr/local/etc/v2ray/config.json /usr/local/etc/v2ray/config.json.1");
}
Progress.Percentage = 60;
if (Settings.WithTLS && !Settings.IsIPAddress)
{
Progress.Desc = ("安装TLS证书");
InstallCert(
dirPath: "/usr/local/etc/v2ray/ssl",
certName: "v2ray_ssl.crt",
keyName: "v2ray_ssl.key");
Progress.Percentage = 75;
}
Progress.Desc = ("生成v2ray服务器配置文件");
var configJson = V2rayConfigBuilder.BuildV2rayConfig(Settings);
WriteToFile(configJson, "/usr/local/etc/v2ray/config.json");
}
private void UploadCaddyFile(bool useCustomWeb = false)
{
var configJson = V2rayConfigBuilder.BuildCaddyConfig(Settings, useCustomWeb);
if (FileExists("/etc/caddy/Caddyfile"))
{
RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
}
WriteToFile(configJson, "/etc/caddy/Caddyfile");
}
private void UninstallV2ray()
{
Progress.Desc = "关闭V2ray服务";
RunCmd("systemctl stop v2ray");
RunCmd("systemctl disable v2ray");
Progress.Desc = "卸载V2ray";
RunCmd("bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) --remove");
}
private void UninstallAcme()
{
Progress.Desc = "卸载 acme.sh";
RunCmd("acme.sh --uninstall");
Progress.Desc = "删除 acme.sh 相关文件";
RunCmd("rm -rf ~/.acme.sh");
}
#endregion
}
}

View file

@ -0,0 +1,293 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ProxySuper.Core.Models.Projects;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace ProxySuper.Core.Services
{
public class XrayConfigBuilder
{
private const string ServerLogDir = @"Templates\xray\server\00_log";
private const string ServerApiDir = @"Templates\xray\server\01_api";
private const string ServerDnsDir = @"Templates\xray\server\02_dns";
private const string ServerRoutingDir = @"Templates\xray\server\03_routing";
private const string ServerPolicyDir = @"Templates\xray\server\04_policy";
private const string ServerInboundsDir = @"Templates\xray\server\05_inbounds";
private const string ServerOutboundsDir = @"Templates\xray\server\06_outbounds";
private const string ServerTransportDir = @"Templates\xray\server\07_transport";
private const string ServerStatsDir = @"Templates\xray\server\08_stats";
private const string ServerReverseDir = @"Templates\xray\server\09_reverse";
private const string CaddyFileDir = @"Templates\xray\caddy";
public static int VLESS_TCP_Port = 1110;
public static int VLESS_WS_Port = 1111;
public static int VLESS_H2_Port = 1112;
public static int VMESS_TCP_Port = 1210;
public static int VMESS_WS_Port = 1211;
public static int VMESS_H2_Port = 1212;
public static int Trojan_TCP_Port = 1310;
public static int Trojan_WS_Port = 1311;
public static int FullbackPort = 8080;
public static dynamic LoadXrayConfig()
{
dynamic logObj = LoadJsonObj(Path.Combine(ServerLogDir, "00_log.json"));
dynamic apiObj = LoadJsonObj(Path.Combine(ServerApiDir, "01_api.json"));
dynamic dnsObj = LoadJsonObj(Path.Combine(ServerDnsDir, "02_dns.json"));
dynamic routingObj = LoadJsonObj(Path.Combine(ServerRoutingDir, "03_routing.json"));
dynamic policyObj = LoadJsonObj(Path.Combine(ServerPolicyDir, "04_policy.json"));
dynamic inboundsObj = LoadJsonObj(Path.Combine(ServerInboundsDir, "05_inbounds.json"));
dynamic outboundsObj = LoadJsonObj(Path.Combine(ServerOutboundsDir, "06_outbounds.json"));
dynamic transportObj = LoadJsonObj(Path.Combine(ServerTransportDir, "07_transport.json"));
dynamic statsObj = LoadJsonObj(Path.Combine(ServerStatsDir, "08_stats.json"));
dynamic reverseObj = LoadJsonObj(Path.Combine(ServerReverseDir, "09_reverse.json"));
return new
{
log = logObj["log"],
//api = apiObj["api"], api不能为空
dns = dnsObj["dns"],
routing = routingObj["routing"],
policy = policyObj["policy"],
inbounds = inboundsObj["inbounds"],
outbounds = outboundsObj["outbounds"],
transport = transportObj["transport"],
stats = statsObj["stats"],
reverse = reverseObj["reverse"]
};
}
public static string BuildCaddyConfig(XraySettings parameters, bool useCustomWeb = false)
{
var caddyStr = File.ReadAllText(Path.Combine(CaddyFileDir, "base.caddyfile"));
caddyStr = caddyStr.Replace("##domain##", parameters.IsIPAddress ? "" : parameters.Domain);
caddyStr = caddyStr.Replace("##port##", FullbackPort.ToString());
if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
{
var prefix = "http://";
if (parameters.MaskDomain.StartsWith("https://"))
{
prefix = "https://";
}
var domain = parameters.MaskDomain
.TrimStart("http://".ToCharArray())
.TrimStart("https://".ToCharArray())
.TrimEnd('/');
caddyStr = caddyStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
}
else
{
caddyStr = caddyStr.Replace("##reverse_proxy##", "");
}
return caddyStr;
}
private static void SetClients(dynamic bound, List<string> uuidList, bool withXtls = false, string flow = "")
{
bound.settings.clients.Clear();
uuidList.ForEach(id =>
{
object obj;
if (!withXtls)
{
obj = new { id = id };
}
else
{
flow = "xtls-rprx-vision";//兼容普通tls与xtls
obj = new { id = id, flow = flow };
}
bound.settings.clients.Add(JToken.FromObject(obj));
});
}
public static string BuildXrayConfig(XraySettings parameters)
{
var uuidList = new List<string>();
uuidList.Add(parameters.UUID);
uuidList.AddRange(parameters.MulitUUID);
var xrayConfig = LoadXrayConfig();
var baseBound = GetBound("VLESS_TCP_XTLS.json");
baseBound.port = parameters.Port;
baseBound.settings.fallbacks.Add(JToken.FromObject(new
{
dest = FullbackPort
}));
xrayConfig.inbounds.Add(baseBound);
SetClients(baseBound, uuidList, withXtls: true, flow: parameters.Flow);
#region Fullbacks
if (parameters.Types.Contains(RayType.VLESS_WS))
{
var wsInbound = GetBound("VLESS_WS.json");
wsInbound.port = VLESS_WS_Port;
SetClients(wsInbound, uuidList);
wsInbound.streamSettings.wsSettings.path = parameters.VLESS_WS_Path;
baseBound.settings.fallbacks.Add(JToken.FromObject(new
{
dest = VLESS_WS_Port,
path = parameters.VLESS_WS_Path,
xver = 1,
}));
xrayConfig.inbounds.Add(JToken.FromObject(wsInbound));
}
if (parameters.Types.Contains(RayType.VMESS_TCP))
{
var mtcpBound = GetBound("VMESS_TCP.json");
mtcpBound.port = VMESS_TCP_Port;
SetClients(mtcpBound, uuidList);
mtcpBound.streamSettings.tcpSettings.header.request.path = parameters.VMESS_TCP_Path;
baseBound.settings.fallbacks.Add(JToken.FromObject(new
{
dest = VMESS_TCP_Port,
path = parameters.VMESS_TCP_Path,
xver = 1,
}));
xrayConfig.inbounds.Add(JToken.FromObject(mtcpBound));
}
if (parameters.Types.Contains(RayType.VMESS_WS))
{
var mwsBound = GetBound("VMESS_WS.json");
mwsBound.port = VMESS_WS_Port;
SetClients(mwsBound, uuidList);
mwsBound.streamSettings.wsSettings.path = parameters.VMESS_WS_Path;
baseBound.settings.fallbacks.Add(JToken.FromObject(new
{
dest = VMESS_WS_Port,
path = parameters.VMESS_WS_Path,
xver = 1,
}));
xrayConfig.inbounds.Add(JToken.FromObject(mwsBound));
}
if (parameters.Types.Contains(RayType.Trojan_TCP))
{
var trojanTcpBound = GetBound("Trojan_TCP.json");
trojanTcpBound.port = Trojan_TCP_Port;
trojanTcpBound.settings.clients[0].password = parameters.TrojanPassword;
trojanTcpBound.settings.fallbacks[0].dest = FullbackPort;
baseBound.settings.fallbacks[0] = JToken.FromObject(new
{
dest = Trojan_TCP_Port,
xver = 1,
});
xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
}
#endregion
#region VLESS GRPC
if (parameters.Types.Contains(RayType.VLESS_gRPC))
{
var gRPCInBound = GetBound("VLESS_gRPC.json");
gRPCInBound.port = parameters.VLESS_gRPC_Port;
SetClients(gRPCInBound, uuidList);
gRPCInBound.streamSettings.grpcSettings.serviceName = parameters.VLESS_gRPC_ServiceName;
gRPCInBound.streamSettings.tlsSettings.serverName = parameters.Domain;
xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound));
}
#endregion
#region VLESS KCP
if (parameters.Types.Contains(RayType.VLESS_KCP))
{
var kcpBound = GetBound("VLESS_KCP.json");
kcpBound.port = parameters.VLESS_KCP_Port;
SetClients(kcpBound, uuidList);
kcpBound.streamSettings.kcpSettings.header.type = parameters.VLESS_KCP_Type;
kcpBound.streamSettings.kcpSettings.seed = parameters.VLESS_KCP_Seed;
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
}
#endregion
#region VLESS QUIC
if (parameters.Types.Contains(RayType.VLESS_QUIC))
{
var quicBound = GetBound("VLESS_QUIC.json");
quicBound.port = parameters.VLESS_QUIC_Port;
SetClients(quicBound, uuidList);
quicBound.streamSettings.quicSettings.security = parameters.VLESS_QUIC_Security;
quicBound.streamSettings.quicSettings.key = parameters.VLESS_QUIC_Key;
quicBound.streamSettings.quicSettings.header.type = parameters.VLESS_QUIC_Type;
xrayConfig.inbounds.Add(JToken.FromObject(quicBound));
}
#endregion
#region VMESS KCP
if (parameters.Types.Contains(RayType.VMESS_KCP))
{
var kcpBound = GetBound("VMESS_KCP.json");
kcpBound.port = parameters.VMESS_KCP_Port;
SetClients(kcpBound, uuidList);
kcpBound.streamSettings.kcpSettings.header.type = parameters.VMESS_KCP_Type;
kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed;
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
}
#endregion
#region VMESS QUIC
if (parameters.Types.Contains(RayType.VMESS_QUIC))
{
var quicBound = GetBound("VMESS_QUIC.json");
quicBound.port = parameters.VMESS_QUIC_Port;
SetClients(quicBound, uuidList);
quicBound.streamSettings.quicSettings.security = parameters.VMESS_QUIC_Security;
quicBound.streamSettings.quicSettings.key = parameters.VMESS_QUIC_Key;
quicBound.streamSettings.quicSettings.header.type = parameters.VMESS_QUIC_Type;
xrayConfig.inbounds.Add(JToken.FromObject(quicBound));
}
#endregion
#region Shadowsocks
if (parameters.Types.Contains(RayType.ShadowsocksAEAD))
{
var ssBound = GetBound("Shadowsocks-AEAD.json");
ssBound.port = parameters.ShadowSocksPort;
ssBound.settings.password = parameters.ShadowSocksPassword;
ssBound.settings.method = parameters.ShadowSocksMethod;
xrayConfig.inbounds.Add(JToken.FromObject(ssBound));
}
#endregion
return JsonConvert.SerializeObject(
xrayConfig,
Formatting.Indented,
new JsonSerializerSettings()
{
NullValueHandling = NullValueHandling.Ignore
});
}
private static dynamic GetBound(string name)
{
return LoadJsonObj(Path.Combine(ServerInboundsDir, name));
}
private static dynamic LoadJsonObj(string path)
{
if (File.Exists(path))
{
var jsonStr = File.ReadAllText(path, Encoding.UTF8);
return JToken.FromObject(JsonConvert.DeserializeObject(jsonStr));
}
return null;
}
}
}

View file

@ -0,0 +1,448 @@
using Microsoft.Win32;
using ProxySuper.Core.Helpers;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.ViewModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.Services
{
public class XrayService : ServiceBase<XraySettings>
{
public XrayService(Host host, XraySettings settings) : base(host, settings)
{
}
public void Install()
{
Task.Factory.StartNew(() =>
{
try
{
int index = 1;
EnsureRootUser();
if (FileExists("/usr/local/bin/xray"))
{
var btnResult = MessageBox.Show("已经安装Xray是否需要重装", "提示", MessageBoxButton.YesNo);
if (btnResult == MessageBoxResult.No)
{
MessageBox.Show("安装终止", "提示");
return;
}
}
Progress.Step = $"{index++}. 检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 5;
Progress.Step = $"{index++}. 安装必要的系统工具";
InstallSystemTools();
Progress.Percentage = 15;
Progress.Step = $"{index++}. 配置防火墙";
ConfigFirewalld();
Progress.Percentage = 20;
Progress.Step = $"{index++}. 检测网络环境";
EnsureNetwork();
if (Settings.IsIPAddress)
{
Progress.Desc = ("检查域名是否解析正确");
ValidateDomain();
}
Progress.Percentage = 25;
Progress.Step = $"{index}. 同步系统和本地时间";
SyncTimeDiff();
Progress.Percentage = 30;
Progress.Step = $"{index++}. 安装Caddy服务器";
InstallCaddy();
Progress.Percentage = 50;
Progress.Step = $"{index++}. 安装Xray-Core";
InstallXray();
Progress.Percentage = 80;
Progress.Step = $"{index++}. 上传Web服务器配置";
UploadCaddyFile();
Progress.Percentage = 90;
Progress.Step = $"{index++}. 启动BBR";
EnableBBR();
Progress.Desc = "重启Xray服务";
RunCmd("systemctl restart caddy");
RunCmd("systemctl restart xray");
Progress.Percentage = 100;
Progress.Step = "安装成功";
Progress.Desc = string.Empty;
if (!Settings.WithTLS)
{
Progress.Step = "安装成功,请上传您的 TLS 证书。";
}
else
{
NavigationService.Navigate<XrayConfigViewModel, XraySettings>(Settings);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UpdateSettings()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "更新Xray配置";
Progress.Percentage = 0;
EnsureRootUser();
var index = 0;
Progress.Desc = $"{index++}. 检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = $"{index++}. 配置防火墙";
RunCmd("systemctl stop xray");
RunCmd("systemctl stop caddy");
ConfigFirewalld();
Progress.Percentage = 40;
Progress.Desc = $"{index++}. 上传Xray配置文件";
var configJson = XrayConfigBuilder.BuildXrayConfig(Settings);
WriteToFile(configJson, "/usr/local/etc/xray/config.json");
Progress.Percentage = 70;
Progress.Desc = $"{index++}. 上传Caddy配置文件";
UploadCaddyFile();
Progress.Percentage = 90;
Progress.Desc = $"{index++}. 重启xray服务";
RunCmd("systemctl restart caddy");
RunCmd("systemctl restart xray");
Progress.Percentage = 100;
Progress.Desc = ("更新配置成功");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UpdateXrayCore()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Step = "更新Xray-Core";
Progress.Percentage = 0;
EnsureRootUser();
Progress.Percentage = 20;
Progress.Desc = "下载最新版本Xray-Core";
EnsureSystemEnv();
Progress.Percentage = 40;
RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ install");
RunCmd("systemctl restart xray");
Progress.Percentage = 100;
Progress.Desc = "更新Xray-Core成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void Uninstall()
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
var index = 1;
Progress.Percentage = 0;
Progress.Step = $"{index++}. 检测系统环境";
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Step = $"{index++}. 卸载Caddy服务";
UninstallCaddy();
Progress.Percentage = 40;
Progress.Step = $"{index++}. 卸载Xray服务";
UninstallXray();
Progress.Percentage = 60;
Progress.Step = $"{index++}. 卸载Acme证书申请服务";
UninstallAcme();
Progress.Percentage = 80;
Progress.Step = $"{index++}. 重置防火墙端口";
ResetFirewalld();
Progress.Percentage = 100;
Progress.Step = "卸载完成";
Progress.Desc = "卸载完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
public void UploadCert()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadCert;
fileDialog.ShowDialog();
}
public void UploadWeb()
{
var fileDialog = new OpenFileDialog();
fileDialog.Filter = "压缩文件|*.zip";
fileDialog.FileOk += DoUploadWeb;
fileDialog.ShowDialog();
}
public void ApplyForCert()
{
Task.Factory.StartNew(() =>
{
try
{
Progress.Percentage = 0;
Progress.Step = "续签证书";
Progress.Desc = "检测系统环境";
EnsureRootUser();
EnsureSystemEnv();
Progress.Desc = "安装证书";
InstallCert(
dirPath: "/usr/local/etc/xray/ssl",
certName: "xray_ssl.crt",
keyName: "xray_ssl.key");
Progress.Percentage = 90;
Progress.Desc = "重启服务";
RunCmd("systemctl restart xray");
Progress.Percentage = 100;
Progress.Desc = "续签证书成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
#region
private void DoUploadCert(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Percentage = 0;
Progress.Step = "上传自有证书";
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
var oldFileName = $"ssl_{DateTime.Now.Ticks}";
RunCmd($"mv /usr/local/etc/xray/ssl /usr/local/etc/xray/{oldFileName}");
RunCmd("mkdir /usr/local/etc/xray/ssl");
UploadFile(stream, "/usr/local/etc/xray/ssl/ssl.zip");
RunCmd("unzip /usr/local/etc/xray/ssl/ssl.zip -d /usr/local/etc/xray/ssl");
}
var crtFiles = RunCmd("find /usr/local/etc/xray/ssl/*.crt").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
var keyFiles = RunCmd("find /usr/local/etc/xray/ssl/*.key").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (crtFiles.Length > 0 && keyFiles.Length > 0)
{
RunCmd($"mv {crtFiles[0]} /usr/local/etc/xray/ssl/xray_ssl.crt");
RunCmd($"mv {keyFiles[0]} /usr/local/etc/xray/ssl/xray_ssl.key");
}
else
{
Progress.Step = "上传失败";
Progress.Desc = "上传证书失败,缺少 .crt 和 .key 文件";
return;
}
Progress.Desc = "重启Xray服务";
RunCmd("systemctl restart xray");
Progress.Percentage = 100;
Progress.Desc = "上传证书完成";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void DoUploadWeb(object sender, CancelEventArgs e)
{
Task.Factory.StartNew(() =>
{
try
{
EnsureRootUser();
Progress.Step = "上传静态网站";
Progress.Desc = "上传静态网站";
Progress.Percentage = 0;
Progress.Desc = "检测系统环境";
EnsureSystemEnv();
Progress.Percentage = 20;
Progress.Desc = "创建网站目录";
if (!FileExists("/usr/share/caddy"))
{
RunCmd("mkdir /usr/share/caddy");
}
RunCmd("rm -rf /usr/share/caddy/*");
Progress.Percentage = 40;
Progress.Desc = "正在上传文件";
var file = sender as OpenFileDialog;
using (var stream = file.OpenFile())
{
UploadFile(stream, "/usr/share/caddy/caddy.zip");
RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
}
RunCmd("chmod -R 777 /usr/share/caddy");
Progress.Percentage = 80;
Progress.Desc = "上传Web配置文件";
UploadCaddyFile(useCustomWeb: true);
Progress.Percentage = 90;
Progress.Desc = "重启caddy服务";
RunCmd("systemctl restart caddy");
Progress.Percentage = 100;
Progress.Desc = "上传静态网站成功";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
});
}
private void InstallXray()
{
Progress.Desc = ("开始安装Xray-Core");
RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ install");
if (!FileExists("/usr/local/bin/xray"))
{
Progress.Desc = ("Xray-Core安装失败请联系开发者");
throw new Exception("Xray-Core安装失败请联系开发者");
}
Progress.Desc = ("设置Xray-core权限");
RunCmd($"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/xray.service");
RunCmd($"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/xray.service");
RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/xray.service");
RunCmd($"systemctl daemon-reload");
if (FileExists("/usr/local/etc/xray/config.json"))
{
RunCmd(@"mv /usr/local/etc/xray/config.json /usr/local/etc/xray/config.json.1");
}
Progress.Percentage = 60;
if (Settings.WithTLS && !Settings.IsIPAddress)
{
Progress.Desc = ("安装TLS证书");
InstallCert(
dirPath: "/usr/local/etc/xray/ssl",
certName: "xray_ssl.crt",
keyName: "xray_ssl.key");
Progress.Percentage = 75;
}
Progress.Desc = ("生成Xray服务器配置文件");
var configJson = XrayConfigBuilder.BuildXrayConfig(Settings);
WriteToFile(configJson, "/usr/local/etc/xray/config.json");
}
private void UploadCaddyFile(bool useCustomWeb = false)
{
var configJson = XrayConfigBuilder.BuildCaddyConfig(Settings, useCustomWeb);
if (FileExists("/etc/caddy/Caddyfile"))
{
RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
}
WriteToFile(configJson, "/etc/caddy/Caddyfile");
}
private void UninstallXray()
{
Progress.Desc = "关闭Xray服务";
RunCmd("systemctl stop xray");
RunCmd("systemctl disable xray");
Progress.Desc = "卸载Xray";
RunCmd("bash -c \"$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)\" @ remove");
}
private void UninstallAcme()
{
Progress.Desc = "卸载 acme.sh";
RunCmd("acme.sh --uninstall");
Progress.Desc = "删除 acme.sh 相关文件";
RunCmd("rm -rf ~/.acme.sh");
}
#endregion
}
}

View file

@ -0,0 +1,24 @@
using MvvmCross.ViewModels;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
namespace ProxySuper.Core.ViewModels
{
public class BrookConfigViewModel : MvxViewModel<BrookSettings>
{
public BrookSettings Settings { get; set; }
public override void Prepare(BrookSettings parameter)
{
Settings = parameter;
}
public string Link
{
get
{
return ShareLink.BuildBrook(Settings);
}
}
}
}

View file

@ -0,0 +1,102 @@
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
namespace ProxySuper.Core.ViewModels
{
public class BrookEditorViewModel : MvxViewModel<Record, Record>
{
public BrookEditorViewModel(IMvxNavigationService navigationService)
{
NavigationService = navigationService;
}
public IMvxNavigationService NavigationService { get; }
public string Id { get; set; }
public Host Host { get; set; }
public BrookSettings Settings { get; set; }
public List<string> BrookTypes
{
get
{
return new List<string> {
BrookType.server.ToString(),
BrookType.wsserver.ToString(),
BrookType.wssserver.ToString(),
BrookType.socks5.ToString(),
};
}
}
public string CheckedBrookType
{
get
{
return Settings.BrookType.ToString();
}
set
{
Settings.BrookType = (BrookType)Enum.Parse(typeof(BrookType), value);
if (Settings.BrookType == BrookType.wssserver)
{
Settings.Port = 443;
RaisePropertyChanged("Settings");
}
RaisePropertyChanged("EnablePort");
RaisePropertyChanged("EnableDomain");
RaisePropertyChanged("EnableIP");
}
}
public bool EnablePort => Settings.BrookType != BrookType.wssserver;
public bool EnableDomain => Settings.BrookType == BrookType.wssserver;
public bool EnableIP => Settings.BrookType != BrookType.wssserver;
public IMvxCommand SaveCommand => new MvxCommand(() => Save());
public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
public override void Prepare(Record parameter)
{
var record = Utils.DeepClone(parameter);
Id = record.Id;
Host = record.Host;
Settings = record.BrookSettings;
}
public void Save()
{
NavigationService.Close(this, new Record()
{
Id = Id,
Host = Host,
BrookSettings = Settings,
});
}
private void SaveAndInstall()
{
var record = new Record
{
Id = this.Id,
Host = this.Host,
BrookSettings = Settings,
};
NavigationService.Close(this, record);
NavigationService.Navigate<BrookInstallViewModel, Record>(record);
}
}
}

View file

@ -0,0 +1,65 @@
using MvvmCross.Commands;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.ViewModels
{
public class BrookInstallViewModel : MvxViewModel<Record>
{
Host _host;
BrookSettings _settings;
BrookService _service;
public override void Prepare(Record parameter)
{
_host = parameter.Host;
_settings = parameter.BrookSettings;
}
public override Task Initialize()
{
_service = new BrookService(_host, _settings);
_service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
_service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
_service.Connect();
return base.Initialize();
}
public override void ViewDestroy(bool viewFinishing = true)
{
_service.Disconnect();
this.SaveInstallLog();
base.ViewDestroy(viewFinishing);
}
public ProjectProgress Progress => _service.Progress;
public string Logs => _service.Progress.Logs;
public IMvxCommand InstallCommand => new MvxCommand(_service.Install);
public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall);
private void SaveInstallLog()
{
if (!Directory.Exists("Logs"))
{
Directory.CreateDirectory("Logs");
}
var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".brook.txt");
File.WriteAllText(fileName, Logs);
}
}
}

View file

@ -0,0 +1,168 @@
using MvvmCross.Commands;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models.Hosts;
using Renci.SshNet;
using System;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.ViewModels
{
public class EnableRootViewModel : MvxViewModel
{
private SshClient _sshClient;
public EnableRootViewModel()
{
Host = new Host();
}
public Host Host { get; set; }
public string RootUserName { get; set; }
public string RootPassword { get; set; }
public string OutputText { get; set; }
public IMvxCommand ExecuteCommand => new MvxCommand(Execute);
public override void ViewDisappearing()
{
base.ViewDisappearing();
if (_sshClient != null)
{
_sshClient.Disconnect();
_sshClient.Dispose();
}
}
public void Execute()
{
Task.Factory.StartNew(() =>
{
OpenConnect();
if (!_sshClient.IsConnected)
{
MessageBox.Show("连接失败,请重试!");
return;
}
string result = string.Empty;
result = RunCmd("id -u");
if (result.TrimEnd('\r', '\n') == "0")
{
MessageBox.Show("当前账户已经具有root权限无需再设置");
return;
}
result = RunCmd($"echo {Host.Password} | sudo -S id -u");
if (result.TrimEnd('\r', '\n') != "0")
{
MessageBox.Show("当前账户无法获取sudo权限设置失败");
return;
}
string cmdPre = $"echo {Host.Password} | sudo -S id -u" + ';';
RunCmd(cmdPre + "sudo sed -i 's/PermitRootLogin /#PermitRootLogin /g' /etc/ssh/sshd_config");
RunCmd(cmdPre + "sudo sed -i 's/PasswordAuthentication /#PasswordAuthentication /g' /etc/ssh/sshd_config");
RunCmd(cmdPre + "sudo sed -i 's/PermitEmptyPasswords /#PermitEmptyPasswords /g' /etc/ssh/sshd_config");
RunCmd(cmdPre + "echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config");
RunCmd(cmdPre + "echo 'PasswordAuthentication yes' | sudo tee -a /etc/ssh/sshd_config");
RunCmd(cmdPre + "echo 'PermitEmptyPasswords no' | sudo tee -a /etc/ssh/sshd_config");
RunCmd(cmdPre + "sudo systemctl restart sshd");
result = RunCmd(@"cat /dev/urandom | tr -dc '_A-Z#\-+=a-z(0-9%^>)]{<|' | head -c 20 ; echo ''");
string setPassword = result.TrimEnd('\r', '\n') + '\n';
RunCmd(cmdPre + $"echo \"{setPassword}{setPassword}\" | sudo passwd root");
RunCmd("sudo systemctl restart sshd");
RootUserName = "root";
RootPassword = setPassword.Trim('\n');
RaisePropertyChanged("RootUserName");
RaisePropertyChanged("RootPassword");
var filePath = Host.Address.Replace(':', '_');
using (StreamWriter sw = new StreamWriter("Logs\\host_password_info.txt"))
{
sw.WriteLine(Host.Address);
sw.WriteLine("root");
sw.WriteLine(setPassword);
}
WriteOutput("设置成功账号信息保存在Logs/host_password_info.txt");
WriteOutput("账号:\nroot");
WriteOutput($"密码:\n{setPassword}");
});
}
protected string RunCmd(string cmdStr)
{
var cmd = _sshClient.CreateCommand(cmdStr);
WriteOutput(cmdStr);
var result = cmd.Execute();
WriteOutput(result);
return result;
}
private void WriteOutput(string text)
{
OutputText += text + '\n';
RaisePropertyChanged("OutputText");
}
private void OpenConnect()
{
WriteOutput("正在建立连接...");
var conneInfo = CreateConnectionInfo(Host);
_sshClient = new SshClient(conneInfo);
try
{
_sshClient.Connect();
WriteOutput("Connected...");
}
catch (Exception ex)
{
WriteOutput(ex.Message);
MessageBox.Show(ex.Message);
}
}
private ConnectionInfo CreateConnectionInfo(Host host)
{
AuthenticationMethod auth = null;
if (host.SecretType == LoginSecretType.Password)
{
auth = new PasswordAuthenticationMethod(host.UserName, host.Password);
}
else if (host.SecretType == LoginSecretType.PrivateKey)
{
auth = new PrivateKeyAuthenticationMethod(host.UserName, new PrivateKeyFile(host.PrivateKeyPath));
}
if (host.Proxy.Type == ProxyTypes.None)
{
return new ConnectionInfo(host.Address, host.Port, host.UserName, auth);
}
else
{
return new ConnectionInfo(
host: host.Address,
port: host.Port,
username: host.UserName,
proxyType: host.Proxy.Type,
proxyHost: host.Proxy.Address,
proxyPort: host.Proxy.Port,
proxyUsername: host.Proxy.UserName,
proxyPassword: host.Proxy.Password,
authenticationMethods: auth);
}
}
}
}

View file

@ -0,0 +1,380 @@
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace ProxySuper.Core.ViewModels
{
public class HomeViewModel : MvxViewModel
{
private readonly IMvxNavigationService _navigationService;
public HomeViewModel(IMvxNavigationService navigationService)
{
_navigationService = navigationService;
ReadRecords();
}
public void ReadRecords()
{
List<Record> records = new List<Record>();
if (File.Exists("Data/Record.json"))
{
var json = File.ReadAllText("Data/Record.json");
records = JsonConvert.DeserializeObject<List<Record>>(json);
}
this.Records = new MvxObservableCollection<Record>();
records.ForEach(item =>
{
if (string.IsNullOrEmpty(item.Id))
{
item.Id = Guid.NewGuid().ToString();
}
this.Records.Add(item);
});
}
public void SaveToJson()
{
var json = JsonConvert.SerializeObject(Records, Formatting.Indented, new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
});
if (!Directory.Exists("Data"))
{
Directory.CreateDirectory("Data");
}
File.WriteAllText("Data/Record.json", json);
}
public void SortDone(string id)
{
var item = Records.Where(x => x.Id == id).FirstOrDefault();
if (item == null) return;
var index = Records.IndexOf(item);
if (index >= Records.Count - 1) return;
Records.Remove(item);
Records.Insert(index + 1, item);
RaisePropertyChanged("Records");
SaveToJson();
}
public void SortUp(string id)
{
var item = Records.Where(x => x.Id == id).FirstOrDefault();
if (item == null) return;
var index = Records.IndexOf(item);
if (index <= 0) return;
Records.Remove(item);
Records.Insert(index - 1, item);
RaisePropertyChanged("Records");
SaveToJson();
}
public MvxObservableCollection<Record> Records { get; set; }
public IMvxCommand SortUpCommand => new MvxCommand<string>(SortUp);
public IMvxCommand SortDoneCommand => new MvxCommand<string>(SortDone);
public IMvxCommand AddV2rayCommand => new MvxAsyncCommand(AddV2rayRecord);
public IMvxCommand AddXrayCommand => new MvxAsyncCommand(AddXrayRecord);
public IMvxCommand AddTrojanGoCommand => new MvxAsyncCommand(AddTrojanGoRecord);
public IMvxCommand AddNaiveProxyCommand => new MvxAsyncCommand(AddNaiveProxyRecord);
public IMvxCommand AddMTProtoGoCommand => new MvxAsyncCommand(AddMTProtoGoRecord);
public IMvxCommand AddBrookCommand => new MvxAsyncCommand(AddBrookRecord);
public IMvxCommand AddHysteriaCommand => new MvxAsyncCommand(AddHysteriaRecord);
public IMvxCommand RemoveCommand => new MvxAsyncCommand<string>(DeleteRecord);
public IMvxCommand EditCommand => new MvxAsyncCommand<string>(EditRecord);
public IMvxCommand ViewConfigCommand => new MvxAsyncCommand<string>(ViewConfig);
public IMvxCommand InstallCommand => new MvxAsyncCommand<string>(GoToInstall);
public async Task AddV2rayRecord()
{
Record record = new Record();
record.Id = Utils.GetTickID();
record.Host = new Host();
record.V2raySettings = new V2raySettings();
var result = await _navigationService.Navigate<V2rayEditorViewModel, Record, Record>(record);
if (result == null) return;
Records.Add(result);
SaveToJson();
}
public async Task AddXrayRecord()
{
Record record = new Record();
record.Id = Utils.GetTickID();
record.Host = new Host();
record.XraySettings = new XraySettings();
var result = await _navigationService.Navigate<XrayEditorViewModel, Record, Record>(record);
if (result == null) return;
Records.Add(result);
SaveToJson();
}
public async Task AddTrojanGoRecord()
{
Record record = new Record();
record.Id = Utils.GetTickID();
record.Host = new Host();
record.TrojanGoSettings = new TrojanGoSettings();
var result = await _navigationService.Navigate<TrojanGoEditorViewModel, Record, Record>(record);
if (result == null) return;
Records.Add(result);
SaveToJson();
}
public async Task AddMTProtoGoRecord()
{
Record record = new Record();
record.Id = Utils.GetTickID();
record.Host = new Host();
record.MTProtoGoSettings = new MTProtoGoSettings();
var result = await _navigationService.Navigate<MTProtoGoEditorViewModel, Record, Record>(record);
if (result == null) return;
Records.Add(result);
SaveToJson();
}
public async Task AddNaiveProxyRecord()
{
Record record = new Record();
record.Id = Utils.GetTickID();
record.Host = new Host();
record.NaiveProxySettings = new NaiveProxySettings();
var result = await _navigationService.Navigate<NaiveProxyEditorViewModel, Record, Record>(record);
if (result == null) return;
Records.Add(result);
SaveToJson();
}
public async Task AddBrookRecord()
{
Record record = new Record();
record.Id = Utils.GetTickID();
record.Host = new Host();
record.BrookSettings = new BrookSettings();
var result = await _navigationService.Navigate<BrookEditorViewModel, Record, Record>(record);
if (result == null) return;
Records.Add(result);
SaveToJson();
}
public async Task AddHysteriaRecord()
{
Record record = new Record();
record.Id = Utils.GetTickID();
record.Host = new Host();
record.HysteriaSettings = new HysteriaSettings();
var result = await _navigationService.Navigate<HysteriaEditorViewModel, Record, Record>(record);
if (result == null) return;
Records.Add(result);
SaveToJson();
}
public async Task EditRecord(string id)
{
var record = Records.FirstOrDefault(x => x.Id == id);
if (record == null) return;
Record result = null;
if (record.Type == ProjectType.V2ray)
{
result = await _navigationService.Navigate<V2rayEditorViewModel, Record, Record>(record);
if (result == null) return;
record.Host = result.Host;
record.V2raySettings = result.V2raySettings;
}
if (record.Type == ProjectType.Xray)
{
result = await _navigationService.Navigate<XrayEditorViewModel, Record, Record>(record);
if (result == null) return;
record.Host = result.Host;
record.XraySettings = result.XraySettings;
}
if (record.Type == ProjectType.TrojanGo)
{
result = await _navigationService.Navigate<TrojanGoEditorViewModel, Record, Record>(record);
if (result == null) return;
record.Host = result.Host;
record.TrojanGoSettings = result.TrojanGoSettings;
}
if (record.Type == ProjectType.NaiveProxy)
{
result = await _navigationService.Navigate<NaiveProxyEditorViewModel, Record, Record>(record);
if (result == null) return;
record.Host = result.Host;
record.NaiveProxySettings = result.NaiveProxySettings;
}
if (record.Type == ProjectType.Brook)
{
result = await _navigationService.Navigate<BrookEditorViewModel, Record, Record>(record);
if (result == null) return;
record.Host = result.Host;
record.BrookSettings = result.BrookSettings;
}
if (record.Type == ProjectType.MTProtoGo)
{
result = await _navigationService.Navigate<MTProtoGoEditorViewModel, Record, Record>(record);
if (result == null) return;
record.Host = result.Host;
record.MTProtoGoSettings = result.MTProtoGoSettings;
}
if (record.Type == ProjectType.Hysteria)
{
result = await _navigationService.Navigate<HysteriaEditorViewModel, Record, Record>(record);
if (result == null) return;
record.Host = result.Host;
record.HysteriaSettings = result.HysteriaSettings;
}
SaveToJson();
}
public async Task DeleteRecord(string id)
{
var result = MessageBox.Show($"您确认删除主机吗?", "提示", MessageBoxButton.OKCancel);
if (result == MessageBoxResult.OK)
{
var record = Records.FirstOrDefault(x => x.Id == id);
if (record != null)
{
Records.Remove(record);
SaveToJson();
}
}
await Task.CompletedTask;
}
public async Task ViewConfig(string id)
{
var record = Records.FirstOrDefault(x => x.Id == id);
if (record == null) return;
if (record.Type == ProjectType.V2ray)
{
await _navigationService.Navigate<V2rayConfigViewModel, V2raySettings>(record.V2raySettings);
}
if (record.Type == ProjectType.Xray)
{
await _navigationService.Navigate<XrayConfigViewModel, XraySettings>(record.XraySettings);
}
if (record.Type == ProjectType.TrojanGo)
{
await _navigationService.Navigate<TrojanGoConfigViewModel, TrojanGoSettings>(record.TrojanGoSettings);
}
if (record.Type == ProjectType.NaiveProxy)
{
await _navigationService.Navigate<NaiveProxyConfigViewModel, NaiveProxySettings>(record.NaiveProxySettings);
}
if (record.Type == ProjectType.Brook)
{
await _navigationService.Navigate<BrookConfigViewModel, BrookSettings>(record.BrookSettings);
}
if (record.Type == ProjectType.MTProtoGo)
{
await _navigationService.Navigate<MTProtoGoConfigViewModel, MTProtoGoSettings>(record.MTProtoGoSettings);
}
if (record.Type == ProjectType.Hysteria)
{
await _navigationService.Navigate<HysteriaConfigViewModel, HysteriaSettings>(record.HysteriaSettings);
}
}
public async Task GoToInstall(string id)
{
var record = Records.FirstOrDefault(x => x.Id == id);
if (record == null) return;
record.OnSave = SaveToJson;
if (record.Type == ProjectType.V2ray)
{
await _navigationService.Navigate<V2rayInstallViewModel, Record>(record);
}
if (record.Type == ProjectType.Xray)
{
await _navigationService.Navigate<XrayInstallViewModel, Record>(record);
}
if (record.Type == ProjectType.TrojanGo)
{
await _navigationService.Navigate<TrojanGoInstallViewModel, Record>(record);
}
if (record.Type == ProjectType.NaiveProxy)
{
await _navigationService.Navigate<NaiveProxyInstallViewModel, Record>(record);
}
if (record.Type == ProjectType.Brook)
{
await _navigationService.Navigate<BrookInstallViewModel, Record>(record);
}
if (record.Type == ProjectType.MTProtoGo)
{
await _navigationService.Navigate<MTProtoGoInstallViewModel, Record>(record);
}
if (record.Type == ProjectType.Hysteria)
{
await _navigationService.Navigate<HysteriaInstallViewModel, Record>(record);
}
SaveToJson();
}
}
}

View file

@ -0,0 +1,45 @@
using MvvmCross.ViewModels;
using Newtonsoft.Json;
using ProxySuper.Core.Models.Projects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.ViewModels
{
public class HysteriaConfigViewModel : MvxViewModel<HysteriaSettings>
{
public HysteriaSettings Settings { get; set; }
public override void Prepare(HysteriaSettings parameter)
{
Settings = parameter;
}
public string ClientJson {
get
{
var jsonData = new
{
server = $"{Settings.Domain}:{Settings.Port}",
obfs = Settings.Obfs,
up_mbps = 10,
down_mbps = 50,
socks5 = new
{
listen = "127.0.0.1:1080"
},
http = new
{
listen = "127.0.0.1:1081"
}
};
return JsonConvert.SerializeObject(jsonData, Formatting.Indented);
}
}
}
}

View file

@ -0,0 +1,68 @@
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Navigation;
namespace ProxySuper.Core.ViewModels
{
public class HysteriaEditorViewModel : MvxViewModel<Record, Record>
{
public string Id { get; set; }
public Host Host { get; set; }
public HysteriaSettings Settings { get; set; }
public IMvxNavigationService NavigationService { get; }
public IMvxCommand SaveCommand => new MvxCommand(() => Save());
public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
public HysteriaEditorViewModel(IMvxNavigationService mvxNavigationService)
{
NavigationService = mvxNavigationService;
}
public override void Prepare(Record parameter)
{
var record = Utils.DeepClone(parameter);
Id = record.Id;
Host = record.Host;
Settings = record.HysteriaSettings;
}
public void Save()
{
NavigationService.Close(this, new Record
{
Id = Id,
Host = Host,
HysteriaSettings = Settings,
});
}
public void SaveAndInstall()
{
var record = new Record
{
Id = Id,
Host = Host,
HysteriaSettings = Settings,
};
NavigationService.Close(this, record);
NavigationService.Navigate<HysteriaInstallViewModel, Record>(record);
}
}
}

View file

@ -0,0 +1,66 @@
using MvvmCross.Commands;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.ViewModels
{
public class HysteriaInstallViewModel : MvxViewModel<Record>
{
public Host _host { get; set; }
public HysteriaSettings _settings { get; set; }
public HysteriaService _service { get; set; }
public override void Prepare(Record parameter)
{
_host = parameter.Host;
_settings = parameter.HysteriaSettings;
}
public override Task Initialize()
{
_service = new HysteriaService(_host, _settings);
_service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
_service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
_service.Connect();
return base.Initialize();
}
public override void ViewDestroy(bool viewFinishing = true)
{
_service.Disconnect();
this.SaveInstallLog();
base.ViewDestroy(viewFinishing);
}
public ProjectProgress Progress => _service.Progress;
public string Logs => _service.Progress.Logs;
public IMvxCommand InstallCommand => new MvxCommand(_service.Install);
public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall);
private void SaveInstallLog()
{
if (!Directory.Exists("Logs"))
{
Directory.CreateDirectory("Logs");
}
var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".hysteria.txt");
File.WriteAllText(fileName, Logs);
}
}
}

View file

@ -0,0 +1,21 @@
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Projects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.ViewModels
{
public class MTProtoGoConfigViewModel : MvxViewModel<MTProtoGoSettings>
{
public MTProtoGoSettings Settings { get; set; }
public override void Prepare(MTProtoGoSettings parameter)
{
Settings = parameter;
}
}
}

View file

@ -0,0 +1,66 @@
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.ViewModels
{
public class MTProtoGoEditorViewModel : MvxViewModel<Record, Record>
{
public MTProtoGoEditorViewModel(IMvxNavigationService navigationService)
{
NavigationService = navigationService;
}
public IMvxNavigationService NavigationService { get; }
public IMvxCommand SaveCommand => new MvxCommand(Save);
public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
public string Id { get; set; }
public Host Host { get; set; }
public MTProtoGoSettings Settings { get; set; }
public override void Prepare(Record parameter)
{
var record = Utils.DeepClone(parameter);
Id = record.Id;
Host = record.Host;
Settings = record.MTProtoGoSettings;
}
private void Save()
{
NavigationService.Close(this, new Record
{
Id = this.Id,
Host = this.Host,
MTProtoGoSettings = Settings,
});
}
private void SaveAndInstall()
{
var record = new Record
{
Id = this.Id,
Host = this.Host,
MTProtoGoSettings = Settings,
};
NavigationService.Close(this, record);
NavigationService.Navigate<MTProtoGoInstallViewModel, Record>(record);
}
}
}

View file

@ -0,0 +1,94 @@
using MvvmCross.Commands;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.ViewModels
{
public class MTProtoGoInstallViewModel : MvxViewModel<Record>
{
Host _host;
MTProtoGoSettings _settings;
MTProtoGoService _mtproxyService;
Action _onSave;
public override void Prepare(Record parameter)
{
_host = parameter.Host;
_settings = parameter.MTProtoGoSettings;
_onSave = parameter.OnSave;
}
public override Task Initialize()
{
_mtproxyService = new MTProtoGoService(_host, _settings);
_mtproxyService.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
_mtproxyService.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
_mtproxyService.Connect();
return base.Initialize();
}
public override void ViewDestroy(bool viewFinishing = true)
{
_mtproxyService.Disconnect();
this.SaveInstallLog();
base.ViewDestroy(viewFinishing);
}
public ProjectProgress Progress
{
get => _mtproxyService.Progress;
}
public string Logs
{
get => _mtproxyService.Progress.Logs;
}
#region Command
public IMvxCommand InstallCommand => new MvxCommand(() =>
{
_mtproxyService.Install();
// 安装时生成的Secret需要保存
_onSave();
});
public IMvxCommand UpdateSettingsCommand => new MvxCommand(() =>
{
_mtproxyService.UpdateSettings();
// 安装时生成的Secret需要保存
_onSave();
});
public IMvxCommand UninstallCommand => new MvxCommand(_mtproxyService.Uninstall);
#endregion
private void SaveInstallLog()
{
if (!Directory.Exists("Logs"))
{
Directory.CreateDirectory("Logs");
}
var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".mtproxy-go.txt");
File.WriteAllText(fileName, Logs);
}
}
}

View file

@ -0,0 +1,24 @@
using MvvmCross.ViewModels;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
namespace ProxySuper.Core.ViewModels
{
public class NaiveProxyConfigViewModel : MvxViewModel<NaiveProxySettings>
{
public NaiveProxySettings Settings { get; set; }
public override void Prepare(NaiveProxySettings parameter)
{
Settings = parameter;
}
public string Link
{
get
{
return ShareLink.BuildNaiveProxy(Settings);
}
}
}
}

View file

@ -0,0 +1,63 @@
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
namespace ProxySuper.Core.ViewModels
{
public class NaiveProxyEditorViewModel : MvxViewModel<Record, Record>
{
public NaiveProxyEditorViewModel(IMvxNavigationService navigationService)
{
NavigationService = navigationService;
}
public IMvxNavigationService NavigationService { get; }
public string Id { get; set; }
public Host Host { get; set; }
public NaiveProxySettings Settings { get; set; }
public override void Prepare(Record parameter)
{
var record = Utils.DeepClone(parameter);
Id = record.Id;
Host = record.Host;
Settings = record.NaiveProxySettings;
}
public IMvxCommand SaveCommand => new MvxCommand(Save);
public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
private void Save()
{
NavigationService.Close(this, new Record
{
Id = Id,
Host = Host,
NaiveProxySettings = Settings
});
}
private void SaveAndInstall()
{
var record = new Record
{
Id = this.Id,
Host = this.Host,
NaiveProxySettings = Settings,
};
NavigationService.Close(this, record);
NavigationService.Navigate<NaiveProxyInstallViewModel, Record>(record);
}
}
}

View file

@ -0,0 +1,75 @@
using MvvmCross.Commands;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.ViewModels
{
public class NaiveProxyInstallViewModel : MvxViewModel<Record>
{
Host _host;
NaiveProxySettings _settings;
NaiveProxyService _service;
public override void Prepare(Record parameter)
{
_host = parameter.Host;
_settings = parameter.NaiveProxySettings;
}
public override Task Initialize()
{
_service = new NaiveProxyService(_host, _settings);
_service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
_service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
_service.Connect();
return base.Initialize();
}
public override void ViewDestroy(bool viewFinishing = true)
{
_service.Disconnect();
this.SaveInstallLog();
base.ViewDestroy(viewFinishing);
}
public ProjectProgress Progress => _service.Progress;
public string Logs => _service.Progress.Logs;
#region Commands
public IMvxCommand InstallCommand => new MvxCommand(_service.Install);
public IMvxCommand UpdateSettingsCommand => new MvxCommand(_service.UpdateSettings);
public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall);
public IMvxCommand UploadWebCommand => new MvxCommand(_service.UploadWeb);
#endregion
private void SaveInstallLog()
{
if (!Directory.Exists("Logs"))
{
Directory.CreateDirectory("Logs");
}
var fileName = System.IO.Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".naiveproxy.txt");
File.WriteAllText(fileName, Logs);
}
}
}

View file

@ -0,0 +1,31 @@
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using System.Collections.Generic;
using System.Text;
namespace ProxySuper.Core.ViewModels
{
public class ShareLinkViewModel : MvxViewModel<List<Record>>
{
public List<Record> Records { get; set; }
public override void Prepare(List<Record> parameter)
{
Records = parameter;
}
public string ShareLinks
{
get
{
StringBuilder sb = new StringBuilder();
Records.ForEach(record =>
{
var link = record.GetShareLink();
sb.AppendLine(link);
});
return sb.ToString();
}
}
}
}

View file

@ -0,0 +1,24 @@
using MvvmCross.ViewModels;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
namespace ProxySuper.Core.ViewModels
{
public class TrojanGoConfigViewModel : MvxViewModel<TrojanGoSettings>
{
public TrojanGoSettings Settings { get; set; }
public override void Prepare(TrojanGoSettings parameter)
{
Settings = parameter;
}
public string Link
{
get
{
return ShareLink.BuildTrojanGo(Settings);
}
}
}
}

View file

@ -0,0 +1,63 @@
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.Services;
namespace ProxySuper.Core.ViewModels
{
public class TrojanGoEditorViewModel : MvxViewModel<Record, Record>
{
public TrojanGoEditorViewModel(IMvxNavigationService navigationService)
{
NavigationService = navigationService;
}
public IMvxNavigationService NavigationService { get; }
public IMvxCommand SaveCommand => new MvxCommand(Save);
public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
public string Id { get; set; }
public Host Host { get; set; }
public TrojanGoSettings Settings { get; set; }
public override void Prepare(Record parameter)
{
var record = Utils.DeepClone(parameter);
Id = record.Id;
Host = record.Host;
Settings = record.TrojanGoSettings;
}
private void Save()
{
NavigationService.Close(this, new Record
{
Id = this.Id,
Host = this.Host,
TrojanGoSettings = Settings,
});
}
private void SaveAndInstall()
{
var record = new Record
{
Id = this.Id,
Host = this.Host,
TrojanGoSettings = Settings,
};
NavigationService.Close(this, record);
NavigationService.Navigate<TrojanGoInstallViewModel, Record>(record);
}
}
}

Some files were not shown because too many files have changed in this diff Show more