Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.
/ warp.sh Public archive

自定义 DNS #102

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ help Prints this message or the help of the given subcommand(s)
menu Chinese special features menu
```

### Configuring Custom DNS

To configure custom DNS, set the environment variables `WireGuard_Interface_DNS_IPv4` and `WireGuard_Interface_DNS_IPv6`.

```bash
export WireGuard_Interface_DNS_IPv4 = '1.1.1.1,8.8.8.8'
export WireGuard_Interface_DNS_IPv6 = '2606:4700:4700::1111,2001:4860:4860::8888'
bash <(curl -fsSL git.io/warp.sh) proxy
```

### Example

- Install and automatically configure the Proxy Mode feature of the WARP client, enable the local loopback port 40000, and use an application that supports SOCKS5 to connect to this port.
Expand Down
14 changes: 12 additions & 2 deletions warp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,20 @@ WGCF_ProfilePath="${WGCF_ProfileDir}/${WGCF_Profile}"
WireGuard_Interface='wgcf'
WireGuard_ConfPath="/etc/wireguard/${WireGuard_Interface}.conf"

WireGuard_Interface_DNS_IPv4='8.8.8.8,8.8.4.4'
WireGuard_Interface_DNS_IPv6='2001:4860:4860::8888,2001:4860:4860::8844'
# Set DNS
if [ ! ${WireGuard_Interface_DNS_IPv4} ]
then
WireGuard_Interface_DNS_IPv4='1.1.1.1,8.8.8.8'
fi

if [ ! ${WireGuard_Interface_DNS_IPv6} ]
then
WireGuard_Interface_DNS_IPv6='2606:4700:4700::1111,2001:4860:4860::8888'
fi

WireGuard_Interface_DNS_46="${WireGuard_Interface_DNS_IPv4},${WireGuard_Interface_DNS_IPv6}"
WireGuard_Interface_DNS_64="${WireGuard_Interface_DNS_IPv6},${WireGuard_Interface_DNS_IPv4}"
echo "You have configured the DNS to $WireGuard_Interface_DNS_46."
WireGuard_Interface_Rule_table='51888'
WireGuard_Interface_Rule_fwmark='51888'
WireGuard_Interface_MTU='1280'
Expand Down