router: Count active requests per backend.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: Send an event when a backend gets drained.

An "all" event gets sent when all backends are drained.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
pkg: Add SSE writer package.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: Drain hook in the API.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: Use type composition for httpRoute.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: Allow all HTTP methods.

This is something the user's server should be handling, really.
One example is a server disallowing POST requests. With this
removed, PATCH verb should now work.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: Use similar data structures to HTTP for TCP.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: Move listener handling logic into tcpRoute.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
pkg: Move sseDecoder to the sse package.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
cli: Add service pausing commands to the CLI.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: Send an event straight away if there's no requests when backends are
paused.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: Update TCP test to work with the new backend structure.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: Close routes before removing them

Signed-off-by: Lewis Marshall <lewis@lmars.net>
router: Use a mutex when doing a get/set on tcpRoute.service.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: PauseService silently noo-ops if there is no service with that name.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
test: Add integration test for request pausing.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: use a PauseReq struct for the pause request.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
pkg/sse: Add sse.Reader.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: WIP

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>
router: Allow creating a new client pointing to a specific address.

Signed-off-by: Blaž Hrastnik <blaz.hrast@gmail.com>