diff --git a/pkg/zos_api/location.go b/pkg/zos_api/location.go new file mode 100644 index 000000000..4952f1133 --- /dev/null +++ b/pkg/zos_api/location.go @@ -0,0 +1,11 @@ +package zosapi + +import ( + "context" + + "github.com/threefoldtech/zos/pkg/geoip" +) + +func (g *ZosAPI) locationGet(ctx context.Context, payload []byte) (interface{}, error) { + return geoip.Fetch() +} diff --git a/pkg/zos_api/routes.go b/pkg/zos_api/routes.go index 8006f23b7..a0a3fa214 100644 --- a/pkg/zos_api/routes.go +++ b/pkg/zos_api/routes.go @@ -48,4 +48,7 @@ func (g *ZosAPI) SetupRoutes(router *peer.Router) { admin.WithHandler("interfaces", g.adminInterfacesHandler) admin.WithHandler("set_public_nic", g.adminSetPublicNICHandler) admin.WithHandler("get_public_nic", g.adminGetPublicNICHandler) + + location := root.SubRoute("location") + location.WithHandler("get", g.locationGet) }