Cleanup DnsManager
This commit is contained in:
parent
b7605d46fa
commit
4c34afc9ca
1 changed files with 10 additions and 14 deletions
|
@ -25,9 +25,9 @@ type DnsConfigurationData struct {
|
|||
|
||||
type DnsManager interface {
|
||||
GetPath() dbus.ObjectPath
|
||||
GetPropertyConfiguration() ([]DnsConfigurationData, error)
|
||||
GetPropertyRcManager() (string, error)
|
||||
GetPropertyMode() (string, error)
|
||||
GetPropertyRcManager() (string, error)
|
||||
GetPropertyConfiguration() ([]DnsConfigurationData, error)
|
||||
}
|
||||
|
||||
type dnsManager struct {
|
||||
|
@ -43,16 +43,20 @@ func (d *dnsManager) GetPath() dbus.ObjectPath {
|
|||
return d.obj.Path()
|
||||
}
|
||||
|
||||
func (d *dnsManager) GetPropertyMode() (string, error) {
|
||||
return d.getStringProperty(DnsManagerPropertyMode)
|
||||
}
|
||||
|
||||
func (d *dnsManager) GetPropertyRcManager() (string, error) {
|
||||
return d.getStringProperty(DnsManagerPropertyRcManager)
|
||||
}
|
||||
|
||||
func (d *dnsManager) GetPropertyConfiguration() ([]DnsConfigurationData, error) {
|
||||
configurations, err := d.getSliceMapStringVariantProperty(DnsManagerPropertyConfiguration)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// for k, c := range configurations {
|
||||
// fmt.Println(k, c)
|
||||
// }
|
||||
|
||||
ret := make([]DnsConfigurationData, len(configurations))
|
||||
for i, conf := range configurations {
|
||||
if serversVar, exist := conf["nameservers"]; exist {
|
||||
|
@ -90,11 +94,3 @@ func (d *dnsManager) GetPropertyConfiguration() ([]DnsConfigurationData, error)
|
|||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (d *dnsManager) GetPropertyRcManager() (string, error) {
|
||||
return d.getStringProperty(DnsManagerPropertyRcManager)
|
||||
}
|
||||
|
||||
func (d *dnsManager) GetPropertyMode() (string, error) {
|
||||
return d.getStringProperty(DnsManagerPropertyMode)
|
||||
}
|
||||
|
|
Reference in a new issue