[Discussion] /api/5/gateway vs /api/5/gateways
Hey, I'm currently adding country code support in bitmask-core. I was wondering about the two endpoints. I don't understand why there are two endpoints in menshen instead of a single one. After talking with Cyberta:
- load balancing is important: menshen should be able to enforce the gateway, the client connects to (by an ordered list of gateways or a quality field per gateway)
- what was new for me: GetService() (/api/5/service) returns a list of locations. In the UI, the user can connect to a location. Then the client can use /gateway(s?) endpoint to filter for a location. This is a new workflow comparing it with v3. After calling GetService(), we don't know the quality of a location (do we?). So we can't show it in the UI.
From my perspective, we can achive our goals with a single /gateway endpoint. We can
- return public gateways (when the provider wants to)
- additionally return private gateways when the client is authenticated
- we support filter (country code, location). If no filter is supplied, return all
In the backend, we have all information we need and can decide what we return. There are corner cases. Like: what if I'm in a censored environment and /gateways returns public and private gateways. Menshen says "use the public one" (load balancing), but the public one is blocked . A solution could be that public gateways are not returned if the client uses an invite token. We could also add a new parameter to filter for public/private
gateways. As the client knows if it's in a normal/censored environment.
What do you think?