Files
builder/ubuntu/scripts/ipv6-mode.sh
T
2026-05-18 00:53:22 +08:00

19 lines
473 B
Bash

#!/usr/bin/env bash
set -euo pipefail
if [ "${XRAY_IPV6_ENABLED:-0}" = "1" ]; then
echo "IPv6 enabled by XRAY_IPV6_ENABLED=1." >&2
exit 0
fi
for path in \
/proc/sys/net/ipv6/conf/all/disable_ipv6 \
/proc/sys/net/ipv6/conf/default/disable_ipv6 \
/proc/sys/net/ipv6/conf/lo/disable_ipv6; do
if [ -w "${path}" ]; then
printf '1' >"${path}" || true
fi
done
echo "IPv6 disabled by default. Set XRAY_IPV6_ENABLED=1 to keep it enabled." >&2