geoip

package
v0.0.0-...-f179113 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package geoip contains implementations of the GeoIP database for AdGuard DNS.

Index

Constants

This section is empty.

Variables

View Source
var DefaultCountryTopASNs = map[Country]ASN{}/* 236 elements not displayed */

DefaultCountryTopASNs is a mapping of a country to their top ASNs.

View Source
var DefaultTopASNs = container.NewMapSet[ASN](
	137,
	174,
	209,
	224,
	513,
	559,
	577,
	680,
	701,
	719,
	760,
	766,
	786,
	803,
	812,
	852,
	855,
	906,
	967,
	984,
	1103,
	1136,
	1213,
	1221,
	1241,
	1257,
	1267,
	1299,
	1403,
	1547,
	1653,
	1659,
	1680,
	1759,
	1764,
	1835,
	1836,
	1853,
	1897,
	1930,
	1955,
	2018,
	2107,
	2108,
	2110,
	2116,
	2119,
	2200,
	2497,
	2514,
	2516,
	2518,
	2519,
	2527,
	2586,
	2588,
	2602,
	2607,
	2609,
	2611,
	2614,
	2740,
	2764,
	2843,
	2847,
	2852,
	2856,
	2860,
	3132,
	3209,
	3212,
	3215,
	3216,
	3221,
	3223,
	3225,
	3238,
	3243,
	3249,
	3255,
	3269,
	3292,
	3301,
	3302,
	3303,
	3308,
	3320,
	3326,
	3329,
	3342,
	3352,
	3356,
	3399,
	3462,
	3549,
	3559,
	3605,
	3695,
	3741,
	3758,
	3786,
	3816,
	3855,
	4007,
	4049,
	4134,
	4181,
	4230,
	4538,
	4609,
	4638,
	4648,
	4657,
	4685,
	4713,
	4721,
	4725,
	4739,
	4760,
	4761,
	4764,
	4766,
	4768,
	4771,
	4773,
	4775,
	4780,
	4788,
	4804,
	4808,
	4812,
	4817,
	4818,
	4826,
	4837,
	4847,
	5089,
	5377,
	5378,
	5379,
	5384,
	5390,
	5391,
	5408,
	5410,
	5413,
	5416,
	5432,
	5466,
	5470,
	5479,
	5483,
	5518,
	5532,
	5578,
	5603,
	5607,
	5610,
	5617,
	5639,
	5645,
	5650,
	5713,
	5769,
	5786,
	6057,
	6079,
	6128,
	6147,
	6167,
	6181,
	6306,
	6327,
	6400,
	6407,
	6535,
	6568,
	6639,
	6661,
	6677,
	6682,
	6697,
	6700,
	6703,
	6713,
	6730,
	6739,
	6747,
	6752,
	6758,
	6772,
	6799,
	6802,
	6805,
	6810,
	6821,
	6830,
	6843,
	6848,
	6849,
	6855,
	6866,
	6871,
	6876,
	6939,
	7018,
	7029,
	7057,
	7122,
	7131,
	7303,
	7315,
	7418,
	7438,
	7470,
	7482,
	7497,
	7522,
	7524,
	7545,
	7552,
	7642,
	7679,
	7713,
	7727,
	7738,
	7794,
	7922,
	7979,
	7992,
	8014,
	8048,
	8053,
	8075,
	8151,
	8167,
	8193,
	8200,
	8220,
	8248,
	8251,
	8257,
	8273,
	8285,
	8290,
	8301,
	8339,
	8346,
	8359,
	8368,
	8369,
	8374,
	8376,
	8386,
	8400,
	8402,
	8412,
	8422,
	8437,
	8445,
	8447,
	8449,
	8452,
	8462,
	8468,
	8473,
	8517,
	8542,
	8544,
	8551,
	8560,
	8585,
	8612,
	8632,
	8661,
	8680,
	8681,
	8697,
	8708,
	8717,
	8728,
	8758,
	8764,
	8767,
	8771,
	8772,
	8781,
	8814,
	8818,
	8821,
	8847,
	8849,
	8866,
	8881,
	8926,
	8948,
	8953,
	8966,
	8978,
	8990,
	9002,
	9008,
	9009,
	9031,
	9038,
	9044,
	9050,
	9051,
	9063,
	9070,
	9105,
	9119,
	9121,
	9123,
	9125,
	9129,
	9145,
	9146,
	9155,
	9158,
	9198,
	9199,
	9208,
	9231,
	9245,
	9246,
	9249,
	9260,
	9269,
	9299,
	9303,
	9304,
	9316,
	9318,
	9329,
	9335,
	9341,
	9351,
	9354,
	9365,
	9381,
	9416,
	9443,
	9471,
	9484,
	9500,
	9506,
	9534,
	9541,
	9595,
	9605,
	9617,
	9644,
	9674,
	9694,
	9751,
	9790,
	9808,
	9824,
	9825,
	9829,
	9845,
	9873,
	9902,
	9908,
	9922,
	9924,
	9930,
	9931,
	9934,
	9946,
	9976,
	9997,
	10010,
	10013,
	10030,
	10036,
	10066,
	10075,
	10076,
	10094,
	10099,
	10101,
	10118,
	10131,
	10139,
	10143,
	10214,
	10219,
	10226,
	10269,
	10292,
	10299,
	10396,
	10412,
	10429,
	10474,
	10617,
	10620,
	10796,
	10834,
	11014,
	11081,
	11139,
	11172,
	11232,
	11259,
	11260,
	11290,
	11315,
	11351,
	11367,
	11426,
	11427,
	11492,
	11556,
	11562,
	11580,
	11594,
	11664,
	11721,
	11776,
	11814,
	11815,
	11816,
	11830,
	11845,
	11888,
	11992,
	12046,
	12066,
	12083,
	12091,
	12252,
	12271,
	12297,
	12301,
	12302,
	12322,
	12334,
	12338,
	12350,
	12353,
	12361,
	12365,
	12389,
	12390,
	12392,
	12400,
	12406,
	12414,
	12430,
	12436,
	12444,
	12455,
	12479,
	12491,
	12508,
	12539,
	12552,
	12576,
	12578,
	12597,
	12605,
	12668,
	12684,
	12709,
	12714,
	12716,
	12735,
	12741,
	12754,
	12764,
	12796,
	12810,
	12829,
	12849,
	12874,
	12876,
	12905,
	12912,
	12929,
	12946,
	12958,
	12969,
	12975,
	12978,
	12997,
	13000,
	13030,
	13036,
	13037,
	13045,
	13046,
	13092,
	13099,
	13110,
	13122,
	13124,
	13127,
	13156,
	13188,
	13189,
	13194,
	13208,
	13213,
	13280,
	13285,
	13306,
	13335,
	13489,
	13771,
	13999,
	14061,
	14080,
	14117,
	14234,
	14259,
	14434,
	14522,
	14593,
	14618,
	14638,
	14709,
	14754,
	14813,
	14868,
	14956,
	14979,
	14988,
	15146,
	15169,
	15311,
	15344,
	15366,
	15377,
	15378,
	15383,
	15389,
	15397,
	15399,
	15404,
	15425,
	15433,
	15435,
	15440,
	15457,
	15474,
	15502,
	15511,
	15516,
	15525,
	15547,
	15557,
	15600,
	15614,
	15623,
	15659,
	15704,
	15706,
	15723,
	15735,
	15751,
	15765,
	15766,
	15774,
	15796,
	15802,
	15805,
	15808,
	15836,
	15895,
	15897,
	15899,
	15924,
	15943,
	15958,
	15962,
	15964,
	15975,
	15994,
	16010,
	16019,
	16028,
	16058,
	16082,
	16086,
	16116,
	16125,
	16135,
	16178,
	16190,
	16202,
	16223,
	16229,
	16232,
	16246,
	16276,
	16322,
	16333,
	16342,
	16345,
	16347,
	16367,
	16437,
	16509,
	16591,
	16592,
	16629,
	16637,
	16705,
	16735,
	16814,
	16906,
	16960,
	17072,
	17079,
	17400,
	17411,
	17421,
	17451,
	17458,
	17465,
	17470,
	17480,
	17488,
	17501,
	17506,
	17511,
	17529,
	17547,
	17551,
	17552,
	17557,
	17621,
	17622,
	17623,
	17639,
	17665,
	17676,
	17698,
	17705,
	17716,
	17809,
	17816,
	17828,
	17849,
	17853,
	17858,
	17882,
	17893,
	17924,
	17976,
	17993,
	18001,
	18004,
	18013,
	18024,
	18049,
	18053,
	18081,
	18106,
	18126,
	18144,
	18182,
	18199,
	18200,
	18209,
	18278,
	18371,
	18390,
	18403,
	18412,
	18419,
	18734,
	18747,
	18809,
	18822,
	18840,
	18881,
	19108,
	19114,
	19180,
	19182,
	19246,
	19422,
	19429,
	19624,
	19711,
	19863,
	19901,
	19978,
	20001,
	20011,
	20055,
	20057,
	20115,
	20207,
	20255,
	20294,
	20299,
	20365,
	20473,
	20485,
	20545,
	20634,
	20661,
	20771,
	20776,
	20804,
	20845,
	20860,
	20875,
	20879,
	20910,
	20911,
	20960,
	20963,
	20978,
	21003,
	21021,
	21040,
	21050,
	21056,
	21100,
	21107,
	21171,
	21183,
	21211,
	21221,
	21230,
	21232,
	21246,
	21271,
	21277,
	21283,
	21299,
	21334,
	21351,
	21412,
	21430,
	21450,
	21466,
	21491,
	21497,
	21502,
	21559,
	21575,
	21599,
	21744,
	21804,
	21826,
	21859,
	21928,
	21949,
	21996,
	22047,
	22069,
	22085,
	22313,
	22423,
	22581,
	22652,
	22724,
	22735,
	22773,
	22869,
	22884,
	22927,
	22933,
	22995,
	23114,
	23201,
	23243,
	23383,
	23470,
	23487,
	23520,
	23655,
	23657,
	23673,
	23674,
	23688,
	23693,
	23700,
	23752,
	23764,
	23783,
	23860,
	23889,
	23900,
	23923,
	23944,
	23955,
	23956,
	23969,
	24016,
	24020,
	24033,
	24086,
	24157,
	24158,
	24163,
	24164,
	24165,
	24183,
	24186,
	24203,
	24309,
	24324,
	24337,
	24378,
	24389,
	24400,
	24432,
	24439,
	24441,
	24444,
	24445,
	24492,
	24499,
	24547,
	24550,
	24559,
	24560,
	24589,
	24608,
	24631,
	24645,
	24651,
	24691,
	24722,
	24757,
	24800,
	24812,
	24822,
	24835,
	24852,
	24863,
	24877,
	24889,
	24921,
	24940,
	24953,
	24955,
	24971,
	25019,
	25106,
	25117,
	25133,
	25135,
	25139,
	25144,
	25159,
	25184,
	25190,
	25198,
	25229,
	25248,
	25250,
	25255,
	25274,
	25369,
	25374,
	25375,
	25400,
	25406,
	25424,
	25429,
	25441,
	25447,
	25454,
	25467,
	25471,
	25472,
	25490,
	25491,
	25509,
	25512,
	25513,
	25543,
	25607,
	25620,
	25668,
	25695,
	26130,
	26210,
	26383,
	26599,
	26611,
	26615,
	26617,
	26932,
	27651,
	27653,
	27660,
	27665,
	27668,
	27672,
	27680,
	27694,
	27695,
	27696,
	27699,
	27708,
	27717,
	27725,
	27729,
	27734,
	27738,
	27742,
	27745,
	27747,
	27757,
	27759,
	27768,
	27773,
	27775,
	27781,
	27789,
	27796,
	27800,
	27806,
	27813,
	27831,
	27833,
	27837,
	27839,
	27843,
	27866,
	27876,
	27882,
	27884,
	27887,
	27889,
	27895,
	27901,
	27903,
	27923,
	27924,
	27927,
	27928,
	27932,
	27947,
	27951,
	27953,
	27983,
	27984,
	27988,
	27995,
	28006,
	28009,
	28015,
	28024,
	28032,
	28036,
	28048,
	28049,
	28061,
	28067,
	28075,
	28094,
	28103,
	28104,
	28118,
	28126,
	28146,
	28182,
	28186,
	28191,
	28201,
	28210,
	28220,
	28258,
	28270,
	28343,
	28398,
	28403,
	28435,
	28458,
	28469,
	28481,
	28509,
	28512,
	28530,
	28531,
	28532,
	28534,
	28536,
	28537,
	28541,
	28545,
	28548,
	28554,
	28555,
	28573,
	28598,
	28649,
	28668,
	28680,
	28683,
	28685,
	28717,
	28725,
	28753,
	28760,
	28787,
	28812,
	28840,
	28878,
	28884,
	28885,
	28919,
	28952,
	28964,
	28972,
	29027,
	29030,
	29049,
	29061,
	29070,
	29084,
	29091,
	29119,
	29170,
	29182,
	29208,
	29222,
	29238,
	29244,
	29247,
	29256,
	29286,
	29310,
	29314,
	29340,
	29348,
	29355,
	29357,
	29405,
	29447,
	29465,
	29467,
	29485,
	29492,
	29518,
	29544,
	29545,
	29555,
	29571,
	29580,
	29582,
	29584,
	29600,
	29614,
	29687,
	29689,
	29695,
	29975,
	30036,
	30058,
	30344,
	30526,
	30600,
	30619,
	30689,
	30722,
	30764,
	30844,
	30848,
	30873,
	30896,
	30929,
	30982,
	30983,
	30985,
	30986,
	30990,
	30992,
	30999,
	31012,
	31027,
	31037,
	31042,
	31115,
	31117,
	31122,
	31126,
	31127,
	31133,
	31143,
	31148,
	31163,
	31169,
	31200,
	31204,
	31205,
	31213,
	31224,
	31242,
	31245,
	31246,
	31252,
	31263,
	31272,
	31287,
	31390,
	31404,
	31423,
	31435,
	31452,
	31499,
	31543,
	31549,
	31615,
	31655,
	31689,
	31721,
	31726,
	31856,
	31898,
	31960,
	32020,
	32098,
	32398,
	32860,
	33363,
	33392,
	33567,
	33576,
	33582,
	33763,
	33765,
	33771,
	33779,
	33781,
	33788,
	33796,
	33852,
	33874,
	33883,
	33885,
	33915,
	33922,
	33983,
	34001,
	34032,
	34058,
	34080,
	34087,
	34170,
	34224,
	34244,
	34245,
	34295,
	34296,
	34318,
	34362,
	34447,
	34458,
	34471,
	34488,
	34515,
	34533,
	34557,
	34577,
	34594,
	34661,
	34666,
	34683,
	34700,
	34702,
	34718,
	34724,
	34743,
	34772,
	34779,
	34797,
	34803,
	34820,
	34857,
	34876,
	34977,
	34984,
	34989,
	35046,
	35047,
	35091,
	35104,
	35107,
	35132,
	35141,
	35179,
	35191,
	35197,
	35223,
	35228,
	35244,
	35297,
	35311,
	35320,
	35328,
	35346,
	35362,
	35432,
	35444,
	35457,
	35518,
	35549,
	35566,
	35567,
	35568,
	35612,
	35699,
	35725,
	35729,
	35753,
	35790,
	35805,
	35807,
	35819,
	35900,
	36290,
	36384,
	36511,
	36549,
	36599,
	36864,
	36865,
	36866,
	36873,
	36874,
	36877,
	36884,
	36890,
	36892,
	36902,
	36903,
	36905,
	36907,
	36908,
	36909,
	36912,
	36913,
	36914,
	36920,
	36924,
	36925,
	36926,
	36930,
	36935,
	36937,
	36939,
	36947,
	36955,
	36958,
	36959,
	36962,
	36963,
	36965,
	36972,
	36974,
	36977,
	36988,
	36992,
	36994,
	36996,
	36998,
	36999,
	37002,
	37006,
	37009,
	37014,
	37020,
	37027,
	37028,
	37030,
	37035,
	37037,
	37049,
	37053,
	37054,
	37057,
	37061,
	37063,
	37069,
	37073,
	37074,
	37075,
	37076,
	37081,
	37084,
	37090,
	37094,
	37098,
	37100,
	37105,
	37110,
	37113,
	37119,
	37123,
	37124,
	37129,
	37133,
	37136,
	37141,
	37148,
	37154,
	37163,
	37164,
	37168,
	37173,
	37182,
	37183,
	37184,
	37187,
	37189,
	37190,
	37196,
	37203,
	37204,
	37205,
	37208,
	37211,
	37215,
	37219,
	37223,
	37228,
	37229,
	37233,
	37239,
	37254,
	37257,
	37273,
	37282,
	37284,
	37287,
	37294,
	37303,
	37305,
	37309,
	37313,
	37315,
	37323,
	37329,
	37332,
	37334,
	37336,
	37337,
	37340,
	37342,
	37343,
	37349,
	37350,
	37353,
	37358,
	37371,
	37376,
	37385,
	37395,
	37406,
	37410,
	37424,
	37425,
	37429,
	37430,
	37440,
	37447,
	37449,
	37451,
	37453,
	37457,
	37460,
	37461,
	37462,
	37463,
	37473,
	37475,
	37480,
	37487,
	37489,
	37492,
	37503,
	37508,
	37517,
	37518,
	37524,
	37526,
	37529,
	37531,
	37532,
	37541,
	37542,
	37545,
	37548,
	37550,
	37552,
	37559,
	37563,
	37575,
	37577,
	37580,
	37582,
	37584,
	37594,
	37604,
	37608,
	37611,
	37612,
	37614,
	37616,
	37622,
	37642,
	37645,
	37647,
	37649,
	37654,
	37665,
	37671,
	37678,
	37680,
	37682,
	37693,
	37697,
	37705,
	37713,
	37721,
	37963,
	38009,
	38019,
	38067,
	38077,
	38136,
	38195,
	38198,
	38201,
	38203,
	38209,
	38235,
	38247,
	38264,
	38266,
	38322,
	38333,
	38442,
	38466,
	38511,
	38553,
	38562,
	38565,
	38600,
	38623,
	38742,
	38800,
	38805,
	38819,
	38841,
	38875,
	38901,
	38999,
	39007,
	39010,
	39032,
	39067,
	39184,
	39199,
	39216,
	39232,
	39273,
	39280,
	39344,
	39351,
	39374,
	39397,
	39402,
	39440,
	39544,
	39603,
	39608,
	39611,
	39615,
	39642,
	39647,
	39686,
	39791,
	39823,
	39824,
	39826,
	39891,
	39906,
	39912,
	40021,
	40029,
	40786,
	40788,
	40945,
	41007,
	41019,
	41068,
	41096,
	41124,
	41164,
	41202,
	41230,
	41275,
	41313,
	41329,
	41330,
	41378,
	41454,
	41496,
	41549,
	41557,
	41563,
	41564,
	41676,
	41704,
	41714,
	41733,
	41738,
	41745,
	41750,
	41798,
	41833,
	41897,
	41956,
	41997,
	42003,
	42013,
	42082,
	42083,
	42109,
	42162,
	42183,
	42232,
	42235,
	42298,
	42306,
	42313,
	42334,
	42337,
	42437,
	42455,
	42473,
	42525,
	42532,
	42541,
	42560,
	42571,
	42580,
	42581,
	42610,
	42652,
	42689,
	42708,
	42713,
	42714,
	42772,
	42779,
	42828,
	42837,
	42841,
	42863,
	42864,
	42905,
	42908,
	42912,
	42925,
	42961,
	42991,
	43019,
	43060,
	43118,
	43139,
	43197,
	43205,
	43242,
	43248,
	43256,
	43284,
	43350,
	43375,
	43451,
	43452,
	43513,
	43529,
	43533,
	43568,
	43581,
	43612,
	43627,
	43633,
	43656,
	43700,
	43708,
	43709,
	43733,
	43754,
	43766,
	43769,
	43791,
	43824,
	43873,
	43892,
	43922,
	43925,
	43939,
	43940,
	43957,
	44027,
	44034,
	44086,
	44087,
	44118,
	44134,
	44143,
	44213,
	44217,
	44234,
	44244,
	44285,
	44313,
	44327,
	44377,
	44391,
	44395,
	44477,
	44483,
	44489,
	44515,
	44549,
	44558,
	44566,
	44575,
	44702,
	44708,
	44735,
	44869,
	44925,
	45090,
	45102,
	45143,
	45177,
	45178,
	45245,
	45267,
	45271,
	45305,
	45345,
	45355,
	45356,
	45361,
	45458,
	45461,
	45498,
	45543,
	45588,
	45609,
	45637,
	45650,
	45669,
	45700,
	45754,
	45758,
	45763,
	45766,
	45879,
	45891,
	45899,
	45905,
	45916,
	45925,
	45935,
	45960,
	46198,
	46408,
	46573,
	46650,
	46868,
	46941,
	47139,
	47169,
	47204,
	47217,
	47232,
	47237,
	47253,
	47331,
	47377,
	47394,
	47474,
	47485,
	47493,
	47524,
	47583,
	47588,
	47589,
	47790,
	47794,
	47881,
	47883,
	47887,
	47898,
	47943,
	47956,
	47959,
	47962,
	48014,
	48092,
	48133,
	48147,
	48161,
	48190,
	48206,
	48239,
	48252,
	48260,
	48266,
	48288,
	48289,
	48418,
	48431,
	48437,
	48480,
	48492,
	48503,
	48506,
	48584,
	48629,
	48675,
	48728,
	48747,
	48781,
	48830,
	48832,
	48847,
	48887,
	48917,
	48944,
	48966,
	49020,
	49040,
	49044,
	49056,
	49100,
	49101,
	49110,
	49115,
	49117,
	49129,
	49223,
	49242,
	49273,
	49282,
	49362,
	49453,
	49460,
	49561,
	49628,
	49724,
	49760,
	49798,
	49800,
	49808,
	49889,
	49902,
	49911,
	49914,
	49981,
	50010,
	50181,
	50195,
	50223,
	50231,
	50251,
	50261,
	50266,
	50274,
	50294,
	50304,
	50318,
	50334,
	50349,
	50436,
	50463,
	50467,
	50482,
	50500,
	50506,
	50558,
	50581,
	50613,
	50616,
	50635,
	50648,
	50670,
	50685,
	50749,
	50767,
	50770,
	50810,
	50821,
	50825,
	50917,
	50959,
	50973,
	50979,
	51018,
	51020,
	51026,
	51104,
	51110,
	51132,
	51142,
	51167,
	51175,
	51184,
	51207,
	51265,
	51336,
	51342,
	51346,
	51375,
	51395,
	51407,
	51430,
	51495,
	51504,
	51582,
	51604,
	51645,
	51653,
	51684,
	51765,
	51784,
	51809,
	51825,
	51847,
	51873,
	51878,
	51896,
	51947,
	52075,
	52173,
	52228,
	52233,
	52238,
	52242,
	52253,
	52257,
	52260,
	52262,
	52263,
	52312,
	52323,
	52341,
	52361,
	52362,
	52363,
	52373,
	52398,
	52405,
	52412,
	52433,
	52436,
	52444,
	52455,
	52465,
	52468,
	52471,
	52613,
	52974,
	53006,
	53667,
	53764,
	53813,
	53926,
	54198,
	54614,
	54801,
	55081,
	55286,
	55330,
	55391,
	55392,
	55415,
	55424,
	55427,
	55430,
	55501,
	55523,
	55561,
	55577,
	55685,
	55699,
	55720,
	55769,
	55805,
	55821,
	55836,
	55850,
	55853,
	55900,
	55915,
	55943,
	55944,
	55990,
	56017,
	56030,
	56040,
	56041,
	56042,
	56044,
	56046,
	56047,
	56048,
	56055,
	56089,
	56099,
	56120,
	56167,
	56207,
	56231,
	56262,
	56293,
	56300,
	56309,
	56329,
	56354,
	56369,
	56410,
	56465,
	56468,
	56478,
	56494,
	56497,
	56568,
	56653,
	56655,
	56665,
	56696,
	56709,
	56882,
	56902,
	56933,
	56971,
	56995,
	57000,
	57013,
	57016,
	57043,
	57070,
	57134,
	57169,
	57218,
	57223,
	57248,
	57269,
	57279,
	57293,
	57344,
	57367,
	57370,
	57374,
	57388,
	57389,
	57443,
	57513,
	57564,
	57566,
	57630,
	57634,
	57743,
	57760,
	57761,
	57764,
	57778,
	57794,
	57852,
	57869,
	57888,
	58061,
	58065,
	58087,
	58098,
	58118,
	58130,
	58224,
	58309,
	58322,
	58328,
	58453,
	58460,
	58461,
	58485,
	58504,
	58507,
	58524,
	58593,
	58610,
	58656,
	58682,
	58689,
	58715,
	58717,
	58731,
	58821,
	58895,
	58945,
	58952,
	58955,
	59108,
	59125,
	59126,
	59257,
	59355,
	59362,
	59381,
	59396,
	59497,
	59588,
	59625,
	59668,
	59729,
	59847,
	59861,
	59890,
	59989,
	60068,
	60171,
	60258,
	60294,
	60296,
	60304,
	60352,
	60367,
	60372,
	60377,
	60415,
	60471,
	60587,
	60602,
	60631,
	60656,
	60690,
	60725,
	60754,
	60757,
	60781,
	60791,
	60806,
	60999,
	61006,
	61010,
	61071,
	61079,
	61112,
	61135,
	61138,
	61143,
	61189,
	61211,
	61272,
	61275,
	61287,
	61307,
	61317,
	61367,
	61424,
	61449,
	61461,
	61466,
	61468,
	61478,
	61490,
	61512,
	62005,
	62013,
	62161,
	62179,
	62211,
	62212,
	62214,
	62240,
	62250,
	62281,
	62282,
	62419,
	62563,
	62651,
	63023,
	63199,
	63526,
	63859,
	63888,
	63949,
	63969,
	63991,
	64037,
	64043,
	64073,
	64098,
	64105,
	64134,
	64443,
	64466,
	131090,
	131111,
	131178,
	131207,
	131267,
	131284,
	131285,
	131316,
	131429,
	131445,
	131464,
	131471,
	131584,
	131591,
	131596,
	131602,
	131627,
	131706,
	131769,
	132061,
	132077,
	132148,
	132165,
	132173,
	132199,
	132203,
	132204,
	132298,
	132429,
	132447,
	132449,
	132462,
	132468,
	132471,
	132525,
	132618,
	132686,
	132815,
	133012,
	133076,
	133199,
	133200,
	133210,
	133334,
	133384,
	133433,
	133480,
	133481,
	133524,
	133533,
	133606,
	133612,
	133613,
	133623,
	133661,
	133752,
	133875,
	133894,
	133897,
	133982,
	134090,
	134113,
	134134,
	134139,
	134204,
	134356,
	134359,
	134489,
	134562,
	134651,
	134674,
	134697,
	134707,
	134715,
	134732,
	134783,
	134810,
	134840,
	134995,
	135043,
	135097,
	135126,
	135298,
	135341,
	135371,
	135375,
	135376,
	135377,
	135405,
	135407,
	135409,
	135477,
	135478,
	135589,
	135600,
	135607,
	135887,
	136000,
	136039,
	136093,
	136119,
	136141,
	136167,
	136210,
	136238,
	136239,
	136255,
	136379,
	136380,
	136384,
	136400,
	136442,
	136454,
	136474,
	136479,
	136515,
	136525,
	136557,
	136617,
	136787,
	136873,
	136907,
	136919,
	136969,
	136972,
	136986,
	136994,
	137040,
	137047,
	137080,
	137226,
	137409,
	137412,
	137424,
	137443,
	137449,
	137453,
	137503,
	137526,
	137561,
	137853,
	137872,
	137895,
	137959,
	137967,
	138089,
	138134,
	138167,
	138179,
	138197,
	138345,
	138346,
	138368,
	138384,
	138423,
	138529,
	138558,
	138590,
	138606,
	138640,
	138655,
	138754,
	138886,
	138915,
	138926,
	138964,
	138965,
	138997,
	139009,
	139029,
	139043,
	139058,
	139224,
	139238,
	139325,
	139628,
	139692,
	139704,
	139741,
	139759,
	139820,
	139831,
	139841,
	139849,
	139879,
	139898,
	139922,
	139952,
	139981,
	139994,
	140045,
	140061,
	140072,
	140091,
	140220,
	140292,
	140345,
	140485,
	140499,
	140504,
	140594,
	140659,
	140726,
	140867,
	140900,
	141015,
	141024,
	141031,
	141039,
	141047,
	141127,
	141140,
	141145,
	141216,
	141342,
	141421,
	141607,
	141680,
	141681,
	141711,
	141767,
	141778,
	141995,
	142032,
	142065,
	142139,
	142271,
	142295,
	142386,
	142647,
	146961,
	147023,
	147049,
	147302,
	149034,
	149173,
	149359,
	149360,
	149419,
	149456,
	149487,
	149707,
	149771,
	150222,
	150331,
	150371,
	150407,
	150452,
	150683,
	150692,
	150748,
	150750,
	150774,
	151080,
	151396,
	151491,
	151636,
	151965,
	151983,
	152178,
	152317,
	152329,
	152337,
	152605,
	152677,
	196640,
	196838,
	196874,
	196925,
	196961,
	197207,
	197225,
	197248,
	197296,
	197301,
	197350,
	197398,
	197423,
	197470,
	197540,
	197556,
	197706,
	197716,
	197830,
	197862,
	197882,
	197897,
	198023,
	198068,
	198256,
	198265,
	198279,
	198288,
	198440,
	198441,
	198471,
	198499,
	198504,
	198589,
	198605,
	198632,
	198668,
	198820,
	198890,
	198930,
	198961,
	198966,
	199081,
	199140,
	199155,
	199173,
	199276,
	199326,
	199469,
	199490,
	199493,
	199524,
	199620,
	199636,
	199707,
	199731,
	199736,
	199739,
	199785,
	200019,
	200076,
	200134,
	200154,
	200200,
	200313,
	200446,
	200590,
	200665,
	200724,
	200736,
	200742,
	200845,
	200865,
	201004,
	201019,
	201073,
	201089,
	201107,
	201167,
	201241,
	201249,
	201411,
	201476,
	201505,
	201540,
	201577,
	201596,
	201601,
	201603,
	201746,
	201749,
	201767,
	201776,
	201838,
	201884,
	201973,
	201986,
	201997,
	202023,
	202087,
	202098,
	202204,
	202254,
	202293,
	202316,
	202422,
	202433,
	202441,
	202468,
	202498,
	202561,
	202613,
	202616,
	202632,
	202651,
	202652,
	202662,
	202710,
	202759,
	202870,
	202876,
	202921,
	202940,
	202960,
	202987,
	203020,
	203136,
	203143,
	203206,
	203214,
	203217,
	203257,
	203424,
	203451,
	203561,
	203622,
	203675,
	203680,
	203715,
	203811,
	203877,
	203912,
	203916,
	203917,
	203936,
	203953,
	203964,
	203971,
	203995,
	203999,
	204020,
	204106,
	204108,
	204151,
	204170,
	204267,
	204274,
	204279,
	204317,
	204342,
	204457,
	204467,
	204566,
	204592,
	204595,
	204649,
	204793,
	204816,
	204918,
	204957,
	204986,
	205015,
	205110,
	205168,
	205244,
	205254,
	205278,
	205367,
	205368,
	205371,
	205547,
	205638,
	205647,
	205714,
	205800,
	205814,
	205889,
	206013,
	206026,
	206065,
	206067,
	206119,
	206206,
	206238,
	206260,
	206262,
	206283,
	206358,
	206375,
	206406,
	206429,
	206446,
	206478,
	206519,
	206557,
	206575,
	206610,
	206666,
	206774,
	206783,
	206784,
	206892,
	206920,
	206977,
	207097,
	207137,
	207192,
	207251,
	207369,
	207375,
	207408,
	207502,
	207569,
	207589,
	207782,
	207810,
	207876,
	207990,
	207991,
	208286,
	208320,
	208324,
	208339,
	208343,
	208448,
	208570,
	208592,
	208671,
	208730,
	208734,
	208859,
	208905,
	208972,
	208997,
	209012,
	209046,
	209049,
	209193,
	209196,
	209240,
	209262,
	209273,
	209277,
	209302,
	209360,
	209424,
	209429,
	209442,
	209491,
	209531,
	209778,
	209835,
	209839,
	209854,
	209948,
	210003,
	210016,
	210021,
	210022,
	210061,
	210070,
	210125,
	210147,
	210218,
	210273,
	210278,
	210315,
	210402,
	210509,
	210595,
	210616,
	210625,
	210644,
	210740,
	210747,
	210808,
	210865,
	211028,
	211057,
	211211,
	211235,
	211309,
	211356,
	211450,
	211458,
	211468,
	211555,
	211559,
	211759,
	211908,
	211995,
	212183,
	212238,
	212271,
	212330,
	212444,
	212449,
	212531,
	212572,
	212616,
	212637,
	212645,
	212655,
	212661,
	212766,
	212851,
	212865,
	212898,
	212999,
	213155,
	213207,
	213295,
	213320,
	213398,
	213402,
	213957,
	214739,
	214790,
	214996,
	215052,
	215284,
	215304,
	215346,
	215355,
	215421,
	215423,
	215501,
	215540,
	215597,
	215746,
	215886,
	215910,
	215968,
	216046,
	216071,
	216139,
	216165,
	216183,
	216200,
	216374,
	216463,
	262145,
	262146,
	262159,
	262181,
	262186,
	262188,
	262191,
	262197,
	262202,
	262210,
	262215,
	262223,
	262234,
	262239,
	262241,
	262248,
	262253,
	262262,
	262287,
	262354,
	262378,
	262468,
	262481,
	262494,
	262589,
	262663,
	262753,
	262773,
	262916,
	263073,
	263175,
	263210,
	263216,
	263222,
	263224,
	263238,
	263242,
	263245,
	263248,
	263292,
	263327,
	263684,
	263686,
	263689,
	263694,
	263698,
	263703,
	263717,
	263725,
	263732,
	263749,
	263750,
	263751,
	263759,
	263762,
	263763,
	263765,
	263783,
	263785,
	263791,
	263792,
	263793,
	263805,
	263824,
	263980,
	264221,
	264605,
	264609,
	264628,
	264635,
	264637,
	264640,
	264642,
	264645,
	264646,
	264663,
	264685,
	264686,
	264694,
	264731,
	264733,
	264738,
	264744,
	264750,
	264754,
	264756,
	264758,
	264770,
	264778,
	264779,
	264780,
	264783,
	264814,
	264821,
	264825,
	264837,
	264847,
	264984,
	265509,
	265540,
	265561,
	265594,
	265606,
	265608,
	265629,
	265631,
	265632,
	265636,
	265675,
	265684,
	265686,
	265688,
	265691,
	265711,
	265721,
	265724,
	265727,
	265762,
	265767,
	265780,
	265798,
	265799,
	265818,
	265822,
	265825,
	265855,
	265867,
	265880,
	266445,
	266668,
	266673,
	266694,
	266725,
	266742,
	266757,
	266792,
	266802,
	266814,
	266815,
	266831,
	266832,
	266841,
	266853,
	266858,
	266860,
	266893,
	266894,
	266904,
	267684,
	267685,
	267699,
	267705,
	267708,
	267713,
	267749,
	267761,
	267765,
	267767,
	267797,
	267803,
	267809,
	267828,
	267845,
	267846,
	267882,
	267883,
	267900,
	267904,
	267905,
	267916,
	267920,
	268323,
	268976,
	269036,
	269729,
	269730,
	269733,
	269734,
	269749,
	269750,
	269769,
	269783,
	269788,
	269797,
	269804,
	269806,
	269816,
	269820,
	269822,
	269831,
	269832,
	269840,
	269843,
	269846,
	269853,
	269862,
	269894,
	269901,
	269908,
	269919,
	269921,
	269927,
	269931,
	269934,
	269940,
	269946,
	269950,
	269953,
	269964,
	269965,
	269973,
	269976,
	269981,
	269983,
	269984,
	269989,
	270007,
	270026,
	270029,
	270035,
	270036,
	270049,
	270052,
	270058,
	270068,
	270071,
	270075,
	270081,
	270096,
	270098,
	270161,
	270186,
	271773,
	271781,
	271791,
	271795,
	271806,
	271808,
	271814,
	271835,
	271837,
	271874,
	271899,
	271907,
	271909,
	271911,
	271916,
	271929,
	271930,
	271933,
	271935,
	271942,
	271943,
	271951,
	271956,
	271965,
	271971,
	272018,
	272026,
	272027,
	272062,
	272066,
	272083,
	272094,
	272099,
	272102,
	272104,
	272106,
	272110,
	272112,
	272120,
	272122,
	272132,
	272134,
	272138,
	272809,
	272814,
	272818,
	272827,
	272836,
	272838,
	272851,
	272869,
	272882,
	272886,
	272906,
	272916,
	272921,
	272953,
	272955,
	272962,
	272991,
	273019,
	273024,
	273054,
	273063,
	273067,
	273093,
	273098,
	273113,
	273133,
	273139,
	273172,
	273173,
	273180,
	273203,
	273824,
	273872,
	327687,
	327693,
	327697,
	327707,
	327712,
	327716,
	327724,
	327725,
	327728,
	327738,
	327750,
	327754,
	327756,
	327765,
	327769,
	327771,
	327776,
	327782,
	327786,
	327795,
	327798,
	327799,
	327802,
	327819,
	327820,
	327828,
	327829,
	327830,
	327862,
	327863,
	327864,
	327871,
	327885,
	327900,
	327901,
	327903,
	327921,
	327931,
	327932,
	327934,
	327947,
	327972,
	327975,
	327987,
	327990,
	327991,
	328001,
	328061,
	328073,
	328075,
	328079,
	328088,
	328111,
	328136,
	328140,
	328146,
	328169,
	328181,
	328191,
	328196,
	328198,
	328200,
	328207,
	328223,
	328228,
	328230,
	328249,
	328250,
	328253,
	328258,
	328282,
	328284,
	328286,
	328297,
	328304,
	328319,
	328320,
	328331,
	328341,
	328358,
	328411,
	328432,
	328436,
	328442,
	328469,
	328471,
	328473,
	328475,
	328479,
	328480,
	328488,
	328490,
	328491,
	328494,
	328509,
	328510,
	328514,
	328535,
	328539,
	328546,
	328549,
	328567,
	328570,
	328576,
	328581,
	328586,
	328590,
	328594,
	328605,
	328610,
	328611,
	328614,
	328619,
	328628,
	328638,
	328652,
	328659,
	328676,
	328697,
	328702,
	328708,
	328716,
	328717,
	328727,
	328753,
	328755,
	328770,
	328777,
	328817,
	328844,
	328856,
	328857,
	328858,
	328880,
	328895,
	328899,
	328923,
	328943,
	328950,
	328954,
	328959,
	328961,
	328965,
	328977,
	328987,
	328988,
	328993,
	328997,
	329006,
	329014,
	329027,
	329029,
	329044,
	329078,
	329082,
	329095,
	329101,
	329103,
	329110,
	329126,
	329129,
	329140,
	329155,
	329167,
	329170,
	329174,
	329179,
	329183,
	329192,
	329205,
	329211,
	329219,
	329220,
	329223,
	329253,
	329261,
	329274,
	329286,
	329288,
	329301,
	329322,
	329373,
	329387,
	329390,
	329411,
	329415,
	329422,
	329425,
	329426,
	329437,
	329472,
	329504,
	393629,
	393894,
	394311,
	394381,
	394684,
	395092,
	395561,
	395916,
	395965,
	396304,
	396338,
	396357,
	396420,
	396982,
	397735,
	397961,
	398228,
	398721,
	398901,
	399077,
	399498,
	399724,
	400099,
)

