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"
|
||||
|
||||
DevicePropertyInterface = DeviceInterface + ".Interface"
|
||||
DevicePropertyIpInterface = DeviceInterface + ".IpInterface"
|
||||
DevicePropertyState = DeviceInterface + ".State"
|
||||
DevicePropertyIP4Config = DeviceInterface + ".Ip4Config"
|
||||
DevicePropertyDeviceType = DeviceInterface + ".DeviceType"
|
||||
|
@ -36,6 +37,9 @@ type Device interface {
|
|||
// interface.
|
||||
GetInterface() string
|
||||
|
||||
// GetIpInterface gets the IP interface name of the device.
|
||||
GetIpInterface() string
|
||||
|
||||
// GetState gets the current state of the device.
|
||||
GetState() NmDeviceState
|
||||
|
||||
|
@ -73,6 +77,10 @@ func (d *device) GetInterface() string {
|
|||
return d.getStringProperty(DevicePropertyInterface)
|
||||
}
|
||||
|
||||
func (d *device) GetIpInterface() string {
|
||||
return d.getStringProperty(DevicePropertyIpInterface)
|
||||
}
|
||||
|
||||
func (d *device) GetState() NmDeviceState {
|
||||
return NmDeviceState(d.getUint32Property(DevicePropertyState))
|
||||
}
|
||||
|
@ -127,6 +135,7 @@ func (d *device) GetAvailableConnections() []Connection {
|
|||
func (d *device) marshalMap() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"Interface": d.GetInterface(),
|
||||
"IP interface": d.GetIpInterface(),
|
||||
"State": d.GetState().String(),
|
||||
"IP4Config": d.GetIP4Config(),
|
||||
"DHCP4Config": d.GetDHCP4Config(),
|
||||
|
|
Reference in a new issue