mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
461 B
24 lines
461 B
9 years ago
|
// +build json
|
||
|
|
||
|
package dns
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
|
||
|
"github.com/v2ray/v2ray-core/common/serial"
|
||
|
)
|
||
|
|
||
|
func (this *CacheConfig) UnmarshalJSON(data []byte) error {
|
||
|
var strlist serial.StringLiteralList
|
||
|
if err := json.Unmarshal(data, strlist); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
config := &CacheConfig{
|
||
|
TrustedTags: make(map[serial.StringLiteral]bool, strlist.Len()),
|
||
|
}
|
||
|
for _, str := range strlist {
|
||
|
config.TrustedTags[str.TrimSpace()] = true
|
||
|
}
|
||
|
return nil
|
||
|
}
|