From 0eed0ca11a3a8d680c67798d0317e58d16195758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sun, 31 Jul 2022 08:48:21 +0800 Subject: [PATCH] Fix dns outbound --- outbound/dns.go | 4 ++-- release/local/config.json | 27 ++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/outbound/dns.go b/outbound/dns.go index d4cf4174..b6a219fb 100644 --- a/outbound/dns.go +++ b/outbound/dns.go @@ -82,7 +82,7 @@ func (d *DNS) NewConnection(ctx context.Context, conn net.Conn, metadata adapter if err != nil { return err } - _responseBuffer := buf.StackNewSize(1024) + _responseBuffer := buf.StackNewPacket() defer common.KeepAlive(_responseBuffer) responseBuffer := common.Dup(_responseBuffer) defer responseBuffer.Release() @@ -133,7 +133,7 @@ func (d *DNS) NewPacketConnection(ctx context.Context, conn N.PacketConn, metada return err } timeout.Update() - _responseBuffer := buf.StackNewSize(1024) + _responseBuffer := buf.StackNewPacket() defer common.KeepAlive(_responseBuffer) responseBuffer := common.Dup(_responseBuffer) defer responseBuffer.Release() diff --git a/release/local/config.json b/release/local/config.json index d20c9050..ce359de6 100644 --- a/release/local/config.json +++ b/release/local/config.json @@ -2,13 +2,38 @@ "log": { "level": "info" }, + "dns": { + "servers": [ + { + "address": "tls://8.8.8.8" + } + ] + }, "inbounds": [ { "type": "shadowsocks", "listen": "::", "listen_port": 8080, + "sniff": true, "method": "2022-blake3-aes-128-gcm", "password": "8JCsPssfgS8tiRwiMlhARg==" } - ] + ], + "outbounds": [ + { + "type": "direct" + }, + { + "type": "dns", + "tag": "dns-out" + } + ], + "route": { + "rules": [ + { + "protocol": "dns", + "outbound": "dns-out" + } + ] + } }