diff --git a/intel/geoip/module.go b/intel/geoip/module.go index 453d08f2..0c15769a 100644 --- a/intel/geoip/module.go +++ b/intel/geoip/module.go @@ -3,6 +3,7 @@ package geoip import ( "context" + "github.com/safing/portbase/api" "github.com/safing/portbase/modules" "github.com/safing/portmaster/updates" ) @@ -14,6 +15,19 @@ func init() { } func prep() error { + if err := api.RegisterEndpoint(api.Endpoint{ + Path: "intel/geoip/country-centers", + 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 + }, + Name: "Get Geographic Country Centers", + Description: "Returns a map of country centers indexed by ISO-A2 country code", + }); err != nil { + return err + } + return module.RegisterEventHook( updates.ModuleName, updates.ResourceUpdateEvent,