Skip to content

Commit 395c04b

Browse files
committed
fix: Use MODE_FILTER=autohostlist and re-filter hostlist
- Switch from antizapret to re-filter list (contains YouTube) - Use <HOSTLIST> placeholders like original zapret - Set DISABLE_IPV6=1 for better compatibility - Config now matches working original zapret setup
1 parent db213de commit 395c04b

2 files changed

Lines changed: 27 additions & 12 deletions

File tree

Sources/main.swift

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,32 +191,42 @@ enum ZapretStrategy: String, CaseIterable, Identifiable {
191191
var id: String { self.rawValue }
192192

193193
var configContent: String {
194+
// Use exact same format as original zapret config with <HOSTLIST> placeholders
194195
let commonVars = """
196+
MODE_FILTER=autohostlist
195197
TPWS_ENABLE=1
196198
TPWS_SOCKS_ENABLE=1
197199
TPWS_PORTS=80,443
198200
INIT_APPLY_FW=1
199-
DISABLE_IPV6=0
201+
DISABLE_IPV6=1
200202
GZIP_LISTS=0
203+
GETLIST=get_refilter_domains.sh
201204
"""
202205

203-
let hostlistArgs = "--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"
204-
205206
switch self {
206207
case .splitDisorder:
207208
return """
208209
\(commonVars)
209-
TPWS_OPT="--filter-tcp=80 --methodeol \(hostlistArgs) --new --filter-tcp=443 --split-pos=1,midsld --disorder \(hostlistArgs)"
210+
TPWS_OPT="
211+
--filter-tcp=80 --methodeol <HOSTLIST> --new
212+
--filter-tcp=443 --split-pos=1,midsld --disorder <HOSTLIST>
213+
"
210214
"""
211215
case .fakeSplit:
212216
return """
213217
\(commonVars)
214-
TPWS_OPT="--filter-tcp=80 --methodeol \(hostlistArgs) --new --filter-tcp=443 --split-pos=1,midsld --disorder --fake \(hostlistArgs)"
218+
TPWS_OPT="
219+
--filter-tcp=80 --methodeol <HOSTLIST> --new
220+
--filter-tcp=443 --split-pos=1,midsld --disorder --dpi-desync-fake-tls=0x00000000 <HOSTLIST>
221+
"
215222
"""
216223
case .fakeOnly:
217224
return """
218225
\(commonVars)
219-
TPWS_OPT="--filter-tcp=80 --methodeol \(hostlistArgs) --new --filter-tcp=443 --fake \(hostlistArgs)"
226+
TPWS_OPT="
227+
--filter-tcp=80 --methodeol <HOSTLIST> --new
228+
--filter-tcp=443 --dpi-desync-fake-tls=0x00000000 <HOSTLIST>
229+
"
220230
"""
221231
}
222232
}

install_darkware.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ cp -R "$SOURCE_DIR/." "$TARGET_DIR/" || { echo "Copy failed" >> "$LOG"; exit 1;
2929
# Create/Reset strategy config if not exists - write default working config
3030
if [ ! -f "$TARGET_DIR/config_custom" ]; then
3131
cat > "$TARGET_DIR/config_custom" <<'CONFIGEOF'
32+
MODE_FILTER=autohostlist
3233
TPWS_ENABLE=1
3334
TPWS_SOCKS_ENABLE=1
3435
TPWS_PORTS=80,443
3536
INIT_APPLY_FW=1
36-
DISABLE_IPV6=0
37+
DISABLE_IPV6=1
3738
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+
GETLIST=get_refilter_domains.sh
40+
TPWS_OPT="
41+
--filter-tcp=80 --methodeol <HOSTLIST> --new
42+
--filter-tcp=443 --split-pos=1,midsld --disorder <HOSTLIST>
43+
"
3944
CONFIGEOF
4045
fi
4146
chmod 666 "$TARGET_DIR/config_custom"
@@ -61,11 +66,11 @@ touch "$TARGET_DIR/ipset/zapret-hosts.txt"
6166
# Make helper scripts executable
6267
chmod +x "$TARGET_DIR/ipset/"*.sh
6368

64-
# Try to download Antizapret list (disable gzip because tpws expects plain txt on macos usually, and easy_install disables it)
65-
echo "Downloading Antizapret hostlist..."
69+
# Try to download Re-filter list (contains YouTube and other needed domains)
70+
echo "Downloading Re-filter hostlist..."
6671
# Run in subshell to not change script cwd, ignore errors to not break install
67-
(export GZIP_LISTS=0 && cd "$TARGET_DIR/ipset" && ./get_antizapret_domains.sh) || echo "Warning: Failed to download Antizapret list. Using empty list."
68-
chmod 644 "$TARGET_DIR/ipset/"*.txt
72+
(export GZIP_LISTS=0 && cd "$TARGET_DIR/ipset" && ./get_refilter_domains.sh) || echo "Warning: Failed to download Re-filter list. Using empty list."
73+
chmod 644 "$TARGET_DIR/ipset/"*.txt
6974

7075
# Add dummy entry if user list is empty (best practice from install_easy.sh)
7176
if [ ! -s "$TARGET_DIR/ipset/zapret-hosts-user.txt" ]; then

0 commit comments

Comments
 (0)