netcheck

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package netcheck is the network reachability + VPN status probe. Network actions can hang when a host sits behind a VPN that isn't connected; this gives a fast bounded reachability check and a best-effort VPN indicator so commands fail fast with an actionable message. stdlib only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SSHReachable

func SSHReachable(host string, port int, timeout time.Duration) bool

SSHReachable is true if the SSH layer on host:port responds within timeout - a stronger check than TCPReachable for VPN-gated hosts on HTTPS-style ports that accept TCP but never complete the SSH banner. A live server (even one that rejects auth) counts as reachable; a hang/refusal does not.

func TCPReachable

func TCPReachable(host string, port int, timeout time.Duration) bool

TCPReachable is true if a TCP connection to host:port opens within timeout.

func VPNActive

func VPNActive() *bool

VPNActive is a heuristic: is a VPN/tunnel interface present? nil when undeterminable (mirrors v1's bool | None).

func VPNInterfaces

func VPNInterfaces() []string

VPNInterfaces is the live list of tunnel/VPN-like interfaces present.

Types

type NetStatus

type NetStatus struct {
	Host        string
	Port        int
	Reachable   bool
	RequiresVPN bool
	VPNName     string // "" == none
	VPNURL      string // "" == none
	VPN         *bool  // nil == undeterminable
}

NetStatus is the reachability of one host:port with a VPN-aware message.

func Check

func Check(host string, port int, requiresVPN bool, vpnName, vpnURL string, timeout time.Duration, ssh bool) NetStatus

Check returns reachability + VPN status for one host:port. ssh=true uses the bounded SSH-banner probe (deploy/rotate); the default TCP probe is faster.

func (NetStatus) Icon

func (s NetStatus) Icon() string

Icon is "online"/"offline".

func (NetStatus) Message

func (s NetStatus) Message() string

Message is the VPN-aware human message (mirrors NetStatus.message).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL