mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-09 19:07:14 -05:00
FakeDNS: use 198.18.0.0/15 as default IP pool (#779)
This commit is contained in:
parent
68f04295f9
commit
933861a761
@ -45,7 +45,7 @@ func NewFakeDNSHolder() (*Holder, error) {
|
||||
if fkdns, err = NewFakeDNSHolderConfigOnly(nil); err != nil {
|
||||
return nil, newError("Unable to create Fake Dns Engine").Base(err).AtError()
|
||||
}
|
||||
err = fkdns.initialize("240.0.0.0/8", 65535)
|
||||
err = fkdns.initialize("198.18.0.0/15", 65535)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ func TestFakeDnsHolderCreateMapping(t *testing.T) {
|
||||
common.Must(err)
|
||||
|
||||
addr := fkdns.GetFakeIPForDomain("fakednstest.v2fly.org")
|
||||
assert.Equal(t, "240.0.0.0", addr[0].IP().String())
|
||||
assert.Equal(t, "198.18.0.0", addr[0].IP().String())
|
||||
}
|
||||
|
||||
func TestFakeDnsHolderCreateMappingMany(t *testing.T) {
|
||||
@ -28,10 +28,10 @@ func TestFakeDnsHolderCreateMappingMany(t *testing.T) {
|
||||
common.Must(err)
|
||||
|
||||
addr := fkdns.GetFakeIPForDomain("fakednstest.v2fly.org")
|
||||
assert.Equal(t, "240.0.0.0", addr[0].IP().String())
|
||||
assert.Equal(t, "198.18.0.0", addr[0].IP().String())
|
||||
|
||||
addr2 := fkdns.GetFakeIPForDomain("fakednstest2.v2fly.org")
|
||||
assert.Equal(t, "240.0.0.1", addr2[0].IP().String())
|
||||
assert.Equal(t, "198.18.0.1", addr2[0].IP().String())
|
||||
}
|
||||
|
||||
func TestFakeDnsHolderCreateMappingManyAndResolve(t *testing.T) {
|
||||
@ -40,21 +40,21 @@ func TestFakeDnsHolderCreateMappingManyAndResolve(t *testing.T) {
|
||||
|
||||
{
|
||||
addr := fkdns.GetFakeIPForDomain("fakednstest.v2fly.org")
|
||||
assert.Equal(t, "240.0.0.0", addr[0].IP().String())
|
||||
assert.Equal(t, "198.18.0.0", addr[0].IP().String())
|
||||
}
|
||||
|
||||
{
|
||||
addr2 := fkdns.GetFakeIPForDomain("fakednstest2.v2fly.org")
|
||||
assert.Equal(t, "240.0.0.1", addr2[0].IP().String())
|
||||
assert.Equal(t, "198.18.0.1", addr2[0].IP().String())
|
||||
}
|
||||
|
||||
{
|
||||
result := fkdns.GetDomainFromFakeDNS(net.ParseAddress("240.0.0.0"))
|
||||
result := fkdns.GetDomainFromFakeDNS(net.ParseAddress("198.18.0.0"))
|
||||
assert.Equal(t, "fakednstest.v2fly.org", result)
|
||||
}
|
||||
|
||||
{
|
||||
result := fkdns.GetDomainFromFakeDNS(net.ParseAddress("240.0.0.1"))
|
||||
result := fkdns.GetDomainFromFakeDNS(net.ParseAddress("198.18.0.1"))
|
||||
assert.Equal(t, "fakednstest2.v2fly.org", result)
|
||||
}
|
||||
}
|
||||
@ -64,10 +64,10 @@ func TestFakeDnsHolderCreateMappingManySingleDomain(t *testing.T) {
|
||||
common.Must(err)
|
||||
|
||||
addr := fkdns.GetFakeIPForDomain("fakednstest.v2fly.org")
|
||||
assert.Equal(t, "240.0.0.0", addr[0].IP().String())
|
||||
assert.Equal(t, "198.18.0.0", addr[0].IP().String())
|
||||
|
||||
addr2 := fkdns.GetFakeIPForDomain("fakednstest.v2fly.org")
|
||||
assert.Equal(t, "240.0.0.0", addr2[0].IP().String())
|
||||
assert.Equal(t, "198.18.0.0", addr2[0].IP().String())
|
||||
}
|
||||
|
||||
func TestFakeDnsHolderCreateMappingAndRollOver(t *testing.T) {
|
||||
|
@ -37,7 +37,7 @@ func (FakeDNSPostProcessingStage) Process(conf *Config) error {
|
||||
if conf.FakeDNS == nil {
|
||||
// Add a Fake DNS Config if there is none
|
||||
conf.FakeDNS = &FakeDNSConfig{
|
||||
IPPool: "240.0.0.0/8",
|
||||
IPPool: "198.18.0.0/15",
|
||||
LruSize: 65535,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user