├── README.md
├── START_APP.cmd
├── WinKcp_Launcher.exe
├── Windows_KCP.cmd
├── Windows_UDP2RAW.cmd
├── bin
├── kcp-client.exe
├── speederv2.exe
└── udp2raw.exe
├── gui.gif
├── ipbox.dat
├── npcap-0.9996.exe
├── src
├── Makefile
├── WinKcp_Launcher.cbp
├── WinKcp_Launcher_vc2010.cbp
├── bk.bmp
├── donate.bmp
├── game.ico
├── ipbox_edit.cpp
├── ipbox_edit.h
├── launcher.cpp
├── launcher.h
├── main.cpp
├── manifest.xml
├── resource.h
├── resource.rc
├── ss.bmp
└── wg.bmp
├── ssk@cn.sh
├── sskcp.py
├── sskcp.sh
├── template
├── README.md
├── WG_TW_SPEED_UDP2RAW_TEST.conf
├── wg_VM-0-13-debian_3.conf
└── wg_ss.png
└── wg_udp2raw.sh
/README.md:
--------------------------------------------------------------------------------
1 | - 欢迎加入编程语言群 Telegram 电报群:https://t.me/codeblocks
2 | - [频道](https://www.youtube.com/sRGB18/videos) www.youtube.com/sRGB18 [赞赏支持!](https://paypal.me/sRGB18) https://paypal.me/sRGB18
3 | - 推荐新手两个性价比:100:好按时计费VPS: :+1: [vultr.com](https://www.vultr.com/?ref=7425413) :+1: [skysilk.com](https://www.skysilk.com/ref/Xmr9xL1Bnf) :+1:按需开启,不用不浪费!
4 | ---
5 | ### Windows KcpTun Udp2Raw 启动管理器 [下载](https://github.com/hongwenjun/WinKcp_Launcher/archive/master.zip) [使用视频演示](https://youtu.be/uwpQ6DLB_OU)
6 | 
7 |
8 | ### 严重声明和友情提示:
9 | - 此项目仅限于技术交流和探讨,在您测试完毕后必须在1秒钟内彻底删除项目副本。此项目为bash一键脚本,其中涉及到的任何软件版权和责任归原作者所有。
10 | - 在中国境内使用、传播、售卖、免费分享等任何翻墙服务,都是违法的。如果你在中国境内使用、测试此项目脚本,或者使用此脚本搭建服务器发生以上违法行为,都有违作者意愿!你必须立刻停止此行为!并删除脚本!
11 |
12 | ### 使用 bash wgmtu 配置好服务器段后的服务示例
13 | 
14 |
15 | ### VirSCAN.org 一个非盈利性的免费病毒检测网站,49款杀毒引擎检测安全
16 | https://r.virscan.org/language/zh-cn/report/c2f68e8bc003e6de4a0b6c5800b05a08
17 |
18 | ### 使用说明:
19 | 1. 需要先安装 pcap 网络驱动包, 安装 [npcap-0.9996.exe](https://nmap.org/npcap/)
20 | 2. 修改 [Windows_KCP.cmd 和 Windows_UDP2RAW.cmd 服务器IP参数](https://github.com/hongwenjun/WinKcp_Launcher/tree/master/template),双击启动调试
21 | 3. 双击 WinKcp_Launcher 分别管理 Windows_KCP.cmd 和 Windows_UDP2RAW.cmd 启动关闭
22 | 4. 电脑$$客户端设置 导入下面的模版配置,再修改成实际密码
23 | 5. 电脑WG客户端设置 导入 wg_client.conf 修改 Endpoint = 127.0.0.1:端口 另存一个配置
24 | 6. 手机可以使用 ss+kcp ; KCP插件参数 按脚本提示
25 |
26 | ### Shadowsocks + Kcp + Udp2RAW 配置模版,导入后改实际密码
27 |
28 | ```
29 | ss://YWVzLTI1Ni1nY206d2cyOTk5QDEyNy4wLjAuMToyMDE4#SS_KCP_UDP2RAW
30 | ```
31 |
32 | ### 手机SS+KCP加速方案
33 | ```
34 | # 手机SS KCP插件下载URL; 权限设置: SS和KCP插件能后台运行和管理启动
35 | https://github.com/shadowsocks/kcptun-android/releases
36 |
37 | KCPTUN端口: 4000 ; KCP插件设置参数 mode=fast2;key=wg2999;mtu=1300
38 | ```
39 |
40 | ### Linux (Debian Centos Ubuntu Arch Alpine) 客户端使用 https://git.io/sskcp.sh
41 | ```
42 | # 国内类Linux系统添加Http代理下载文件,适合 wget curl git apt 等
43 | export http_proxy="http://192.168.1.135:8010"
44 | export https_proxy="http://192.168.1.135:8010"
45 |
46 | # 借用服务端脚本安装必要程序,自行删除 /etc/rc.local
47 | wget git.io/wgmtu && bash wgmtu setup
48 |
49 | # 设置参数
50 | wget git.io/sskcp.sh && bash sskcp set
51 |
52 | ```
53 |
54 | ### OpenWRT和KoolShar使用 加速udp2raw+kcptun脚本 https://git.io/sskcp.sh
55 | - KcpTun [软件下载](https://github.com/xtaci/kcptun/releases) client_linux 改名成 kcp-client 存放路径 /usr/bin
56 | - KoolShare LEDE X64 可以酷软装udp2raw和kcptun,做软链接,示例命令
57 |
58 | ln -s /koolshare/bin/kcpclient /usr/bin/kcp-client
59 |
60 | ### 软路由参考 《OpenWRT 安装 WireGuard 配置 Udp2Raw + UdpSpeeder + WireGuard 文档教程》
61 | - 短网址: https://git.io/wrt.wg
62 |
63 | ### 参数参考 udp2raw+kcptun 加速tcp流量 Step by Step 教程
64 | https://github.com/wangyu-/udp2raw-tunnel/blob/master/doc/kcptun_step_by_step.md
65 |
66 | 
67 |
68 |
69 | ### START_APP.cmd 文件 设置三个图标对应程序
70 |
71 | ```
72 | @TITLE 运行Brook客户端Kcp+Udp2RAW #设置自定义按钮的显示文本
73 |
74 | ::设置三个图标对应程序,点击图标能自动开启; 路径如果有空格需要"双引号"括起来
75 |
76 | ::WG_APP = "C:\Program Files\TunSafe\TunSafe.exe"
77 | ::SS_APP = .\Shadowsocks.exe
78 | ::MY_APP = D:\Git\git-bash.exe
79 |
80 | ```
81 | - 下载 [Shadowsocks](https://github.com/shadowsocks/shadowsocks-windows) 放到程序目录下,可以点小飞机图标调用
82 |
83 |
84 | ### 运行Brook客户端Kcp+Udp2RAW 本地批处理示例
85 | 
86 |
--------------------------------------------------------------------------------
/START_APP.cmd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/START_APP.cmd
--------------------------------------------------------------------------------
/WinKcp_Launcher.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/WinKcp_Launcher.exe
--------------------------------------------------------------------------------
/Windows_KCP.cmd:
--------------------------------------------------------------------------------
1 | @echo.
2 | @set PATH=%~dp0;%~dp0/bin;%PATH%
3 |
4 | @set SERVER_IP=1.2.3.4
5 | @set PORT=1999
6 | @set PASSWORD=wg2999
7 | @set SS_PORT=2018
8 |
9 | @start /b kcp-client -r "127.0.0.1:4000" -l ":%SS_PORT%" --key %PASSWORD% -mode fast2 -mtu 1300
10 | @start /b udp2raw -c -r%SERVER_IP%:%PORT% -l0.0.0.0:4000 -k %PASSWORD% --raw-mode faketcp
11 |
12 |
--------------------------------------------------------------------------------
/Windows_UDP2RAW.cmd:
--------------------------------------------------------------------------------
1 | @echo.
2 | @set PATH=%~dp0;%~dp0/bin;%PATH%
3 |
4 | @set SERVER_IP=1.2.3.4
5 | @set PORT=2999
6 | @set PASSWORD=wg2999
7 | @set WG_PORT=8000
8 |
9 | @set GATEWAY=192.168.1.1
10 | @route DELETE %SERVER_IP% && route ADD %SERVER_IP% mask 255.255.255.255 %GATEWAY% METRIC 20
11 | @start /b udp2raw -c -r%SERVER_IP%:%PORT% -l0.0.0.0:8888 -k %PASSWORD% --raw-mode faketcp
12 | @start /b speederv2 -c -l0.0.0.0:%WG_PORT% -r127.0.0.1:8888 -f20:10 -k %PASSWORD% --mode 0
13 |
14 |
--------------------------------------------------------------------------------
/bin/kcp-client.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/bin/kcp-client.exe
--------------------------------------------------------------------------------
/bin/speederv2.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/bin/speederv2.exe
--------------------------------------------------------------------------------
/bin/udp2raw.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/bin/udp2raw.exe
--------------------------------------------------------------------------------
/gui.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/gui.gif
--------------------------------------------------------------------------------
/ipbox.dat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/ipbox.dat
--------------------------------------------------------------------------------
/npcap-0.9996.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/npcap-0.9996.exe
--------------------------------------------------------------------------------
/src/Makefile:
--------------------------------------------------------------------------------
1 | # Compiler settings - Can be customized.
2 | CC = g++
3 | WINDRES = windres.exe
4 | CXXFLAGS = -Wall -O2 -std=c++11 -fexec-charset=gbk -finput-charset=UTF-8
5 | LDFLAGS = -s -shared-libstdc++ -lgdi32 -luser32 -lkernel32 -lcomctl32 -mwindows
6 |
7 | # Makefile settings - Can be customized.
8 | APPNAME = WinKcp_Launcher
9 | EXT = .cpp
10 |
11 | SRCDIR = .
12 | OBJDIR = .
13 |
14 | ############## Do not change anything from here downwards! #############
15 | SRC = $(wildcard $(SRCDIR)/*$(EXT))
16 | OBJ = $(SRC:$(SRCDIR)/%$(EXT)=$(OBJDIR)/%.o)
17 | DEP = $(OBJ:$(OBJDIR)/%.o=%.d)
18 |
19 | ####################### Targets beginning here #########################
20 | all: $(APPNAME)
21 |
22 | # Builds the app
23 | $(APPNAME): $(OBJ)
24 | $(WINDRES) -J rc -O coff -i resource.rc -o resource.res
25 | $(CC) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) resource.res
26 |
27 | # Includes all .h files
28 | -include $(DEP)
29 |
30 | # Building rule for .o files and its .c/.cpp in combination with all .h
31 | $(OBJDIR)/%.o: $(SRCDIR)/%$(EXT)
32 | $(CC) $(CXXFLAGS) -o $@ -c $<
33 |
--------------------------------------------------------------------------------
/src/WinKcp_Launcher.cbp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/src/WinKcp_Launcher_vc2010.cbp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/src/bk.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/src/bk.bmp
--------------------------------------------------------------------------------
/src/donate.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/src/donate.bmp
--------------------------------------------------------------------------------
/src/game.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/src/game.ico
--------------------------------------------------------------------------------
/src/ipbox_edit.cpp:
--------------------------------------------------------------------------------
1 | #include "ipbox_edit.h"
2 |
3 | const char* ipbox_file = "ipbox.dat";
4 | static char getip[256] = "NULL";
5 |
6 | void getnewip(char* newip)
7 | {
8 | strcpy(newip, getip);
9 | }
10 |
11 | // ip管理窗口开启 ipbox[] 数组
12 | void open_ipbox(HWND &hwndDlg)
13 | {
14 |
15 | // 隐藏图片
16 | HWND hwnd_bmp = ::GetDlgItem(hwndDlg, DONATE_PIC);
17 | ::ShowWindow(hwnd_bmp, SW_HIDE);
18 | // 隐藏自身按钮
19 | HWND hwnd_ip_seselect = ::GetDlgItem(hwndDlg, IP_SESELECT);
20 | ::ShowWindow(hwnd_ip_seselect, SW_HIDE);
21 |
22 |
23 | for (size_t i = 0 ; i != sizeof ipbox / sizeof * ipbox ; i++) {
24 | HWND hwnd_ipbox = ::GetDlgItem(hwndDlg, ipbox[i]);
25 | ::ShowWindow(hwnd_ipbox, SW_SHOW);
26 | }
27 |
28 | }
29 |
30 | // 添加IP地址
31 | void ipbox_add(HWND &hwndDlg)
32 | {
33 |
34 | // 获得文本框的文本
35 | HWND hwnd_edit_ip = ::GetDlgItem(hwndDlg, IP_TEXT);
36 | HWND hwnd_edit_info = ::GetDlgItem(hwndDlg, IP_INFO);
37 |
38 | char ipbuf[256];
39 | char info_buf[256];
40 | int len_ip = ::GetWindowText(hwnd_edit_ip, ipbuf, 256);
41 | int len_info = ::GetWindowText(hwnd_edit_info, info_buf, 256);
42 |
43 | if (len_ip > 0) {
44 | // 向列表框添加文本
45 | if (len_info > 0) {
46 | if (len_ip < 16) {
47 | strcat(ipbuf, " ");
48 | ipbuf[16] = '\0';
49 | }
50 | strcat(ipbuf, " # ");
51 | strcat(ipbuf, info_buf);
52 |
53 | // 清空文本框文本
54 | ::SetWindowText(hwnd_edit_info, "");
55 | }
56 |
57 | ::SendDlgItemMessage(hwndDlg, IP_LIST, LB_ADDSTRING, NULL, (LPARAM)ipbuf);
58 |
59 | }
60 | }
61 |
62 |
63 | // 删除IP地址
64 | void ipbox_del(HWND &hwndDlg)
65 | {
66 | // 获取列表框选择字符串索引
67 | int index = ::SendDlgItemMessage(hwndDlg, IP_LIST, LB_GETCURSEL, 0, 0);
68 |
69 | // 删除当前索引字符
70 | ::SendDlgItemMessage(hwndDlg, IP_LIST, LB_DELETESTRING, index, 0);
71 |
72 | }
73 |
74 | // 保存IP列表
75 | void ipbox_save(HWND &hwndDlg)
76 | {
77 | char buf[512];
78 | FILE* pFile = fopen(ipbox_file, "w");
79 |
80 | // 获取 IP列表 IP总数
81 | size_t size = ::SendDlgItemMessage(hwndDlg, IP_LIST, LB_GETCOUNT, 0, 0);
82 |
83 | // IP列表 写文件
84 | for (size_t index = 0; index != size ; index++) {
85 | ::SendDlgItemMessage(hwndDlg, IP_LIST, LB_GETTEXT, index, (LPARAM)buf);
86 | fprintf(pFile, "%s\n", buf);
87 | }
88 |
89 | fclose(pFile);
90 | }
91 |
92 | // 加载IP列表
93 | void ipbox_load(HWND &hwndDlg)
94 | {
95 | char buf[512] = {0};
96 | char* pch;
97 | FILE* pFile = fopen(ipbox_file, "r");
98 |
99 | if (pFile != NULL) {
100 | while (fgets(buf, 512, pFile) != NULL) {
101 | pch = strrchr(buf, '\n');
102 | if (pch != NULL)
103 | *pch = '\0';
104 |
105 | if (strlen(buf) > 0)
106 | ::SendDlgItemMessage(hwndDlg, IP_LIST, LB_ADDSTRING, NULL, (LPARAM)buf);
107 | }
108 | fclose(pFile);
109 | }
110 | }
111 |
112 | // 读取 START_APP.cmd 中的标题
113 | void read_appname(HWND &hwndDlg)
114 | {
115 | char buf[512] = {0};
116 | char* pch;
117 | char* ps;
118 | const char* value = "@TITLE";
119 |
120 | FILE* pFile = fopen("START_APP.cmd", "r");
121 | if (pFile != NULL) {
122 | while (fgets(buf, 512, pFile) != NULL) {
123 | if ((ps = strstr(buf, value)) != NULL) {
124 | pch = strtok(buf, " \t");
125 | if (pch != NULL) {
126 | pch = strtok(NULL, " \t");
127 | ::SetWindowText(::GetDlgItem(hwndDlg, OPEN_START_APP), pch);
128 | }
129 | }
130 | }
131 | fclose(pFile);
132 | }
133 | }
134 |
135 | // IP管理表框,判断鼠标单击或双击
136 | void ipbox_list_signal(HWND &hwndDlg, int wmEvent)
137 | {
138 |
139 | HWND hwnd_edit_ip = ::GetDlgItem(hwndDlg, IP_TEXT);
140 | HWND hwnd_edit_info = ::GetDlgItem(hwndDlg, IP_INFO);
141 | char buf[512] = {0};
142 | char* pch = NULL;
143 |
144 | int index = ::SendDlgItemMessage(hwndDlg, IP_LIST, LB_GETCURSEL, 0, 0);
145 | ::SendDlgItemMessage(hwndDlg, IP_LIST, LB_GETTEXT, index, (LPARAM)buf);
146 |
147 | // IP列表选择
148 | if (wmEvent == LBN_SELCHANGE) {
149 | pch = strtok(buf, " #");
150 | if (pch != NULL) {
151 | ::SetWindowText(hwnd_edit_ip, buf);
152 | pch = strtok(NULL, " #");
153 | if (pch != NULL)
154 | ::SetWindowText(hwnd_edit_info, pch);
155 | else
156 | ::SetWindowText(hwnd_edit_info, "");
157 | }
158 |
159 |
160 |
161 | strcpy(buf, " 信息: IP 管理功能,添加和删除后,请点保存!");
162 | ::SetWindowText(::GetDlgItem(hwndDlg, IDC_INFO_TEXT), buf);
163 |
164 | }
165 | // 鼠标双击选择IP,复制到剪贴板
166 | if (wmEvent == LBN_DBLCLK) {
167 | pch = strtok(buf, " #");
168 | if (pch != NULL) {
169 | CopyTextToClipboard(buf);
170 | }
171 |
172 | // 更细提示信息
173 | strcpy(getip, buf);
174 | strcpy(buf, " 信息: IP已复制到剪贴板,方便其他程序使用!");
175 | ::SetWindowText(::GetDlgItem(hwndDlg, IDC_INFO_TEXT), buf);
176 |
177 | // MessageBox(hwndDlg, buf, getip, MB_OK);
178 |
179 | // 更新命令按钮文本
180 | strcpy(buf, "开启Speeder + Udp2Raw加速TCP伪装 选择IP: ");
181 | strcat(buf, getip);
182 | ::SetWindowText(::GetDlgItem(hwndDlg, OPEN_UDP2RAW), buf);
183 |
184 | strcpy(buf, "开启KcpTun + Udp2Raw加速TCP伪装 选择IP: ");
185 | strcat(buf, getip);
186 | ::SetWindowText(::GetDlgItem(hwndDlg, OPEN_KCP), buf);
187 |
188 | }
189 | }
190 |
191 | // 复制文本到剪贴板
192 | bool CopyTextToClipboard(const char* text)
193 | {
194 | int i = 0, j = 0;
195 | for (; i < 6; i++) {
196 | //打开剪切板
197 | j = OpenClipboard(NULL);
198 |
199 | //判断是否打开成功,如果打开失败则重新尝试5次
200 | if (j == 0 && i < 5)
201 | Sleep(60);
202 | if (j == 0 && i == 5)
203 | return false;
204 | if (j != 0) {
205 | i = 0;
206 | j = 0;
207 | break;
208 | }
209 | }
210 | //分配字节数,HGLOBAL表示一个内存块
211 | HGLOBAL hmem = GlobalAlloc(GHND, strlen(text) + 1);
212 |
213 | //锁定内存中指定的内存块,并返回一个地址值令其指向内存块的起始处
214 | char* pmem = (char*)GlobalLock(hmem);
215 |
216 | //清空剪切板并释放剪切板内数据的句柄
217 | EmptyClipboard();
218 | memcpy(pmem, text, strlen(text) + 1);
219 | SetClipboardData(CF_TEXT, hmem); //写入数据
220 | CloseClipboard(); //关闭剪切板
221 | GlobalFree(hmem); //释放内存块
222 |
223 | return true; //返回成功
224 | }
225 |
226 | // 设置批处理文件中的服务器IP
227 | bool set_server_ip(const char* filename, const char* newip)
228 | {
229 | FILE* input = fopen(filename, "r");
230 | if (input == NULL) {
231 | return false;
232 | }
233 |
234 | #define LINE_SIZE 1024
235 | char line[LINE_SIZE];
236 | char* buf = (char*)malloc(256 * LINE_SIZE);
237 | memset(buf, 0, 256 * LINE_SIZE);
238 |
239 | char* ps;
240 | const char* Value = "@set SERVER_IP=";
241 |
242 | while (fgets(line, LINE_SIZE, input)) { // 读取每一行
243 | if ((ps = strstr(line, Value)) != NULL) {
244 | sprintf(line, "%s%s\n", Value, newip);
245 | }
246 | strcat(buf, line);
247 | }
248 |
249 | fclose(input);
250 |
251 | FILE* output = fopen(filename, "w");
252 | fprintf(output, "%s", buf);
253 |
254 | free(buf);
255 | fclose(output);
256 | return true;
257 | }
258 |
--------------------------------------------------------------------------------
/src/ipbox_edit.h:
--------------------------------------------------------------------------------
1 | #ifndef IPBOX_EDIT_H_INCLUDED
2 | #define IPBOX_EDIT_H_INCLUDED
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include "resource.h"
9 |
10 |
11 | // ip管理窗口
12 | const long ipbox[] = { IP_TEXT, IP_LIST, IP_ADD, IP_DEL, IP_INFO, IP_SAVE, IP_BOX, IP_LT1, IP_LT2 , DEBUG_FLG};
13 |
14 | void getnewip(char* newip);
15 | void open_ipbox(HWND &hwndDlg);
16 | void ipbox_add(HWND &hwndDlg);
17 | void ipbox_del(HWND &hwndDlg);
18 | void ipbox_save(HWND &hwndDlg);
19 | void ipbox_load(HWND &hwndDlg);
20 | void read_appname(HWND &hwndDlg);
21 | void ipbox_list_signal(HWND &hwndDlg, int wmEvent);
22 |
23 | bool CopyTextToClipboard(const char* text);
24 | bool set_server_ip(const char* filename, const char* newip);
25 | #endif // IPBOX_EDIT_H_INCLUDED
26 |
--------------------------------------------------------------------------------
/src/launcher.cpp:
--------------------------------------------------------------------------------
1 | #include "launcher.h"
2 |
3 |
4 | // 鼠标点击坐标,对应三个图标的程序,二维码坐标,信息栏坐标
5 |
6 | void mouse_click_signal(HWND &hwndDlg, LPARAM lParam)
7 | {
8 | // 注册图标焦点POS
9 | POINT WG_POS = {40, 40};
10 | POINT SS_POS = {40, 120};
11 | POINT BK_POS = {40, 200};
12 | POINT DONATE_POS = {415, 145};
13 | POINT TIPS_POS = {140, 250};
14 |
15 | POINT mouse_pos;
16 | mouse_pos.x = LOWORD(lParam);
17 | mouse_pos.y = HIWORD(lParam);
18 |
19 | char app_cmd[256] = {0};
20 |
21 | // 鼠标点击图标,打开对应程序
22 | if (abs((int)mouse_pos.x - 40) < 30) {
23 | if (abs((int)mouse_pos.y - WG_POS.y) < 30) {
24 | read_app_cmd(app_cmd, "::WG_APP");
25 | ShellExecuteA(NULL, NULL, app_cmd, NULL, NULL, SW_SHOW);
26 |
27 | } else if (abs((int)mouse_pos.y - SS_POS.y) < 30) {
28 | read_app_cmd(app_cmd, "::SS_APP");
29 | ShellExecuteA(NULL, NULL, app_cmd, NULL, NULL, SW_SHOW);
30 |
31 | } else if (abs((int)mouse_pos.y - BK_POS.y) < 30) {
32 | read_app_cmd(app_cmd, "::MY_APP");
33 | ShellExecuteA(NULL, NULL, app_cmd, NULL, NULL, SW_SHOW);
34 |
35 | }
36 | }
37 |
38 | // 点击图片,快速访问Youtube频道
39 | if (abs((int)mouse_pos.x - DONATE_POS.x) < 80) {
40 | if (abs((int)mouse_pos.y - DONATE_POS.y) < 80) {
41 |
42 | char url[64] = "https://www.youtube.com/channel/UCupRwki_4n87nrwP0GIBUXA";
43 | ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOW);
44 | return ;
45 | }
46 |
47 | }
48 |
49 | // 点击信息栏区域,切换信息
50 | char buf[512] = {0};
51 | static int id = 0;
52 | if (id >= 12)
53 | id = 0;
54 | const char* tips[] = {" 信息: 感谢之前打赏和使用本软件的朋友!",
55 | " 信息: 点击左边图标,能自动开启对应程序!",
56 | " 信息: 编辑START_APP.cmd设置三个图标对应程序",
57 | " 信息: IP 管理功能,添加和删除后,请点保存!",
58 | " 信息: 中间箭头IP管理,调试:勾选->显示窗口!",
59 | " 1. 需要先安装 pcap 网络驱动包 npcap-0.9983.exe",
60 | " 2. 修改 Windows_KCP.cmd 脚本服务器IP参数",
61 | " 3. 使用软件管理 Windows_KCP.cmd 启动关闭",
62 | " 4. 电脑WG客户端设置 修改成 Endpoint = 127.0.0.1",
63 | " 5. 手机可以使用 ss+kcp ; KCP插件参数 按脚本提示",
64 | " 信息: 点击右边图片,快速访问Youtube频道!",
65 | " 信息: 好吧! 点击绿色区域就能关闭程序了!",
66 | };
67 | if (abs((int)mouse_pos.x - TIPS_POS.x) < 150) {
68 | if (abs((int)mouse_pos.y - TIPS_POS.y) < 30) {
69 | strcpy(buf, tips[id++]);
70 | ::SetWindowText(::GetDlgItem(hwndDlg, IDC_INFO_TEXT), buf);
71 | return ;
72 | }
73 | }
74 |
75 | //sprintf(buf, "鼠标点击W坐标:[%d %d]", mouse_pos.x, mouse_pos.y);
76 | //MessageBox(hwndDlg, buf, buf, MB_OK);
77 | // WinExec(runapp, SW_SHOW);
78 |
79 | EndDialog(hwndDlg, 0);
80 | }
81 |
82 | // 读取 START_APP.cmd 中对应三个图标的程序路径
83 | void read_app_cmd(char* app_cmd, const char* value)
84 | {
85 | char buf[512] = {0};
86 | char* pch;
87 | char* ps;
88 |
89 | FILE* pFile = fopen("START_APP.cmd", "r");
90 | if (pFile != NULL) {
91 | while (fgets(buf, 512, pFile) != NULL) {
92 | if ((ps = strstr(buf, value)) != NULL) {
93 | if ((ps = strstr(buf, "\"")) != NULL) {
94 | pch = strtok(ps, "\"\t\n");
95 | strcpy(app_cmd, pch);
96 |
97 | } else if (pch != NULL) {
98 | ps = strstr(buf, "=");
99 | pch = strtok(ps, " \t\n=");
100 | strcpy(app_cmd, pch);
101 | }
102 | }
103 | }
104 | // MessageBox(NULL, app_cmd, app_cmd, MB_OK);
105 | fclose(pFile);
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/src/launcher.h:
--------------------------------------------------------------------------------
1 | #ifndef LAUNCHER_H_INCLUDED
2 | #define LAUNCHER_H_INCLUDED
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include "resource.h"
9 |
10 | // 鼠标点击坐标,对应三个图标的程序,二维码坐标,信息栏坐标
11 | void mouse_click_signal(HWND &hwndDlg, LPARAM lParam);
12 |
13 | // 读取 START_APP.cmd 中对应三个图标的程序路径
14 | void read_app_cmd(char* app_cmd, const char* value);
15 |
16 | #endif // LAUNCHER_H_INCLUDED
17 |
--------------------------------------------------------------------------------
/src/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "resource.h"
5 | #include "ipbox_edit.h"
6 | #include "launcher.h"
7 |
8 | bool open_kcp_server(void);
9 | bool open_start_app(void);
10 | bool close_kcp_server(void);
11 | bool open_wireguard_udp2raw(void);
12 | bool kill_advert_process(void);
13 | int hide_run_cmd(char* cmdline);
14 | void App_Initdialog(HWND & hwnd);
15 | void feedback_info(HWND & hwndDlg, int BTN_ID);
16 |
17 | void mouse_click_signal(HWND &hwndDlg, LPARAM lParam);
18 |
19 | HBITMAP g_hBitmap_DONATE; // 打赏图片的句柄
20 | HICON g_hIcon; // 对话框图标句柄
21 | bool debug_flg = false; // 调试:勾选->显示窗口
22 |
23 | HINSTANCE hInst;
24 |
25 | BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
26 | {
27 |
28 | switch (uMsg) {
29 | case WM_INITDIALOG: {
30 | App_Initdialog(hwndDlg); // 设置标题栏图标,// 设置图片
31 |
32 | }
33 | break;
34 |
35 | case WM_CLOSE: {
36 | EndDialog(hwndDlg, 0);
37 | }
38 | return TRUE;
39 |
40 | case WM_COMMAND: {
41 |
42 | // int wmId = LOWORD(wParam);
43 | int wmEvent = HIWORD(wParam);
44 |
45 | switch (LOWORD(wParam)) {
46 |
47 | case OPEN_START_APP: {
48 | open_start_app();
49 | EndDialog(hwndDlg, 0);
50 | }
51 | break;
52 |
53 | case OPEN_KCP: {
54 | close_kcp_server();
55 |
56 | if (BST_CHECKED == IsDlgButtonChecked(hwndDlg, DEBUG_FLG))
57 | debug_flg = true;
58 | else
59 | debug_flg = false;
60 |
61 | open_kcp_server();
62 | feedback_info(hwndDlg, OPEN_KCP);
63 | }
64 | break;
65 |
66 | case OPEN_UDP2RAW: {
67 | close_kcp_server();
68 |
69 | if (BST_CHECKED == IsDlgButtonChecked(hwndDlg, DEBUG_FLG))
70 | debug_flg = true;
71 | else
72 | debug_flg = false;
73 |
74 | open_wireguard_udp2raw();
75 | feedback_info(hwndDlg, OPEN_UDP2RAW);
76 | }
77 | break;
78 |
79 | case CLOSE_KCP: {
80 | close_kcp_server();
81 | kill_advert_process();
82 | EndDialog(hwndDlg, 0);
83 | }
84 | break;
85 |
86 | case IP_SESELECT: {
87 | // ip管理窗口开启
88 | ipbox_load(hwndDlg);
89 | open_ipbox(hwndDlg);
90 | }
91 | break;
92 |
93 | case IP_ADD: {
94 | ipbox_add(hwndDlg);
95 | }
96 | break;
97 |
98 | case IP_DEL: {
99 | ipbox_del(hwndDlg);
100 | }
101 | break;
102 |
103 | case IP_SAVE: {
104 | ipbox_save(hwndDlg);
105 | }
106 | break;
107 |
108 | case IP_LIST: {
109 | ipbox_list_signal(hwndDlg, wmEvent);
110 | }
111 | break;
112 |
113 | return TRUE;
114 | }
115 | }
116 | return TRUE;
117 |
118 | // 鼠标单击信号传替
119 | case WM_LBUTTONDOWN: {
120 | mouse_click_signal(hwndDlg, lParam);
121 | break;
122 | }
123 |
124 | }
125 | return FALSE;
126 | }
127 |
128 |
129 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
130 | {
131 | hInst = hInstance;
132 | // InitCommonControls();
133 |
134 | // 从资源中加载BMP文件和图标,这些工作也可以在WM_INITDIALOG消息中进行
135 | g_hBitmap_DONATE = ::LoadBitmap(hInst, (LPCTSTR)IDB_BITMAP1);
136 | g_hIcon = ::LoadIcon(hInst, (LPCTSTR)IDI_ICON1);
137 |
138 | return DialogBox(hInst, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)DlgMain);
139 | }
140 |
141 | void feedback_info(HWND & hwndDlg, int BTN_ID)
142 | {
143 | SetWindowText(::GetDlgItem(hwndDlg, BTN_ID), "【。。加速服务正在运行中。。】");
144 | SetWindowText(::GetDlgItem(hwndDlg, IDC_INFO_TEXT), "【服务运行中-->三图标启动程序-->点绿色区域关闭】");
145 | }
146 | bool open_start_app(void)
147 | {
148 | char newip[128] = {0};
149 | getnewip(newip);
150 | if (strcmp(newip, "NULL") != 0)
151 | set_server_ip("START_APP.cmd", newip);
152 |
153 | char cmdline[] = "cmd /c START_APP.cmd";
154 | hide_run_cmd(cmdline);
155 |
156 | return true;
157 | }
158 |
159 | bool open_kcp_server(void)
160 | {
161 | char newip[128] = {0};
162 | getnewip(newip);
163 | if (strcmp(newip, "NULL") != 0)
164 | set_server_ip("Windows_KCP.cmd", newip);
165 |
166 | char cmdline[] = "cmd /c Windows_KCP.cmd";
167 | hide_run_cmd(cmdline);
168 |
169 | return true;
170 | }
171 |
172 | bool open_wireguard_udp2raw(void)
173 | {
174 | char newip[128] = {0};
175 | getnewip(newip);
176 | if (strcmp(newip, "NULL") != 0)
177 | set_server_ip("Windows_UDP2RAW.cmd", newip);
178 | // MessageBox(0, newip, newip, MB_OK);
179 |
180 | char cmdline[] = "cmd /c Windows_UDP2RAW.cmd";
181 | hide_run_cmd(cmdline);
182 |
183 | return true;
184 | }
185 |
186 |
187 | bool close_kcp_server(void)
188 | {
189 | char cmdline[] = "taskkill.exe /im kcp-client.exe /f /im udp2raw.exe /im speederv2.exe "
190 | "/im brook.exe /im TunSafe.exe ";
191 | hide_run_cmd(cmdline);
192 |
193 | return true;
194 | }
195 |
196 | bool kill_advert_process(void)
197 | {
198 | char cmdline[] = "taskkill.exe /im YunDetectService.exe /im AlibabaprotectUI.exe /im acrotray.exe ";
199 | hide_run_cmd(cmdline);
200 |
201 | return true;
202 | }
203 |
204 | // 后台执行命令行函数
205 | int hide_run_cmd(char* cmdline)
206 | {
207 | SetConsoleTitle(cmdline);
208 | STARTUPINFO si;
209 | PROCESS_INFORMATION pi;
210 | ZeroMemory(&si, sizeof(si));
211 | si.cb = sizeof(si);
212 |
213 | // 后台隐藏
214 | si.dwFlags = STARTF_USESHOWWINDOW;
215 | si.wShowWindow = SW_HIDE;
216 |
217 | if (debug_flg) {
218 | si.wShowWindow = SW_SHOW;
219 | }
220 |
221 | ZeroMemory(&pi, sizeof(pi));
222 | // Start the child process.
223 | CreateProcess(NULL, TEXT(cmdline), NULL, NULL, FALSE, 0,
224 | NULL, NULL, &si, &pi);
225 | // Wait until child process exits.
226 | WaitForSingleObject(pi.hProcess, INFINITE);
227 | // Get the return value of the child process
228 | DWORD ret;
229 | GetExitCodeProcess(pi.hProcess, &ret);
230 | // if (!ret) {
231 | // // .....
232 | // }
233 | // Close process and thread handles.
234 | // CloseHandle(pi.hProcess);
235 | // CloseHandle(pi.hThread);
236 | return ret;
237 | }
238 |
239 | void App_Initdialog(HWND & hwnd)
240 | {
241 |
242 | // 大图标:按下alt+tab键切换窗口时对应的图标
243 | // 小图标:就是窗口左上角对应的那个图标
244 | ::SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)g_hIcon);
245 | ::SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)g_hIcon);
246 |
247 | // 设置图片
248 | ::SendDlgItemMessage(hwnd, DONATE_PIC, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)g_hBitmap_DONATE);
249 |
250 |
251 | // ipbox : ip管理窗口隐藏
252 | for (size_t i = 0 ; i != sizeof ipbox / sizeof * ipbox ; i++) {
253 | HWND hwnd_ipbox = ::GetDlgItem(hwnd, ipbox[i]);
254 | ::ShowWindow(hwnd_ipbox, SW_HIDE);
255 | }
256 |
257 | // 读取自定义程序标题名
258 | read_appname(hwnd);
259 | }
260 |
--------------------------------------------------------------------------------
/src/manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/resource.h:
--------------------------------------------------------------------------------
1 | #ifndef IDC_STATIC
2 | #define IDC_STATIC (-1)
3 | #endif
4 |
5 | #define DLG_MAIN 100
6 | #define IDI_ICON1 103
7 | #define IDB_BITMAP1 106
8 | #define IDB_BITMAP2 107
9 | #define IDB_BITMAP3 108
10 | #define IDB_BITMAP4 109
11 | #define OPEN_KCP 40000
12 | #define CLOSE_KCP 40001
13 | #define DONATE_PIC 40002
14 | #define OPEN_START_APP 40003
15 | #define OPEN_UDP2RAW 40004
16 | #define IP_SESELECT 40005
17 | #define WG_LOGO 40006
18 | #define SS_LOGO 40007
19 | #define BK_LOGO 40008
20 | #define IP_TEXT 50000
21 | #define IP_LIST 50001
22 | #define IP_ADD 50002
23 | #define IP_DEL 50003
24 | #define IP_INFO 50004
25 | #define IP_SAVE 50005
26 | #define IP_BOX 50006
27 | #define IP_LT1 50007
28 | #define IP_LT2 50008
29 | #define IDC_INFO_TEXT 50009
30 | #define DEBUG_FLG 50010
31 |
--------------------------------------------------------------------------------
/src/resource.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/src/resource.rc
--------------------------------------------------------------------------------
/src/ss.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/src/ss.bmp
--------------------------------------------------------------------------------
/src/wg.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/src/wg.bmp
--------------------------------------------------------------------------------
/ssk@cn.sh:
--------------------------------------------------------------------------------
1 | udp2raw_install()
2 | {
3 | wget https://262235.xyz/u/udp2raw_binaries.tar.gz
4 | tar xf udp2raw_binaries.tar.gz
5 | mv udp2raw_amd64 /usr/bin/udp2raw
6 |
7 | wget https://262235.xyz/u/kcptun-linux-amd64-20230811.tar.gz
8 | tar xf kcptun-linux-amd64-20230811.tar.gz
9 | mv server_linux_amd64 /usr/bin/kcp-server
10 | mv client_linux_amd64 /usr/bin/kcp-client
11 |
12 | wget https://262235.xyz/u//speederv2_binaries.tar.gz
13 | tar xf speederv2_binaries.tar.gz
14 | mv speederv2_amd64 /usr/bin/speederv2
15 | }
16 |
17 | def_install(){
18 | # Download the binary release of Pure Compilation.
19 | wget -O /tmp/ss.tgz https://262235.xyz/u/ss.tgz
20 | tar xvf /tmp/ss.tgz -C /
21 |
22 | echo "/usr/local/lib" > /etc/ld.so.conf.d/ss-libev.conf
23 | ldconfig
24 | export PATH=$PATH:/usr/local/bin
25 | }
26 |
27 | cd /tmp/
28 |
29 | if [ ! -e '/usr/bin/speederv2' ]; then
30 | apt update -y && apt install iptables -y
31 | update-alternatives --set iptables /usr/sbin/iptables-legacy
32 | def_install
33 | udp2raw_install
34 | fi
35 |
36 | wget -O /root/sskcp.py https://262235.xyz/u/sskcp.py
37 |
--------------------------------------------------------------------------------
/sskcp.py:
--------------------------------------------------------------------------------
1 | import sqlite3, sys, os.path
2 | # define Color
3 | Green = '\033[32m'; Red = '\033[31m'; GreenBG = '\033[42;37m'; RedBG = '\033[41;37m'
4 | Yellow = '\033[0;33m'; SkyBlue = '\033[0;36m'; Font = '\033[0m'
5 |
6 | db_flag = os.path.exists('vps2021.db')
7 | conn = sqlite3.connect('vps2021.db')
8 | c = conn.cursor()
9 |
10 | if db_flag == False :
11 | c.execute('''CREATE TABLE vps
12 | (ip text, port text, password text, ss_port text, info text)''')
13 | c.execute('''INSERT INTO vps VALUES
14 | ('188.188.188.188', '22', 'passwd@SSL', '443', '0号示例')''')
15 | conn.commit()
16 |
17 | # sql 获取 vps 数据 , 显示 vps 数据
18 | def display_data(c):
19 | print(GreenBG, ":: 显示 SQLite3 数据库 vps2021.db 中获节点表 ")
20 | sql = 'SELECT * FROM vps ORDER BY ip'
21 | c.execute(sql)
22 | vps = c.fetchall()
23 |
24 | cnt=0 ; sk = list()
25 | for row in vps:
26 | print(SkyBlue, cnt,'节点:', Yellow, row)
27 | sk.append(list(row))
28 | cnt+=1
29 | print(Font)
30 | return sk
31 |
32 | vps = display_data(c)
33 | print(SkyBlue, ":: 使用节点直接输入节点号数字 ")
34 | print(GreenBG, ":: 输入命令:", RedBG, "del <1> 删除节点 \n :: 添加节点:", SkyBlue, 'add ', Font)
35 | print(' $ ', end='')
36 | cmd = input().strip()
37 | cmd = cmd.replace(',', '').replace('\'', '')
38 | arg = cmd.split()
39 | # print(arg)
40 |
41 | if (len(arg)==0):
42 | sys.exit(1)
43 |
44 | # 命令 del <1> 删除节点
45 | if arg[0] == 'del' :
46 | id = int(arg[1])
47 | row = vps[id]
48 | c.execute("DELETE FROM vps WHERE ip=? AND port=? ", (row[0], row[1]) )
49 | conn.commit()
50 | print('\n'); display_data(c)
51 | sys.exit(0)
52 |
53 | # 命令 add 添加节点
54 | if arg[0] == 'add' and len(arg)==6:
55 | row =(arg[1], arg[2], arg[3], arg[4], arg[5])
56 | c.execute('INSERT INTO vps VALUES (?,?,?,?,?)', row)
57 | conn.commit()
58 | print('\n'); display_data(c)
59 | sys.exit(0)
60 |
61 | text = '''
62 | start(){
63 | # SS + KcpTun + Udp2RAW
64 | udp2raw -c -r$SERVER_IP:$PORT -l0.0.0.0:4000 -k $PASSWORD --raw-mode faketcp -a >> /var/log/udp2raw.log &
65 | kcp-client -r 127.0.0.1:4000 -l :$SS_PORT --key $PASSWORD -mode fast2 -mtu 1300 >> /var/log/kcp-client.log 2>&1 &
66 |
67 | # ss-local -s 服务器IP地址 -p 服务器端口 -b 绑定本地IP -l 本地端口 -k 密码 -m 加密方式 [-c 配置文件]
68 | ss-local -s 127.0.0.1 -p $SS_PORT -b 0.0.0.0 -l $SOCKS5_PORT -k $PASSWORD -m aes-256-gcm -t 300 >> /var/log/ss-local.log &
69 |
70 | # status
71 | }
72 |
73 | stop(){
74 | killall -9 kcp-client
75 | killall -9 udp2raw
76 | killall -9 ss-local
77 | }
78 |
79 | restart(){
80 | stop
81 | start
82 | }
83 |
84 | help(){
85 | echo -e "${SkyBlue}:: Source: ${Green}https://git.io/sskcp.sh ${Font}By 蘭雅sRGB"
86 | echo -e "${SkyBlue}:: Usage: ${GreenBG} bash sskcp.sh ${Yellow} [start|stop|restart|service|set] ${Font}"
87 | echo
88 | }
89 |
90 | status(){
91 | # log 和 命令行参数
92 | cat /var/log/udp2raw.log | tail
93 | cat /var/log/kcp-client.log | tail
94 | cat /var/log/ss-local.log | tail
95 | echo
96 |
97 | if [[ -e /etc/openwrt_release ]]; then
98 | ps | grep -e udp2raw -e kcp-client -e ss-local
99 | else
100 | ps ax | grep --color=auto -e udp2raw -e kcp-client -e ss-local
101 | fi
102 | echo
103 | }
104 |
105 | setconf()
106 | {
107 | echo -e "${SkyBlue}:: 修改脚本sskcp.sh记录参数,按${RedBG}${SkyBlue}不修改! ${Yellow}"
108 | head -n 6 sskcp.sh | tail -n 4 && echo -e "${SkyBlue}"
109 |
110 | read -p ":: 1.请输入远程服务器IP: " sv_ip
111 | read -p ":: 2.请输入udp2raw 端口: " port
112 | read -p ":: 3.请输入套接转发密码: " passwd
113 | read -p ":: 4.请输入 SS 服务端口: " ss_port
114 |
115 | if [[ ! -z "${sv_ip}" ]]; then
116 | sed -i "s/^SERVER_IP=.*/SERVER_IP=${sv_ip}/g" "sskcp.sh"
117 | fi
118 | if [[ ! -z "${port}" ]]; then
119 | sed -i "s/^PORT=.*/PORT=${port}/g" "sskcp.sh"
120 | fi
121 | if [[ ! -z "${passwd}" ]]; then
122 | sed -i "s/^PASSWORD=.*/PASSWORD=${passwd}/g" "sskcp.sh"
123 | fi
124 | if [[ ! -z "${ss_port}" ]]; then
125 | sed -i "s/^SS_PORT=.*/SS_PORT=${ss_port}/g" "sskcp.sh"
126 | fi
127 |
128 | echo -e "${Yellow}" && head -n 7 sskcp.sh | tail -n 5 && echo -e "${Font}"
129 | }
130 |
131 | system_def(){
132 | Green="\033[32m" && Red="\033[31m" && GreenBG="\033[42;37m" && RedBG="\033[41;37m"
133 | Font="\033[0m" && Yellow="\033[0;33m" && SkyBlue="\033[0;36m"
134 | }
135 |
136 | systemd_service(){
137 | # 安装启动服务
138 | cat </usr/lib/systemd/system/sskcp.service
139 | [Unit]
140 | Description=sskcp.sh Service
141 | After=network.target
142 |
143 | [Service]
144 | Type=forking
145 | User=root
146 | ExecStart=nohup /root/sskcp.sh start &
147 | ExecReload=sh /root/sskcp.sh stop
148 |
149 | [Install]
150 | WantedBy=multi-user.target
151 |
152 | EOF
153 | chmod +x /root/sskcp.sh
154 | systemctl enable sskcp.service
155 | systemctl start sskcp.service
156 | systemctl status sskcp.service
157 | }
158 |
159 | # 脚本命令参数
160 | system_def
161 | if [[ $# > 0 ]]; then
162 | key="$1"
163 | case $key in
164 | start)
165 | start
166 | ;;
167 | stop)
168 | stop
169 | ;;
170 | restart)
171 | restart
172 | ;;
173 | service)
174 | systemd_service
175 | ;;
176 | set)
177 | setconf
178 | ;;
179 | esac
180 | else
181 | status
182 | fi
183 | help
184 | '''
185 | def make_sskcp(sk, id):
186 | cfg = sk[id]
187 | str = '#!/bin/bash\n\n'
188 | str += 'SERVER_IP=' + cfg[0] + '\nPORT=' + cfg[1] + '\nPASSWORD=' + cfg[2] + '\nSS_PORT=40000\nSOCKS5_PORT=1080\n'
189 | print(str)
190 | str += text
191 | return str
192 |
193 | if int(arg[0]) < len(vps) and len(arg)==1:
194 | str = make_sskcp(vps, int(arg[0]))
195 | f = open('sskcp.sh', 'w')
196 | f.write(str); f.close()
197 | os.system('bash sskcp.sh stop')
198 | os.system('bash sskcp.sh start')
199 | sys.exit(0)
200 |
201 | conn.close()
202 |
--------------------------------------------------------------------------------
/sskcp.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | SERVER_IP=188.188.188.188
4 | PORT=1999
5 | PASSWORD=wg2999
6 | SS_PORT=40000
7 | SOCKS5_PORT=1080
8 |
9 | start(){
10 | # SS + KcpTun + Udp2RAW
11 | udp2raw -c -r$SERVER_IP:$PORT -l0.0.0.0:4000 -k $PASSWORD --raw-mode faketcp -a >> /var/log/udp2raw.log &
12 | kcp-client -r 127.0.0.1:4000 -l :$SS_PORT --key $PASSWORD -mode fast2 -mtu 1300 >> /var/log/kcp-client.log 2>&1 &
13 |
14 | # ss-local -s 服务器IP地址 -p 服务器端口 -b 绑定本地IP -l 本地端口 -k 密码 -m 加密方式 [-c 配置文件]
15 | ss-local -s 127.0.0.1 -p $SS_PORT -b 0.0.0.0 -l $SOCKS5_PORT -k $PASSWORD -m aes-256-gcm -t 300 >> /var/log/ss-local.log &
16 |
17 | # status
18 | }
19 |
20 | stop(){
21 | killall -9 kcp-client
22 | killall -9 udp2raw
23 | killall -9 ss-local
24 | }
25 |
26 | restart(){
27 | stop
28 | start
29 | }
30 |
31 | help(){
32 | echo -e "${SkyBlue}:: Source: ${Green}https://git.io/sskcp.sh ${Font}By 蘭雅sRGB"
33 | echo -e "${SkyBlue}:: Usage: ${GreenBG} bash sskcp.sh ${Yellow} [start|stop|restart|service|set] ${Font}"
34 | echo
35 | }
36 |
37 | status(){
38 | # log 和 命令行参数
39 | cat /var/log/udp2raw.log | tail
40 | cat /var/log/kcp-client.log | tail
41 | cat /var/log/ss-local.log | tail
42 | echo
43 |
44 | if [[ -e /etc/openwrt_release ]]; then
45 | ps | grep -e udp2raw -e kcp-client -e ss-local
46 | else
47 | ps ax | grep --color=auto -e udp2raw -e kcp-client -e ss-local
48 | fi
49 | echo
50 | }
51 |
52 | setconf()
53 | {
54 | echo -e "${SkyBlue}:: 修改脚本sskcp.sh记录参数,按${RedBG}${SkyBlue}不修改! ${Yellow}"
55 | head -n 6 sskcp.sh | tail -n 4 && echo -e "${SkyBlue}"
56 |
57 | read -p ":: 1.请输入远程服务器IP: " sv_ip
58 | read -p ":: 2.请输入udp2raw 端口: " port
59 | read -p ":: 3.请输入套接转发密码: " passwd
60 | read -p ":: 4.请输入 SS 服务端口: " ss_port
61 |
62 | if [[ ! -z "${sv_ip}" ]]; then
63 | sed -i "s/^SERVER_IP=.*/SERVER_IP=${sv_ip}/g" "sskcp.sh"
64 | fi
65 | if [[ ! -z "${port}" ]]; then
66 | sed -i "s/^PORT=.*/PORT=${port}/g" "sskcp.sh"
67 | fi
68 | if [[ ! -z "${passwd}" ]]; then
69 | sed -i "s/^PASSWORD=.*/PASSWORD=${passwd}/g" "sskcp.sh"
70 | fi
71 | if [[ ! -z "${ss_port}" ]]; then
72 | sed -i "s/^SS_PORT=.*/SS_PORT=${ss_port}/g" "sskcp.sh"
73 | fi
74 |
75 | echo -e "${Yellow}" && head -n 7 sskcp.sh | tail -n 5 && echo -e "${Font}"
76 | }
77 |
78 | system_def(){
79 | Green="\033[32m" && Red="\033[31m" && GreenBG="\033[42;37m" && RedBG="\033[41;37m"
80 | Font="\033[0m" && Yellow="\033[0;33m" && SkyBlue="\033[0;36m"
81 | }
82 |
83 | systemd_service(){
84 | # 安装启动服务
85 | cat </usr/lib/systemd/system/sskcp.service
86 | [Unit]
87 | Description=sskcp.sh Service
88 | After=network.target
89 |
90 | [Service]
91 | Type=forking
92 | User=root
93 | ExecStart=nohup /root/sskcp.sh start &
94 | ExecReload=sh /root/sskcp.sh stop
95 |
96 | [Install]
97 | WantedBy=multi-user.target
98 |
99 | EOF
100 | chmod +x /root/sskcp.sh
101 | systemctl enable sskcp.service
102 | systemctl start sskcp.service
103 | systemctl status sskcp.service
104 | }
105 |
106 | # 脚本命令参数
107 | system_def
108 | if [[ $# > 0 ]]; then
109 | key="$1"
110 | case $key in
111 | start)
112 | start
113 | ;;
114 | stop)
115 | stop
116 | ;;
117 | restart)
118 | restart
119 | ;;
120 | service)
121 | systemd_service
122 | ;;
123 | set)
124 | setconf
125 | ;;
126 | esac
127 | else
128 | status
129 | fi
130 | help
131 |
--------------------------------------------------------------------------------
/template/README.md:
--------------------------------------------------------------------------------
1 | ### 下载模版文件,如图修改红框范围内 IP端口和密码
2 | 
3 |
4 | # WireGuard + Speeder + Udp2Raw 和 Shadowsocks + Kcp + Udp2RAW 一键脚本
5 | ### 请访问 https://git.io/winkcp 下载客户端程序和模版
6 |
7 | ### OpenWRT 安装 WireGuard 配置 Udp2Raw + UdpSpeeder + WireGuard 文档教程
8 | - 短网址: https://git.io/wrt.wg [蘭雅sRGB YouTube频道](https://www.youtube.com/channel/UCupRwki_4n87nrwP0GIBUXA/videos)
9 |
10 | ### OpenWRT和KoolShar使用 加速udp2raw+kcptun脚本 https://git.io/sskcp.sh
11 |
12 | ### TunSafe 导入客户配置连接后,浏览器访问 http://10.0.0.1 或者 http://ip111.cn/
13 | 可以访问或者检测出你当前IP地址,表示软件设置没问题,*测试服务器只测试连接,不提供翻墙服务*
14 |
15 | ### WireGuard是VPN协议,如果连上而没有回程流量,请使用 WG+SS 分流方案
16 | - 客户端配置 AllowedIPs = 0.0.0.0/0, ::0/0 改成 AllowedIPs = 10.0.0.1/32
17 | - WG服务器相当于一个远程路由器,IP: 10.0.0.1,再开启一个SS,IP填 IP: 10.0.0.1
18 |
19 | ### cat /etc/wireguard/wg_VM-0-13-debian_3.conf WireGuard直连配置
20 | ```
21 | [Interface]
22 | PrivateKey = aMWVZ78fCeOG1e0ljJ06cvHqyXVqbfsEw4pZz+TNW24=
23 | Address = 10.0.0.3/24
24 | DNS = 8.8.8.8
25 |
26 | [Peer]
27 | PublicKey = 7+lLY7yN97cbwe/OkNR4pyHuX/uCiVc/maPrneVcHg8=
28 | Endpoint = 118.24.232.233:8000
29 | AllowedIPs = 0.0.0.0/0, ::0/0
30 | PersistentKeepalive = 25
31 | ```
32 |
33 | ### cat /etc/wireguard/wg0.conf WireGuard 服务端配置文件实例
34 | ```
35 | [Interface]
36 | PrivateKey = cFNf5sTNOXnPygDEuSD8kJ8NlisBY4OOxR/tBpJ7+Ws=
37 | Address = 10.0.0.1/24
38 | PostUp = iptables -I FORWARD -i wg0 -j ACCEPT; iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
39 | PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
40 | ListenPort = 8000
41 | DNS = 8.8.8.8
42 | MTU = 1420
43 |
44 | [Peer]
45 | PublicKey = p4L8R4YutqtSq64pAmOclcdqdo0e1Jo5lTQh0Um8BH4=
46 | AllowedIPs = 10.0.0.218/32
47 |
48 | [Peer]
49 | PublicKey = c1R+xHfGweOAotOQNdcqeMlFHzG8L6oNp8ai/MARQik=
50 | AllowedIPs = 10.0.0.2/32
51 |
52 | [Peer]
53 | PublicKey = /cHDZfLZm8OLPiPjMxhlA8U+sd1tOPwf6qXhpm38dQI=
54 | AllowedIPs = 10.0.0.3/32
55 |
56 | ```
57 |
58 | [](https://youtu.be/-sJLfPg12oc)
59 |
60 | ### GCP添加防火墙规则 ss-wg-udp
61 | ```
62 | # 入站 来源IP 0.0.0.0/0 ;指定协议和端口
63 | tcp:1999,2999,3999,8000; udp:1999,2999,3999,8000
64 |
65 | # 最好提前指定,不然要等很久才能生效
66 |
67 | ```
68 |
69 | ### 示例服务端信息
70 | ```
71 | 按以下实际信息填充 服务器IP: 118.24.232.233
72 | WG+SPEED+UDP2RAW 原端口: 8000 ; UDP2RAW伪装TCP后端口: 2999 ; 转发密码: wg2999
73 |
74 | SS+KCP+UDP2RAW加速: UDP2RAW伪装TCP后端口: 1999 ; SS密码: wg2999 加密协议 aes-256-gcm
75 |
76 | 手机SS+KCP加速方案: KCPTUN端口: 4000 ; KCP插件设置参数 mode=fast2;key=wg2999;mtu=1300
77 |
78 | ```
79 | ### root@gcp-tw:~# cat /etc/rc.local
80 | ```
81 | #!/bin/sh -e
82 | #
83 | # rc.local
84 |
85 | # SS+KCP+UDP2RAW 加速UDP TCP伪装
86 | ss-server -s 127.0.0.1 -p 40000 -k wg2999 -m aes-256-gcm -t 300 >> /var/log/ss-server.log &
87 | kcp-server -t "127.0.0.1:40000" -l ":4000" --key wg2999 -mode fast2 -mtu 1300 >> /var/log/kcp-server.log &
88 | udp2raw -s -l0.0.0.0:1999 -r 127.0.0.1:4000 -k wg2999 --raw-mode faketcp >> /var/log/udp2raw.log &
89 |
90 | # WG + Speeder + Udp2RAW 加速UDP TCP伪装
91 | speederv2 -s -l127.0.0.1:8888 -r127.0.0.1:8000 -f20:10 -k wg2999 --mode 0 >> /var/log/speederv2.log &
92 | udp2raw -s -l0.0.0.0:2999 -r 127.0.0.1:8888 -k wg2999 --raw-mode faketcp >> /var/log/wg_udp2raw.log &
93 |
94 | exit 0
95 | ```
96 | ### 下载模版文件,如图修改红框范围内 IP端口和密码
97 | 
98 |
99 | ### WG_TW_SPEED_UDP2RAW_TEST.conf 示范WG+Speed+Udp2RAW客户端配置
100 | ```
101 | [Interface]
102 | PrivateKey = aMWVZ78fCeOG1e0ljJ06cvHqyXVqbfsEw4pZz+TNW24=
103 | Address = 10.0.0.3/24
104 | DNS = 8.8.8.8
105 |
106 | [Peer]
107 | PublicKey = 7+lLY7yN97cbwe/OkNR4pyHuX/uCiVc/maPrneVcHg8=
108 | Endpoint = 127.0.0.1:8000
109 | AllowedIPs = 0.0.0.0/0, ::0/0
110 | PersistentKeepalive = 25
111 |
112 | ```
113 |
114 | 
115 |
116 | ### Windows_UDP2RAW.cmd 示范客户端开启串接模版
117 | ```
118 | @echo.
119 | @set PATH=%~dp0;%PATH%
120 |
121 | @set SERVER_IP=118.24.232.233
122 | @set PORT=2999
123 | @set PASSWORD=wg2999
124 | @set WG_PORT=8000
125 |
126 | @set GATEWAY=192.168.1.1
127 | @route DELETE %SERVER_IP% && route ADD %SERVER_IP% mask 255.255.255.255 %GATEWAY% METRIC 20
128 | @start /b udp2raw -c -r%SERVER_IP%:%PORT% -l0.0.0.0:8888 -k %PASSWORD% --raw-mode faketcp
129 | @start /b speederv2 -c -l0.0.0.0:%WG_PORT% -r127.0.0.1:8888 -f20:10 -k %PASSWORD% --mode 0
130 |
131 | ```
132 |
133 | ### Windows_KCP.cmd 示范客户端开启串接模版
134 | ```
135 | @echo.
136 | @set PATH=%~dp0;%PATH%
137 |
138 | @set SERVER_IP=118.24.232.233
139 | @set PORT=1999
140 | @set PASSWORD=wg2999
141 | @set SS_PORT=2018
142 |
143 | @start /b kcp-client -r "127.0.0.1:4000" -l ":%SS_PORT%" --key %PASSWORD% -mode fast2 -mtu 1300
144 | @start /b udp2raw -c -r%SERVER_IP%:%PORT% -l0.0.0.0:4000 -k %PASSWORD% --raw-mode faketcp
145 |
146 | ```
147 | ### Shadowsocks + Kcp + Udp2RAW 配置模版,导入后改实际密码
148 |
149 | ```
150 | ss://YWVzLTI1Ni1nY206d2cyOTk5QDEyNy4wLjAuMToyMDE4#test
151 | ```
152 |
153 | ### 手机SS+KCP加速方案
154 | ```
155 | # 手机SS KCP插件下载URL; 权限设置: SS和KCP插件能后台运行和管理启动
156 | https://github.com/shadowsocks/kcptun-android/releases
157 |
158 | KCPTUN端口: 4000 ; KCP插件设置参数 mode=fast2;key=wg2999;mtu=1300
159 | ```
160 |
161 |
162 | ### START_APP.cmd 示范客户端开启串接模版
163 | ```
164 | @echo.
165 | @set PATH=%~dp0;%PATH%
166 | @TITLE 自定APP名称
167 |
168 | :: 两个冒号是注释,删除命令行首开启命令
169 |
170 | :: 运行 WireGuard 客户端 TunSafe
171 | :: CD /D C:\soft\TunSafe\
172 | :: start TunSafe.exe
173 |
174 | :: 运行 Shadowsocks 客户端
175 | :: CD /D C:\soft\Shadowsocks
176 | :: start Shadowsocks.exe
177 |
178 | :: BROOK + KcpTun + Udp2Raw 客户端接口配置
179 | @set SERVER_IP=1.2.3.4
180 | @set PORT=2999
181 | @set PASSWORD=wg2999
182 | @set BK_PORT=3999
183 |
184 | @start /b kcp-client -r "127.0.0.1:4000" -l ":%BK_PORT%" --key %PASSWORD% -mode fast2 -mtu 1300
185 | @start /b udp2raw -c -r%SERVER_IP%:%PORT% -l0.0.0.0:4000 -k %PASSWORD% --raw-mode faketcp
186 |
187 |
188 | :: 打开 Brook 客户端服务
189 | set IP_URL=127.0.0.1
190 | set PASSWORD=wg2999
191 | set PORT=3999
192 |
193 | CD /D C:\soft\Brook
194 | start /b brook client -l 127.0.0.1:2080 -i 127.0.0.1 -s %IP_URL%:%PORT% -p %PASSWORD%
195 |
196 | ```
197 |
--------------------------------------------------------------------------------
/template/WG_TW_SPEED_UDP2RAW_TEST.conf:
--------------------------------------------------------------------------------
1 | [Interface]
2 | PrivateKey = aMWVZ78fCeOG1e0ljJ06cvHqyXVqbfsEw4pZz+TNW24=
3 | Address = 10.0.0.3/24
4 | DNS = 8.8.8.8
5 |
6 | [Peer]
7 | PublicKey = 7+lLY7yN97cbwe/OkNR4pyHuX/uCiVc/maPrneVcHg8=
8 | Endpoint = 127.0.0.1:8000
9 | AllowedIPs = 0.0.0.0/0, ::0/0
10 | PersistentKeepalive = 25
11 |
--------------------------------------------------------------------------------
/template/wg_VM-0-13-debian_3.conf:
--------------------------------------------------------------------------------
1 | [Interface]
2 | PrivateKey = aMWVZ78fCeOG1e0ljJ06cvHqyXVqbfsEw4pZz+TNW24=
3 | Address = 10.0.0.3/24
4 | DNS = 8.8.8.8
5 |
6 | [Peer]
7 | PublicKey = 7+lLY7yN97cbwe/OkNR4pyHuX/uCiVc/maPrneVcHg8=
8 | Endpoint = 118.24.232.233:8000
9 | AllowedIPs = 0.0.0.0/0, ::0/0
10 | PersistentKeepalive = 25
11 |
--------------------------------------------------------------------------------
/template/wg_ss.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hongwenjun/WinKcp_Launcher/526cf141fd7dfa88d26cb679d380ad4d02ac724f/template/wg_ss.png
--------------------------------------------------------------------------------
/wg_udp2raw.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # 密码随机,脚本提供修改
4 | passwd=$(date | md5sum | head -c 6)
5 |
6 | # 默认端口参数, 为了简单好用,请下载脚本自编辑修改
7 | wg_port=$(wg | grep 'listening port:' | awk '{print $3}')
8 | raw_port=2999
9 | speed_port=8888
10 |
11 | ss_raw_port=1999
12 | kcp_port=4000
13 |
14 | if [ ! -e '/var/ip_addr' ]; then
15 | echo -n $(curl -4 ip.sb) > /var/ip_addr
16 | fi
17 | serverip=$(cat /var/ip_addr)
18 |
19 | ########################################################
20 | clear
21 | # 定义文字颜色
22 | Green="\033[32m" && Red="\033[31m" && GreenBG="\033[42;37m" && RedBG="\033[41;37m"
23 | Font="\033[0m" && Yellow="\033[0;33m" && SkyBlue="\033[0;36m"
24 |
25 | default_display()
26 | {
27 | echo -e "${GreenBG} WireGuard + Speeder + Udp2Raw 和 Shadowsocks + Kcp + Udp2RAW 一键脚本 ${Font}"
28 | echo -e "${SkyBlue} 开源项目: https://github.com/hongwenjun/vps_setup ${Font}"
29 |
30 | echo -e "随机生成密码: ${RedBG} ${passwd} ${Font} 现在可修改; "
31 | read -p "请输入你要的密码(按回车不修改): " -t 30 new
32 |
33 | if [[ ! -z "${new}" ]]; then
34 | passwd="${new}"
35 | echo -e "${SkyBlue}:: 修改后新密码: ${GreenBG} ${passwd} ${Font}"
36 | echo -e "${SkyBlue}:: WG+SPEED+UDP2RAW 默认伪装TCP端口: ${RedBG} ${raw_port} "
37 | echo -e "${SkyBlue}:: SS+KCP+UDP2RAW 默认伪装TCP端口: ${RedBG} ${ss_raw_port} ${Font}"
38 |
39 | read -p ":: 1.请输入WG+SPEED+UDP2RAW 伪装端口: " raw_port
40 | if [[ -z "${raw_port}" ]]; then
41 | raw_port=2999
42 | fi
43 |
44 | read -p ":: 2.请输入 SS+KCP+UDP2RAW 伪装端口: " ss_raw_port
45 | if [[ -z "${ss_raw_port}" ]]; then
46 | ss_raw_port=1999
47 | fi
48 | fi
49 |
50 | }
51 |
52 | english_display()
53 | {
54 | echo -e "${GreenBG} WireGuard+Speeder+Udp2Raw and SS+Kcp+Udp2RAW Automated Configuration ${Font}"
55 | echo -e "${SkyBlue} Open Source Project: https://github.com/hongwenjun/vps_setup ${Font}"
56 |
57 | echo -e "Random Password: ${RedBG} ${passwd} ${Font} Now, You can change the Password, Press Enter to not Modify:"
58 |
59 | read -p "Please Enter the New Password: " -t 30 new
60 |
61 | if [[ ! -z "${new}" ]]; then
62 | passwd="${new}"
63 | echo -e "${SkyBlue}:: Now, the New Password: ${GreenBG} ${passwd} ${Font}"
64 | echo -e "${SkyBlue}:: WG+SPEED+UDP2RAW Default Camouflage TCP Port: ${RedBG} ${raw_port} "
65 | echo -e "${SkyBlue}:: SS+KCP+UDP2RAW Default Camouflage TCP Port: ${RedBG} ${ss_raw_port} ${Font}"
66 |
67 | read -p ":: 1.Please Modify WG+SPEED+UDP2RAW Camouflage TCP Port: " raw_port
68 | if [[ -z "${raw_port}" ]]; then
69 | raw_port=2999
70 | fi
71 |
72 | read -p ":: 2.Please Modify SS+KCP+UDP2RAW Camouflage TCP Port: " ss_raw_port
73 | if [[ -z "${ss_raw_port}" ]]; then
74 | ss_raw_port=1999
75 | fi
76 | fi
77 | }
78 |
79 | # 中英文显示支持
80 | if [[ "$1" == "english" ]]; then
81 | english_display
82 | else
83 | default_display
84 | fi
85 |
86 | udp2raw_install()
87 | {
88 | # 下载 UDP2RAW
89 | udp2raw_ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/wangyu-/udp2raw-tunnel/releases/latest | grep 'tag_name' | cut -d\" -f4)
90 | wget https://github.com/wangyu-/udp2raw-tunnel/releases/download/${udp2raw_ver}/udp2raw_binaries.tar.gz
91 | tar xf udp2raw_binaries.tar.gz
92 | mv udp2raw_amd64 /usr/bin/udp2raw
93 | rm udp2raw* -rf
94 | rm version.txt
95 |
96 | # 下载 KCPTUN
97 | kcp_ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/xtaci/kcptun/releases/latest | grep 'tag_name' | cut -d\" -f4)
98 | kcp_gz_ver=${kcp_ver:1:8}
99 |
100 | kcptun_tar_gz=kcptun-linux-amd64-${kcp_gz_ver}.tar.gz
101 | wget https://github.com/xtaci/kcptun/releases/download/${kcp_ver}/$kcptun_tar_gz
102 | tar xf $kcptun_tar_gz
103 | mv server_linux_amd64 /usr/bin/kcp-server
104 | mv client_linux_amd64 /usr/bin/kcp-client
105 | rm $kcptun_tar_gz
106 |
107 | # 下载 UDPspeeder
108 | udpspeeder_ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/wangyu-/UDPspeeder/releases/latest | grep 'tag_name' | cut -d\" -f4)
109 | wget https://github.com/wangyu-/UDPspeeder/releases/download/${udpspeeder_ver}/speederv2_binaries.tar.gz
110 | tar xf speederv2_binaries.tar.gz
111 | mv speederv2_amd64 /usr/bin/speederv2
112 | rm speederv2* -rf
113 | rm version.txt
114 | }
115 |
116 | # 首次运行脚本需要安装
117 | if [ ! -e '/usr/bin/speederv2' ]; then
118 | apt install iptables -y # Debian 11默认没装 iptables
119 | update-alternatives --set iptables /usr/sbin/iptables-legacy
120 | udp2raw_install
121 | fi
122 |
123 | # 安装到启动项
124 | cat </etc/rc.local
125 | #!/bin/sh -e
126 | #
127 | # rc.local
128 |
129 | # SS + KcpTun + Udp2RAW or (SSR BROOK) # IPv6 支持参数 -s ::0
130 | ss-server -s 0.0.0.0 -p 40000 -k ${passwd} -m aes-256-gcm -t 300 -s ::0 >> /var/log/ss-server.log &
131 | kcp-server -t "127.0.0.1:40000" -l ":${kcp_port}" --key ${passwd} -mode fast2 -mtu 1300 2>> /var/log/kcp-server.log &
132 | udp2raw -s -l0.0.0.0:${ss_raw_port} -r 127.0.0.1:${kcp_port} -k ${passwd} --raw-mode faketcp -a >> /var/log/udp2raw.log &
133 |
134 | # WG + Speeder + Udp2RAW or (V2ray udp)
135 | # speederv2 -s -l127.0.0.1:${speed_port} -r127.0.0.1:${wg_port} -f20:10 -k ${passwd} --mode 0 >> /var/log/speederv2.log &
136 | # udp2raw -s -l0.0.0.0:${raw_port} -r 127.0.0.1:${speed_port} -k ${passwd} --raw-mode faketcp -a >> /var/log/wg_udp2raw.log &
137 |
138 | exit 0
139 |
140 | EOF
141 |
142 | # 重启启动项服务
143 | systemctl stop rc-local
144 |
145 | # 简化判断系统 debian/centos 族群
146 | if [ -e '/etc/redhat-release' ]; then
147 | mv /etc/rc.local /etc/rc.d/rc.local
148 | ln -s /etc/rc.d/rc.local /etc/rc.local
149 | chmod +x /etc/rc.d/rc.local
150 | systemctl enable rc-local
151 | else
152 | chmod +x /etc/rc.local
153 | fi
154 |
155 | systemctl restart rc-local
156 |
157 | put_config(){
158 | echo -e "${SkyBlue}:: WG+Speeder+Udp2Raw 和 SS+Kcp+Udp2RAW 配置信息, 再查${GreenBG} cat vps_setup.log ${Font}"
159 | cat /etc/rc.local
160 |
161 | echo -e "请访问${GreenBG} https://git.io/winkcp ${Font}下载 Windows KcpTun 和 Udp2RAW 套接桥接工具"
162 | echo -e "按以下实际信息填充 ${RedBG} 服务器IP: ${serverip} ${Font} "
163 | echo -e "${Yellow} WG+SPEED+UDP2RAW 原端口: ${wg_port} ; UDP2RAW伪装TCP后端口: ${raw_port} ; 转发密码: ${passwd} ${Font}"
164 | echo -e "${Red} SS+KCP+UDP2RAW加速: UDP2RAW伪装TCP后端口: ${ss_raw_port} ; SS密码: ${passwd} 加密协议 aes-256-gcm ${Font}"
165 | echo -e "${Green} 手机SS+KCP加速方案: KCPTUN端口: ${kcp_port} ; KCP插件设置参数 mode=fast2;key=${passwd};mtu=1300 ${Font}"
166 | echo
167 | echo -e "${SkyBlue} 开源项目:https://github.com/hongwenjun/vps_setup ${Font}"
168 | }
169 |
170 | put_english_config(){
171 | echo -e "${SkyBlue}:: WG+Speeder+Udp2Raw and SS+Kcp+Udp2RAW Configuration information. ${Font}"
172 | cat /etc/rc.local
173 |
174 | echo -e "Please visit ${GreenBG} https://git.io/winkcp ${Font} to download the Windows KcpTun and Udp2RAW Socket Bridge tools."
175 | echo -e "Display Information ${RedBG} Server IP: ${serverip} ${Font} "
176 | echo -e "${Yellow} WG+SPEED+UDP2RAW Original Port: ${wg_port} ; UDP2RAW Camouflage TCP Port: ${raw_port} ; Forward Password: ${passwd} ${Font}"
177 | echo -e "${Red} SS+KCP+UDP2RAW Speeded-Up: UDP2RAW Camouflage TCP Port: ${ss_raw_port} ; SS_Password: ${passwd} Encrypt_Method: aes-256-gcm ${Font}"
178 | echo -e "${Green} Mobile Phone SS+KCP Speeded-Up: KCPTUN Port: ${kcp_port} ; KCP Plugin Parameters: mode=fast2;key=${passwd};mtu=1300 ${Font}"
179 | echo
180 | echo -e "${SkyBlue} Open Source Project: https://github.com/hongwenjun/vps_setup ${Font}"
181 | }
182 |
183 | cur_dir=$(pwd) && clear
184 |
185 | if [[ "$1" == "english" ]]; then
186 | put_english_config 2>&1 | tee ${cur_dir}/vps_setup.log
187 | else
188 | put_config 2>&1 | tee ${cur_dir}/vps_setup.log
189 | fi
190 |
191 |
--------------------------------------------------------------------------------