A minimal and extensible library to build gateway servers. Stargate aims to be simple while providing niche solutions like several load balancer implementations, middleware, service discovery, etc.
Stargate supports:
- WebSockets
- Hot-reloading of routes
- Middleware
stargatecontrb contains some middleware implementations that are not in the scope of this library, but might be useful for some people.
Check the basic example that implements a
stargate.ServiceLister
to create a static table of routes and uses round-robin approach to load balance the request.
In the same sprits, the WebSockets example shows a simple WebSocket backend.
Stargate uses stargate.Log
variable to write its logging output. This variable is an implementation
of stargate.Logger
. You may write your own implementation of this interface and write stargate.Log = myOwnLogger{}
whenever your program starts.
Check the custom logger example.
If the stargate.ServiceLister
's implementation updates the route table, the stargate.Router
instance can be told to
update the routing by calling the Reload()
method.
Check the reloading routes example.
Check the eureka package in stargatecontrib.
Stargate defines middleware as:
type MiddlewareFunc func (http.Handler) http.Handler
Check the middleware example, that counts the number of requests served.
- Improve logging
- Improve documentation
- Write more tests
- Customizable healthchecks
- Priority round-robin