Ajout système d'interface
This commit is contained in:
24
pkg/utils/NetworkLister.go
Normal file
24
pkg/utils/NetworkLister.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
func NetworkLister() {
|
||||
// Retrieve Interfaces
|
||||
inter, err := net.Interfaces()
|
||||
|
||||
// Process errors
|
||||
if err != nil {
|
||||
println("[ERROR] An error occurred : " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Display items
|
||||
println("\n\nNetwork interface list :")
|
||||
for i, val := range inter {
|
||||
fmt.Printf("%d. %s\n", i, val.Name)
|
||||
}
|
||||
print("\n")
|
||||
}
|
||||
Reference in New Issue
Block a user