github.com/jaypipes/ghw@v0.21.1/pkg/snapshot/clonetree_net_linux.go (about) 1 // 2 // Use and distribution licensed under the Apache license version 2. 3 // 4 // See the COPYING file in the root project directory for full text. 5 // 6 7 package snapshot 8 9 import ( 10 "strings" 11 ) 12 13 // ExpectedCloneNetContent returns a slice of strings pertaning to the network interfaces ghw 14 // cares about. We cannot use a static list because we want to filter away the virtual devices, 15 // which ghw doesn't concern itself about. So we need to do some runtime discovery. 16 // Additionally, we want to make sure to clone the backing device data. 17 func ExpectedCloneNetContent() []string { 18 ifaceEntries := []string{ 19 "addr_assign_type", 20 // intentionally avoid to clone "address" to avoid to leak any host-idenfifiable data. 21 } 22 23 filterLink := func(linkDest string) bool { 24 return !strings.Contains(linkDest, "devices/virtual/net") 25 } 26 27 return cloneContentByClass("net", ifaceEntries, filterNone, filterLink) 28 }