mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-02 16:21:05 +00:00
dns config
This commit is contained in:
1 parent
95c8910f87
commit
5b3e84ede6
6 files changed
+67
-20
No files matched your search
@@ -0,0 +1,35 @@
|
||||
package json
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
serialjson "github.com/v2ray/v2ray-core/common/serial/json"
|
||||
)
|
||||
|
||||
type TagList map[string]bool
|
||||
|
||||
func NewTagList(tags []string) TagList {
|
||||
list := TagList(make(map[string]bool))
|
||||
for _, tag := range tags {
|
||||
list[strings.TrimSpace(tag)] = true
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
func (this *TagList) UnmarshalJSON(data []byte) error {
|
||||
tags, err := serialjson.UnmarshalStringList(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*this = NewTagList(tags)
|
||||
return nil
|
||||
}
|
||||
|
||||
type CacheConfig struct {
|
||||
TrustedTags TagList `json:"trustedTags"`
|
||||
}
|
||||
|
||||
func (this *CacheConfig) IsTrustedSource(tag string) bool {
|
||||
_, found := this.TrustedTags[tag]
|
||||
return found
|
||||
}
|
||||
Reference in new issue
Block a user