Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

subping

import "github.com/fadhilyori/subping"

Index

func RunPing

func RunPing(ipAddress string, count int, interval time.Duration, timeout time.Duration) ping.Statistics

RunPing sends ICMP echo requests to the specified IP address and returns the ping statistics.

type Options

Options holds the configuration options for creating a new Subping instance.

type Options struct {
    // List of IP addresses to ping
    Targets []net.IP

    // Number of ping packets to send
    Count int

    // Interval for each ping request
    Interval time.Duration

    // Timeout specifies a timeout before exits each target
    Timeout time.Duration

    // Number of concurrent jobs to execute
    NumJobs int
}

type Subping

Subping is a utility for concurrently pinging multiple IP addresses and collecting the Results.

type Subping struct {
    // List of IP addresses to ping
    Targets []net.IP

    // Number of ping packets to send
    Count int

    // Interval for each ping request
    Interval time.Duration

    // Timeout specifies a timeout before exits each target
    Timeout time.Duration

    // Number of concurrent jobs to execute
    NumJobs int

    // Results of the ping requests
    Results map[string]ping.Statistics

    // PartitionedTargets List of IP addresses that have already been partitioned for pinging.
    PartitionedTargets [][]net.IP
}

func NewSubping

func NewSubping(opts *Options) (Subping, error)

NewSubping creates a new Subping instance with the provided options.

func (*Subping) GetOnlineHosts

func (s *Subping) GetOnlineHosts() map[string]ping.Statistics

GetOnlineHosts returns the Results of the ping requests for IP addresses that responded successfully.

func (*Subping) Run

func (s *Subping) Run()

Run starts the ping operation on the specified IP addresses using the configured options.

Generated by gomarkdoc