Skip to content

Commit db213de

Browse files
committed
fix: Critical fixes for traffic redirection
- Add TPWS_PORTS=80,443 to config generation (required for pf.sh to create redirect rules) - Fix LaunchDaemon to use 'start' instead of 'start-daemons' (enables firewall rules on boot) - Fix typo TPPORT vs TPPORT_SOCKS in macos/functions - Write complete working config on install instead of empty file - Add uninstall script
1 parent 4435c51 commit db213de

4 files changed

Lines changed: 35 additions & 4 deletions

File tree

Sources/main.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ enum ZapretStrategy: String, CaseIterable, Identifiable {
194194
let commonVars = """
195195
TPWS_ENABLE=1
196196
TPWS_SOCKS_ENABLE=1
197+
TPWS_PORTS=80,443
197198
INIT_APPLY_FW=1
198199
DISABLE_IPV6=0
199200
GZIP_LISTS=0

install_darkware.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,17 @@ mkdir -p "$TARGET_DIR"
2626
# Copy files (using dot syntax for reliable copying of content)
2727
cp -R "$SOURCE_DIR/." "$TARGET_DIR/" || { echo "Copy failed" >> "$LOG"; exit 1; }
2828

29-
# Create/Reset strategy config if not exists
29+
# Create/Reset strategy config if not exists - write default working config
3030
if [ ! -f "$TARGET_DIR/config_custom" ]; then
31-
echo "# Custom strategy config" > "$TARGET_DIR/config_custom"
31+
cat > "$TARGET_DIR/config_custom" <<'CONFIGEOF'
32+
TPWS_ENABLE=1
33+
TPWS_SOCKS_ENABLE=1
34+
TPWS_PORTS=80,443
35+
INIT_APPLY_FW=1
36+
DISABLE_IPV6=0
37+
GZIP_LISTS=0
38+
TPWS_OPT="--filter-tcp=80 --methodeol --hostlist=/opt/darkware-zapret/ipset/zapret-hosts.txt --hostlist-auto=/opt/darkware-zapret/ipset/zapret-hosts-auto.txt --hostlist-auto-fail-threshold=3 --hostlist-auto-fail-time=60 --hostlist-auto-retrans-threshold=3 --new --filter-tcp=443 --split-pos=1,midsld --disorder --hostlist=/opt/darkware-zapret/ipset/zapret-hosts.txt --hostlist-auto=/opt/darkware-zapret/ipset/zapret-hosts-auto.txt --hostlist-auto-fail-threshold=3 --hostlist-auto-fail-time=60 --hostlist-auto-retrans-threshold=3"
39+
CONFIGEOF
3240
fi
3341
chmod 666 "$TARGET_DIR/config_custom"
3442

@@ -90,7 +98,7 @@ cat > "$PLIST_PATH" <<EOF
9098
<key>ProgramArguments</key>
9199
<array>
92100
<string>/opt/darkware-zapret/init.d/macos/zapret</string>
93-
<string>start-daemons</string>
101+
<string>start</string>
94102
</array>
95103
<key>RunAtLoad</key>
96104
<true/>

uninstall_darkware.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
echo "Stopping Application..."
3+
pkill -f "darkware zapret" || true
4+
5+
echo "Unloading LaunchDaemon..."
6+
sudo launchctl unload /Library/LaunchDaemons/com.darkware.zapret.plist 2>/dev/null || true
7+
8+
echo "Stopping Service..."
9+
sudo /opt/darkware-zapret/init.d/macos/zapret stop 2>/dev/null || true
10+
11+
echo "Removing Files..."
12+
rm -rf "/Applications/darkware zapret.app"
13+
sudo rm -rf /opt/darkware-zapret
14+
sudo rm -f /Library/LaunchDaemons/com.darkware.zapret.plist
15+
sudo rm -f /etc/sudoers.d/darkware-zapret
16+
17+
echo "Cleaning Preferences & Logs..."
18+
defaults delete com.darkware.zapret 2>/dev/null || true
19+
rm -f /tmp/darkware-zapret.*
20+
rm -f /tmp/darkware_install.log
21+
22+
echo "✅ System Cleaned Successfully!"

zapret_src/init.d/macos/functions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ IPSET_DIR=$ZAPRET_BASE/ipset
1515

1616
PIDDIR=/var/run
1717
[ -n "$TPPORT" ] || TPPORT=988
18-
[ -n "$TPPORT_SOCKS" ] || TPPORT=987
18+
[ -n "$TPPORT_SOCKS" ] || TPPORT_SOCKS=987
1919
[ -n "$WS_USER" ] || WS_USER=daemon
2020
TPWS_WAIT="--bind-wait-ifup=30 --bind-wait-ip=30"
2121
TPWS_WAIT_SOCKS6="$TPWS_WAIT --bind-wait-ip-linklocal=30"

0 commit comments

Comments
 (0)