DefaultTopASNs contains all specially handled ASNs.

Functions

This section is empty.

Types

type ASN

type ASN uint32

ASN is the autonomous system number of an IP address.

See also https://datatracker.ietf.org/doc/html/rfc7300.

type Continent

type Continent string

Continent represents a continent code used by MaxMind.

const (
	// ContinentNone is an unknown continent code.
	ContinentNone Continent = ""
	// ContinentAF is Africa.
	ContinentAF Continent = "AF"
	// ContinentAN is Antarctica.
	ContinentAN Continent = "AN"
	// ContinentAS is Asia.
	ContinentAS Continent = "AS"
	// ContinentEU is Europe.
	ContinentEU Continent = "EU"
	// ContinentNA is North America.
	ContinentNA Continent = "NA"
	// ContinentOC is Oceania.
	ContinentOC Continent = "OC"
	// ContinentSA is South America.
	ContinentSA Continent = "SA"
)

Continent code constants.

func NewContinent

func NewContinent(s string) (c Continent, err error)

NewContinent converts s into a Continent while also validating it. Prefer to use this instead of a plain conversion.

type Country

type Country string

Country represents an ISO 3166-1 alpha-2 country code.

const (
	// CountryNone is an invalid or unknown country code.
	CountryNone Country = ""

	// CountryNotApplicable is the user-assigned ISO 3166-1 alpha-2 code used
	// when a country of origin cannot be determined due to a lack of
	// information, for example a response of the record type that doesn't
	// contain an IP address.
	CountryNotApplicable Country = "QN"

	// CountryXK is the user-assigned ISO 3166-1 alpha-2 code for Republic of
	// Kosovo.  Kosovo does not have a recognized ISO 3166 code, but it is still
	// an entity whose user-assigned code is relatively common.
	CountryXK Country = "XK"

	// CountryAD is the ISO 3166-1 alpha-2 code for
	// Andorra.
	CountryAD Country = "AD"
	// CountryAE is the ISO 3166-1 alpha-2 code for
	// United Arab Emirates.
	CountryAE Country = "AE"
	// CountryAF is the ISO 3166-1 alpha-2 code for
	// Afghanistan.
	CountryAF Country = "AF"
	// CountryAG is the ISO 3166-1 alpha-2 code for
	// Antigua and Barbuda.
	CountryAG Country = "AG"
	// CountryAI is the ISO 3166-1 alpha-2 code for
	// Anguilla.
	CountryAI Country = "AI"
	// CountryAL is the ISO 3166-1 alpha-2 code for
	// Albania.
	CountryAL Country = "AL"
	// CountryAM is the ISO 3166-1 alpha-2 code for
	// Armenia.
	CountryAM Country = "AM"
	// CountryAO is the ISO 3166-1 alpha-2 code for
	// Angola.
	CountryAO Country = "AO"
	// CountryAQ is the ISO 3166-1 alpha-2 code for
	// Antarctica.
	CountryAQ Country = "AQ"
	// CountryAR is the ISO 3166-1 alpha-2 code for
	// Argentina.
	CountryAR Country = "AR"
	// CountryAS is the ISO 3166-1 alpha-2 code for
	// American Samoa.
	CountryAS Country = "AS"
	// CountryAT is the ISO 3166-1 alpha-2 code for
	// Austria.
	CountryAT Country = "AT"
	// CountryAU is the ISO 3166-1 alpha-2 code for
	// Australia.
	CountryAU Country = "AU"
	// CountryAW is the ISO 3166-1 alpha-2 code for
	// Aruba.
	CountryAW Country = "AW"
	// CountryAX is the ISO 3166-1 alpha-2 code for
	// Åland Islands.
	CountryAX Country = "AX"
	// CountryAZ is the ISO 3166-1 alpha-2 code for
	// Azerbaijan.
	CountryAZ Country = "AZ"
	// CountryBA is the ISO 3166-1 alpha-2 code for
	// Bosnia and Herzegovina.
	CountryBA Country = "BA"
	// CountryBB is the ISO 3166-1 alpha-2 code for
	// Barbados.
	CountryBB Country = "BB"
	// CountryBD is the ISO 3166-1 alpha-2 code for
	// Bangladesh.
	CountryBD Country = "BD"
	// CountryBE is the ISO 3166-1 alpha-2 code for
	// Belgium.
	CountryBE Country = "BE"
	// CountryBF is the ISO 3166-1 alpha-2 code for
	// Burkina Faso.
	CountryBF Country = "BF"
	// CountryBG is the ISO 3166-1 alpha-2 code for
	// Bulgaria.
	CountryBG Country = "BG"
	// CountryBH is the ISO 3166-1 alpha-2 code for
	// Bahrain.
	CountryBH Country = "BH"
	// CountryBI is the ISO 3166-1 alpha-2 code for
	// Burundi.
	CountryBI Country = "BI"
	// CountryBJ is the ISO 3166-1 alpha-2 code for
	// Benin.
	CountryBJ Country = "BJ"
	// CountryBL is the ISO 3166-1 alpha-2 code for
	// Saint Barthélemy.
	CountryBL Country = "BL"
	// CountryBM is the ISO 3166-1 alpha-2 code for
	// Bermuda.
	CountryBM Country = "BM"
	// CountryBN is the ISO 3166-1 alpha-2 code for
	// Brunei Darussalam.
	CountryBN Country = "BN"
	// CountryBO is the ISO 3166-1 alpha-2 code for
	// Bolivia, Plurinational State of.
	CountryBO Country = "BO"
	// CountryBQ is the ISO 3166-1 alpha-2 code for
	// Bonaire, Sint Eustatius and Saba.
	CountryBQ Country = "BQ"
	// CountryBR is the ISO 3166-1 alpha-2 code for
	// Brazil.
	CountryBR Country = "BR"
	// CountryBS is the ISO 3166-1 alpha-2 code for
	// Bahamas.
	CountryBS Country = "BS"
	// CountryBT is the ISO 3166-1 alpha-2 code for
	// Bhutan.
	CountryBT Country = "BT"
	// CountryBV is the ISO 3166-1 alpha-2 code for
	// Bouvet Island.
	CountryBV Country = "BV"
	// CountryBW is the ISO 3166-1 alpha-2 code for
	// Botswana.
	CountryBW Country = "BW"
	// CountryBY is the ISO 3166-1 alpha-2 code for
	// Belarus.
	CountryBY Country = "BY"
	// CountryBZ is the ISO 3166-1 alpha-2 code for
	// Belize.
	CountryBZ Country = "BZ"
	// CountryCA is the ISO 3166-1 alpha-2 code for
	// Canada.
	CountryCA Country = "CA"
	// CountryCC is the ISO 3166-1 alpha-2 code for
	// Cocos (Keeling) Islands.
	CountryCC Country = "CC"
	// CountryCD is the ISO 3166-1 alpha-2 code for
	// Congo, Democratic Republic of the.
	CountryCD Country = "CD"
	// CountryCF is the ISO 3166-1 alpha-2 code for
	// Central African Republic.
	CountryCF Country = "CF"
	// CountryCG is the ISO 3166-1 alpha-2 code for
	// Congo.
	CountryCG Country = "CG"
	// CountryCH is the ISO 3166-1 alpha-2 code for
	// Switzerland.
	CountryCH Country = "CH"
	// CountryCI is the ISO 3166-1 alpha-2 code for
	// Côte d'Ivoire.
	CountryCI Country = "CI"
	// CountryCK is the ISO 3166-1 alpha-2 code for
	// Cook Islands.
	CountryCK Country = "CK"
	// CountryCL is the ISO 3166-1 alpha-2 code for
	// Chile.
	CountryCL Country = "CL"
	// CountryCM is the ISO 3166-1 alpha-2 code for
	// Cameroon.
	CountryCM Country = "CM"
	// CountryCN is the ISO 3166-1 alpha-2 code for
	// China.
	CountryCN Country = "CN"
	// CountryCO is the ISO 3166-1 alpha-2 code for
	// Colombia.
	CountryCO Country = "CO"
	// CountryCR is the ISO 3166-1 alpha-2 code for
	// Costa Rica.
	CountryCR Country = "CR"
	// CountryCU is the ISO 3166-1 alpha-2 code for
	// Cuba.
	CountryCU Country = "CU"
	// CountryCV is the ISO 3166-1 alpha-2 code for
	// Cabo Verde.
	CountryCV Country = "CV"
	// CountryCW is the ISO 3166-1 alpha-2 code for
	// Curaçao.
	CountryCW Country = "CW"
	// CountryCX is the ISO 3166-1 alpha-2 code for
	// Christmas Island.
	CountryCX Country = "CX"
	// CountryCY is the ISO 3166-1 alpha-2 code for
	// Cyprus.
	CountryCY Country = "CY"
	// CountryCZ is the ISO 3166-1 alpha-2 code for
	// Czechia.
	CountryCZ Country = "CZ"
	// CountryDE is the ISO 3166-1 alpha-2 code for
	// Germany.
	CountryDE Country = "DE"
	// CountryDJ is the ISO 3166-1 alpha-2 code for
	// Djibouti.
	CountryDJ Country = "DJ"
	// CountryDK is the ISO 3166-1 alpha-2 code for
	// Denmark.
	CountryDK Country = "DK"
	// CountryDM is the ISO 3166-1 alpha-2 code for
	// Dominica.
	CountryDM Country = "DM"
	// CountryDO is the ISO 3166-1 alpha-2 code for
	// Dominican Republic.
	CountryDO Country = "DO"
	// CountryDZ is the ISO 3166-1 alpha-2 code for
	// Algeria.
	CountryDZ Country = "DZ"
	// CountryEC is the ISO 3166-1 alpha-2 code for
	// Ecuador.
	CountryEC Country = "EC"
	// CountryEE is the ISO 3166-1 alpha-2 code for
	// Estonia.
	CountryEE Country = "EE"
	// CountryEG is the ISO 3166-1 alpha-2 code for
	// Egypt.
	CountryEG Country = "EG"
	// CountryEH is the ISO 3166-1 alpha-2 code for
	// Western Sahara.
	CountryEH Country = "EH"
	// CountryER is the ISO 3166-1 alpha-2 code for
	// Eritrea.
	CountryER Country = "ER"
	// CountryES is the ISO 3166-1 alpha-2 code for
	// Spain.
	CountryES Country = "ES"
	// CountryET is the ISO 3166-1 alpha-2 code for
	// Ethiopia.
	CountryET Country = "ET"
	// CountryFI is the ISO 3166-1 alpha-2 code for
	// Finland.
	CountryFI Country = "FI"
	// CountryFJ is the ISO 3166-1 alpha-2 code for
	// Fiji.
	CountryFJ Country = "FJ"
	// CountryFK is the ISO 3166-1 alpha-2 code for
	// Falkland Islands (Malvinas).
	CountryFK Country = "FK"
	// CountryFM is the ISO 3166-1 alpha-2 code for
	// Micronesia, Federated States of.
	CountryFM Country = "FM"
	// CountryFO is the ISO 3166-1 alpha-2 code for
	// Faroe Islands.
	CountryFO Country = "FO"
	// CountryFR is the ISO 3166-1 alpha-2 code for
	// France.
	CountryFR Country = "FR"
	// CountryGA is the ISO 3166-1 alpha-2 code for
	// Gabon.
	CountryGA Country = "GA"
	// CountryGB is the ISO 3166-1 alpha-2 code for
	// United Kingdom of Great Britain and Northern Ireland.
	CountryGB Country = "GB"
	// CountryGD is the ISO 3166-1 alpha-2 code for
	// Grenada.
	CountryGD Country = "GD"
	// CountryGE is the ISO 3166-1 alpha-2 code for
	// Georgia.
	CountryGE Country = "GE"
	// CountryGF is the ISO 3166-1 alpha-2 code for
	// French Guiana.
	CountryGF Country = "GF"
	// CountryGG is the ISO 3166-1 alpha-2 code for
	// Guernsey.
	CountryGG Country = "GG"
	// CountryGH is the ISO 3166-1 alpha-2 code for
	// Ghana.
	CountryGH Country = "GH"
	// CountryGI is the ISO 3166-1 alpha-2 code for
	// Gibraltar.
	CountryGI Country = "GI"
	// CountryGL is the ISO 3166-1 alpha-2 code for
	// Greenland.
	CountryGL Country = "GL"
	// CountryGM is the ISO 3166-1 alpha-2 code for
	// Gambia.
	CountryGM Country = "GM"
	// CountryGN is the ISO 3166-1 alpha-2 code for
	// Guinea.
	CountryGN Country = "GN"
	// CountryGP is the ISO 3166-1 alpha-2 code for
	// Guadeloupe.
	CountryGP Country = "GP"
	// CountryGQ is the ISO 3166-1 alpha-2 code for
	// Equatorial Guinea.
	CountryGQ Country = "GQ"
	// CountryGR is the ISO 3166-1 alpha-2 code for
	// Greece.
	CountryGR Country = "GR"
	// CountryGS is the ISO 3166-1 alpha-2 code for
	// South Georgia and the South Sandwich Islands.
	CountryGS Country = "GS"
	// CountryGT is the ISO 3166-1 alpha-2 code for
	// Guatemala.
	CountryGT Country = "GT"
	// CountryGU is the ISO 3166-1 alpha-2 code for
	// Guam.
	CountryGU Country = "GU"
	// CountryGW is the ISO 3166-1 alpha-2 code for
	// Guinea-Bissau.
	CountryGW Country = "GW"
	// CountryGY is the ISO 3166-1 alpha-2 code for
	// Guyana.
	CountryGY Country = "GY"
	// CountryHK is the ISO 3166-1 alpha-2 code for
	// Hong Kong.
	CountryHK Country = "HK"
	// CountryHM is the ISO 3166-1 alpha-2 code for
	// Heard Island and McDonald Islands.
	CountryHM Country = "HM"
	// CountryHN is the ISO 3166-1 alpha-2 code for
	// Honduras.
	CountryHN Country = "HN"
	// CountryHR is the ISO 3166-1 alpha-2 code for
	// Croatia.
	CountryHR Country = "HR"
	// CountryHT is the ISO 3166-1 alpha-2 code for
	// Haiti.
	CountryHT Country = "HT"
	// CountryHU is the ISO 3166-1 alpha-2 code for
	// Hungary.
	CountryHU Country = "HU"
	// CountryID is the ISO 3166-1 alpha-2 code for
	// Indonesia.
	CountryID Country = "ID"
	// CountryIE is the ISO 3166-1 alpha-2 code for
	// Ireland.
	CountryIE Country = "IE"
	// CountryIL is the ISO 3166-1 alpha-2 code for
	// Israel.
	CountryIL Country = "IL"
	// CountryIM is the ISO 3166-1 alpha-2 code for
	// Isle of Man.
	CountryIM Country = "IM"
	// CountryIN is the ISO 3166-1 alpha-2 code for
	// India.
	CountryIN Country = "IN"
	// CountryIO is the ISO 3166-1 alpha-2 code for
	// British Indian Ocean Territory.
	CountryIO Country = "IO"
	// CountryIQ is the ISO 3166-1 alpha-2 code for
	// Iraq.
	CountryIQ Country = "IQ"
	// CountryIR is the ISO 3166-1 alpha-2 code for
	// Iran, Islamic Republic of.
	CountryIR Country = "IR"
	// CountryIS is the ISO 3166-1 alpha-2 code for
	// Iceland.
	CountryIS Country = "IS"
	// CountryIT is the ISO 3166-1 alpha-2 code for
	// Italy.
	CountryIT Country = "IT"
	// CountryJE is the ISO 3166-1 alpha-2 code for
	// Jersey.
	CountryJE Country = "JE"
	// CountryJM is the ISO 3166-1 alpha-2 code for
	// Jamaica.
	CountryJM Country = "JM"
	// CountryJO is the ISO 3166-1 alpha-2 code for
	// Jordan.
	CountryJO Country = "JO"
	// CountryJP is the ISO 3166-1 alpha-2 code for
	// Japan.
	CountryJP Country = "JP"
	// CountryKE is the ISO 3166-1 alpha-2 code for
	// Kenya.
	CountryKE Country = "KE"
	// CountryKG is the ISO 3166-1 alpha-2 code for
	// Kyrgyzstan.
	CountryKG Country = "KG"
	// CountryKH is the ISO 3166-1 alpha-2 code for
	// Cambodia.
	CountryKH Country = "KH"
	// CountryKI is the ISO 3166-1 alpha-2 code for
	// Kiribati.
	CountryKI Country = "KI"
	// CountryKM is the ISO 3166-1 alpha-2 code for
	// Comoros.
	CountryKM Country = "KM"
	// CountryKN is the ISO 3166-1 alpha-2 code for
	// Saint Kitts and Nevis.
	CountryKN Country = "KN"
	// CountryKP is the ISO 3166-1 alpha-2 code for
	// Korea, Democratic People's Republic of.
	CountryKP Country = "KP"
	// CountryKR is the ISO 3166-1 alpha-2 code for
	// Korea, Republic of.
	CountryKR Country = "KR"
	// CountryKW is the ISO 3166-1 alpha-2 code for
	// Kuwait.
	CountryKW Country = "KW"
	// CountryKY is the ISO 3166-1 alpha-2 code for
	// Cayman Islands.
	CountryKY Country = "KY"
	// CountryKZ is the ISO 3166-1 alpha-2 code for
	// Kazakhstan.
	CountryKZ Country = "KZ"
	// CountryLA is the ISO 3166-1 alpha-2 code for
	// Lao People's Democratic Republic.
	CountryLA Country = "LA"
	// CountryLB is the ISO 3166-1 alpha-2 code for
	// Lebanon.
	CountryLB Country = "LB"
	// CountryLC is the ISO 3166-1 alpha-2 code for
	// Saint Lucia.
	CountryLC Country = "LC"
	// CountryLI is the ISO 3166-1 alpha-2 code for
	// Liechtenstein.
	CountryLI Country = "LI"
	// CountryLK is the ISO 3166-1 alpha-2 code for
	// Sri Lanka.
	CountryLK Country = "LK"
	// CountryLR is the ISO 3166-1 alpha-2 code for
	// Liberia.
	CountryLR Country = "LR"
	// CountryLS is the ISO 3166-1 alpha-2 code for
	// Lesotho.
	CountryLS Country = "LS"
	// CountryLT is the ISO 3166-1 alpha-2 code for
	// Lithuania.
	CountryLT Country = "LT"
	// CountryLU is the ISO 3166-1 alpha-2 code for
	// Luxembourg.
	CountryLU Country = "LU"
	// CountryLV is the ISO 3166-1 alpha-2 code for
	// Latvia.
	CountryLV Country = "LV"
	// CountryLY is the ISO 3166-1 alpha-2 code for
	// Libya.
	CountryLY Country = "LY"
	// CountryMA is the ISO 3166-1 alpha-2 code for
	// Morocco.
	CountryMA Country = "MA"
	// CountryMC is the ISO 3166-1 alpha-2 code for
	// Monaco.
	CountryMC Country = "MC"
	// CountryMD is the ISO 3166-1 alpha-2 code for
	// Moldova, Republic of.
	CountryMD Country = "MD"
	// CountryME is the ISO 3166-1 alpha-2 code for
	// Montenegro.
	CountryME Country = "ME"
	// CountryMF is the ISO 3166-1 alpha-2 code for
	// Saint Martin (French part).
	CountryMF Country = "MF"
	// CountryMG is the ISO 3166-1 alpha-2 code for
	// Madagascar.
	CountryMG Country = "MG"
	// CountryMH is the ISO 3166-1 alpha-2 code for
	// Marshall Islands.
	CountryMH Country = "MH"
	// CountryMK is the ISO 3166-1 alpha-2 code for
	// North Macedonia.
	CountryMK Country = "MK"
	// CountryML is the ISO 3166-1 alpha-2 code for
	// Mali.
	CountryML Country = "ML"
	// CountryMM is the ISO 3166-1 alpha-2 code for
	// Myanmar.
	CountryMM Country = "MM"
	// CountryMN is the ISO 3166-1 alpha-2 code for
	// Mongolia.
	CountryMN Country = "MN"
	// CountryMO is the ISO 3166-1 alpha-2 code for
	// Macao.
	CountryMO Country = "MO"
	// CountryMP is the ISO 3166-1 alpha-2 code for
	// Northern Mariana Islands.
	CountryMP Country = "MP"
	// CountryMQ is the ISO 3166-1 alpha-2 code for
	// Martinique.
	CountryMQ Country = "MQ"
	// CountryMR is the ISO 3166-1 alpha-2 code for
	// Mauritania.
	CountryMR Country = "MR"
	// CountryMS is the ISO 3166-1 alpha-2 code for
	// Montserrat.
	CountryMS Country = "MS"
	// CountryMT is the ISO 3166-1 alpha-2 code for
	// Malta.
	CountryMT Country = "MT"
	// CountryMU is the ISO 3166-1 alpha-2 code for
	// Mauritius.
	CountryMU Country = "MU"
	// CountryMV is the ISO 3166-1 alpha-2 code for
	// Maldives.
	CountryMV Country = "MV"
	// CountryMW is the ISO 3166-1 alpha-2 code for
	// Malawi.
	CountryMW Country = "MW"
	// CountryMX is the ISO 3166-1 alpha-2 code for
	// Mexico.
	CountryMX Country = "MX"
	// CountryMY is the ISO 3166-1 alpha-2 code for
	// Malaysia.
	CountryMY Country = "MY"
	// CountryMZ is the ISO 3166-1 alpha-2 code for
	// Mozambique.
	CountryMZ Country = "MZ"
	// CountryNA is the ISO 3166-1 alpha-2 code for
	// Namibia.
	CountryNA Country = "NA"
	// CountryNC is the ISO 3166-1 alpha-2 code for
	// New Caledonia.
	CountryNC Country = "NC"
	// CountryNE is the ISO 3166-1 alpha-2 code for
	// Niger.
	CountryNE Country = "NE"
	// CountryNF is the ISO 3166-1 alpha-2 code for
	// Norfolk Island.
	CountryNF Country = "NF"
	// CountryNG is the ISO 3166-1 alpha-2 code for
	// Nigeria.
	CountryNG Country = "NG"
	// CountryNI is the ISO 3166-1 alpha-2 code for
	// Nicaragua.
	CountryNI Country = "NI"
	// CountryNL is the ISO 3166-1 alpha-2 code for
	// Netherlands, Kingdom of the.
	CountryNL Country = "NL"
	// CountryNO is the ISO 3166-1 alpha-2 code for
	// Norway.
	CountryNO Country = "NO"
	// CountryNP is the ISO 3166-1 alpha-2 code for
	// Nepal.
	CountryNP Country = "NP"
	// CountryNR is the ISO 3166-1 alpha-2 code for
	// Nauru.
	CountryNR Country = "NR"
	// CountryNU is the ISO 3166-1 alpha-2 code for
	// Niue.
	CountryNU Country = "NU"
	// CountryNZ is the ISO 3166-1 alpha-2 code for
	// New Zealand.
	CountryNZ Country = "NZ"
	// CountryOM is the ISO 3166-1 alpha-2 code for
	// Oman.
	CountryOM Country = "OM"
	// CountryPA is the ISO 3166-1 alpha-2 code for
	// Panama.
	CountryPA Country = "PA"
	// CountryPE is the ISO 3166-1 alpha-2 code for
	// Peru.
	CountryPE Country = "PE"
	// CountryPF is the ISO 3166-1 alpha-2 code for
	// French Polynesia.
	CountryPF Country = "PF"
	// CountryPG is the ISO 3166-1 alpha-2 code for
	// Papua New Guinea.
	CountryPG Country = "PG"
	// CountryPH is the ISO 3166-1 alpha-2 code for
	// Philippines.
	CountryPH Country = "PH"
	// CountryPK is the ISO 3166-1 alpha-2 code for
	// Pakistan.
	CountryPK Country = "PK"
	// CountryPL is the ISO 3166-1 alpha-2 code for
	// Poland.
	CountryPL Country = "PL"
	// CountryPM is the ISO 3166-1 alpha-2 code for
	// Saint Pierre and Miquelon.
	CountryPM Country = "PM"
	// CountryPN is the ISO 3166-1 alpha-2 code for
	// Pitcairn.
	CountryPN Country = "PN"
	// CountryPR is the ISO 3166-1 alpha-2 code for
	// Puerto Rico.
	CountryPR Country = "PR"
	// CountryPS is the ISO 3166-1 alpha-2 code for
	// Palestine, State of.
	CountryPS Country = "PS"
	// CountryPT is the ISO 3166-1 alpha-2 code for
	// Portugal.
	CountryPT Country = "PT"
	// CountryPW is the ISO 3166-1 alpha-2 code for
	// Palau.
	CountryPW Country = "PW"
	// CountryPY is the ISO 3166-1 alpha-2 code for
	// Paraguay.
	CountryPY Country = "PY"
	// CountryQA is the ISO 3166-1 alpha-2 code for
	// Qatar.
	CountryQA Country = "QA"
	// CountryRE is the ISO 3166-1 alpha-2 code for
	// Réunion.
	CountryRE Country = "RE"
	// CountryRO is the ISO 3166-1 alpha-2 code for
	// Romania.
	CountryRO Country = "RO"
	// CountryRS is the ISO 3166-1 alpha-2 code for
	// Serbia.
	CountryRS Country = "RS"
	// CountryRU is the ISO 3166-1 alpha-2 code for
	// Russian Federation.
	CountryRU Country = "RU"
	// CountryRW is the ISO 3166-1 alpha-2 code for
	// Rwanda.
	CountryRW Country = "RW"
	// CountrySA is the ISO 3166-1 alpha-2 code for
	// Saudi Arabia.
	CountrySA Country = "SA"
	// CountrySB is the ISO 3166-1 alpha-2 code for
	// Solomon Islands.
	CountrySB Country = "SB"
	// CountrySC is the ISO 3166-1 alpha-2 code for
	// Seychelles.
	CountrySC Country = "SC"
	// CountrySD is the ISO 3166-1 alpha-2 code for
	// Sudan.
	CountrySD Country = "SD"
	// CountrySE is the ISO 3166-1 alpha-2 code for
	// Sweden.
	CountrySE Country = "SE"
	// CountrySG is the ISO 3166-1 alpha-2 code for
	// Singapore.
	CountrySG Country = "SG"
	// CountrySH is the ISO 3166-1 alpha-2 code for
	// Saint Helena, Ascension and Tristan da Cunha.
	CountrySH Country = "SH"
	// CountrySI is the ISO 3166-1 alpha-2 code for
	// Slovenia.
	CountrySI Country = "SI"
	// CountrySJ is the ISO 3166-1 alpha-2 code for
	// Svalbard and Jan Mayen.
	CountrySJ Country = "SJ"
	// CountrySK is the ISO 3166-1 alpha-2 code for
	// Slovakia.
	CountrySK Country = "SK"
	// CountrySL is the ISO 3166-1 alpha-2 code for
	// Sierra Leone.
	CountrySL Country = "SL"
	// CountrySM is the ISO 3166-1 alpha-2 code for
	// San Marino.
	CountrySM Country = "SM"
	// CountrySN is the ISO 3166-1 alpha-2 code for
	// Senegal.
	CountrySN Country = "SN"
	// CountrySO is the ISO 3166-1 alpha-2 code for
	// Somalia.
	CountrySO Country = "SO"
	// CountrySR is the ISO 3166-1 alpha-2 code for
	// Suriname.
	CountrySR Country = "SR"
	// CountrySS is the ISO 3166-1 alpha-2 code for
	// South Sudan.
	CountrySS Country = "SS"
	// CountryST is the ISO 3166-1 alpha-2 code for
	// Sao Tome and Principe.
	CountryST Country = "ST"
	// CountrySV is the ISO 3166-1 alpha-2 code for
	// El Salvador.
	CountrySV Country = "SV"
	// CountrySX is the ISO 3166-1 alpha-2 code for
	// Sint Maarten (Dutch part).
	CountrySX Country = "SX"
	// CountrySY is the ISO 3166-1 alpha-2 code for
	// Syrian Arab Republic.
	CountrySY Country = "SY"
	// CountrySZ is the ISO 3166-1 alpha-2 code for
	// Eswatini.
	CountrySZ Country = "SZ"
	// CountryTC is the ISO 3166-1 alpha-2 code for
	// Turks and Caicos Islands.
	CountryTC Country = "TC"
	// CountryTD is the ISO 3166-1 alpha-2 code for
	// Chad.
	CountryTD Country = "TD"
	// CountryTF is the ISO 3166-1 alpha-2 code for
	// French Southern Territories.
	CountryTF Country = "TF"
	// CountryTG is the ISO 3166-1 alpha-2 code for
	// Togo.
	CountryTG Country = "TG"
	// CountryTH is the ISO 3166-1 alpha-2 code for
	// Thailand.
	CountryTH Country = "TH"
	// CountryTJ is the ISO 3166-1 alpha-2 code for
	// Tajikistan.
	CountryTJ Country = "TJ"
	// CountryTK is the ISO 3166-1 alpha-2 code for
	// Tokelau.
	CountryTK Country = "TK"
	// CountryTL is the ISO 3166-1 alpha-2 code for
	// Timor-Leste.
	CountryTL Country = "TL"
	// CountryTM is the ISO 3166-1 alpha-2 code for
	// Turkmenistan.
	CountryTM Country = "TM"
	// CountryTN is the ISO 3166-1 alpha-2 code for
	// Tunisia.
	CountryTN Country = "TN"
	// CountryTO is the ISO 3166-1 alpha-2 code for
	// Tonga.
	CountryTO Country = "TO"
	// CountryTR is the ISO 3166-1 alpha-2 code for
	// Türkiye.
	CountryTR Country = "TR"
	// CountryTT is the ISO 3166-1 alpha-2 code for
	// Trinidad and Tobago.
	CountryTT Country = "TT"
	// CountryTV is the ISO 3166-1 alpha-2 code for
	// Tuvalu.
	CountryTV Country = "TV"
	// CountryTW is the ISO 3166-1 alpha-2 code for
	// Taiwan, Province of China.
	CountryTW Country = "TW"
	// CountryTZ is the ISO 3166-1 alpha-2 code for
	// Tanzania, United Republic of.
	CountryTZ Country = "TZ"
	// CountryUA is the ISO 3166-1 alpha-2 code for
	// Ukraine.
	CountryUA Country = "UA"
	// CountryUG is the ISO 3166-1 alpha-2 code for
	// Uganda.
	CountryUG Country = "UG"
	// CountryUM is the ISO 3166-1 alpha-2 code for
	// United States Minor Outlying Islands.
	CountryUM Country = "UM"
	// CountryUS is the ISO 3166-1 alpha-2 code for
	// United States of America.
	CountryUS Country = "US"
	// CountryUY is the ISO 3166-1 alpha-2 code for
	// Uruguay.
	CountryUY Country = "UY"
	// CountryUZ is the ISO 3166-1 alpha-2 code for
	// Uzbekistan.
	CountryUZ Country = "UZ"
	// CountryVA is the ISO 3166-1 alpha-2 code for
	// Holy See.
	CountryVA Country = "VA"
	// CountryVC is the ISO 3166-1 alpha-2 code for
	// Saint Vincent and the Grenadines.
	CountryVC Country = "VC"
	// CountryVE is the ISO 3166-1 alpha-2 code for
	// Venezuela, Bolivarian Republic of.
	CountryVE Country = "VE"
	// CountryVG is the ISO 3166-1 alpha-2 code for
	// Virgin Islands (British).
	CountryVG Country = "VG"
	// CountryVI is the ISO 3166-1 alpha-2 code for
	// Virgin Islands (U.S.).
	CountryVI Country = "VI"
	// CountryVN is the ISO 3166-1 alpha-2 code for
	// Viet Nam.
	CountryVN Country = "VN"
	// CountryVU is the ISO 3166-1 alpha-2 code for
	// Vanuatu.
	CountryVU Country = "VU"
	// CountryWF is the ISO 3166-1 alpha-2 code for
	// Wallis and Futuna.
	CountryWF Country = "WF"
	// CountryWS is the ISO 3166-1 alpha-2 code for
	// Samoa.
	CountryWS Country = "WS"
	// CountryYE is the ISO 3166-1 alpha-2 code for
	// Yemen.
	CountryYE Country = "YE"
	// CountryYT is the ISO 3166-1 alpha-2 code for
	// Mayotte.
	CountryYT Country = "YT"
	// CountryZA is the ISO 3166-1 alpha-2 code for
	// South Africa.
	CountryZA Country = "ZA"
	// CountryZM is the ISO 3166-1 alpha-2 code for
	// Zambia.
	CountryZM Country = "ZM"
	// CountryZW is the ISO 3166-1 alpha-2 code for
	// Zimbabwe.
	CountryZW Country = "ZW"
)

