https://github.com/bluekeyes/srcsnk
Simple test server that acts as a data source or sink
https://github.com/bluekeyes/srcsnk
golang testing
Last synced: 3 months ago
JSON representation
Simple test server that acts as a data source or sink
- Host: GitHub
- URL: https://github.com/bluekeyes/srcsnk
- Owner: bluekeyes
- Created: 2018-03-05T07:06:48.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-12T06:05:06.000Z (about 7 years ago)
- Last Synced: 2025-01-13T21:33:36.631Z (5 months ago)
- Topics: golang, testing
- Language: Go
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# srcsnk
A simple server that sends and receives arbitrary amounts of data at arbitrary
speeds. Useful for testing proxies and clients.## Installation
go get -u github.com/bluekeyes/srcsnk
## Usage
Run `srcsnk` to start the server. Once the server is running, you can download
a file at any path:$ curl localhost:8000/an/arbitrary/file.bin?size=10M -o file.bin
Or upload a file to any path:
$ curl -T file.bin localhost:8000/an/arbitrary/path/file.bin
All the received data is discarded by the server.
Each endpoint accepts several paramters described below.
### Paramters
- `size` – (download only) controls the size of the downloaded file. It takes
the suffixes `B`, `K`, `M`, and `G` for bytes, kilobytes, megabytes, or
gigabytes, respectively; these have the same meaning as in the `dd` command.- `rate` – controls the download or upload rate, in bytes per second. It
accepts the same suffixes as the `size` paramter.- `delayPre` – the amount of time to wait before processing the request,
including reading the request body. It accepts any value allowed by
[`time.ParseDuration`][].- `delayRes` – the amount of time to wait before sending the initial response
headers. It accepts any value allowed by [`time.ParseDuration`][]. For
downloads, `delayPre` and `delayRes` are interchangeable.[`time.ParseDuration`]: https://golang.org/pkg/time/#ParseDuration
### Flags
The command accepts the following flags:
- `-address` – sets the address (IP and port) the server listens on; defaults to `127.0.0.1:8000`
- `-log-file` – sets the file where log output is written; if not provided, logs are written to stdout