diff --git a/scripts/gen_multi2.py b/scripts/gen_multi2.py index 08ff6fc..2c2d58b 100644 --- a/scripts/gen_multi2.py +++ b/scripts/gen_multi2.py @@ -35,15 +35,15 @@ from gen_test_data import ( # When a row has a given snam/cnam, its :ipd is replaced with one of these IPs. # This creates realistic topology — servers have high in-degree. -# CDN: 3 edge nodes in different regions -CDN_IPS = ['203.0.113.10', '203.0.113.11', '203.0.113.12'] -API_IPS = ['198.51.100.20', '198.51.100.21'] -MAIL_IPS = ['192.0.2.50', '192.0.2.51'] -AUTH_IPS = ['10.20.30.40'] -SOCIAL_IPS = ['172.16.100.10'] -STORAGE_IPS = ['198.51.100.50'] -STREAM_IPS = ['203.0.113.50', '203.0.113.51'] -SEARCH_IPS = ['198.51.100.60'] +# CDN: 3 edge nodes in different regions (Akamai/Cloudflare ranges) +CDN_IPS = ['23.0.5.10', '104.16.100.10', '151.101.1.10'] +API_IPS = ['52.84.100.20', '54.230.100.20'] # Amazon CloudFront +MAIL_IPS = ['74.125.200.26', '66.102.1.26'] # Google mail +AUTH_IPS = ['40.126.32.100'] # Microsoft Azure +SOCIAL_IPS = ['157.240.1.35'] # Facebook +STORAGE_IPS = ['52.216.100.50'] # Amazon S3 +STREAM_IPS = ['52.84.200.50', '54.192.200.50'] # Amazon CloudFront +SEARCH_IPS = ['142.250.80.4'] # Google SNAM_TO_IPS = { 'cdn.example.com': CDN_IPS, @@ -75,25 +75,15 @@ ALL_SERVER_IPS = list(set( ip for pool in SNAM_TO_IPS.values() for ip in pool )) -# Server IP → geo info (so GeoIP columns match when we remap :ipd) -SERVER_GEO = { - '203.0.113.10': {'lat': 37.77, 'lon': -122.42, 'city': 'San Francisco', 'country': 'us', 'isp': 'AT&T', 'org': 'Amazon.com Inc.'}, - '203.0.113.11': {'lat': 40.71, 'lon': -74.00, 'city': 'New York', 'country': 'us', 'isp': 'Verizon', 'org': 'Google LLC'}, - '203.0.113.12': {'lat': 51.51, 'lon': -0.13, 'city': 'London', 'country': 'gb', 'isp': 'BT Group', 'org': 'Microsoft Corp.'}, - '198.51.100.20': {'lat': 31.23, 'lon': 121.47, 'city': 'Shanghai', 'country': 'cn', 'isp': 'China Mobile','org': 'Tencent'}, - '198.51.100.21': {'lat': 39.90, 'lon': 116.40, 'city': 'Beijing', 'country': 'cn', 'isp': 'China Telecom','org': 'Alibaba Inc.'}, - '192.0.2.50': {'lat': 37.77, 'lon': -122.42, 'city': 'San Francisco', 'country': 'us', 'isp': 'AT&T', 'org': 'Google LLC'}, - '192.0.2.51': {'lat': 50.11, 'lon': 8.68, 'city': 'Frankfurt', 'country': 'de', 'isp': 'Deutsche Telekom', 'org': 'Meta Platforms'}, - '10.20.30.40': {'lat': 40.71, 'lon': -74.00, 'city': 'New York', 'country': 'us', 'isp': 'Verizon', 'org': 'Microsoft Corp.'}, - '172.16.100.10': {'lat': 37.77, 'lon': -122.42, 'city': 'San Francisco', 'country': 'us', 'isp': 'AT&T', 'org': 'Meta Platforms'}, - '198.51.100.50': {'lat': 40.71, 'lon': -74.00, 'city': 'New York', 'country': 'us', 'isp': 'Verizon', 'org': 'Amazon.com Inc.'}, - '203.0.113.50': {'lat': 1.35, 'lon': 103.82, 'city': 'Singapore', 'country': 'sg', 'isp': 'Singtel', 'org': 'Netflix Inc.'}, - '203.0.113.51': {'lat': 35.68, 'lon': 139.76, 'city': 'Tokyo', 'country': 'jp', 'isp': 'NTT', 'org': 'Apple Inc.'}, - '198.51.100.60': {'lat': 37.77, 'lon': -122.42, 'city': 'San Francisco', 'country': 'us', 'isp': 'AT&T', 'org': 'Google LLC'}, -} - -# Proxy IPs — high out-degree (appear as :ips connecting to many servers) -PROXY_IPS = ['10.0.1.1', '10.0.2.1', '10.0.3.1', '10.0.4.1', '10.0.5.1'] +# Proxy IPs — public IPs resolvable by GeoIP MMDB +# MUST be public IPs that GeoIP can resolve (no private ranges!) +PROXY_IPS = [ + '1.1.1.1', # Cloudflare DNS — US-West + '8.8.8.8', # Google DNS — US-West + '223.5.5.5', # AliDNS — CN + '208.67.222.222', # OpenDNS — US-East + '77.88.8.8', # Yandex DNS — EU +] def main(): @@ -179,17 +169,7 @@ def main(): row[':ips'] = random.choice(PROXY_IPS) row['client-ip'] = row[':ips'] - # Update GeoIP columns to match server location - geo = SERVER_GEO.get(dst_ip) - if geo: - rlat = round(geo['lat'] + random.uniform(-0.3, 0.3), 6) - rlon = round(geo['lon'] + random.uniform(-0.3, 0.3), 6) - row[':ipd.latd'] = str(rlat) - row[':ipd.lond'] = str(rlon) - row[':ipd.city'] = geo['city'] - row[':ipd.ispn'] = geo['isp'] - row[':ipd.orgn'] = geo['org'] - row['dcnt'] = geo['country'] + # GeoIP: use MMDB in upload flow; CSV lat/lon are ignored anyway file_rows.append(row) degree_src[row[':ips']] += 1