()
| 47 | } |
| 48 | |
| 49 | func ExampleAttachNetNs() { |
| 50 | prog, err := createSkLookupProgram() |
| 51 | if err != nil { |
| 52 | panic(err) |
| 53 | } |
| 54 | defer prog.Close() |
| 55 | |
| 56 | // This can be a path to another netns as well. |
| 57 | netns, err := os.Open("/proc/self/ns/net") |
| 58 | if err != nil { |
| 59 | panic(err) |
| 60 | } |
| 61 | defer netns.Close() |
| 62 | |
| 63 | link, err := AttachNetNs(int(netns.Fd()), prog) |
| 64 | if err != nil { |
| 65 | panic(err) |
| 66 | } |
| 67 | |
| 68 | // The socket lookup program is now active until Close(). |
| 69 | link.Close() |
| 70 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…