Skip to content

Commit 887cc26

Browse files
committed
fix(ui): align engine/strategy pickers; fix(docs): remove discord voice claim; feat(diag): add ciadpi support to blockcheck
1 parent 7337632 commit 887cc26

4 files changed

Lines changed: 133 additions & 128 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Lightweight TCP-only transparent proxy. Best for simple web browsing and standar
4040
- **Mode:** Transparent Proxy
4141
4242
### ciadpi (ByeDPI)
43-
Advanced SOCKS5 proxy with **UDP support**. Required for **Discord Voice**, **WebRTC**, and **HTTP/3 (QUIC)**.
43+
Advanced SOCKS5 proxy with **UDP support**.
4444
- **Protocol:** TCP + UDP
4545
- **Mode:** System SOCKS5 Proxy (Auto-configured)
4646
- **Features:** Fake packets, UDP traversal

README.ru.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
- **Режим:** Прозрачный прокси (Transparent Proxy)
4040
4141
### ciadpi (ByeDPI)
42-
Продвинутый SOCKS5 прокси с **поддержкой UDP**. Необходим для **Discord Voice**, **WebRTC** и **HTTP/3 (QUIC)**.
42+
Продвинутый SOCKS5 прокси с **поддержкой UDP**.
4343
- **Протокол:** TCP + UDP
4444
- **Режим:** Системный SOCKS5 прокси (автонастройка)
4545
- **Возможности:** Фейковые пакеты (Fake packets), проход UDP