Country code constants. Note that these constants don't include the user-assigned ones.

func NewCountry

func NewCountry(s string) (c Country, err error)

NewCountry converts s into a Country while also validating it. Prefer to use this instead of a plain conversion.

func (*Country) UnmarshalText

func (c *Country) UnmarshalText(b []byte) (err error)

UnmarshalText implements the encoding.TextUnmarshaler interface for *Country.

type File

type File struct {
	// contains filtered or unexported fields
}

File is a file implementation of geoip.Interface. It should be initially refreshed before use.

func NewFile

func NewFile(c *FileConfig) (f *File)

NewFile returns a new GeoIP database that reads information from a file. It also adds the caches with IDs [CacheIDIP] and [CacheIDHost] to the cache manager.

func (*File) Data

func (f *File) Data(host string, ip netip.Addr) (l *Location, err error)

Data implements the Interface interface for *File. If ip is netip.Addr{}, Data tries to lookup and return the data based on host, unless it's empty.

func (*File) Refresh

func (f *File) Refresh(ctx context.Context) (err error)

Refresh implements the [agdservice.Refresher] interface for *File. It reopens the GeoIP database files.

func (*File) SubnetByLocation

func (f *File) SubnetByLocation(l *Location, fam netutil.AddrFamily) (n netip.Prefix, err error)

