code: func (s *awsIPs) tryUpdate() error {
  	response, err := fetchAWSIPs(s.host)
  	if err != nil {
  		return err
  	}
  
  	var ipv4 []net.IPNet
  	var ipv6 []net.IPNet
  
  	processAddress := func(output *[]net.IPNet, prefix string, region string) {
  		regionAllowed := false
  		if len(s.awsRegion) > 0 {
  			for _, ar := range s.awsRegion {
  				if strings.ToLower(region) == ar {
  					regionAllowed = true
  					break
  				}
  			}
  		} else {
  			regionAllowed = true
  		}
  
  		_, network, err := net.ParseCIDR(prefix)
  		if err != nil {
  			dcontext.GetLoggerWithFields(dcontext.Background(), map[interface{}]interface{}{
  				"cidr": prefix,
  			}).Error("unparseable cidr")
  			return
  		}
  		if regionAllowed {
  			*output = append(*output, *network)
  		}
  
  	}
  
  	for _, prefix := range response.Prefixes {
  		processAddress(&ipv4, prefix.IPV4Prefix, prefix.Region)
  	}
  	for _, prefix := range response.V6Prefixes {
  		processAddress(&ipv6, prefix.IPV6Prefix, prefix.Region)
  	}
  	s.mutex.Lock()
  	defer s.mutex.Unlock()
  	// Update each attr of awsips atomically.
  	s.ipv4 = ipv4
  	s.ipv6 = ipv6
  	s.initialized = true
  	return nil
  }
docs: // tryUpdate attempts to download the new set of ip addresses.
  // tryUpdate must be thread safe with contains