1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-09 11:51:02 -05:00
v2fly/app/dns/internal/config_json.go

24 lines
466 B
Go
Raw Normal View History

2016-01-15 09:23:12 -05:00
// +build json
2016-01-31 11:01:28 -05:00
package internal
2016-01-15 09:23:12 -05:00
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
}