Merge upstream
This commit is contained in:
parent
f731daa637
commit
7525115948
10 changed files with 54 additions and 32 deletions
|
@ -46,7 +46,7 @@ func (c *dhcp4Config) GetPropertyOptions() (DHCP4Options, error) {
|
|||
}
|
||||
|
||||
func (c *dhcp4Config) MarshalJSON() ([]byte, error) {
|
||||
Options, err := c.GetOptions()
|
||||
Options, err := c.GetPropertyOptions()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package gonetworkmanager
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/godbus/dbus"
|
||||
)
|
||||
|
@ -296,11 +295,11 @@ func (d *device) GetPropertyReal() (bool, error) {
|
|||
}
|
||||
|
||||
func (d *device) marshalMap() (map[string]interface{}, error) {
|
||||
Interface, err := d.GetInterface()
|
||||
Interface, err := d.GetPropertyInterface()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
IPinterface, err := d.GetPropertyIpInterface()
|
||||
IpInterface, err := d.GetPropertyIpInterface()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -327,7 +326,7 @@ func (d *device) marshalMap() (map[string]interface{}, error) {
|
|||
|
||||
return map[string]interface{}{
|
||||
"Interface": Interface,
|
||||
"IP interface": IPinterface,
|
||||
"IP interface": IpInterface,
|
||||
"State": State.String(),
|
||||
"IP4Config": IP4Config,
|
||||
"DHCP4Config": DHCP4Config,
|
||||
|
|
|
@ -34,7 +34,11 @@ func (d *deviceDummy) GetPropertyHwAddress() (string, error) {
|
|||
}
|
||||
|
||||
func (d *deviceDummy) MarshalJSON() ([]byte, error) {
|
||||
m := d.device.marshalMap()
|
||||
m, err := d.device.marshalMap()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m["HwAddress"], _ = d.GetPropertyHwAddress()
|
||||
return json.Marshal(m)
|
||||
}
|
||||
|
|
|
@ -42,7 +42,11 @@ func (d *deviceGeneric) GetPropertyTypeDescription() (string, error) {
|
|||
}
|
||||
|
||||
func (d *deviceGeneric) MarshalJSON() ([]byte, error) {
|
||||
m := d.device.marshalMap()
|
||||
m, err := d.device.marshalMap()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m["HwAddress"], _ = d.GetPropertyHwAddress()
|
||||
m["TypeDescription"], _ = d.GetPropertyTypeDescription()
|
||||
return json.Marshal(m)
|
||||
|
|
|
@ -129,7 +129,11 @@ func (d *deviceIpTunnel) GetPropertyFlags() (uint32, error) {
|
|||
}
|
||||
|
||||
func (d *deviceIpTunnel) MarshalJSON() ([]uint8, error) {
|
||||
m := d.device.marshalMap()
|
||||
m, err := d.device.marshalMap()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m["Mode"], _ = d.GetPropertyMode()
|
||||
m["Parent"], _ = d.GetPropertyParent()
|
||||
m["Local"], _ = d.GetPropertyLocal()
|
||||
|
|
|
@ -66,7 +66,11 @@ func (d *deviceWired) GetPropertyCarrier() (bool, error) {
|
|||
}
|
||||
|
||||
func (d *deviceWired) MarshalJSON() ([]byte, error) {
|
||||
m := d.device.marshalMap()
|
||||
m, err := d.device.marshalMap()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m["HwAddress"], _ = d.GetPropertyHwAddress()
|
||||
m["PermHwAddress"], _ = d.GetPropertyPermHwAddress()
|
||||
m["Speed"], _ = d.GetPropertySpeed()
|
||||
|
|
|
@ -176,7 +176,11 @@ func (d *deviceWireless) GetPropertyLastScan() (int64, error) {
|
|||
}
|
||||
|
||||
func (d *deviceWireless) MarshalJSON() ([]byte, error) {
|
||||
m := d.device.marshalMap()
|
||||
m, err := d.device.marshalMap()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m["AccessPoints"], _ = d.GetPropertyAccessPoints()
|
||||
m["HwAddress"], _ = d.GetPropertyHwAddress()
|
||||
m["PermHwAddress"], _ = d.GetPropertyPermHwAddress()
|
||||
|
|
|
@ -558,112 +558,112 @@ func (nm *networkManager) Unsubscribe() {
|
|||
|
||||
func (nm *networkManager) MarshalJSON() ([]byte, error) {
|
||||
|
||||
Devices, err := n.GetPropertyDevices()
|
||||
Devices, err := nm.GetPropertyDevices()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
AllDevices, err := n.GetPropertyAllDevices()
|
||||
AllDevices, err := nm.GetPropertyAllDevices()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Checkpoints, err := n.GetPropertyCheckpoints()
|
||||
Checkpoints, err := nm.GetPropertyCheckpoints()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
NetworkingEnabled, err := n.GetPropertyNetworkingEnabled()
|
||||
NetworkingEnabled, err := nm.GetPropertyNetworkingEnabled()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
WirelessEnabled, err := n.GetPropertyWirelessEnabled()
|
||||
WirelessEnabled, err := nm.GetPropertyWirelessEnabled()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
WirelessHardwareEnabled, err := n.GetPropertyWirelessHardwareEnabled()
|
||||
WirelessHardwareEnabled, err := nm.GetPropertyWirelessHardwareEnabled()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
WwanEnabled, err := n.GetPropertyWwanEnabled()
|
||||
WwanEnabled, err := nm.GetPropertyWwanEnabled()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
WwanHardwareEnabled, err := n.GetPropertyWwanHardwareEnabled()
|
||||
WwanHardwareEnabled, err := nm.GetPropertyWwanHardwareEnabled()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
WimaxEnabled, err := n.GetPropertyWimaxEnabled()
|
||||
WimaxEnabled, err := nm.GetPropertyWimaxEnabled()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
WimaxHardwareEnabled, err := n.GetPropertyWimaxHardwareEnabled()
|
||||
WimaxHardwareEnabled, err := nm.GetPropertyWimaxHardwareEnabled()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ActiveConnections, err := n.GetPropertyActiveConnections()
|
||||
ActiveConnections, err := nm.GetPropertyActiveConnections()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
PrimaryConnection, err := n.GetPropertyPrimaryConnection()
|
||||
PrimaryConnection, err := nm.GetPropertyPrimaryConnection()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
PrimaryConnectionType, err := n.GetPropertyPrimaryConnectionType()
|
||||
PrimaryConnectionType, err := nm.GetPropertyPrimaryConnectionType()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Metered, err := n.GetPropertyMetered()
|
||||
Metered, err := nm.GetPropertyMetered()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ActivatingConnection, err := n.GetPropertyActivatingConnection()
|
||||
ActivatingConnection, err := nm.GetPropertyActivatingConnection()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Startup, err := n.GetPropertyStartup()
|
||||
Startup, err := nm.GetPropertyStartup()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Version, err := n.GetPropertyVersion()
|
||||
Version, err := nm.GetPropertyVersion()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Capabilities, err := n.GetPropertyCapabilities()
|
||||
Capabilities, err := nm.GetPropertyCapabilities()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
State, err := n.GetPropertyState()
|
||||
State, err := nm.GetPropertyState()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Connectivity, err := n.GetPropertyConnectivity()
|
||||
Connectivity, err := nm.GetPropertyConnectivity()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ConnectivityCheckAvailable, err := n.GetPropertyConnectivityCheckAvailable()
|
||||
ConnectivityCheckAvailable, err := nm.GetPropertyConnectivityCheckAvailable()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ConnectivityCheckEnabled, err := n.GetPropertyConnectivityCheckEnabled()
|
||||
ConnectivityCheckEnabled, err := nm.GetPropertyConnectivityCheckEnabled()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
2
go.mod
2
go.mod
|
@ -3,3 +3,5 @@ module github.com/Wifx/gonetworkmanager
|
|||
go 1.12
|
||||
|
||||
require github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f
|
||||
|
||||
replace github.com/godbus/dbus => github.com/godbus/dbus/v5 v5.0.2
|
||||
|
|
1
go.sum
1
go.sum
|
@ -1,2 +1,3 @@
|
|||
github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f h1:zlOR3rOlPAVvtfuxGKoghCmop5B0TRyu/ZieziZuGiM=
|
||||
github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
|
||||
github.com/godbus/dbus/v5 v5.0.2/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
|
|
Reference in a new issue