From 1af45280385ed121d51cf8ad1d01c629610ea2c2 Mon Sep 17 00:00:00 2001 From: Tevin Date: Wed, 3 Jan 2024 17:47:55 +0800 Subject: [PATCH] Add comments to the example code Solves #28 --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 8cac7ba..a7f9887 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,8 @@ The reason for a fake implementation is that there is currently no way to perfor ```go import "github.com/tevino/tcp-shaker" +// Initializing the checker +// It is expected to be shared among goroutines, only one instance is necessary. c := NewChecker() ctx, stopChecker := context.WithCancel(context.Background()) @@ -73,6 +75,8 @@ go func() { <-c.WaitReady() +// Checking google.com + timeout := time.Second * 1 err := c.CheckAddr("google.com:80", timeout) switch err {