Fix IP6Config nameserver data fetch
This commit is contained in:
parent
bdc679ae76
commit
c8c883838e
2 changed files with 16 additions and 16 deletions
24
IP6Config.go
24
IP6Config.go
|
@ -49,10 +49,6 @@ type IP6RouteData struct {
|
|||
AdditionalAttributes map[string]string
|
||||
}
|
||||
|
||||
type IP6NameserverData struct {
|
||||
Address string
|
||||
}
|
||||
|
||||
type IP6Config interface {
|
||||
|
||||
// Array of IP address data objects. All addresses will include "address" (an IP address string), and "prefix" (a uint). Some addresses may include additional attributes.
|
||||
|
@ -65,7 +61,7 @@ type IP6Config interface {
|
|||
GetRouteData() []IP6RouteData
|
||||
|
||||
// GetNameservers gets the nameservers in use.
|
||||
GetNameservers() []IP6NameserverData
|
||||
GetNameservers() []string
|
||||
|
||||
// A list of domains this address belongs to.
|
||||
GetDomains() []string
|
||||
|
@ -141,19 +137,15 @@ func (c *ip6Config) GetRouteData() []IP6RouteData {
|
|||
return routes
|
||||
}
|
||||
|
||||
func (c *ip6Config) GetNameservers() []IP6NameserverData {
|
||||
nameserversData := c.getSliceMapStringVariantProperty(IP6ConfigPropertyNameservers)
|
||||
nameservers := make([]IP6NameserverData, len(nameserversData))
|
||||
func (c *ip6Config) GetNameservers() []string {
|
||||
nameservers := c.getSliceSliceByteProperty(IP6ConfigPropertyNameservers)
|
||||
ret := make([]string, len(nameservers))
|
||||
|
||||
for _, nameserverData := range nameserversData {
|
||||
|
||||
nameserver := IP6NameserverData{
|
||||
Address: nameserverData["address"].Value().(string),
|
||||
}
|
||||
|
||||
nameservers = append(nameservers, nameserver)
|
||||
for i, nameserver := range nameservers {
|
||||
ret[i] = string(nameserver)
|
||||
}
|
||||
return nameservers
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (c *ip6Config) GetDomains() []string {
|
||||
|
|
8
utils.go
8
utils.go
|
@ -108,6 +108,14 @@ func (d *dbusBase) getSliceStringProperty(iface string) []string {
|
|||
return value
|
||||
}
|
||||
|
||||
func (d *dbusBase) getSliceSliceByteProperty(iface string) [][]byte {
|
||||
value, ok := d.getProperty(iface).([][]byte)
|
||||
if !ok {
|
||||
panic(makeErrVariantType(iface))
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
func (d *dbusBase) getMapStringVariantProperty(iface string) map[string]dbus.Variant {
|
||||
value, ok := d.getProperty(iface).(map[string]dbus.Variant)
|
||||
if !ok {
|
||||
|
|
Reference in a new issue