diff options
| author | Fuwn <[email protected]> | 2026-01-19 04:17:50 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-01-19 04:17:50 -0800 |
| commit | 1e96ec397d38e6263c5369d91f2579092c9c9390 (patch) | |
| tree | b4b73accb870de9178acc931443c8cd474423fa5 /internal/monitor/tcp.go | |
| parent | feat: Add browser timezone option for client-side time display (diff) | |
| download | kaze-1e96ec397d38e6263c5369d91f2579092c9c9390.tar.xz kaze-1e96ec397d38e6263c5369d91f2579092c9c9390.zip | |
feat: Add retry option for monitor checks
Diffstat (limited to 'internal/monitor/tcp.go')
| -rw-r--r-- | internal/monitor/tcp.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/monitor/tcp.go b/internal/monitor/tcp.go index f93ae10..d315545 100644 --- a/internal/monitor/tcp.go +++ b/internal/monitor/tcp.go @@ -15,6 +15,7 @@ type TCPMonitor struct { target string interval time.Duration timeout time.Duration + retries int } // NewTCPMonitor creates a new TCP monitor @@ -30,6 +31,7 @@ func NewTCPMonitor(cfg config.MonitorConfig) (*TCPMonitor, error) { target: cfg.Target, interval: cfg.Interval.Duration, timeout: cfg.Timeout.Duration, + retries: cfg.Retries, }, nil } @@ -53,6 +55,11 @@ func (m *TCPMonitor) Interval() time.Duration { return m.interval } +// Retries returns the number of retry attempts +func (m *TCPMonitor) Retries() int { + return m.retries +} + // Check performs the TCP connection check func (m *TCPMonitor) Check(ctx context.Context) *Result { result := &Result{ |