{"id":22967947,"url":"https://github.com/satta/ifplugo","last_synced_at":"2025-08-13T09:34:07.995Z","repository":{"id":57514657,"uuid":"132905631","full_name":"satta/ifplugo","owner":"satta","description":"dynamic network link status notification in pure Go on Linux","archived":false,"fork":false,"pushed_at":"2020-05-08T13:46:38.000Z","size":42,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-21T16:59:25.977Z","etag":null,"topics":["cable","connection","ethtool","golang","golang-library","ifplugd","link","linux","monitoring","networking"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/satta.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}},"created_at":"2018-05-10T13:39:57.000Z","updated_at":"2024-01-18T04:50:44.000Z","dependencies_parsed_at":"2022-09-06T04:00:41.121Z","dependency_job_id":null,"html_url":"https://github.com/satta/ifplugo","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/satta%2Fifplugo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satta%2Fifplugo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satta%2Fifplugo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satta%2Fifplugo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/satta","download_url":"https://codeload.github.com/satta/ifplugo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229754902,"owners_count":18119134,"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":["cable","connection","ethtool","golang","golang-library","ifplugd","link","linux","monitoring","networking"],"created_at":"2024-12-14T21:15:10.912Z","updated_at":"2024-12-14T21:15:11.830Z","avatar_url":"https://github.com/satta.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ifplugo\n\n[![GoDoc](https://godoc.org/github.com/satta/ifplugo?status.svg)](http://godoc.org/github.com/satta/ifplugo)\n[![CircleCI](https://circleci.com/gh/satta/ifplugo.svg?style=shield)](https://circleci.com/gh/satta/ifplugo)\n\nifplugo delivers network interface link information and link changes. It does this (on Linux) by querying kernel ioctls to gather the necessary status information, then emits a status summary on a given channel. This summary (`LinkStatusSample`) is emitted on the first invocation and each time the state changes for at least one monitored interface.\n\n```Go\ntype LinkStatusSample struct {\n    Ifaces  map[string]InterfaceStatus\n}\n```\n\nwhere `InterfaceStatus` can be:\n\n```Go\nconst (\n    // InterfaceUnknown represents an interface with no assigned state.\n    InterfaceUnknown InterfaceStatus = iota\n    // InterfaceUp represents an interface with a cable connected.\n    InterfaceUp\n    // InterfaceDown represents an interface with no cable connected.\n    InterfaceDown\n    // InterfaceErr represents an interface with errors querying its status.\n    InterfaceErr\n)\n```\n\nThese summaries can then easily be consumed (example):\n\n```Go\noutchan := make(chan ifplugo.LinkStatusSample)\nmon := ifplugo.MakeLinkStatusMonitor(2 * time.Second, []string{\"eth0\"}, outchan)\ngo func() {\n    for v := range outchan {\n        for k, v := range v.Ifaces {\n            fmt.Printf(\"%s: %s\\n\", k, v)\n        }\n    }\n}()\nmon.Run()\n```\n\nIt is also possible to determine the status of an interface from whether any data is flowing or not. This can be useful if, for example, the interesting interface is only connected to one way of the physical connection (RX or TX) or for other reasons can not complete autonegotiation. Use `CheckIncomingDelta()` in this case, it allows to also mark an interface as 'up' and seeing traffic if a certain threshold of received bytes is exceeded during one polling period. Example:\n\n```Go\nmon.CheckIncomingDelta(true, 1000)\n```\n\nThis would, for example, also mark an interface as up if more than 1000 bytes are received during the polling period, and mark the interface as down if there are ever less than 1000 bytes received in a polling period.\n\n## Platform restrictions\n\nObviously, this works on Linux only.\n\n## Example\n\nSee the source code of the simple command line tools in `cmd/*` for more simple examples of how to use ifplugo.\n\n```Text\n$ ifplugo-watch eth0,eth1,eth2,eth3\neth0: link\neth1: link\neth2: link\neth3: no link\n^C\n$\n```\n\n## Authors\n\nSascha Steinbiss \u003csascha (at) steinbiss (dot) name\u003e.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatta%2Fifplugo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsatta%2Fifplugo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatta%2Fifplugo/lists"}