SubnetByLocation implements the Interface interface for *File. fam must be either netutil.AddrFamilyIPv4 or netutil.AddrFamilyIPv6. l must not be nil.

The process of the subnet selection is as follows:

  1. A list of the most common ASNs, including the top ASN for each country, is pre-generated from the statistics data. See file asntops_generate.go and its output, asntops.go.

  2. During the server startup, File scans through the provided GeoIP database files searching for the fitting subnets for ASNs and countries. See [resetCountrySubnets] and [File.resetLocationSubnets].

  3. If asn is found within the list of the most used ASNs, its subnet is returned. If not, the top ASN for the provided country is chosen and its subnet is returned. If the information about the most used ASNs is not available, the first subnet from the country that is broad enough (see resetCountrySubnets) is chosen.

type FileConfig

type FileConfig struct {
	// Logger is used for logging the operation of the file-based GeoIP
	// database.
	Logger *slog.Logger

	// CacheManager is the global cache manager.  CacheManager must not be nil.
	CacheManager agdcache.Manager

	// AllTopASNs contains all subnets from CountryTopASNs.  While scanning the
	// statistics data file this set is used to check if the current ASN
	// included in CountryTopASNs.
	AllTopASNs *container.MapSet[ASN]

	// CountryTopASNs is a mapping of a country to their top ASNs.
	CountryTopASNs map[Country]ASN

	// ASNPath is the path to the GeoIP database of ASNs.
	ASNPath string

	// CountryPath is the path to the GeoIP database of countries.  The
	// databases containing subdivisions and cities info are also supported.
	CountryPath string

	// HostCacheCount is how many lookups are cached by hostname.  Zero means no
	// host caching is performed.
	HostCacheCount int

	// IPCacheCount is how many lookups are cached by IP address.
	IPCacheCount int
}

