Get the IP interface name of the device.
This commit is contained in:
parent
394a1ac2cd
commit
a623a58bfe
1 changed files with 9 additions and 0 deletions
|
@ -10,6 +10,7 @@ const (
|
||||||
DeviceInterface = NetworkManagerInterface + ".Device"
|
DeviceInterface = NetworkManagerInterface + ".Device"
|
||||||
|
|
||||||
DevicePropertyInterface = DeviceInterface + ".Interface"
|
DevicePropertyInterface = DeviceInterface + ".Interface"
|
||||||
|
DevicePropertyIpInterface = DeviceInterface + ".IpInterface"
|
||||||
DevicePropertyState = DeviceInterface + ".State"
|
DevicePropertyState = DeviceInterface + ".State"
|
||||||
DevicePropertyIP4Config = DeviceInterface + ".Ip4Config"
|
DevicePropertyIP4Config = DeviceInterface + ".Ip4Config"
|
||||||
DevicePropertyDeviceType = DeviceInterface + ".DeviceType"
|
DevicePropertyDeviceType = DeviceInterface + ".DeviceType"
|
||||||
|
@ -36,6 +37,9 @@ type Device interface {
|
||||||
// interface.
|
// interface.
|
||||||
GetInterface() string
|
GetInterface() string
|
||||||
|
|
||||||
|
// GetIpInterface gets the IP interface name of the device.
|
||||||
|
GetIpInterface() string
|
||||||
|
|
||||||
// GetState gets the current state of the device.
|
// GetState gets the current state of the device.
|
||||||
GetState() NmDeviceState
|
GetState() NmDeviceState
|
||||||
|
|
||||||
|
@ -73,6 +77,10 @@ func (d *device) GetInterface() string {
|
||||||
return d.getStringProperty(DevicePropertyInterface)
|
return d.getStringProperty(DevicePropertyInterface)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *device) GetIpInterface() string {
|
||||||
|
return d.getStringProperty(DevicePropertyIpInterface)
|
||||||
|
}
|
||||||
|
|
||||||
func (d *device) GetState() NmDeviceState {
|
func (d *device) GetState() NmDeviceState {
|
||||||
return NmDeviceState(d.getUint32Property(DevicePropertyState))
|
return NmDeviceState(d.getUint32Property(DevicePropertyState))
|
||||||
}
|
}
|
||||||
|
@ -127,6 +135,7 @@ func (d *device) GetAvailableConnections() []Connection {
|
||||||
func (d *device) marshalMap() map[string]interface{} {
|
func (d *device) marshalMap() map[string]interface{} {
|
||||||
return map[string]interface{}{
|
return map[string]interface{}{
|
||||||
"Interface": d.GetInterface(),
|
"Interface": d.GetInterface(),
|
||||||
|
"IP interface": d.GetIpInterface(),
|
||||||
"State": d.GetState().String(),
|
"State": d.GetState().String(),
|
||||||
"IP4Config": d.GetIP4Config(),
|
"IP4Config": d.GetIP4Config(),
|
||||||
"DHCP4Config": d.GetDHCP4Config(),
|
"DHCP4Config": d.GetDHCP4Config(),
|
||||||
|
|
Reference in a new issue