{"id":37147139,"url":"https://github.com/5aaee9/go-ping","last_synced_at":"2026-01-14T17:14:24.848Z","repository":{"id":184163730,"uuid":"671409903","full_name":"5aaee9/go-ping","owner":"5aaee9","description":"A library for creating continuous probers","archived":false,"fork":true,"pushed_at":"2023-07-31T07:51:32.000Z","size":1351,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-11T12:11:43.248Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"prometheus-community/pro-bing","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/5aaee9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null}},"created_at":"2023-07-27T08:53:04.000Z","updated_at":"2023-07-27T09:04:21.000Z","dependencies_parsed_at":"2023-07-27T10:24:57.297Z","dependency_job_id":"b9363622-bd84-4104-bc32-2127917b4060","html_url":"https://github.com/5aaee9/go-ping","commit_stats":null,"previous_names":["5aaee9/go-ping"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/5aaee9/go-ping","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5aaee9%2Fgo-ping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5aaee9%2Fgo-ping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5aaee9%2Fgo-ping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5aaee9%2Fgo-ping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/5aaee9","download_url":"https://codeload.github.com/5aaee9/go-ping/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5aaee9%2Fgo-ping/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28427206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T17:14:24.243Z","updated_at":"2026-01-14T17:14:24.835Z","avatar_url":"https://github.com/5aaee9.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pro-bing\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/prometheus-community/pro-bing)](https://pkg.go.dev/github.com/prometheus-community/pro-bing)\n[![Circle CI](https://circleci.com/gh/prometheus-community/pro-bing.svg?style=svg)](https://circleci.com/gh/prometheus-community/pro-bing)\n\nA simple but powerful ICMP echo (ping) library for Go, inspired by\n[go-ping](https://github.com/go-ping/ping) \u0026 [go-fastping](https://github.com/tatsushid/go-fastping).\n\nHere is a very simple example that sends and receives three packets:\n\n```go\npinger, err := probing.NewPinger(\"www.google.com\")\nif err != nil {\n\tpanic(err)\n}\npinger.Count = 3\nerr = pinger.Run() // Blocks until finished.\nif err != nil {\n\tpanic(err)\n}\nstats := pinger.Statistics() // get send/receive/duplicate/rtt stats\n```\n\nHere is an example that emulates the traditional UNIX ping command:\n\n```go\npinger, err := probing.NewPinger(\"www.google.com\")\nif err != nil {\n\tpanic(err)\n}\n\n// Listen for Ctrl-C.\nc := make(chan os.Signal, 1)\nsignal.Notify(c, os.Interrupt)\ngo func() {\n\tfor _ = range c {\n\t\tpinger.Stop()\n\t}\n}()\n\npinger.OnRecv = func(pkt *probing.Packet) {\n\tfmt.Printf(\"%d bytes from %s: icmp_seq=%d time=%v\\n\",\n\t\tpkt.Nbytes, pkt.IPAddr, pkt.Seq, pkt.Rtt)\n}\n\npinger.OnDuplicateRecv = func(pkt *probing.Packet) {\n\tfmt.Printf(\"%d bytes from %s: icmp_seq=%d time=%v ttl=%v (DUP!)\\n\",\n\t\tpkt.Nbytes, pkt.IPAddr, pkt.Seq, pkt.Rtt, pkt.Ttl)\n}\n\npinger.OnFinish = func(stats *ping.Statistics) {\n\tfmt.Printf(\"\\n--- %s ping statistics ---\\n\", stats.Addr)\n\tfmt.Printf(\"%d packets transmitted, %d packets received, %v%% packet loss\\n\",\n\t\tstats.PacketsSent, stats.PacketsRecv, stats.PacketLoss)\n\tfmt.Printf(\"round-trip min/avg/max/stddev = %v/%v/%v/%v\\n\",\n\t\tstats.MinRtt, stats.AvgRtt, stats.MaxRtt, stats.StdDevRtt)\n}\n\nfmt.Printf(\"PING %s (%s):\\n\", pinger.Addr(), pinger.IPAddr())\nerr = pinger.Run()\nif err != nil {\n\tpanic(err)\n}\n```\n\nIt sends ICMP Echo Request packet(s) and waits for an Echo Reply in\nresponse. If it receives a response, it calls the `OnRecv` callback\nunless a packet with that sequence number has already been received,\nin which case it calls the `OnDuplicateRecv` callback. When it's\nfinished, it calls the `OnFinish` callback.\n\nFor a full ping example, see\n[cmd/ping/ping.go](https://github.com/prometheus-community/pro-bing/blob/master/cmd/ping/ping.go).\n\n## Installation\n\n```\ngo get -u github.com/prometheus-community/pro-bing\n```\n\nTo install the native Go ping executable:\n\n```bash\ngo get -u github.com/prometheus-community/pro-bing/...\n$GOPATH/bin/ping\n```\n\n## Supported Operating Systems\n\n### Linux\nThis library attempts to send an \"unprivileged\" ping via UDP. On Linux,\nthis must be enabled with the following sysctl command:\n\n```\nsudo sysctl -w net.ipv4.ping_group_range=\"0 2147483647\"\n```\n\nIf you do not wish to do this, you can call `pinger.SetPrivileged(true)`\nin your code and then use setcap on your binary to allow it to bind to\nraw sockets (or just run it as root):\n\n```\nsetcap cap_net_raw=+ep /path/to/your/compiled/binary\n```\n\nSee [this blog](https://sturmflut.github.io/linux/ubuntu/2015/01/17/unprivileged-icmp-sockets-on-linux/)\nand the Go [x/net/icmp](https://godoc.org/golang.org/x/net/icmp) package\nfor more details.\n\nThis library supports setting the `SO_MARK` socket option which is equivalent to the `-m mark`\nflag in standard ping binaries on linux. Setting this option requires the `CAP_NET_ADMIN` capability\n(via `setcap` or elevated privileges). You can set a mark (ex: 100) with `pinger.SetMark(100)` in your code.\n\nSetting the \"Don't Fragment\" bit is supported under Linux which is equivalent to `ping -Mdo`.\nYou can enable this with `pinger.SetDoNotFragment(true)`.\n\n### Windows\n\nYou must use `pinger.SetPrivileged(true)`, otherwise you will receive\nthe following error:\n\n```\nsocket: The requested protocol has not been configured into the system, or no implementation for it exists.\n```\n\nDespite the method name, this should work without the need to elevate\nprivileges and has been tested on Windows 10. Please note that accessing\npacket TTL values is not supported due to limitations in the Go\nx/net/ipv4 and x/net/ipv6 packages.\n\n### Plan 9 from Bell Labs\n\nThere is no support for Plan 9. This is because the entire `x/net/ipv4`\nand `x/net/ipv6` packages are not implemented by the Go programming\nlanguage.\n\n## Maintainers and Getting Help:\n\nThis repo was originally in the personal account of\n[sparrc](https://github.com/sparrc), but is now maintained by the\n[Prometheus Community](https://prometheus.io/community).\n\n## Contributing\n\nRefer to [CONTRIBUTING.md](https://github.com/prometheus-community/pro-bing/blob/master/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5aaee9%2Fgo-ping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F5aaee9%2Fgo-ping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5aaee9%2Fgo-ping/lists"}