53 lines
1.5 KiB
Markdown
53 lines
1.5 KiB
Markdown
# Connectivity Test Server
|
|
|
|
A simple HTTP server for connectivity testing. It can be run from the command line or in a container. It relies only on Python's standard library, so it should work in any environment with Python installed.
|
|
|
|
It displays a simple HTML or plain-text page with the client's IP address and any detected `X-*` headers.
|
|
|
|
## Disclaimer
|
|
|
|
The `ok-server.py` file was generated using AI under human supervision. The owner of the repository is not responsible for any issues that may arise from using the AI-generated code.
|
|
|
|
## Usage
|
|
|
|
### Command Line
|
|
|
|
To run the server from the command line:
|
|
|
|
```bash
|
|
python3 ok-server.py
|
|
python3 ok-server.py --look basic
|
|
python3 ok-server.py --bind 127.0.0.1 --port 8080 --look bootstrap
|
|
```
|
|
|
|
`--look` accepts `basic`, `nice`, or `bootstrap`.
|
|
You can override the look per request with the `look` query parameter, for example:
|
|
|
|
```bash
|
|
curl -i "http://localhost:8000/?look=basic"
|
|
```
|
|
|
|
### Docker
|
|
|
|
Use the included `Dockerfile` to build and run the server in a Docker container:
|
|
|
|
```bash
|
|
docker build -t ok-server .
|
|
docker run --rm -d --name ok-server --cpus=1 --memory=256m -p 8000:8000 ok-server
|
|
```
|
|
|
|
### Container CLI on a Mac
|
|
|
|
```shell
|
|
container builder stop
|
|
container builder start -c 4 -m 1G
|
|
container build -t ok-server .
|
|
container run --rm -d --name ok-server -c 1 -m 256m -p 8000:8000 ok-server
|
|
```
|
|
|
|
This will start the server and expose it on port 8000.
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|