{"id":18832807,"url":"https://github.com/linka-cloud/ping","last_synced_at":"2026-01-25T20:30:18.156Z","repository":{"id":114454034,"uuid":"528399895","full_name":"linka-cloud/ping","owner":"linka-cloud","description":null,"archived":false,"fork":false,"pushed_at":"2022-08-24T11:55:03.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-30T07:23:15.921Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linka-cloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-24T11:49:36.000Z","updated_at":"2022-08-24T11:50:52.000Z","dependencies_parsed_at":"2023-06-07T23:45:39.158Z","dependency_job_id":null,"html_url":"https://github.com/linka-cloud/ping","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linka-cloud%2Fping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linka-cloud%2Fping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linka-cloud%2Fping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linka-cloud%2Fping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linka-cloud","download_url":"https://codeload.github.com/linka-cloud/ping/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239768926,"owners_count":19693763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-08T01:59:03.592Z","updated_at":"2026-01-25T20:30:18.077Z","avatar_url":"https://github.com/linka-cloud.png","language":"Go","readme":"# Ping\n\nPing is based on [github.com/digineo/go-ping](https://github.com/digineo/go-ping), \nmore precisely on [github.com/digineo/go-ping/cmd/multiping](https://github.com/digineo/go-ping/tree/master/cmd/multiping).\n\nIt allow to ping multiple destinations.\n\nExample : \n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"time\"\n\n    \"github.com/sirupsen/logrus\"\n    \n    \"gitlab.bertha.cloud/partitio/isi/ping\"\n)\n\nfunc main() {\n    ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Second)\n    defer cancel()\n    p, err := ping.NewPinger(ctx, \"127.0.0.1\", \"255.0.0.1\", \"192.168.12.1\")\n    if err != nil {\n        logrus.Fatal(err)\n    }\n    defer p.Close()\n\n    go p.Run()\n\n    t := time.NewTicker(time.Second)\n    for {\n        select {\n        case \u003c-t.C:\n            sts := p.Statistics()\n            for _, s := range sts {\n                logrus.WithFields(logrus.Fields{\n                    \"host\":     s.Addr,\n                    \"address\":  s.IPAddr,\n                    \"sent\":     s.PacketsSent,\n                    \"lost\":     s.PacketLoss,\n                    \"received\": s.PacketsRecv,\n                    \"min\":      s.MinRtt,\n                    \"max\":      s.MaxRtt,\n                    \"mean\":     s.AvgRtt,\n                    \"rtts\":     s.Rtts,\n                }).Info()\n            }\n        case \u003c-ctx.Done():\n            return\n        }\n    }\n}\n```\n\nThe pinger :\n\n```go\ntype Pinger interface {\n    // deprecated: removed udp support\n    Privileged() bool\n\n    // Addresses returns the list of the destinations host\n    Addresses() []string\n    // IPAddresses returns the list of the destinations addresses\n    IPAddresses() []net.IPAddr\n\n    // AddAddress add a destination to the pinger\n    AddAddress(a string) error\n    // Remove Address remove a destination from the pinger\n    RemoveAddress(a string) error\n\n    // Run start the pinger. It fails silently if the pinger is already running\n    Run()\n    // Stop stops the pinger. It fails silently if the pinger is already stopped\n    Stop()\n\n    // IsRunning returns the state of the pinger\n    IsRunning() bool\n\n    // Statistics returns the a map address ping Statistics\n    Statistics() map[string]Statistics\n\n    // Close closes the connection. It should be call deferred right after the creation of the pinger\n    Close()\n}\n```\n\nThe Statistics :\n\n```go\ntype Statistics struct {\n    // PacketsRecv is the number of packets received.\n    PacketsRecv int\n\n    // PacketsSent is the number of packets sent.\n    PacketsSent int\n\n    // PacketLoss is the percentage of packets lost.\n    PacketLoss float64\n\n    // IPAddr is the address of the host being pinged.\n    IPAddr net.IPAddr\n\n    // Addr is the string address of the host being pinged.\n    Addr string\n\n    // Rtts is the last 10 round-trip times sent via this pinger.\n    // 0 means nothing was received\n    Rtts []time.Duration\n\n    // MinRtt is the minimum round-trip time sent via this pinger.\n    MinRtt time.Duration\n\n    // MaxRtt is the maximum round-trip time sent via this pinger.\n    MaxRtt time.Duration\n\n    // AvgRtt is the average round-trip time sent via this pinger.\n    AvgRtt time.Duration\n\n    // StdDevRtt is the standard deviation of the round-trip times sent via\n    // this pinger.\n    StdDevRtt time.Duration\n}\n\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinka-cloud%2Fping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinka-cloud%2Fping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinka-cloud%2Fping/lists"}