mirror of
https://github.com/anten-ka/go_warp_pro.git
synced 2026-05-19 14:26:00 +00:00
Fix YouTube hangs: MTU 1280->1380, add MSS clamping (TCPMSS --clamp-mss-to-pmtu) for warp interface
Made-with: Cursor
This commit is contained in:
11
warp.sh
11
warp.sh
@@ -665,7 +665,7 @@ awg_build_warp_conf() {
|
||||
[Interface]
|
||||
PrivateKey = ${pk}
|
||||
Address = ${addr}
|
||||
MTU = 1280
|
||||
MTU = 1380
|
||||
Table = off
|
||||
|
||||
[Peer]
|
||||
@@ -1033,6 +1033,10 @@ awg_cleanup_rules() {
|
||||
rule=$(echo "$line" | sed "s/^-A /-D /")
|
||||
iptables -t nat $rule || true
|
||||
done
|
||||
iptables -t mangle -S FORWARD 2>/dev/null | grep "\-o warp.*TCPMSS" | while read -r line; do
|
||||
rule=$(echo "$line" | sed "s/^-A /-D /")
|
||||
iptables -t mangle $rule || true
|
||||
done
|
||||
ip route flush table 100 2>/dev/null || true
|
||||
' >/dev/null 2>&1 || true
|
||||
}
|
||||
@@ -1041,6 +1045,10 @@ awg_apply_rules() {
|
||||
awg_cleanup_rules
|
||||
[ ${#AWG_SELECTED_IPS[@]} -eq 0 ] && return 0
|
||||
docker exec "$CONTAINER" sh -c "ip route add default dev warp table 100 2>/dev/null || ip route replace default dev warp table 100 2>/dev/null || true"
|
||||
docker exec "$CONTAINER" sh -c "
|
||||
iptables -t mangle -C FORWARD -o warp -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu 2>/dev/null || \
|
||||
iptables -t mangle -A FORWARD -o warp -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu 2>/dev/null || true
|
||||
"
|
||||
local prio=100
|
||||
for ip in "${AWG_SELECTED_IPS[@]}"; do
|
||||
docker exec "$CONTAINER" sh -c "
|
||||
@@ -1067,6 +1075,7 @@ awg_patch_start_sh() {
|
||||
|
||||
if [ ${#AWG_SELECTED_IPS[@]} -gt 0 ]; then
|
||||
warp_block+="ip route add default dev warp table 100 2>/dev/null || ip route replace default dev warp table 100 2>/dev/null || true"$'\n'
|
||||
warp_block+="iptables -t mangle -C FORWARD -o warp -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu 2>/dev/null || iptables -t mangle -A FORWARD -o warp -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu 2>/dev/null || true"$'\n'
|
||||
warp_block+=""$'\n'
|
||||
local prio=100
|
||||
for ip in "${AWG_SELECTED_IPS[@]}"; do
|
||||
|
||||
Reference in New Issue
Block a user