[Feature] Set final DNS to avoid issues when using templates.extend
with templates.servers
#37
Labels
bug
Something isn't working
Commit: 474ab7e
According to the source code1, using
templates.extend
to extend a template, fields of type list in the derived template will be prepended to the field in the base template (which is a good feature, especially when overriding DNS/route rules). However, it raises an issue when extendingservers
(DNS servers) in a template.For example, for the following configuration:
the
derived
template produces the following DNS config:The newly added DNS server
internal
is the first in the list, therefore becomes the final DNS server2, which is not desired. We desire the originaldefault
DNS server to be the final one.Therefore, we propose serenity to set
dns.final
todefault
(or user-specified value) to avoid this issue. It seems to require only one line of change:Footnotes
https://github.com/SagerNet/sing/blob/9f69e7f9f7e2c4fc26828d98ec9f81ab72fdec98/common/json/badjson/merge.go#L111-L120 ↩
https://github.com/SagerNet/sing-box/blob/77e4d86fa02d2f476e7a6767e8ea1de830a0b8b0/route/router.go#L268 ↩
The text was updated successfully, but these errors were encountered: