forked from mirror/serenity
Add template.custom_fakeip
This commit is contained in:
parent
ea777c25b0
commit
774257d003
@ -22,6 +22,7 @@
|
|||||||
"enable_fakeip": false,
|
"enable_fakeip": false,
|
||||||
"pre_dns_rules": [],
|
"pre_dns_rules": [],
|
||||||
"custom_dns_rules": [],
|
"custom_dns_rules": [],
|
||||||
|
"custom_fakeip": {},
|
||||||
|
|
||||||
// Inbound
|
// Inbound
|
||||||
|
|
||||||
@ -158,6 +159,10 @@ List of [DNS Rule](https://sing-box.sagernet.org/configuration/dns/rule/).
|
|||||||
|
|
||||||
No default traffic bypassing DNS rules will be generated if not empty.
|
No default traffic bypassing DNS rules will be generated if not empty.
|
||||||
|
|
||||||
|
#### custom_fakeip
|
||||||
|
|
||||||
|
Custom [FakeIP](https://sing-box.sagernet.org/configuration/dns/fakeip/) template.
|
||||||
|
|
||||||
#### inbounds
|
#### inbounds
|
||||||
|
|
||||||
List of [Inbound](https://sing-box.sagernet.org/configuration/inbound/).
|
List of [Inbound](https://sing-box.sagernet.org/configuration/inbound/).
|
||||||
|
@ -35,6 +35,7 @@ type _Template struct {
|
|||||||
DisableDNSLeak bool `json:"disable_dns_leak,omitempty"`
|
DisableDNSLeak bool `json:"disable_dns_leak,omitempty"`
|
||||||
PreDNSRules []option.DNSRule `json:"pre_dns_rules,omitempty"`
|
PreDNSRules []option.DNSRule `json:"pre_dns_rules,omitempty"`
|
||||||
CustomDNSRules []option.DNSRule `json:"custom_dns_rules,omitempty"`
|
CustomDNSRules []option.DNSRule `json:"custom_dns_rules,omitempty"`
|
||||||
|
CustomFakeIP *option.DNSFakeIPOptions `json:"custom_fakeip,omitempty"`
|
||||||
|
|
||||||
// Inbound
|
// Inbound
|
||||||
Inbounds []option.Inbound `json:"inbounds,omitempty"`
|
Inbounds []option.Inbound `json:"inbounds,omitempty"`
|
||||||
|
@ -94,11 +94,15 @@ func (t *Template) renderDNS(metadata M.Metadata, options *option.Options) error
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
if t.EnableFakeIP {
|
if t.EnableFakeIP {
|
||||||
options.DNS.FakeIP = &option.DNSFakeIPOptions{
|
options.DNS.FakeIP = t.CustomFakeIP
|
||||||
Enabled: true,
|
if options.DNS.FakeIP == nil {
|
||||||
Inet4Range: common.Ptr(netip.MustParsePrefix("198.18.0.0/15")),
|
options.DNS.FakeIP = &option.DNSFakeIPOptions{}
|
||||||
}
|
}
|
||||||
if !t.DisableIPv6() {
|
options.DNS.FakeIP.Enabled = true
|
||||||
|
if !options.DNS.FakeIP.Inet4Range.IsValid() {
|
||||||
|
options.DNS.FakeIP.Inet4Range = common.Ptr(netip.MustParsePrefix("198.18.0.0/15"))
|
||||||
|
}
|
||||||
|
if !t.DisableIPv6() && !options.DNS.FakeIP.Inet6Range.IsValid() {
|
||||||
options.DNS.FakeIP.Inet6Range = common.Ptr(netip.MustParsePrefix("fc00::/18"))
|
options.DNS.FakeIP.Inet6Range = common.Ptr(netip.MustParsePrefix("fc00::/18"))
|
||||||
}
|
}
|
||||||
options.DNS.Servers = append(options.DNS.Servers, option.DNSServerOptions{
|
options.DNS.Servers = append(options.DNS.Servers, option.DNSServerOptions{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user