Sources/main.swift

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -81,58 +81,59 @@ struct ContentView: View {
8181

8282
Divider()
8383

84-
// Engine Selection
85-
HStack {
86-
Text("Engine")
87-
.font(.body)
88-
Spacer()
89-
Picker("", selection: Binding(
90-
get: { zapretManager.currentEngine },
91-
set: { zapretManager.setEngine($0) }
92-
)) {
93-
ForEach(Engine.allCases) { engine in
94-
Text(engine.rawValue).tag(engine)
84+
// Settings (Engine & Strategy)
85+
VStack(spacing: 6) {
86+
// Engine Selection
87+
HStack {
88+
Text("Engine")
89+
.font(.body)
90+
Spacer()
91+
Picker("", selection: Binding(
92+
get: { zapretManager.currentEngine },
93+
set: { zapretManager.setEngine($0) }
94+
)) {
95+
ForEach(Engine.allCases) { engine in
96+
Text(engine.rawValue).tag(engine)
97+
}
9598
}
99+
.labelsHidden()
100+
.pickerStyle(.menu)
101+
.frame(width: 160, alignment: .trailing) // Force alignment to right
102+
.disabled(zapretManager.isLoading)
96103
}
97-
.labelsHidden()
98-
.pickerStyle(.menu)
99-
.frame(width: 140) // Fixed width for alignment
100-
.disabled(zapretManager.isLoading)
101-
}
102-
.padding(.horizontal, 14)
103-
.padding(.vertical, 4)
104-
105-
// Strategy Selection (dynamic based on engine)
106-
HStack {
107-
Text("Strategy")
108-
.font(.body)
109-
Spacer()
110104

111-
Group {
112-
if zapretManager.currentEngine == .tpws {
113-
Picker("", selection: Binding(
114-
get: { zapretManager.currentStrategy },
115-
set: { zapretManager.setStrategy($0) }
116-
)) {
117-
ForEach(ZapretStrategy.allCases) { strategy in
118-
Text(strategy.rawValue).tag(strategy)
105+
// Strategy Selection
106+
HStack {
107+
Text("Strategy")
108+
.font(.body)
109+
Spacer()
110+
111+
Group {
112+
if zapretManager.currentEngine == .tpws {
113+
Picker("", selection: Binding(
114+
get: { zapretManager.currentStrategy },
115+
set: { zapretManager.setStrategy($0) }
116+
)) {
117+
ForEach(ZapretStrategy.allCases) { strategy in
118+
Text(strategy.rawValue).tag(strategy)
119+
}
119120
}
120-
}
121-
} else {
122-
Picker("", selection: Binding(
123-
get: { zapretManager.currentByeDPIStrategy },
124-
set: { zapretManager.setByeDPIStrategy($0) }
125-
)) {
126-
ForEach(ByeDPIStrategy.allCases) { strategy in
127-
Text(strategy.rawValue).tag(strategy)
121+
} else {
122+
Picker("", selection: Binding(
123+
get: { zapretManager.currentByeDPIStrategy },
124+
set: { zapretManager.setByeDPIStrategy($0) }
125+
)) {
126+
ForEach(ByeDPIStrategy.allCases) { strategy in
127+
Text(strategy.rawValue).tag(strategy)
128+
}
128129
}
129130
}
130131
}
132+
.labelsHidden()
133+
.pickerStyle(.menu)
134+
.frame(width: 160, alignment: .trailing) // Force alignment to right
135+
.disabled(zapretManager.isLoading)
131136
}
132-
.labelsHidden()
133-
.pickerStyle(.menu)
134-
.frame(width: 140) // Fixed width for alignment
135-
.disabled(zapretManager.isLoading)
136137
}
137138
.padding(.horizontal, 14)
138139
.padding(.vertical, 4)

zapret_src/macos_blockcheck.sh

Lines changed: 86 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/bin/bash
22
#
33
# Darkware Zapret - macOS Diagnostics
4-
# Диагностика блокировок и тестирование tpws стратегий
4+
# Диагностика блокировок и тестирование стратегий (tpws + ciadpi)
55
#
66

77
# Конфигурация
88
ZAPRET_BASE="${ZAPRET_BASE:-/opt/darkware-zapret}"
99
TPWS="${ZAPRET_BASE}/tpws/tpws"
10+
CIADPI="${ZAPRET_BASE}/byedpi/ciadpi"
1011
CURL_TIMEOUT="${CURL_TIMEOUT:-5}"
1112
SOCKS_PORT="${SOCKS_PORT:-19999}"
1213
DOMAIN="${DOMAIN:-discord.com}"
@@ -15,13 +16,13 @@ HTTP_URL="http://${DOMAIN}"
1516

1617
# Результаты
1718
declare -a WORKING_STRATEGIES
18-
TPWS_PID=""
19+
ENGINE_PID=""
1920

2021
# Очистка при выходе
2122
cleanup() {
22-
if [ -n "$TPWS_PID" ] && kill -0 "$TPWS_PID" 2>/dev/null; then
23-
kill "$TPWS_PID" 2>/dev/null || true
24-
wait "$TPWS_PID" 2>/dev/null || true
23+
if [ -n "$ENGINE_PID" ] && kill -0 "$ENGINE_PID" 2>/dev/null; then
24+
kill "$ENGINE_PID" 2>/dev/null || true
25+
wait "$ENGINE_PID" 2>/dev/null || true
2526
fi
2627
}
2728
trap cleanup EXIT INT TERM
@@ -41,6 +42,12 @@ check_system() {
4142
exit 1
4243
fi
4344

45+
if [ -x "$CIADPI" ]; then
46+
echo "ciadpi: OK"
47+
else
48+
echo "ciadpi: NOT FOUND"
49+
fi
50+
4451
# Найти свободный порт
4552
for p in $(seq 19999 20010); do
4653
if ! nc -z 127.0.0.1 $p 2>/dev/null; then
@@ -98,7 +105,7 @@ check_direct() {
98105
if [ $http_exit -eq 0 ] && echo "$http_code" | grep -q "^[23]"; then
99106
echo "HTTP: OK"
100107
else
101-
echo "HTTP: FAILED (exit=$http_exit)"
108+
echo "HTTP: BLOCKED (Code: $http_code)"
102109
fi
103110

104111
# HTTPS
@@ -107,95 +114,99 @@ check_direct() {
107114
local https_exit=$?
108115

109116
if [ $https_exit -eq 0 ] && echo "$https_code" | grep -q "^[23]"; then
110-
echo "HTTPS: OK (no DPI block detected)"
111-
HTTPS_WORKS=1
117+
echo "HTTPS: OK"
118+
echo "NOTE: Connection works without bypass!"
112119
else
113120
if [ $https_exit -eq 28 ]; then
114-
echo "HTTPS: TIMEOUT (DPI block detected)"
121+
echo "HTTPS: BLOCKED (Timeout)"
115122
else
116-
echo "HTTPS: FAILED (exit=$https_exit)"
123+
echo "HTTPS: BLOCKED (Curl exit code: $https_exit, HTTP code: $https_code)"
117124
fi
118-
HTTPS_WORKS=0
119125
fi
120126
echo ""
121127
}
122128

123-
# Запуск tpws
124-
start_tpws() {
125-
local params="$@"
129+
# Функция теста стратегии (общая логика)
130+
test_strategy_generic() {
131+
local engine_bin="$1"
132+
local engine_name="$2"
133+
local strategy_name="$3"
134+
local args="$4"
126135

127-
if [ -n "$TPWS_PID" ] && kill -0 "$TPWS_PID" 2>/dev/null; then
128-
kill "$TPWS_PID" 2>/dev/null || true
129-
wait "$TPWS_PID" 2>/dev/null || true
130-
fi
136+
# Запуск движка
137+
# >/dev/null 2>&1 убрано (если нужно дебажить, но для юзера лучше убрать мусор)
138+
$engine_bin $args >/dev/null 2>&1 &
139+
ENGINE_PID=$!
131140

132-
"$TPWS" --bind-addr=127.0.0.1 --port=$SOCKS_PORT --socks $params >/dev/null 2>&1 &
133-
TPWS_PID=$!
134-
sleep 0.3
135-
136-
if ! kill -0 "$TPWS_PID" 2>/dev/null; then
137-
TPWS_PID=""
138-
return 1
139-
fi
140-
return 0
141-
}
142-
143-
# Тест стратегии
144-
test_strategy() {
145-
local name="$1"
146-
local params="$2"
141+
# Дать время на старт
142+
sleep 0.5
147143

148-
if ! start_tpws $params; then
149-
echo " $name: ERROR (tpws failed)"
144+
if ! kill -0 "$ENGINE_PID" 2>/dev/null; then
145+
echo " $strategy_name: FAILED TO START ($engine_name crashed)"
146+
ENGINE_PID=""
150147
return 1
151148
fi
152149

153150
local result
151+
# Используем socks5h для удаленного DNS резолва
154152
result=$(curl -s --max-time "$CURL_TIMEOUT" \
155-
--proxy "socks5://127.0.0.1:$SOCKS_PORT" \
153+
--proxy "socks5h://127.0.0.1:$SOCKS_PORT" \
156154
-o /dev/null -w "%{http_code}" "$TEST_URL" 2>&1)
157155
local code=$?
158156

159-
if [ -n "$TPWS_PID" ]; then
160-
kill "$TPWS_PID" 2>/dev/null || true
161-
wait "$TPWS_PID" 2>/dev/null || true
162-
TPWS_PID=""
157+
if [ -n "$ENGINE_PID" ]; then
158+
kill "$ENGINE_PID" 2>/dev/null || true
159+
wait "$ENGINE_PID" 2>/dev/null || true
160+
ENGINE_PID=""
163161
fi
164162

165163
if [ $code -eq 0 ] && echo "$result" | grep -q "^[23]"; then
166-
echo " $name: OK"
167-
WORKING_STRATEGIES+=("$name")
164+
echo " $strategy_name: OK"
165+
WORKING_STRATEGIES+=("$engine_name: $strategy_name")
168166
return 0
169167
else
170168
if [ $code -eq 28 ]; then
171-
echo " $name: TIMEOUT"
169+
echo " $strategy_name: TIMEOUT"
172170
else
173-
echo " $name: FAILED"
171+
echo " $strategy_name: FAILED"
174172
fi
175173
return 1
176174
fi
177175
}
178176

177+
# Тестирование TPWS
178+
test_tpws_strategy() {
179+
local name="$1"
180+
local args="$2"
181+
# tpws needs --socks --port
182+
test_strategy_generic "$TPWS" "tpws" "$name" "--socks --port $SOCKS_PORT $args"
183+
}
184+
185+
# Тестирование CIADPI
186+
test_ciadpi_strategy() {
187+
local name="$1"
188+
local args="$2"
189+
# ciadpi needs -p port
190+
test_strategy_generic "$CIADPI" "ciadpi" "$name" "-p $SOCKS_PORT $args"
191+
}
192+
179193
# Тестирование стратегий
180194
test_strategies() {
181-
echo "=== TPWS STRATEGY TESTING ==="
182-
echo "Domain: $DOMAIN"
195+
echo "=== TPWS STRATEGIES ==="
196+
test_tpws_strategy "Split+Disorder" "--split-pos=1,midsld --disorder"
197+
test_tpws_strategy "TLSRec+Split" "--tlsrec=sniext --split-pos=1,midsld --disorder"
198+
test_tpws_strategy "TLSRec MidSLD" "--tlsrec=midsld --split-pos=midsld --disorder"
199+
test_tpws_strategy "TLSRec+OOB" "--tlsrec=sniext --split-pos=1,midsld --disorder --hostdot"
183200
echo ""
184201

185-
# Наши стратегии из приложения
186-
echo "Darkware Strategies:"
187-
test_strategy "Split+Disorder" "--split-pos=1,midsld --disorder"
188-
test_strategy "TLSRec+Split" "--tlsrec=sniext --split-pos=1,midsld --disorder"
189-
test_strategy "TLSRec MidSLD" "--tlsrec=midsld --split-pos=midsld --disorder"
190-
test_strategy "TLSRec+OOB" "--tlsrec=sniext --split-pos=1,midsld --disorder --hostdot"
191-
192-
echo ""
193-
echo "Additional methods:"
194-
test_strategy "split-pos=2" "--split-pos=2"
195-
test_strategy "split-pos=2+disorder" "--split-pos=2 --disorder"
196-
test_strategy "tlsrec=sniext" "--tlsrec=sniext"
197-
test_strategy "tlsrec=midsld" "--tlsrec=midsld"
198-
echo ""
202+
if [ -x "$CIADPI" ]; then
203+
echo "=== CIADPI STRATEGIES ==="
204+
test_ciadpi_strategy "Disorder (Simple)" "-d 1"
205+
test_ciadpi_strategy "Disorder (SNI)" "-d 1+s"
206+
test_ciadpi_strategy "Fake Packets" "-d 1 -f -1 -t 6"
207+
test_ciadpi_strategy "Auto (Torst)" "-A torst -d 1"
208+
echo ""
209+
fi
199210
}
200211

201212
# Итоги
@@ -210,30 +221,23 @@ print_summary() {
210221
echo " + $s"
211222
done
212223
echo ""
224+
echo "RECOMMENDED: Select one of the working strategies above."
213225

214-
# Рекомендация на основе наших стратегий
215-
local recommended=""
216-
for s in "${WORKING_STRATEGIES[@]}"; do
217-
case "$s" in
218-
"Split+Disorder"*) recommended="Split+Disorder"; break;;
219-
"TLSRec+Split"*) recommended="TLSRec+Split"; break;;
220-
"TLSRec MidSLD"*) recommended="TLSRec MidSLD"; break;;
221-
"TLSRec+OOB"*) recommended="TLSRec+OOB"; break;;
222-
esac
223-
done
224-
225-
if [ -n "$recommended" ]; then
226-
echo "RECOMMENDED: Select '$recommended' strategy in Darkware Zapret"
227-
else
228-
echo "NOTE: Your ISP may require custom tpws parameters"
226+
# Попытка парсинга первой рабочей стратегии для рекомендации
227+
local first_working="${WORKING_STRATEGIES[0]}"
228+
if [[ "$first_working" == "tpws:"* ]]; then
229+
echo "Default Engine: tpws"
230+
elif [[ "$first_working" == "ciadpi:"* ]]; then
231+
echo "Default Engine: ciadpi"
229232
fi
233+
230234
else
231235
echo "NO WORKING STRATEGIES FOUND"
232236
echo ""
233237
echo "Possible reasons:"
234238
echo " - ISP blocks by IP, not DPI"
235-
echo " - Need different tpws parameters"
236-
echo " - Try VPN instead"
239+
echo " - Need custom parameters"
240+
echo " - Try using a VPN"
237241
fi
238242

239243
echo ""
@@ -249,15 +253,15 @@ main() {
249253
# Парсинг аргументов
250254
while [ $# -gt 0 ]; do
251255
case "$1" in
252-
--domain=*)
256+
--domain=*)
253257
DOMAIN="${1#*=}"
254258
TEST_URL="https://${DOMAIN}"
255259
HTTP_URL="http://${DOMAIN}"
256260
;;
257-
--timeout=*) CURL_TIMEOUT="${1#*=}" ;;
258-
--help)
259-
echo "Usage: $0 [--domain=DOMAIN] [--timeout=SEC]"
260-
exit 0
261+
SCANLEVEL=*)
262+
# Игнорируем legacy параметр
263+
;;
264+
*)
261265
;;
262266
esac
263267
shift

0 commit comments

Comments
 (0)