1- # go-udev [ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/pilebones/go-udev )] ( https://goreportcard.com/report/github.com/pilebones/go-udev ) [ ![ GitHub Repo stars] ( https://img.shields.io/github/stars/pilebones/go-udev )] ( https://somsubhra.github.io/github-release-stats/?username=pilebones&repository=go-udev ) [ ![ GoDoc] ( https://godoc.org/github.com/pilebones/go-udev?status.svg )] ( https://godoc.org/github.com/pilebones/go-udev ) [ ![ Release] ( https://img.shields.io/github/release/pilebones/go-udev.svg )] ( https://github.com/pilebones/go-udev/releases/latest ) [ ![ License] ( https://img.shields.io/github/license/pilebones/go-udev )] ( /LICENSE ) ![ Build Status] ( https://github.com/pilebones/go-udev/workflows/CI/badge.svg ) [ ![ Coverage Status] ( https://coveralls.io/repos/github/pilebones/go-udev/badge.svg?branch=master )] ( https://coveralls.io/github/pilebones/go-udev?branch=master )
1+ # go-udev [ ![ GitHub Repo stars] ( https://img.shields.io/github/stars/pilebones/go-udev )] ( https://somsubhra.github.io/github-release-stats/?username=pilebones&repository=go-udev )
2+
3+ [ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/pilebones/go-udev )] ( https://goreportcard.com/report/github.com/pilebones/go-udev ) ![ Build Status] ( https://github.com/pilebones/go-udev/workflows/CI/badge.svg ) [ ![ Linters Status] ( https://github.com/pilebones/go-udev/actions/workflows/golangci-lint.yml/badge.svg )] ( https://github.com/pilebones/go-udev/actions/workflows/golangci-lint.yml ) [ ![ Coverage Status] ( https://coveralls.io/repos/github/pilebones/go-udev/badge.svg?branch=master )] ( https://coveralls.io/github/pilebones/go-udev?branch=master )
4+ [ ![ GoDoc] ( https://godoc.org/github.com/pilebones/go-udev?status.svg )] ( https://godoc.org/github.com/pilebones/go-udev ) [ ![ Release] ( https://img.shields.io/github/release/pilebones/go-udev.svg )] ( https://github.com/pilebones/go-udev/releases/latest ) [ ![ License] ( https://img.shields.io/github/license/pilebones/go-udev )] ( /LICENSE )
25
36Simple udev implementation in Golang developed from scratch.
47This library allow to listen and manage Linux-kernel (since version 2.6.10) Netlink messages to user space (ie: ` NETLINK_KOBJECT_UEVENT ` ).
@@ -53,6 +56,7 @@ Handle all kernel message to detect change about plugged or unplugged devices:
5356#### Examples
5457
5558Example of output when a USB storage is plugged:
59+
5660```
57612017/10/20 23:47:23 Handle netlink.UEvent{
5862 Action: "add",
@@ -73,6 +77,7 @@ Example of output when a USB storage is plugged:
7377```
7478
7579Example of output when a USB storage is unplugged:
80+
7681```
7782[...]
78832017/10/20 23:47:29 Handle netlink.UEvent{
@@ -102,6 +107,7 @@ Is it possible to filter uevents/devices with a Matcher.
102107A Matcher is a list of your own rules to match only relevant uevent kernel message (see: ` matcher.sample ` ).
103108
104109You could pass this file using for both mode:
110+
105111```
106112./go-udev -file matcher.sample [...]
107113
@@ -110,19 +116,23 @@ You could pass this file using for both mode:
110116## Docker usage
111117
112118### How to build docker image
119+
113120```
114121docker build . -f Dockfile.multistage -t go-udev
115122```
116123
117124### How to execute ` go-udev -info ` using docker image
125+
118126```
119127docker run -rm -t go-udev -info
120128```
121129
122130### How to execute ` go-udev -monitor ` using docker image
131+
123132```
124133docker run --rm -v=/dev:/dev -v /run/udev:/run/udev:ro --net=host -t go-udev -monitor
125134```
135+
126136Warning: unsafe method because we share host /dev directory to the container.
127137
128138* __ TODO__ : unsafe and ` -monitor ` is not fully functional in docker, fix working in progress...*
@@ -133,12 +143,13 @@ Don't hesitate to notice if you detect a problem with this tool or library.
133143
134144## Links
135145
136- - Netlink Manual: http://man7.org/linux/man-pages/man7/netlink.7.html
137- - Linux source code about:
138- * Struct sockaddr_netlink: http://elixir.free-electrons.com/linux/v3.12/source/lib/kobject_uevent.c#L45
139- * KObject action: http://elixir.free-electrons.com/linux/v3.12/source/lib/kobject_uevent.c#L45
146+ - Netlink Manual: < http://man7.org/linux/man-pages/man7/netlink.7.html >
147+ - Linux source code about:
148+ - Struct sockaddr_netlink: < http://elixir.free-electrons.com/linux/v3.12/source/lib/kobject_uevent.c#L45 >
149+ - KObject action: < http://elixir.free-electrons.com/linux/v3.12/source/lib/kobject_uevent.c#L45 >
140150
141151## Documentation
152+
142153- [ GoDoc Reference] ( http://godoc.org/github.com/pilebones/go-udev ) .
143154
144155## License
0 commit comments