server

command
v2.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package server provides a sample HTTP/Websocket server which registers itself in consul using one or more url prefixes to demonstrate and test the automatic fabio routing table update.

During startup the server performs the following steps:

  • Add a handler for each prefix which provides a unique response for that instance and endpoint
  • Add a `/health` handler for the consul health check
  • Register the service in consul with the listen address, a health check under the given name and with one `urlprefix-` tag per prefix
  • Install a signal handler to deregister the service on exit

If the protocol is set to "ws" the registered endpoints function as websocket echo servers.

Example:

# http server
./server -addr 127.0.0.1:5000 -name svc-a -prefix /foo,/bar
./server -addr 127.0.0.1:5001 -name svc-b -prefix /baz,/bar

# https server
./server -addr 127.0.0.1:5000 -name svc-a -proto https -certFile ... -keyFile ... -prefix /foo
./server -addr 127.0.0.1:5000 -name svc-a -proto https -certFile ... -keyFile ... -prefix "/foo tlsskipverify=true"

# websocket server
./server -addr 127.0.0.1:6000 -name ws-a -proto ws -prefix /echo1,/echo2

# tcp server
./server -addr 127.0.0.1:7000 -name tcp-a -proto tcp -prefix :1234

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL