mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-09-29 15:26:29 -04:00
added json parser for multi fake dns pool
This commit is contained in:
parent
1ed32e35a6
commit
94ab10fce3
@ -6,12 +6,26 @@ import (
|
|||||||
"github.com/v2fly/v2ray-core/v4/app/dns/fakedns"
|
"github.com/v2fly/v2ray-core/v4/app/dns/fakedns"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FakeDNSConfig struct {
|
type FakeDNSPoolElementConfig struct {
|
||||||
IPPool string `json:"ipPool"`
|
IPPool string `json:"ipPool"`
|
||||||
LruSize int64 `json:"poolSize"`
|
LruSize int64 `json:"poolSize"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FakeDNSConfig struct {
|
||||||
|
IPPool string `json:"ipPool"`
|
||||||
|
LruSize int64 `json:"poolSize"`
|
||||||
|
Pools *[]FakeDNSPoolElementConfig `json:"pools,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
func (f FakeDNSConfig) Build() (proto.Message, error) {
|
func (f FakeDNSConfig) Build() (proto.Message, error) {
|
||||||
|
if f.Pools != nil {
|
||||||
|
fakeDNSPool := &fakedns.FakeDnsPoolMulti{}
|
||||||
|
for _, v := range *f.Pools {
|
||||||
|
fakeDNSPool.Pools = append(fakeDNSPool.Pools, &fakedns.FakeDnsPool{IpPool: v.IPPool, LruSize: v.LruSize})
|
||||||
|
}
|
||||||
|
return fakeDNSPool, nil
|
||||||
|
}
|
||||||
|
|
||||||
return &fakedns.FakeDnsPool{
|
return &fakedns.FakeDnsPool{
|
||||||
IpPool: f.IPPool,
|
IpPool: f.IPPool,
|
||||||
LruSize: f.LruSize,
|
LruSize: f.LruSize,
|
||||||
|
Loading…
Reference in New Issue
Block a user