public static NormalizedLocation TryParseFromSection(RawWhoisSection section) { var location = new NormalizedLocation() { Address = NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, addressFields, allBlacklistedValues), Street = NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, streetFields, allBlacklistedValues), City = NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, cityFields, allBlacklistedValues), StateProvince = NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, stateProvinceFields, allBlacklistedValues), PostalCode = RemoveExtraPrefix(NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, postalCodeFields, allBlacklistedValues)), Country = NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, countryFields, blacklistedValuesExceptSimilarToCountries), // Not using blacklisted values because NA is a valid country Geolocation = NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, geolocationFields) }; return(location); }
public static NormalizedOrganization TryParseFromSection(RawWhoisSection section) { if (organizationTypes.Contains(section.Type)) { var organization = new NormalizedOrganization() { Location = NormalizedLocation.TryParseFromSection(section), Phone = NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, phoneFields) }; NormalizationUtils.ExtractCommonRecordMetadata(section, section.Id, nameFields, organization); return(organization); } return(null); }
public static NormalizedNetwork TryParseFromSection(RawWhoisSection section) { if (networkTypes.Contains(section.Type)) { var network = new NormalizedNetwork() { Location = NormalizedLocation.TryParseFromSection(section), AuthArea = NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, authAreaFields), OriginAS = NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, originASFields), Status = NormalizationUtils.FindFirstMatchingFieldValueInRecords(section, statusFields) }; var candidateRanges = NormalizationUtils.FindAllMatchingFieldValuesInRecords(section, ipRangeFields); if (candidateRanges != null) { IPAddressRange range = null; foreach (var candidateRange in candidateRanges) { if (IPAddressRange.TryParse(candidateRange, out range)) { break; } } network.IPRange = range; } else { // TODO: Some networks do not have an explicit IP range but maybe we can get it from the Auth Area or from the ID? } NormalizationUtils.ExtractCommonRecordMetadata(section, section.Id, nameFields, network); return(network); } return(null); }