mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05: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"
|
||||
)
|
||||
|
||||
type FakeDNSConfig struct {
|
||||
type FakeDNSPoolElementConfig struct {
|
||||
IPPool string `json:"ipPool"`
|
||||
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) {
|
||||
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{
|
||||
IpPool: f.IPPool,
|
||||
LruSize: f.LruSize,
|
||||
|
Loading…
Reference in New Issue
Block a user