feat(cli): add tcping subcommand#2249
Open
Kelvinoppong wants to merge 1 commit intomicrosoft:mainfrom
Open
Conversation
Add a lightweight `kubectl retina tcping HOST PORT` subcommand that probes a TCP port by performing a full connect()/close() handshake and reports per-attempt RTT plus final min/avg/max/loss statistics. This removes the need for ad-hoc `curl` loops (or heavier tools like nmap) when users want to generate simple, continuous TCP traffic against a service while debugging with Retina. Behavior mirrors `ping`: it runs until interrupted (SIGINT/SIGTERM) or until `--count` probes have been sent, then prints a summary. Flags: -c, --count number of probes (0 = unlimited, default) -i, --interval interval between probes (default 1s) -t, --timeout TCP connect timeout per probe (default 2s) Fixes microsoft#2022
Contributor
Author
|
@nddq I have tackled another issue and this PR is ready for review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
kubectl retina tcping HOST PORTsubcommand that probes a TCP port by performing a full connect/close handshake, reports per-attempt RTT, and prints min/avg/max/loss statistics at the end (or on Ctrl+C).This resolves #2022, which asked for a simple tool to generate continuous TCP traffic for debugging without needing
curlin awhileloop or heavier tools likenmap.Behavior
--countprobes are sent.net.JoinHostPort+net.DialTimeout).Flags
-c, --count0(unlimited)-i, --interval1s-t, --timeout2sExample
Test plan
cli/cmd/tcping_test.go).go test ./cli/...).go vet ./cli/...clean.1.1.1.1:443)google.com:443)[::1]:22)nonexistent.invalid.domain:80)127.0.0.1:1)Fixes #2022