Skip to content

Commit

Permalink
Fix DNS issue in TUN mode (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
NarukawaHime committed Jun 9, 2022
1 parent c55a5f6 commit 406135b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Netch/Controllers/TUNController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public async Task StartAsync(Socks5Server server, Mode mode)

if (_tunConfig.UseCustomDNS)
{
Dial(NameList.TYPE_DNSADDR, _tunConfig.DNS);
Dial(NameList.TYPE_DNSADDR, DnsUtils.AppendPort(_tunConfig.DNS));
}
else
{
Expand Down Expand Up @@ -175,8 +175,13 @@ private void SetupRouteTable()

if (_tunConfig.UseCustomDNS)
{
// NOTICE: DNS metric is network interface metric
RouteUtils.CreateRoute(_tun.FillTemplate(_tunConfig.DNS, 32));
if (_tunConfig.ProxyDNS)
{
// NOTICE: DNS metric is network interface metric
RouteUtils.CreateRoute(_tun.FillTemplate(_tunConfig.DNS, 32));
}

tunNetworkInterface.SetDns(_tunConfig.DNS);
}
else
{
Expand Down

0 comments on commit 406135b

Please sign in to comment.