| 1 |
==================== |
| 2 |
Amphorae test server |
| 3 |
==================== |
| 4 |
|
| 5 |
test_server.bin is a static application that simulates HTTP, HTTPS, and UDP |
| 6 |
servers. This server can properly handle concurrent requests. |
| 7 |
|
| 8 |
Building |
| 9 |
-------- |
| 10 |
|
| 11 |
To build a statically linked binary for test_server (can run anywhere): |
| 12 |
|
| 13 |
Install dependencies for Ubuntu/Debian: |
| 14 |
|
| 15 |
:: |
| 16 |
|
| 17 |
sudo apt-get install -y golang |
| 18 |
|
| 19 |
Install dependencies for Centos: |
| 20 |
|
| 21 |
:: |
| 22 |
|
| 23 |
sudo dnf install -y golang |
| 24 |
|
| 25 |
Build the binary: |
| 26 |
|
| 27 |
:: |
| 28 |
|
| 29 |
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-s -w -extldflags -static' -o test_server.bin test_server.go |
| 30 |
|
| 31 |
|
| 32 |
Usage |
| 33 |
----- |
| 34 |
|
| 35 |
The usage string can be output from the command by running: |
| 36 |
|
| 37 |
:: |
| 38 |
|
| 39 |
./test_server.bin --help |
| 40 |
|
| 41 |
Example output: |
| 42 |
|
| 43 |
:: |
| 44 |
|
| 45 |
Usage of ./test_server.bin: |
| 46 |
-cert string |
| 47 |
Server side PEM format certificate file path. |
| 48 |
-client_ca string |
| 49 |
Client auth PEM format CA certificate file path. |
| 50 |
-https_port int |
| 51 |
HTTPS port to listen on, -1 is disabled. (default -1) |
| 52 |
-https_client_auth_port int |
| 53 |
HTTPS with client authentication port to listen on, -1 is disabled. |
| 54 |
(default -1) |
| 55 |
-id string |
| 56 |
Server ID (default "1") |
| 57 |
-key string |
| 58 |
Server side PEM format key file path. |
| 59 |
-port int |
| 60 |
Port to listen on (default 8080) |
| 61 |
|
| 62 |
If -https_port is not specified, the server will not accept HTTPS requests. |
| 63 |
When --https_port is specified, -cert and -key are required parameters. |
| 64 |
|
| 65 |
If -https_client_auth_port is specified, the -client_ca parameter is required. |
| 66 |
When -client_ca is specified, it will configure the HTTPS client auth port to |
| 67 |
require a valid client certificate to connect. |