Categorygithub.com/strideynet/go-ping-ttl
modulepackage
0.1.2
Repository: https://github.com/strideynet/go-ping-ttl.git
Documentation: pkg.go.dev

# README

go-ping-ttl

Utility library for sending ICMP pings to IPv4 or IPv6 destinations with TTL control.

Actions Status Coverage GitHub last commit GitHub issues GitHub pull requests License Status


Usage

  1. Create an instance of the Pinger with pingttl.New()
  2. Call .Ping() with a context and the address of the host you want to ping.

Your entire application should have a single instance of Pinger. Store it globally (🤢), or preferably, inject it as a dependency!

pinger := pingttl.New()

ip, err := net.ResolveIPAddr("ip4", "google.com")
if err != nil {
    return err
}

ctx, cancel := context.WithTimeout(context.Background(), time.Second * 5)
defer cancel()

// Providing 0 as a TTL will default to a sane value (64)
res, err := pinger.Ping(ctx, ip, 0)
if err != nil {
    return err
}

log.Printf("%s", res.Duration)

# Packages

No description provided by the author

# Functions

No description provided by the author

# Variables

No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author