Skip to content

Commit

Permalink
Add custom DNS servers
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Oct 23, 2024
1 parent fe3c2b4 commit 4f768e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 7 additions & 6 deletions option/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ type _Template struct {
RemoteResolve bool `json:"remote_resolve,omitempty"`

// DNS
DNS string `json:"dns,omitempty"`
DNSLocal string `json:"dns_local,omitempty"`
EnableFakeIP bool `json:"enable_fakeip,omitempty"`
DisableDNSLeak bool `json:"disable_dns_leak,omitempty"`
PreDNSRules []option.DNSRule `json:"pre_dns_rules,omitempty"`
CustomDNSRules []option.DNSRule `json:"custom_dns_rules,omitempty"`
Servers []option.DNSServerOptions `json:"servers,omitempty"`
DNS string `json:"dns,omitempty"`
DNSLocal string `json:"dns_local,omitempty"`
EnableFakeIP bool `json:"enable_fakeip,omitempty"`
DisableDNSLeak bool `json:"disable_dns_leak,omitempty"`
PreDNSRules []option.DNSRule `json:"pre_dns_rules,omitempty"`
CustomDNSRules []option.DNSRule `json:"custom_dns_rules,omitempty"`

// Inbound
Inbounds []option.Inbound `json:"inbounds,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions template/render_dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func (t *Template) renderDNS(metadata M.Metadata, options *option.Options) error
domainStrategyLocal = 0
}
options.DNS = &option.DNSOptions{
Servers: t.Servers,
ReverseMapping: !t.DisableTrafficBypass && metadata.Platform != M.PlatformUnknown && !metadata.Platform.IsApple(),
DNSClientOptions: option.DNSClientOptions{
Strategy: domainStrategy,
Expand Down

0 comments on commit 4f768e6

Please sign in to comment.