netcmd

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NetCheck

func NetCheck(address string, timeout time.Duration) (time.Duration, error)

NetCheck checks if a TCP port is open.

func NetEcho

func NetEcho(addr string, timeout time.Duration) error

NetEcho starts a TCP echo server.

func NetScan

func NetScan(host string, start, end int, timeout time.Duration) ([]int, error)

NetScan scans a port range on a host.

func NetWait

func NetWait(address string, timeout time.Duration) error

NetWait waits for a TCP port to become available.

func Run

func Run(opts ...Option) error

Run executes network utilities.

Types

type Config

type Config struct {
	Mode      string
	Timeout   time.Duration
	StartPort int
	EndPort   int
	Addr      string
	Host      string
	Stdout    io.Writer
	Stderr    io.Writer
}

Config holds configuration for the net command.

type Option

type Option func(*Config)

Option configures a Config.

func WithAddr

func WithAddr(addr string) Option

func WithEndPort

func WithEndPort(p int) Option

func WithHost

func WithHost(host string) Option

func WithMode

func WithMode(mode string) Option

func WithStartPort

func WithStartPort(p int) Option

func WithStderr

func WithStderr(w io.Writer) Option

func WithStdout

func WithStdout(w io.Writer) Option

func WithTimeout

func WithTimeout(d time.Duration) Option

Jump to

Keyboard shortcuts

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