Пример #1
0
func NewNetworkList(networks serial.StringLiteralList) NetworkList {
	list := NetworkList(make([]Network, networks.Len()))
	for idx, network := range networks {
		list[idx] = Network(network.TrimSpace().ToLower())
	}
	return list
}
Пример #2
0
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
}