GetInterfaces, GetBridgeMTU
This commit is contained in:
parent
0f6b7b8b80
commit
2a8836721c
@ -108,6 +108,35 @@ func (jh *JailHost) GetDefaultGateway6() string {
|
|||||||
return jh.default_gateway6
|
return jh.default_gateway6
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Get all network interfaces
|
||||||
|
****************************************************************************/
|
||||||
|
func (jh *JailHost) GetInterfaces() ([]string, error) {
|
||||||
|
var names []string
|
||||||
|
|
||||||
|
interfaces, err := net.Interfaces()
|
||||||
|
if err != nil {
|
||||||
|
return names, fmt.Errorf("Error listing network interfaces: %v", err)
|
||||||
|
}
|
||||||
|
for _, n := range interfaces {
|
||||||
|
names = append(names, n.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
return names, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (jh *JailHost) GetBridgeMTU(bridgeName string) (int, error) {
|
||||||
|
bridge, err := net.InterfaceByName(bridgeName)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return bridge.MTU, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Get all IPv4 currently in use on host
|
||||||
|
****************************************************************************/
|
||||||
func getHostInUseIPv4() ([]string, error) {
|
func getHostInUseIPv4() ([]string, error) {
|
||||||
var ips []string
|
var ips []string
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user