OLD | NEW |
| (Empty) |
1 # -*- coding: utf-8 -*- | |
2 """ | |
3 Constants needed for the binary parser. Part of the pygeoip package. | |
4 | |
5 @author: Jennifer Ennis <zaylea@gmail.com> | |
6 | |
7 @license: Copyright(C) 2004 MaxMind LLC | |
8 | |
9 This program is free software: you can redistribute it and/or modify | |
10 it under the terms of the GNU Lesser General Public License as published by | |
11 the Free Software Foundation, either version 3 of the License, or | |
12 (at your option) any later version. | |
13 | |
14 This program is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
19 You should have received a copy of the GNU Lesser General Public License | |
20 along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>. | |
21 """ | |
22 | |
23 from platform import python_version_tuple | |
24 | |
25 PY2 = python_version_tuple()[0] == '2' | |
26 PY3 = python_version_tuple()[0] == '3' | |
27 | |
28 GEOIP_STANDARD = 0 | |
29 GEOIP_MEMORY_CACHE = 1 | |
30 | |
31 DMA_MAP = { | |
32 500: 'Portland-Auburn, ME', | |
33 501: 'New York, NY', | |
34 502: 'Binghamton, NY', | |
35 503: 'Macon, GA', | |
36 504: 'Philadelphia, PA', | |
37 505: 'Detroit, MI', | |
38 506: 'Boston, MA', | |
39 507: 'Savannah, GA', | |
40 508: 'Pittsburgh, PA', | |
41 509: 'Ft Wayne, IN', | |
42 510: 'Cleveland, OH', | |
43 511: 'Washington, DC', | |
44 512: 'Baltimore, MD', | |
45 513: 'Flint, MI', | |
46 514: 'Buffalo, NY', | |
47 515: 'Cincinnati, OH', | |
48 516: 'Erie, PA', | |
49 517: 'Charlotte, NC', | |
50 518: 'Greensboro, NC', | |
51 519: 'Charleston, SC', | |
52 520: 'Augusta, GA', | |
53 521: 'Providence, RI', | |
54 522: 'Columbus, GA', | |
55 523: 'Burlington, VT', | |
56 524: 'Atlanta, GA', | |
57 525: 'Albany, GA', | |
58 526: 'Utica-Rome, NY', | |
59 527: 'Indianapolis, IN', | |
60 528: 'Miami, FL', | |
61 529: 'Louisville, KY', | |
62 530: 'Tallahassee, FL', | |
63 531: 'Tri-Cities, TN', | |
64 532: 'Albany-Schenectady-Troy, NY', | |
65 533: 'Hartford, CT', | |
66 534: 'Orlando, FL', | |
67 535: 'Columbus, OH', | |
68 536: 'Youngstown-Warren, OH', | |
69 537: 'Bangor, ME', | |
70 538: 'Rochester, NY', | |
71 539: 'Tampa, FL', | |
72 540: 'Traverse City-Cadillac, MI', | |
73 541: 'Lexington, KY', | |
74 542: 'Dayton, OH', | |
75 543: 'Springfield-Holyoke, MA', | |
76 544: 'Norfolk-Portsmouth, VA', | |
77 545: 'Greenville-New Bern-Washington, NC', | |
78 546: 'Columbia, SC', | |
79 547: 'Toledo, OH', | |
80 548: 'West Palm Beach, FL', | |
81 549: 'Watertown, NY', | |
82 550: 'Wilmington, NC', | |
83 551: 'Lansing, MI', | |
84 552: 'Presque Isle, ME', | |
85 553: 'Marquette, MI', | |
86 554: 'Wheeling, WV', | |
87 555: 'Syracuse, NY', | |
88 556: 'Richmond-Petersburg, VA', | |
89 557: 'Knoxville, TN', | |
90 558: 'Lima, OH', | |
91 559: 'Bluefield-Beckley-Oak Hill, WV', | |
92 560: 'Raleigh-Durham, NC', | |
93 561: 'Jacksonville, FL', | |
94 563: 'Grand Rapids, MI', | |
95 564: 'Charleston-Huntington, WV', | |
96 565: 'Elmira, NY', | |
97 566: 'Harrisburg-Lancaster-Lebanon-York, PA', | |
98 567: 'Greenville-Spartenburg, SC', | |
99 569: 'Harrisonburg, VA', | |
100 570: 'Florence-Myrtle Beach, SC', | |
101 571: 'Ft Myers, FL', | |
102 573: 'Roanoke-Lynchburg, VA', | |
103 574: 'Johnstown-Altoona, PA', | |
104 575: 'Chattanooga, TN', | |
105 576: 'Salisbury, MD', | |
106 577: 'Wilkes Barre-Scranton, PA', | |
107 581: 'Terre Haute, IN', | |
108 582: 'Lafayette, IN', | |
109 583: 'Alpena, MI', | |
110 584: 'Charlottesville, VA', | |
111 588: 'South Bend, IN', | |
112 592: 'Gainesville, FL', | |
113 596: 'Zanesville, OH', | |
114 597: 'Parkersburg, WV', | |
115 598: 'Clarksburg-Weston, WV', | |
116 600: 'Corpus Christi, TX', | |
117 602: 'Chicago, IL', | |
118 603: 'Joplin-Pittsburg, MO', | |
119 604: 'Columbia-Jefferson City, MO', | |
120 605: 'Topeka, KS', | |
121 606: 'Dothan, AL', | |
122 609: 'St Louis, MO', | |
123 610: 'Rockford, IL', | |
124 611: 'Rochester-Mason City-Austin, MN', | |
125 612: 'Shreveport, LA', | |
126 613: 'Minneapolis-St Paul, MN', | |
127 616: 'Kansas City, MO', | |
128 617: 'Milwaukee, WI', | |
129 618: 'Houston, TX', | |
130 619: 'Springfield, MO', | |
131 620: 'Tuscaloosa, AL', | |
132 622: 'New Orleans, LA', | |
133 623: 'Dallas-Fort Worth, TX', | |
134 624: 'Sioux City, IA', | |
135 625: 'Waco-Temple-Bryan, TX', | |
136 626: 'Victoria, TX', | |
137 627: 'Wichita Falls, TX', | |
138 628: 'Monroe, LA', | |
139 630: 'Birmingham, AL', | |
140 631: 'Ottumwa-Kirksville, IA', | |
141 632: 'Paducah, KY', | |
142 633: 'Odessa-Midland, TX', | |
143 634: 'Amarillo, TX', | |
144 635: 'Austin, TX', | |
145 636: 'Harlingen, TX', | |
146 637: 'Cedar Rapids-Waterloo, IA', | |
147 638: 'St Joseph, MO', | |
148 639: 'Jackson, TN', | |
149 640: 'Memphis, TN', | |
150 641: 'San Antonio, TX', | |
151 642: 'Lafayette, LA', | |
152 643: 'Lake Charles, LA', | |
153 644: 'Alexandria, LA', | |
154 646: 'Anniston, AL', | |
155 647: 'Greenwood-Greenville, MS', | |
156 648: 'Champaign-Springfield-Decatur, IL', | |
157 649: 'Evansville, IN', | |
158 650: 'Oklahoma City, OK', | |
159 651: 'Lubbock, TX', | |
160 652: 'Omaha, NE', | |
161 656: 'Panama City, FL', | |
162 657: 'Sherman, TX', | |
163 658: 'Green Bay-Appleton, WI', | |
164 659: 'Nashville, TN', | |
165 661: 'San Angelo, TX', | |
166 662: 'Abilene-Sweetwater, TX', | |
167 669: 'Madison, WI', | |
168 670: 'Ft Smith-Fay-Springfield, AR', | |
169 671: 'Tulsa, OK', | |
170 673: 'Columbus-Tupelo-West Point, MS', | |
171 675: 'Peoria-Bloomington, IL', | |
172 676: 'Duluth, MN', | |
173 678: 'Wichita, KS', | |
174 679: 'Des Moines, IA', | |
175 682: 'Davenport-Rock Island-Moline, IL', | |
176 686: 'Mobile, AL', | |
177 687: 'Minot-Bismarck-Dickinson, ND', | |
178 691: 'Huntsville, AL', | |
179 692: 'Beaumont-Port Author, TX', | |
180 693: 'Little Rock-Pine Bluff, AR', | |
181 698: 'Montgomery, AL', | |
182 702: 'La Crosse-Eau Claire, WI', | |
183 705: 'Wausau-Rhinelander, WI', | |
184 709: 'Tyler-Longview, TX', | |
185 710: 'Hattiesburg-Laurel, MS', | |
186 711: 'Meridian, MS', | |
187 716: 'Baton Rouge, LA', | |
188 717: 'Quincy, IL', | |
189 718: 'Jackson, MS', | |
190 722: 'Lincoln-Hastings, NE', | |
191 724: 'Fargo-Valley City, ND', | |
192 725: 'Sioux Falls, SD', | |
193 734: 'Jonesboro, AR', | |
194 736: 'Bowling Green, KY', | |
195 737: 'Mankato, MN', | |
196 740: 'North Platte, NE', | |
197 743: 'Anchorage, AK', | |
198 744: 'Honolulu, HI', | |
199 745: 'Fairbanks, AK', | |
200 746: 'Biloxi-Gulfport, MS', | |
201 747: 'Juneau, AK', | |
202 749: 'Laredo, TX', | |
203 751: 'Denver, CO', | |
204 752: 'Colorado Springs, CO', | |
205 753: 'Phoenix, AZ', | |
206 754: 'Butte-Bozeman, MT', | |
207 755: 'Great Falls, MT', | |
208 756: 'Billings, MT', | |
209 757: 'Boise, ID', | |
210 758: 'Idaho Falls-Pocatello, ID', | |
211 759: 'Cheyenne, WY', | |
212 760: 'Twin Falls, ID', | |
213 762: 'Missoula, MT', | |
214 764: 'Rapid City, SD', | |
215 765: 'El Paso, TX', | |
216 766: 'Helena, MT', | |
217 767: 'Casper-Riverton, WY', | |
218 770: 'Salt Lake City, UT', | |
219 771: 'Yuma, AZ', | |
220 773: 'Grand Junction, CO', | |
221 789: 'Tucson, AZ', | |
222 790: 'Albuquerque, NM', | |
223 798: 'Glendive, MT', | |
224 800: 'Bakersfield, CA', | |
225 801: 'Eugene, OR', | |
226 802: 'Eureka, CA', | |
227 803: 'Los Angeles, CA', | |
228 804: 'Palm Springs, CA', | |
229 807: 'San Francisco, CA', | |
230 810: 'Yakima-Pasco, WA', | |
231 811: 'Reno, NV', | |
232 813: 'Medford-Klamath Falls, OR', | |
233 819: 'Seattle-Tacoma, WA', | |
234 820: 'Portland, OR', | |
235 821: 'Bend, OR', | |
236 825: 'San Diego, CA', | |
237 828: 'Monterey-Salinas, CA', | |
238 839: 'Las Vegas, NV', | |
239 855: 'Santa Barbara, CA', | |
240 862: 'Sacramento, CA', | |
241 866: 'Fresno, CA', | |
242 868: 'Chico-Redding, CA', | |
243 881: 'Spokane, WA' | |
244 } | |
245 | |
246 COUNTRY_CODES = ( | |
247 '', | |
248 'AP', 'EU', 'AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AN', 'AO', 'AQ', | |
249 'AR', 'AS', 'AT', 'AU', 'AW', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', | |
250 'BH', 'BI', 'BJ', 'BM', 'BN', 'BO', 'BR', 'BS', 'BT', 'BV', 'BW', 'BY', | |
251 'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', | |
252 'CO', 'CR', 'CU', 'CV', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', | |
253 'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', | |
254 'FO', 'FR', 'FX', 'GA', 'GB', 'GD', 'GE', 'GF', 'GH', 'GI', 'GL', 'GM', | |
255 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN', | |
256 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', | |
257 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW', | |
258 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', | |
259 'LY', 'MA', 'MC', 'MD', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', | |
260 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', | |
261 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', | |
262 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PS', 'PT', 'PW', | |
263 'PY', 'QA', 'RE', 'RO', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', | |
264 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'ST', 'SV', 'SY', | |
265 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TM', 'TN', 'TO', 'TL', | |
266 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', | |
267 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'RS', 'ZA', | |
268 'ZM', 'ME', 'ZW', 'A1', 'A2', 'O1', 'AX', 'GG', 'IM', 'JE', 'BL', 'MF', | |
269 'BQ', 'SS' | |
270 ) | |
271 | |
272 COUNTRY_CODES3 = ( | |
273 '', 'AP', 'EU', 'AND', 'ARE', 'AFG', 'ATG', 'AIA', 'ALB', 'ARM', 'ANT', | |
274 'AGO', 'AQ', 'ARG', 'ASM', 'AUT', 'AUS', 'ABW', 'AZE', 'BIH', 'BRB', 'BGD', | |
275 'BEL', 'BFA', 'BGR', 'BHR', 'BDI', 'BEN', 'BMU', 'BRN', 'BOL', 'BRA', | |
276 'BHS', 'BTN', 'BV', 'BWA', 'BLR', 'BLZ', 'CAN', 'CC', 'COD', 'CAF', 'COG', | |
277 'CHE', 'CIV', 'COK', 'CHL', 'CMR', 'CHN', 'COL', 'CRI', 'CUB', 'CPV', 'CX', | |
278 'CYP', 'CZE', 'DEU', 'DJI', 'DNK', 'DMA', 'DOM', 'DZA', 'ECU', 'EST', | |
279 'EGY', 'ESH', 'ERI', 'ESP', 'ETH', 'FIN', 'FJI', 'FLK', 'FSM', 'FRO', | |
280 'FRA', 'FX', 'GAB', 'GBR', 'GRD', 'GEO', 'GUF', 'GHA', 'GIB', 'GRL', 'GMB', | |
281 'GIN', 'GLP', 'GNQ', 'GRC', 'GS', 'GTM', 'GUM', 'GNB', 'GUY', 'HKG', 'HM', | |
282 'HND', 'HRV', 'HTI', 'HUN', 'IDN', 'IRL', 'ISR', 'IND', 'IO', 'IRQ', 'IRN', | |
283 'ISL', 'ITA', 'JAM', 'JOR', 'JPN', 'KEN', 'KGZ', 'KHM', 'KIR', 'COM', | |
284 'KNA', 'PRK', 'KOR', 'KWT', 'CYM', 'KAZ', 'LAO', 'LBN', 'LCA', 'LIE', | |
285 'LKA', 'LBR', 'LSO', 'LTU', 'LUX', 'LVA', 'LBY', 'MAR', 'MCO', 'MDA', | |
286 'MDG', 'MHL', 'MKD', 'MLI', 'MMR', 'MNG', 'MAC', 'MNP', 'MTQ', 'MRT', | |
287 'MSR', 'MLT', 'MUS', 'MDV', 'MWI', 'MEX', 'MYS', 'MOZ', 'NAM', 'NCL', | |
288 'NER', 'NFK', 'NGA', 'NIC', 'NLD', 'NOR', 'NPL', 'NRU', 'NIU', 'NZL', | |
289 'OMN', 'PAN', 'PER', 'PYF', 'PNG', 'PHL', 'PAK', 'POL', 'SPM', 'PCN', | |
290 'PRI', 'PSE', 'PRT', 'PLW', 'PRY', 'QAT', 'REU', 'ROU', 'RUS', 'RWA', | |
291 'SAU', 'SLB', 'SYC', 'SDN', 'SWE', 'SGP', 'SHN', 'SVN', 'SJM', 'SVK', | |
292 'SLE', 'SMR', 'SEN', 'SOM', 'SUR', 'STP', 'SLV', 'SYR', 'SWZ', 'TCA', | |
293 'TCD', 'TF', 'TGO', 'THA', 'TJK', 'TKL', 'TLS', 'TKM', 'TUN', 'TON', 'TUR', | |
294 'TTO', 'TUV', 'TWN', 'TZA', 'UKR', 'UGA', 'UM', 'USA', 'URY', 'UZB', 'VAT', | |
295 'VCT', 'VEN', 'VGB', 'VIR', 'VNM', 'VUT', 'WLF', 'WSM', 'YEM', 'YT', 'SRB', | |
296 'ZAF', 'ZMB', 'MNE', 'ZWE', 'A1', 'A2', 'O1', 'ALA', 'GGY', 'IMN', 'JEY', | |
297 'BLM', 'MAF', 'BES', 'SSD' | |
298 ) | |
299 | |
300 COUNTRY_NAMES = ( | |
301 '', 'Asia/Pacific Region', 'Europe', 'Andorra', 'United Arab Emirates', | |
302 'Afghanistan', 'Antigua and Barbuda', 'Anguilla', 'Albania', 'Armenia', | |
303 'Netherlands Antilles', 'Angola', 'Antarctica', 'Argentina', | |
304 'American Samoa', 'Austria', 'Australia', 'Aruba', 'Azerbaijan', | |
305 'Bosnia and Herzegovina', 'Barbados', 'Bangladesh', 'Belgium', | |
306 'Burkina Faso', 'Bulgaria', 'Bahrain', 'Burundi', 'Benin', 'Bermuda', | |
307 'Brunei Darussalam', 'Bolivia', 'Brazil', 'Bahamas', 'Bhutan', | |
308 'Bouvet Island', 'Botswana', 'Belarus', 'Belize', 'Canada', | |
309 'Cocos (Keeling) Islands', 'Congo, The Democratic Republic of the', | |
310 'Central African Republic', 'Congo', 'Switzerland', 'Cote D\'Ivoire', | |
311 'Cook Islands', 'Chile', 'Cameroon', 'China', 'Colombia', 'Costa Rica', | |
312 'Cuba', 'Cape Verde', 'Christmas Island', 'Cyprus', 'Czech Republic', | |
313 'Germany', 'Djibouti', 'Denmark', 'Dominica', 'Dominican Republic', | |
314 'Algeria', 'Ecuador', 'Estonia', 'Egypt', 'Western Sahara', 'Eritrea', | |
315 'Spain', 'Ethiopia', 'Finland', 'Fiji', 'Falkland Islands (Malvinas)', | |
316 'Micronesia, Federated States of', 'Faroe Islands', 'France', | |
317 'France, Metropolitan', 'Gabon', 'United Kingdom', 'Grenada', 'Georgia', | |
318 'French Guiana', 'Ghana', 'Gibraltar', 'Greenland', 'Gambia', 'Guinea', | |
319 'Guadeloupe', 'Equatorial Guinea', 'Greece', | |
320 'South Georgia and the South Sandwich Islands', 'Guatemala', 'Guam', | |
321 'Guinea-Bissau', 'Guyana', 'Hong Kong', | |
322 'Heard Island and McDonald Islands', 'Honduras', 'Croatia', 'Haiti', | |
323 'Hungary', 'Indonesia', 'Ireland', 'Israel', 'India', | |
324 'British Indian Ocean Territory', 'Iraq', 'Iran, Islamic Republic of', | |
325 'Iceland', 'Italy', 'Jamaica', 'Jordan', 'Japan', 'Kenya', 'Kyrgyzstan', | |
326 'Cambodia', 'Kiribati', 'Comoros', 'Saint Kitts and Nevis', | |
327 'Korea, Democratic People\'s Republic of', 'Korea, Republic of', 'Kuwait', | |
328 'Cayman Islands', 'Kazakhstan', 'Lao People\'s Democratic Republic', | |
329 'Lebanon', 'Saint Lucia', 'Liechtenstein', 'Sri Lanka', 'Liberia', | |
330 'Lesotho', 'Lithuania', 'Luxembourg', 'Latvia', 'Libya', 'Morocco', | |
331 'Monaco', 'Moldova, Republic of', 'Madagascar', 'Marshall Islands', | |
332 'Macedonia', 'Mali', 'Myanmar', 'Mongolia', 'Macau', | |
333 'Northern Mariana Islands', 'Martinique', 'Mauritania', 'Montserrat', | |
334 'Malta', 'Mauritius', 'Maldives', 'Malawi', 'Mexico', 'Malaysia', | |
335 'Mozambique', 'Namibia', 'New Caledonia', 'Niger', 'Norfolk Island', | |
336 'Nigeria', 'Nicaragua', 'Netherlands', 'Norway', 'Nepal', 'Nauru', 'Niue', | |
337 'New Zealand', 'Oman', 'Panama', 'Peru', 'French Polynesia', | |
338 'Papua New Guinea', 'Philippines', 'Pakistan', 'Poland', | |
339 'Saint Pierre and Miquelon', 'Pitcairn Islands', 'Puerto Rico', | |
340 'Palestinian Territory', 'Portugal', 'Palau', 'Paraguay', 'Qatar', | |
341 'Reunion', 'Romania', 'Russian Federation', 'Rwanda', 'Saudi Arabia', | |
342 'Solomon Islands', 'Seychelles', 'Sudan', 'Sweden', 'Singapore', | |
343 'Saint Helena', 'Slovenia', 'Svalbard and Jan Mayen', 'Slovakia', | |
344 'Sierra Leone', 'San Marino', 'Senegal', 'Somalia', 'Suriname', | |
345 'Sao Tome and Principe', 'El Salvador', 'Syrian Arab Republic', | |
346 'Swaziland', 'Turks and Caicos Islands', 'Chad', | |
347 'French Southern Territories', 'Togo', 'Thailand', 'Tajikistan', 'Tokelau', | |
348 'Turkmenistan', 'Tunisia', 'Tonga', 'Timor-Leste', 'Turkey', | |
349 'Trinidad and Tobago', 'Tuvalu', 'Taiwan', 'Tanzania, United Republic of', | |
350 'Ukraine', 'Uganda', 'United States Minor Outlying Islands', | |
351 'United States', 'Uruguay', 'Uzbekistan', 'Holy See (Vatican City State)', | |
352 'Saint Vincent and the Grenadines', 'Venezuela', 'Virgin Islands, British', | |
353 'Virgin Islands, U.S.', 'Vietnam', 'Vanuatu', 'Wallis and Futuna', 'Samoa', | |
354 'Yemen', 'Mayotte', 'Serbia', 'South Africa', 'Zambia', 'Montenegro', | |
355 'Zimbabwe', 'Anonymous Proxy', 'Satellite Provider', 'Other', | |
356 'Aland Islands', 'Guernsey', 'Isle of Man', 'Jersey', 'Saint Barthelemy', | |
357 'Saint Martin', 'Bonaire, Sint Eustatius and Saba', 'South Sudan' | |
358 ) | |
359 | |
360 CONTINENT_NAMES = ( | |
361 '--', 'AS', 'EU', 'EU', 'AS', 'AS', 'NA', 'NA', 'EU', 'AS', 'NA', 'AF', | |
362 'AN', 'SA', 'OC', 'EU', 'OC', 'NA', 'AS', 'EU', 'NA', 'AS', 'EU', 'AF', | |
363 'EU', 'AS', 'AF', 'AF', 'NA', 'AS', 'SA', 'SA', 'NA', 'AS', 'AN', 'AF', | |
364 'EU', 'NA', 'NA', 'AS', 'AF', 'AF', 'AF', 'EU', 'AF', 'OC', 'SA', 'AF', | |
365 'AS', 'SA', 'NA', 'NA', 'AF', 'AS', 'AS', 'EU', 'EU', 'AF', 'EU', 'NA', | |
366 'NA', 'AF', 'SA', 'EU', 'AF', 'AF', 'AF', 'EU', 'AF', 'EU', 'OC', 'SA', | |
367 'OC', 'EU', 'EU', 'NA', 'AF', 'EU', 'NA', 'AS', 'SA', 'AF', 'EU', 'NA', | |
368 'AF', 'AF', 'NA', 'AF', 'EU', 'AN', 'NA', 'OC', 'AF', 'SA', 'AS', 'AN', | |
369 'NA', 'EU', 'NA', 'EU', 'AS', 'EU', 'AS', 'AS', 'AS', 'AS', 'AS', 'EU', | |
370 'EU', 'NA', 'AS', 'AS', 'AF', 'AS', 'AS', 'OC', 'AF', 'NA', 'AS', 'AS', | |
371 'AS', 'NA', 'AS', 'AS', 'AS', 'NA', 'EU', 'AS', 'AF', 'AF', 'EU', 'EU', | |
372 'EU', 'AF', 'AF', 'EU', 'EU', 'AF', 'OC', 'EU', 'AF', 'AS', 'AS', 'AS', | |
373 'OC', 'NA', 'AF', 'NA', 'EU', 'AF', 'AS', 'AF', 'NA', 'AS', 'AF', 'AF', | |
374 'OC', 'AF', 'OC', 'AF', 'NA', 'EU', 'EU', 'AS', 'OC', 'OC', 'OC', 'AS', | |
375 'NA', 'SA', 'OC', 'OC', 'AS', 'AS', 'EU', 'NA', 'OC', 'NA', 'AS', 'EU', | |
376 'OC', 'SA', 'AS', 'AF', 'EU', 'EU', 'AF', 'AS', 'OC', 'AF', 'AF', 'EU', | |
377 'AS', 'AF', 'EU', 'EU', 'EU', 'AF', 'EU', 'AF', 'AF', 'SA', 'AF', 'NA', | |
378 'AS', 'AF', 'NA', 'AF', 'AN', 'AF', 'AS', 'AS', 'OC', 'AS', 'AF', 'OC', | |
379 'AS', 'EU', 'NA', 'OC', 'AS', 'AF', 'EU', 'AF', 'OC', 'NA', 'SA', 'AS', | |
380 'EU', 'NA', 'SA', 'NA', 'NA', 'AS', 'OC', 'OC', 'OC', 'AS', 'AF', 'EU', | |
381 'AF', 'AF', 'EU', 'AF', '--', '--', '--', 'EU', 'EU', 'EU', 'EU', 'NA', | |
382 'NA', 'NA', 'AF' | |
383 ) | |
384 | |
385 # storage / caching flags | |
386 STANDARD = 0 | |
387 MEMORY_CACHE = 1 | |
388 MMAP_CACHE = 8 | |
389 | |
390 # Database structure constants | |
391 COUNTRY_BEGIN = 16776960 | |
392 STATE_BEGIN_REV0 = 16700000 | |
393 STATE_BEGIN_REV1 = 16000000 | |
394 | |
395 STRUCTURE_INFO_MAX_SIZE = 20 | |
396 DATABASE_INFO_MAX_SIZE = 100 | |
397 | |
398 # Database editions | |
399 COUNTRY_EDITION = 1 | |
400 COUNTRY_EDITION_V6 = 12 | |
401 REGION_EDITION_REV0 = 7 | |
402 REGION_EDITION_REV1 = 3 | |
403 CITY_EDITION_REV0 = 6 | |
404 CITY_EDITION_REV1 = 2 | |
405 CITY_EDITION_REV1_V6 = 30 | |
406 ORG_EDITION = 5 | |
407 ISP_EDITION = 4 | |
408 ASNUM_EDITION = 9 | |
409 ASNUM_EDITION_V6 = 21 | |
410 # Not yet supported databases | |
411 PROXY_EDITION = 8 | |
412 NETSPEED_EDITION = 11 | |
413 | |
414 # Collection of databases | |
415 IPV6_EDITIONS = (COUNTRY_EDITION_V6, ASNUM_EDITION_V6, CITY_EDITION_REV1_V6) | |
416 CITY_EDITIONS = (CITY_EDITION_REV0, CITY_EDITION_REV1, CITY_EDITION_REV1_V6) | |
417 REGION_EDITIONS = (REGION_EDITION_REV0, REGION_EDITION_REV1) | |
418 REGION_CITY_EDITIONS = REGION_EDITIONS + CITY_EDITIONS | |
419 | |
420 SEGMENT_RECORD_LENGTH = 3 | |
421 STANDARD_RECORD_LENGTH = 3 | |
422 ORG_RECORD_LENGTH = 4 | |
423 MAX_RECORD_LENGTH = 4 | |
424 MAX_ORG_RECORD_LENGTH = 300 | |
425 FULL_RECORD_LENGTH = 50 | |
426 | |
427 US_OFFSET = 1 | |
428 CANADA_OFFSET = 677 | |
429 WORLD_OFFSET = 1353 | |
430 FIPS_RANGE = 360 | |
431 ENCODING = 'iso-8859-1' | |
OLD | NEW |