docs: update README for new cli handling options
Some checks failed
Build & Test CI / build (push) Has been cancelled

This commit is contained in:
raf 2025-06-18 15:45:06 +03:00
commit c6413a0e58
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF

View file

@ -1,8 +1,8 @@
# tct # tct
**tct** (**t**cp **c**onnection **t**imer) is a quick and minimal program (< 70 **t**cp **c**onnection **t**imer (tct) is a miniscule utility to help determinee
LoC!) that helps determine the "optimal" number of parallel TCP requests for the "optimal" number of parallel TCP requests for your network connection, for a
your network connection. given target.
It performs a series of tests (following your desired configuration) by It performs a series of tests (following your desired configuration) by
incrementally increasing the number of parallel requests and measuring the time incrementally increasing the number of parallel requests and measuring the time
@ -11,6 +11,48 @@ taken for each test.
The optimal number is identified as the point where adding more parallel The optimal number is identified as the point where adding more parallel
requests does not significantly reduce the overall time taken. requests does not significantly reduce the overall time taken.
## Usage
```bash
Usage:
tct [flags]
Flags:
-d, --delay duration Delay between requests
-h, --help help for tct
-m, --max int Maximum number of parallel requests (default 100)
-u, --url string URL to fetch (default "http://example.com")
-v, --version version for tct
```
For example:
```bash
tct --max 200 --delay 100ms --url "http://yourtargeturl.com"
```
Replace `"http://yourtargeturl.com"` with the actual URL you wish to test
against. You can also omit the URL and use an IP address instead. For example,
`8.8.8.8` for Google or `1.1.1.1` for Cloudflare. You may notice differences
between target URLs as a result of different distances to different hosts, or
different network setups.
The `--max` parameter specifies the maximum number of parallel requests to test,
and `--delay` sets the interval between each request.
> [!TIP]
> You are strongly advised to use the delay option. I have observed high latency
> while running with the default 0 second delay, which is likely some form of
> throttling by the host. If you test against an URL that you _know_ does not
> throttle connections, then you may consider omitting `-delay`.
### Flags
- `--url`: The URL to fetch.
- `--max`: Maximum number of parallel requests to test. Default is `100`
- `--delay`: Delay between requests. Can be specified as a duration (e.g.,
`500ms`). Default is `0` (i.e. no delay)
## Motivation ## Motivation
The [Nix Package Manager](https://github.com/NixOS/nix) has an option called The [Nix Package Manager](https://github.com/NixOS/nix) has an option called
@ -25,37 +67,6 @@ set `http-connections` in.
Do keep in mind that this is not 100% accurate. There are many factors that may Do keep in mind that this is not 100% accurate. There are many factors that may
affect the results of network related tests. affect the results of network related tests.
## Usage
```bash
tct -url="http://yourtargeturl.com" -max=200 -delay=500ms
```
Replace `"http://yourtargeturl.com"` with the actual URL you wish to test
against. You can also omit the URL and use an IP address instead, for example,
`8.8.8.8` for Google or `1.1.1.1` for Cloudflare. You may notice differences
between target URLs.
The `-max` parameter specifies the maximum number of parallel requests to test,
and `-delay` sets the interval between each request.
<!-- deno-fmt-ignore-start -->
> [!NOTE]
> You are strongly advised to use the delay option. I have observed high
> latency while running with the default 0 second delay, which is likely some
> form of throttling by the host. If you test against an URL that you _know_
> does not throttle connections, then you may consider omitting `-delay`.
<!-- deno-fmt-ignore-end -->
## Flags
- `-url`: The URL to fetch.
- `-max`: Maximum number of parallel requests to test. Default is `100`
- `-delay`: Delay between requests. Can be specified as a duration (e.g.,
`500ms`). Default is `0` (i.e. no delay)
## Notes ## Notes
- Remember to adjust the `-max` and `-delay` parameters based on your network - Remember to adjust the `-max` and `-delay` parameters based on your network
@ -63,7 +74,7 @@ and `-delay` sets the interval between each request.
any assumptions, but the default values will not be suitable for all testing any assumptions, but the default values will not be suitable for all testing
conditions. conditions.
- tct will try to always exit gracefully when you, e.g., kill the program with - tct will try to always exit gracefully when you, e.g., kill the program with
<kbd>ctrl+c</kbd>. <kbd>Ctrl+C</kbd>.
## Contributing ## Contributing