FileConfig is the file-based GeoIP configuration structure.

type Interface

type Interface interface {
	// SubnetByLocation returns the default subnet for location, if there is
	// one.  If there isn't, n is an unspecified subnet.  fam must be either
	// [netutil.AddrFamilyIPv4] or [netutil.AddrFamilyIPv6].
	SubnetByLocation(l *Location, fam netutil.AddrFamily) (n netip.Prefix, err error)

	// Data returns the GeoIP data for ip.  It may use host to get cached GeoIP
	// data if ip is netip.Addr{}.
	Data(host string, ip netip.Addr) (l *Location, err error)
}

Interface is the interface for the GeoIP database that stores the geographic data about an IP address.

type Location

type Location struct {
	// Country is the country whose subnets contain the IP address.
	Country Country

	// Continent is the continent whose subnets contain the IP address.
	Continent Continent

	// TopSubdivision is the ISO-code of the political subdivision of a country
	// whose subnets contain the IP address.  This field may be empty.
	TopSubdivision string

	// ASN is the number of the autonomous system whose subnets contain the IP
	// address.
	ASN ASN
}

Location represents the GeoIP location data about an IP address.

type NotAContinentError

type NotAContinentError struct {
	// Code is the code presented to NewContinent.
	Code string
}

NotAContinentError is returned from NewContinent when the string doesn't represent a valid continent.

func (*NotAContinentError) Error

func (err *NotAContinentError) Error() (msg string)

Error implements the error interface for *NotAContinentError.

type NotACountryError

type NotACountryError struct {
	// Code is the code presented to NewCountry.
	Code string
}

NotACountryError is returned from NewCountry when the string doesn't represent a valid country.

func (*NotACountryError) Error

func (err *NotACountryError) Error() (msg string)

Error implements the error interface for *NotACountryError.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL