Skip to content

Commit

Permalink
Cleanup DnsManager
Browse files Browse the repository at this point in the history
  • Loading branch information
mullerch committed Nov 21, 2022
1 parent b7605d4 commit 4c34afc
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions DnsManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
}

0 comments on commit 4c34afc

Please sign in to comment.