mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Combine geoip country info and add country names
This commit is contained in:
parent
629b2db495
commit
5939486767
9 changed files with 1828 additions and 543 deletions
1776
intel/geoip/country_info.go
Normal file
1776
intel/geoip/country_info.go
Normal file
File diff suppressed because it is too large
Load diff
43
intel/geoip/country_info_test.go
Normal file
43
intel/geoip/country_info_test.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
package geoip
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCountryInfo(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
for key, country := range countries {
|
||||
if key != country.ID {
|
||||
t.Errorf("%s has a wrong ID of %q", key, country.ID)
|
||||
}
|
||||
if country.Name == "" {
|
||||
t.Errorf("%s is missing name", key)
|
||||
}
|
||||
if country.Region == "" {
|
||||
t.Errorf("%s is missing region", key)
|
||||
}
|
||||
if country.ContinentCode == "" {
|
||||
t.Errorf("%s is missing continent", key)
|
||||
}
|
||||
if country.Center.Latitude == 0 && country.Center.Longitude == 0 {
|
||||
t.Errorf("%s is missing coords", key)
|
||||
}
|
||||
|
||||
// Generate map source from data:
|
||||
// fmt.Printf(
|
||||
// `"%s": {Name:%q,Region:%q,ContinentCode:%q,Center:Coordinates{AccuracyRadius:%d,Latitude:%f,Longitude:%f},},`,
|
||||
// key,
|
||||
// country.Name,
|
||||
// country.Region,
|
||||
// country.ContinentCode,
|
||||
// country.Center.AccuracyRadius,
|
||||
// country.Center.Latitude,
|
||||
// country.Center.Longitude,
|
||||
// )
|
||||
// fmt.Println()
|
||||
}
|
||||
if len(countries) < 247 {
|
||||
t.Errorf("dataset only includes %d countries", len(countries))
|
||||
}
|
||||
}
|
|
@ -1,264 +0,0 @@
|
|||
package geoip
|
||||
|
||||
const defaultCountryBasedAccuracy = 200
|
||||
|
||||
// FillMissingInfo tries to fill missing location information based on the
|
||||
// available existing information.
|
||||
func (l *Location) FillMissingInfo() {
|
||||
// Get coordinates from country.
|
||||
if l.Coordinates.Latitude == 0 &&
|
||||
l.Coordinates.Longitude == 0 &&
|
||||
l.Country.ISOCode != "" {
|
||||
if c, ok := countryCoordinates[l.Country.ISOCode]; ok {
|
||||
l.Coordinates = c
|
||||
l.Coordinates.AccuracyRadius = defaultCountryBasedAccuracy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var countryCoordinates = map[string]Coordinates{
|
||||
"AD": {Latitude: 42, Longitude: 1},
|
||||
"AE": {Latitude: 23, Longitude: 53},
|
||||
"AF": {Latitude: 33, Longitude: 67},
|
||||
"AG": {Latitude: 17, Longitude: -61},
|
||||
"AI": {Latitude: 18, Longitude: -63},
|
||||
"AL": {Latitude: 41, Longitude: 20},
|
||||
"AM": {Latitude: 40, Longitude: 45},
|
||||
"AN": {Latitude: 12, Longitude: -69},
|
||||
"AO": {Latitude: -11, Longitude: 17},
|
||||
"AQ": {Latitude: -75, Longitude: -0},
|
||||
"AR": {Latitude: -38, Longitude: -63},
|
||||
"AS": {Latitude: -14, Longitude: -170},
|
||||
"AT": {Latitude: 47, Longitude: 14},
|
||||
"AU": {Latitude: -25, Longitude: 133},
|
||||
"AW": {Latitude: 12, Longitude: -69},
|
||||
"AZ": {Latitude: 40, Longitude: 47},
|
||||
"BA": {Latitude: 43, Longitude: 17},
|
||||
"BB": {Latitude: 13, Longitude: -59},
|
||||
"BD": {Latitude: 23, Longitude: 90},
|
||||
"BE": {Latitude: 50, Longitude: 4},
|
||||
"BF": {Latitude: 12, Longitude: -1},
|
||||
"BG": {Latitude: 42, Longitude: 25},
|
||||
"BH": {Latitude: 25, Longitude: 50},
|
||||
"BI": {Latitude: -3, Longitude: 29},
|
||||
"BJ": {Latitude: 9, Longitude: 2},
|
||||
"BM": {Latitude: 32, Longitude: -64},
|
||||
"BN": {Latitude: 4, Longitude: 114},
|
||||
"BO": {Latitude: -16, Longitude: -63},
|
||||
"BR": {Latitude: -14, Longitude: -51},
|
||||
"BS": {Latitude: 25, Longitude: -77},
|
||||
"BT": {Latitude: 27, Longitude: 90},
|
||||
"BV": {Latitude: -54, Longitude: 3},
|
||||
"BW": {Latitude: -22, Longitude: 24},
|
||||
"BY": {Latitude: 53, Longitude: 27},
|
||||
"BZ": {Latitude: 17, Longitude: -88},
|
||||
"CA": {Latitude: 56, Longitude: -106},
|
||||
"CC": {Latitude: -12, Longitude: 96},
|
||||
"CD": {Latitude: -4, Longitude: 21},
|
||||
"CF": {Latitude: 6, Longitude: 20},
|
||||
"CG": {Latitude: -0, Longitude: 15},
|
||||
"CH": {Latitude: 46, Longitude: 8},
|
||||
"CI": {Latitude: 7, Longitude: -5},
|
||||
"CK": {Latitude: -21, Longitude: -159},
|
||||
"CL": {Latitude: -35, Longitude: -71},
|
||||
"CM": {Latitude: 7, Longitude: 12},
|
||||
"CN": {Latitude: 35, Longitude: 104},
|
||||
"CO": {Latitude: 4, Longitude: -74},
|
||||
"CR": {Latitude: 9, Longitude: -83},
|
||||
"CU": {Latitude: 21, Longitude: -77},
|
||||
"CV": {Latitude: 16, Longitude: -24},
|
||||
"CX": {Latitude: -10, Longitude: 105},
|
||||
"CY": {Latitude: 35, Longitude: 33},
|
||||
"CZ": {Latitude: 49, Longitude: 15},
|
||||
"DE": {Latitude: 51, Longitude: 10},
|
||||
"DJ": {Latitude: 11, Longitude: 42},
|
||||
"DK": {Latitude: 56, Longitude: 9},
|
||||
"DM": {Latitude: 15, Longitude: -61},
|
||||
"DO": {Latitude: 18, Longitude: -70},
|
||||
"DZ": {Latitude: 28, Longitude: 1},
|
||||
"EC": {Latitude: -1, Longitude: -78},
|
||||
"EE": {Latitude: 58, Longitude: 25},
|
||||
"EG": {Latitude: 26, Longitude: 30},
|
||||
"EH": {Latitude: 24, Longitude: -12},
|
||||
"ER": {Latitude: 15, Longitude: 39},
|
||||
"ES": {Latitude: 40, Longitude: -3},
|
||||
"ET": {Latitude: 9, Longitude: 40},
|
||||
"FI": {Latitude: 61, Longitude: 25},
|
||||
"FJ": {Latitude: -16, Longitude: 179},
|
||||
"FK": {Latitude: -51, Longitude: -59},
|
||||
"FM": {Latitude: 7, Longitude: 150},
|
||||
"FO": {Latitude: 61, Longitude: -6},
|
||||
"FR": {Latitude: 46, Longitude: 2},
|
||||
"GA": {Latitude: -0, Longitude: 11},
|
||||
"GB": {Latitude: 55, Longitude: -3},
|
||||
"GD": {Latitude: 12, Longitude: -61},
|
||||
"GE": {Latitude: 42, Longitude: 43},
|
||||
"GF": {Latitude: 3, Longitude: -53},
|
||||
"GG": {Latitude: 49, Longitude: -2},
|
||||
"GH": {Latitude: 7, Longitude: -1},
|
||||
"GI": {Latitude: 36, Longitude: -5},
|
||||
"GL": {Latitude: 71, Longitude: -42},
|
||||
"GM": {Latitude: 13, Longitude: -15},
|
||||
"GN": {Latitude: 9, Longitude: -9},
|
||||
"GP": {Latitude: 16, Longitude: -62},
|
||||
"GQ": {Latitude: 1, Longitude: 10},
|
||||
"GR": {Latitude: 39, Longitude: 21},
|
||||
"GS": {Latitude: -54, Longitude: -36},
|
||||
"GT": {Latitude: 15, Longitude: -90},
|
||||
"GU": {Latitude: 13, Longitude: 144},
|
||||
"GW": {Latitude: 11, Longitude: -15},
|
||||
"GY": {Latitude: 4, Longitude: -58},
|
||||
"GZ": {Latitude: 31, Longitude: 34},
|
||||
"HK": {Latitude: 22, Longitude: 114},
|
||||
"HM": {Latitude: -53, Longitude: 73},
|
||||
"HN": {Latitude: 15, Longitude: -86},
|
||||
"HR": {Latitude: 45, Longitude: 15},
|
||||
"HT": {Latitude: 18, Longitude: -72},
|
||||
"HU": {Latitude: 47, Longitude: 19},
|
||||
"ID": {Latitude: -0, Longitude: 113},
|
||||
"IE": {Latitude: 53, Longitude: -8},
|
||||
"IL": {Latitude: 31, Longitude: 34},
|
||||
"IM": {Latitude: 54, Longitude: -4},
|
||||
"IN": {Latitude: 20, Longitude: 78},
|
||||
"IO": {Latitude: -6, Longitude: 71},
|
||||
"IQ": {Latitude: 33, Longitude: 43},
|
||||
"IR": {Latitude: 32, Longitude: 53},
|
||||
"IS": {Latitude: 64, Longitude: -19},
|
||||
"IT": {Latitude: 41, Longitude: 12},
|
||||
"JE": {Latitude: 49, Longitude: -2},
|
||||
"JM": {Latitude: 18, Longitude: -77},
|
||||
"JO": {Latitude: 30, Longitude: 36},
|
||||
"JP": {Latitude: 36, Longitude: 138},
|
||||
"KE": {Latitude: -0, Longitude: 37},
|
||||
"KG": {Latitude: 41, Longitude: 74},
|
||||
"KH": {Latitude: 12, Longitude: 104},
|
||||
"KI": {Latitude: -3, Longitude: -168},
|
||||
"KM": {Latitude: -11, Longitude: 43},
|
||||
"KN": {Latitude: 17, Longitude: -62},
|
||||
"KP": {Latitude: 40, Longitude: 127},
|
||||
"KR": {Latitude: 35, Longitude: 127},
|
||||
"KW": {Latitude: 29, Longitude: 47},
|
||||
"KY": {Latitude: 19, Longitude: -80},
|
||||
"KZ": {Latitude: 48, Longitude: 66},
|
||||
"LA": {Latitude: 19, Longitude: 102},
|
||||
"LB": {Latitude: 33, Longitude: 35},
|
||||
"LC": {Latitude: 13, Longitude: -60},
|
||||
"LI": {Latitude: 47, Longitude: 9},
|
||||
"LK": {Latitude: 7, Longitude: 80},
|
||||
"LR": {Latitude: 6, Longitude: -9},
|
||||
"LS": {Latitude: -29, Longitude: 28},
|
||||
"LT": {Latitude: 55, Longitude: 23},
|
||||
"LU": {Latitude: 49, Longitude: 6},
|
||||
"LV": {Latitude: 56, Longitude: 24},
|
||||
"LY": {Latitude: 26, Longitude: 17},
|
||||
"MA": {Latitude: 31, Longitude: -7},
|
||||
"MC": {Latitude: 43, Longitude: 7},
|
||||
"MD": {Latitude: 47, Longitude: 28},
|
||||
"ME": {Latitude: 42, Longitude: 19},
|
||||
"MG": {Latitude: -18, Longitude: 46},
|
||||
"MH": {Latitude: 7, Longitude: 171},
|
||||
"MK": {Latitude: 41, Longitude: 21},
|
||||
"ML": {Latitude: 17, Longitude: -3},
|
||||
"MM": {Latitude: 21, Longitude: 95},
|
||||
"MN": {Latitude: 46, Longitude: 103},
|
||||
"MO": {Latitude: 22, Longitude: 113},
|
||||
"MP": {Latitude: 17, Longitude: 145},
|
||||
"MQ": {Latitude: 14, Longitude: -61},
|
||||
"MR": {Latitude: 21, Longitude: -10},
|
||||
"MS": {Latitude: 16, Longitude: -62},
|
||||
"MT": {Latitude: 35, Longitude: 14},
|
||||
"MU": {Latitude: -20, Longitude: 57},
|
||||
"MV": {Latitude: 3, Longitude: 73},
|
||||
"MW": {Latitude: -13, Longitude: 34},
|
||||
"MX": {Latitude: 23, Longitude: -102},
|
||||
"MY": {Latitude: 4, Longitude: 101},
|
||||
"MZ": {Latitude: -18, Longitude: 35},
|
||||
"NA": {Latitude: -22, Longitude: 18},
|
||||
"NC": {Latitude: -20, Longitude: 165},
|
||||
"NE": {Latitude: 17, Longitude: 8},
|
||||
"NF": {Latitude: -29, Longitude: 167},
|
||||
"NG": {Latitude: 9, Longitude: 8},
|
||||
"NI": {Latitude: 12, Longitude: -85},
|
||||
"NL": {Latitude: 52, Longitude: 5},
|
||||
"NO": {Latitude: 60, Longitude: 8},
|
||||
"NP": {Latitude: 28, Longitude: 84},
|
||||
"NR": {Latitude: -0, Longitude: 166},
|
||||
"NU": {Latitude: -19, Longitude: -169},
|
||||
"NZ": {Latitude: -40, Longitude: 174},
|
||||
"OM": {Latitude: 21, Longitude: 55},
|
||||
"PA": {Latitude: 8, Longitude: -80},
|
||||
"PE": {Latitude: -9, Longitude: -75},
|
||||
"PF": {Latitude: -17, Longitude: -149},
|
||||
"PG": {Latitude: -6, Longitude: 143},
|
||||
"PH": {Latitude: 12, Longitude: 121},
|
||||
"PK": {Latitude: 30, Longitude: 69},
|
||||
"PL": {Latitude: 51, Longitude: 19},
|
||||
"PM": {Latitude: 46, Longitude: -56},
|
||||
"PN": {Latitude: -24, Longitude: -127},
|
||||
"PR": {Latitude: 18, Longitude: -66},
|
||||
"PS": {Latitude: 31, Longitude: 35},
|
||||
"PT": {Latitude: 39, Longitude: -8},
|
||||
"PW": {Latitude: 7, Longitude: 134},
|
||||
"PY": {Latitude: -23, Longitude: -58},
|
||||
"QA": {Latitude: 25, Longitude: 51},
|
||||
"RE": {Latitude: -21, Longitude: 55},
|
||||
"RO": {Latitude: 45, Longitude: 24},
|
||||
"RS": {Latitude: 44, Longitude: 21},
|
||||
"RU": {Latitude: 61, Longitude: 105},
|
||||
"RW": {Latitude: -1, Longitude: 29},
|
||||
"SA": {Latitude: 23, Longitude: 45},
|
||||
"SB": {Latitude: -9, Longitude: 160},
|
||||
"SC": {Latitude: -4, Longitude: 55},
|
||||
"SD": {Latitude: 12, Longitude: 30},
|
||||
"SE": {Latitude: 60, Longitude: 18},
|
||||
"SG": {Latitude: 1, Longitude: 103},
|
||||
"SH": {Latitude: -24, Longitude: -10},
|
||||
"SI": {Latitude: 46, Longitude: 14},
|
||||
"SJ": {Latitude: 77, Longitude: 23},
|
||||
"SK": {Latitude: 48, Longitude: 19},
|
||||
"SL": {Latitude: 8, Longitude: -11},
|
||||
"SM": {Latitude: 43, Longitude: 12},
|
||||
"SN": {Latitude: 14, Longitude: -14},
|
||||
"SO": {Latitude: 5, Longitude: 46},
|
||||
"SR": {Latitude: 3, Longitude: -56},
|
||||
"ST": {Latitude: 0, Longitude: 6},
|
||||
"SV": {Latitude: 13, Longitude: -88},
|
||||
"SY": {Latitude: 34, Longitude: 38},
|
||||
"SZ": {Latitude: -26, Longitude: 31},
|
||||
"TC": {Latitude: 21, Longitude: -71},
|
||||
"TD": {Latitude: 15, Longitude: 18},
|
||||
"TF": {Latitude: -49, Longitude: 69},
|
||||
"TG": {Latitude: 8, Longitude: 0},
|
||||
"TH": {Latitude: 15, Longitude: 100},
|
||||
"TJ": {Latitude: 38, Longitude: 71},
|
||||
"TK": {Latitude: -8, Longitude: -171},
|
||||
"TL": {Latitude: -8, Longitude: 125},
|
||||
"TM": {Latitude: 38, Longitude: 59},
|
||||
"TN": {Latitude: 33, Longitude: 9},
|
||||
"TO": {Latitude: -21, Longitude: -175},
|
||||
"TR": {Latitude: 38, Longitude: 35},
|
||||
"TT": {Latitude: 10, Longitude: -61},
|
||||
"TV": {Latitude: -7, Longitude: 177},
|
||||
"TW": {Latitude: 23, Longitude: 120},
|
||||
"TZ": {Latitude: -6, Longitude: 34},
|
||||
"UA": {Latitude: 48, Longitude: 31},
|
||||
"UG": {Latitude: 1, Longitude: 32},
|
||||
"US": {Latitude: 37, Longitude: -95},
|
||||
"UY": {Latitude: -32, Longitude: -55},
|
||||
"UZ": {Latitude: 41, Longitude: 64},
|
||||
"VA": {Latitude: 41, Longitude: 12},
|
||||
"VC": {Latitude: 12, Longitude: -61},
|
||||
"VE": {Latitude: 6, Longitude: -66},
|
||||
"VG": {Latitude: 18, Longitude: -64},
|
||||
"VI": {Latitude: 18, Longitude: -64},
|
||||
"VN": {Latitude: 14, Longitude: 108},
|
||||
"VU": {Latitude: -15, Longitude: 166},
|
||||
"WF": {Latitude: -13, Longitude: -177},
|
||||
"WS": {Latitude: -13, Longitude: -172},
|
||||
"XK": {Latitude: 42, Longitude: 20},
|
||||
"YE": {Latitude: 15, Longitude: 48},
|
||||
"YT": {Latitude: -12, Longitude: 45},
|
||||
"ZA": {Latitude: -30, Longitude: 22},
|
||||
"ZM": {Latitude: -13, Longitude: 27},
|
||||
"ZW": {Latitude: -19, Longitude: 29},
|
||||
}
|
|
@ -22,6 +22,7 @@ type Location struct {
|
|||
Code string `maxminddb:"code"`
|
||||
} `maxminddb:"continent"`
|
||||
Country struct {
|
||||
Name string
|
||||
ISOCode string `maxminddb:"iso_code"`
|
||||
} `maxminddb:"country"`
|
||||
Coordinates Coordinates `maxminddb:"location"`
|
||||
|
|
|
@ -23,8 +23,7 @@ func GetLocation(ip net.IP) (*Location, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
record.FillMissingInfo()
|
||||
record.AddRegion()
|
||||
record.AddCountryInfo()
|
||||
return record, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -16,14 +16,14 @@ func init() {
|
|||
|
||||
func prep() error {
|
||||
if err := api.RegisterEndpoint(api.Endpoint{
|
||||
Path: "intel/geoip/country-centers",
|
||||
Path: "intel/geoip/countries",
|
||||
Read: api.PermitUser,
|
||||
// Do not attach to module, as the data is always available anyway.
|
||||
StructFunc: func(ar *api.Request) (i interface{}, err error) {
|
||||
return countryCoordinates, nil
|
||||
return countries, nil
|
||||
},
|
||||
Name: "Get Geographic Country Centers",
|
||||
Description: "Returns a map of country centers indexed by ISO-A2 country code",
|
||||
Name: "Get Country Information",
|
||||
Description: "Returns a map of country information centers indexed by ISO-A2 country code",
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -4,13 +4,6 @@ import (
|
|||
"github.com/safing/portbase/utils"
|
||||
)
|
||||
|
||||
// AddRegion adds the region based on the country.
|
||||
func (l *Location) AddRegion() {
|
||||
if regionID, ok := countryRegions[l.Country.ISOCode]; ok {
|
||||
l.Continent.Code = regionID
|
||||
}
|
||||
}
|
||||
|
||||
// IsRegionalNeighbor returns whether the supplied location is a regional neighbor.
|
||||
func (l *Location) IsRegionalNeighbor(other *Location) bool {
|
||||
if l.Continent.Code == "" || other.Continent.Code == "" {
|
||||
|
@ -250,255 +243,3 @@ var regions = map[string]*Region{
|
|||
},
|
||||
},
|
||||
}
|
||||
|
||||
var countryRegions = map[string]string{
|
||||
"AF": "AS-S",
|
||||
"AX": "EU-N",
|
||||
"AL": "EU-S",
|
||||
"DZ": "AF-N",
|
||||
"AS": "OC-E",
|
||||
"AD": "EU-S",
|
||||
"AO": "AF-C",
|
||||
"AI": "NA-E",
|
||||
"AQ": "AN",
|
||||
"AG": "NA-E",
|
||||
"AR": "SA",
|
||||
"AM": "AS-W",
|
||||
"AW": "NA-E",
|
||||
"AU": "OC-S",
|
||||
"AT": "EU-W",
|
||||
"AZ": "AS-W",
|
||||
"BS": "NA-E",
|
||||
"BH": "AS-W",
|
||||
"BD": "AS-S",
|
||||
"BB": "NA-E",
|
||||
"BY": "EU-E",
|
||||
"BE": "EU-W",
|
||||
"BZ": "NA-S",
|
||||
"BJ": "AF-W",
|
||||
"BM": "NA-N",
|
||||
"BT": "AS-S",
|
||||
"BO": "SA",
|
||||
"BQ": "NA-E",
|
||||
"BA": "EU-S",
|
||||
"BW": "AF-S",
|
||||
"BV": "SA",
|
||||
"BR": "SA",
|
||||
"IO": "AF-E",
|
||||
"BN": "AS-SE",
|
||||
"BG": "EU-E",
|
||||
"BF": "AF-W",
|
||||
"BI": "AF-E",
|
||||
"CV": "AF-W",
|
||||
"KH": "AS-SE",
|
||||
"CM": "AF-C",
|
||||
"CA": "NA-N",
|
||||
"KY": "NA-E",
|
||||
"CF": "AF-C",
|
||||
"TD": "AF-C",
|
||||
"CL": "SA",
|
||||
"CN": "AS-E",
|
||||
"CX": "OC-S",
|
||||
"CC": "OC-S",
|
||||
"CO": "SA",
|
||||
"KM": "AF-E",
|
||||
"CG": "AF-C",
|
||||
"CD": "AF-C",
|
||||
"CK": "OC-E",
|
||||
"CR": "NA-S",
|
||||
"CI": "AF-W",
|
||||
"HR": "EU-S",
|
||||
"CU": "NA-E",
|
||||
"CW": "NA-E",
|
||||
"CY": "AS-W",
|
||||
"CZ": "EU-E",
|
||||
"DK": "EU-N",
|
||||
"DJ": "AF-E",
|
||||
"DM": "NA-E",
|
||||
"DO": "NA-E",
|
||||
"EC": "SA",
|
||||
"EG": "AF-N",
|
||||
"SV": "NA-S",
|
||||
"GQ": "AF-C",
|
||||
"ER": "AF-E",
|
||||
"EE": "EU-N",
|
||||
"SZ": "AF-S",
|
||||
"ET": "AF-E",
|
||||
"FK": "SA",
|
||||
"FO": "EU-N",
|
||||
"FJ": "OC-C",
|
||||
"FI": "EU-N",
|
||||
"FR": "EU-W",
|
||||
"GF": "SA",
|
||||
"PF": "OC-E",
|
||||
"TF": "AF-E",
|
||||
"GA": "AF-C",
|
||||
"GM": "AF-W",
|
||||
"GE": "AS-W",
|
||||
"DE": "EU-W",
|
||||
"GH": "AF-W",
|
||||
"GI": "EU-S",
|
||||
"GR": "EU-S",
|
||||
"GL": "NA-N",
|
||||
"GD": "NA-E",
|
||||
"GP": "NA-E",
|
||||
"GU": "OC-N",
|
||||
"GT": "NA-S",
|
||||
"GG": "EU-N",
|
||||
"GN": "AF-W",
|
||||
"GW": "AF-W",
|
||||
"GY": "SA",
|
||||
"HT": "NA-E",
|
||||
"HM": "OC-S",
|
||||
"VA": "EU-S",
|
||||
"HN": "NA-S",
|
||||
"HK": "AS-E",
|
||||
"HU": "EU-E",
|
||||
"IS": "EU-N",
|
||||
"IN": "AS-S",
|
||||
"ID": "AS-SE",
|
||||
"IR": "AS-S",
|
||||
"IQ": "AS-W",
|
||||
"IE": "EU-N",
|
||||
"IM": "EU-N",
|
||||
"IL": "AS-W",
|
||||
"IT": "EU-S",
|
||||
"JM": "NA-E",
|
||||
"JP": "AS-E",
|
||||
"JE": "EU-N",
|
||||
"JO": "AS-W",
|
||||
"KZ": "AS-C",
|
||||
"KE": "AF-E",
|
||||
"KI": "OC-N",
|
||||
"KP": "AS-E",
|
||||
"KR": "AS-E",
|
||||
"KW": "AS-W",
|
||||
"KG": "AS-C",
|
||||
"LA": "AS-SE",
|
||||
"LV": "EU-N",
|
||||
"LB": "AS-W",
|
||||
"LS": "AF-S",
|
||||
"LR": "AF-W",
|
||||
"LY": "AF-N",
|
||||
"LI": "EU-W",
|
||||
"LT": "EU-N",
|
||||
"LU": "EU-W",
|
||||
"MO": "AS-E",
|
||||
"MG": "AF-E",
|
||||
"MW": "AF-E",
|
||||
"MY": "AS-SE",
|
||||
"MV": "AS-S",
|
||||
"ML": "AF-W",
|
||||
"MT": "EU-S",
|
||||
"MH": "OC-N",
|
||||
"MQ": "NA-E",
|
||||
"MR": "AF-W",
|
||||
"MU": "AF-E",
|
||||
"YT": "AF-E",
|
||||
"MX": "NA-S",
|
||||
"FM": "OC-N",
|
||||
"MD": "EU-E",
|
||||
"MC": "EU-W",
|
||||
"MN": "AS-E",
|
||||
"ME": "EU-S",
|
||||
"MS": "NA-E",
|
||||
"MA": "AF-N",
|
||||
"MZ": "AF-E",
|
||||
"MM": "AS-SE",
|
||||
"NA": "AF-S",
|
||||
"NR": "OC-N",
|
||||
"NP": "AS-S",
|
||||
"NL": "EU-W",
|
||||
"NC": "OC-C",
|
||||
"NZ": "OC-S",
|
||||
"NI": "NA-S",
|
||||
"NE": "AF-W",
|
||||
"NG": "AF-W",
|
||||
"NU": "OC-E",
|
||||
"NF": "OC-S",
|
||||
"MK": "EU-S",
|
||||
"MP": "OC-N",
|
||||
"NO": "EU-N",
|
||||
"OM": "AS-W",
|
||||
"PK": "AS-S",
|
||||
"PW": "OC-N",
|
||||
"PS": "AS-W",
|
||||
"PA": "NA-S",
|
||||
"PG": "OC-C",
|
||||
"PY": "SA",
|
||||
"PE": "SA",
|
||||
"PH": "AS-SE",
|
||||
"PN": "OC-E",
|
||||
"PL": "EU-E",
|
||||
"PT": "EU-S",
|
||||
"PR": "NA-E",
|
||||
"QA": "AS-W",
|
||||
"RE": "AF-E",
|
||||
"RO": "EU-E",
|
||||
"RU": "EU-E",
|
||||
"RW": "AF-E",
|
||||
"BL": "NA-E",
|
||||
"SH": "AF-W",
|
||||
"KN": "NA-E",
|
||||
"LC": "NA-E",
|
||||
"MF": "NA-E",
|
||||
"PM": "NA-N",
|
||||
"VC": "NA-E",
|
||||
"WS": "OC-E",
|
||||
"SM": "EU-S",
|
||||
"ST": "AF-C",
|
||||
"SA": "AS-W",
|
||||
"SN": "AF-W",
|
||||
"RS": "EU-S",
|
||||
"SC": "AF-E",
|
||||
"SL": "AF-W",
|
||||
"SG": "AS-SE",
|
||||
"SX": "NA-E",
|
||||
"SK": "EU-E",
|
||||
"SI": "EU-S",
|
||||
"SB": "OC-C",
|
||||
"SO": "AF-E",
|
||||
"ZA": "AF-S",
|
||||
"GS": "SA",
|
||||
"SS": "AF-E",
|
||||
"ES": "EU-S",
|
||||
"LK": "AS-S",
|
||||
"SD": "AF-N",
|
||||
"SR": "SA",
|
||||
"SJ": "EU-N",
|
||||
"SE": "EU-N",
|
||||
"CH": "EU-W",
|
||||
"SY": "AS-W",
|
||||
"TW": "AS-E",
|
||||
"TJ": "AS-C",
|
||||
"TZ": "AF-E",
|
||||
"TH": "AS-SE",
|
||||
"TL": "AS-SE",
|
||||
"TG": "AF-W",
|
||||
"TK": "OC-E",
|
||||
"TO": "OC-E",
|
||||
"TT": "NA-E",
|
||||
"TN": "AF-N",
|
||||
"TR": "AS-W",
|
||||
"TM": "AS-C",
|
||||
"TC": "NA-E",
|
||||
"TV": "OC-E",
|
||||
"UG": "AF-E",
|
||||
"UA": "EU-E",
|
||||
"AE": "AS-W",
|
||||
"GB": "EU-N",
|
||||
"US": "NA-N",
|
||||
"UM": "OC-N",
|
||||
"UY": "SA",
|
||||
"UZ": "AS-C",
|
||||
"VU": "OC-C",
|
||||
"VE": "SA",
|
||||
"VN": "AS-SE",
|
||||
"VG": "NA-E",
|
||||
"VI": "NA-E",
|
||||
"WF": "OC-E",
|
||||
"EH": "AF-N",
|
||||
"YE": "AS-W",
|
||||
"ZM": "AF-E",
|
||||
"ZW": "AF-E",
|
||||
}
|
||||
|
|
|
@ -160,19 +160,9 @@ var securityLevelSettings = []string{
|
|||
}
|
||||
|
||||
var (
|
||||
// SPNRulesQuickSettings is a list of countries the SPN currently is present in
|
||||
// as quick settings in order to help users with SPN related policy settings.
|
||||
// This is a quick win to make the MVP easier to use, but will be replaced by
|
||||
// a better solution in the future.
|
||||
// SPNRulesQuickSettings are now generated automatically shorty after start.
|
||||
SPNRulesQuickSettings = []config.QuickSetting{
|
||||
{Name: "Exclude Canada (CA)", Action: config.QuickMergeTop, Value: []string{"- CA"}},
|
||||
{Name: "Exclude Finland (FI)", Action: config.QuickMergeTop, Value: []string{"- FI"}},
|
||||
{Name: "Exclude France (FR)", Action: config.QuickMergeTop, Value: []string{"- FR"}},
|
||||
{Name: "Exclude Germany (DE)", Action: config.QuickMergeTop, Value: []string{"- DE"}},
|
||||
{Name: "Exclude Israel (IL)", Action: config.QuickMergeTop, Value: []string{"- IL"}},
|
||||
{Name: "Exclude Poland (PL)", Action: config.QuickMergeTop, Value: []string{"- PL"}},
|
||||
{Name: "Exclude United Kingdom (GB)", Action: config.QuickMergeTop, Value: []string{"- GB"}},
|
||||
{Name: "Exclude United States of America (US)", Action: config.QuickMergeTop, Value: []string{"- US"}},
|
||||
{Name: "Loading...", Action: config.QuickMergeTop, Value: []string{""}},
|
||||
}
|
||||
|
||||
// SPNRulesVerdictNames defines the verdicts names to be used for SPN Rules.
|
||||
|
@ -733,7 +723,6 @@ Please note that if you are using the system resolver, bypass attempts might be
|
|||
Sensitive: true,
|
||||
OptType: config.OptTypeStringArray,
|
||||
ExpertiseLevel: config.ExpertiseLevelExpert,
|
||||
ReleaseLevel: config.ReleaseLevelBeta,
|
||||
DefaultValue: []string{},
|
||||
Annotations: config.Annotations{
|
||||
config.StackableAnnotation: true,
|
||||
|
|
|
@ -461,7 +461,7 @@ func (profile *Profile) updateMetadata(binaryPath string) (changed bool) {
|
|||
changed = true
|
||||
}
|
||||
|
||||
// Migrato to Fingerprints.
|
||||
// Migrate to Fingerprints.
|
||||
// TODO: Remove in v1.5
|
||||
if len(profile.Fingerprints) == 0 && profile.LinkedPath != "" {
|
||||
profile.Fingerprints = []Fingerprint{
|
||||
|
|
Loading…
Add table
Reference in a new issue