Skip to content

Commit

Permalink
Use utils.ToString for all providers
Browse files Browse the repository at this point in the history
  • Loading branch information
felixwrt committed Aug 7, 2023
1 parent fc8e3f9 commit becdbc8
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion internal/provider/providers/desec/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (p *Provider) isValid() error {
}

func (p *Provider) String() string {
return fmt.Sprintf("[domain: %s | host: %s | provider: deSEC]", p.domain, p.host)
return utils.ToString(p.domain, p.host, constants.DeSEC, p.ipVersion)
}

func (p *Provider) Domain() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/providers/dyn/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (p *Provider) isValid() error {
}

func (p *Provider) String() string {
return fmt.Sprintf("[domain: %s | host: %s | provider: Dyn]", p.domain, p.host)
return utils.ToString(p.domain, p.host, constants.Dyn, p.ipVersion)
}

func (p *Provider) Domain() string {
Expand Down
3 changes: 2 additions & 1 deletion internal/provider/providers/dynv6/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/url"

"github.com/qdm12/ddns-updater/internal/models"
"github.com/qdm12/ddns-updater/internal/provider/constants"
"github.com/qdm12/ddns-updater/internal/provider/errors"
"github.com/qdm12/ddns-updater/internal/provider/headers"
"github.com/qdm12/ddns-updater/internal/provider/utils"
Expand Down Expand Up @@ -58,7 +59,7 @@ func (p *Provider) isValid() error {
}

func (p *Provider) String() string {
return fmt.Sprintf("[domain: %s | host: %s | provider: DynV6]", p.domain, p.host)
return utils.ToString(p.domain, p.host, constants.DynV6, p.ipVersion)
}

func (p *Provider) Domain() string {
Expand Down
3 changes: 2 additions & 1 deletion internal/provider/providers/inwx/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strings"

"github.com/qdm12/ddns-updater/internal/models"
"github.com/qdm12/ddns-updater/internal/provider/constants"
"github.com/qdm12/ddns-updater/internal/provider/errors"
"github.com/qdm12/ddns-updater/internal/provider/headers"
"github.com/qdm12/ddns-updater/internal/provider/utils"
Expand Down Expand Up @@ -62,7 +63,7 @@ func (p *Provider) isValid() error {
}

func (p *Provider) String() string {
return fmt.Sprintf("[domain: %s | host: %s | provider: INWX]", p.domain, p.host)
return utils.ToString(p.domain, p.host, constants.INWX, p.ipVersion)
}

func (p *Provider) Domain() string {
Expand Down
3 changes: 2 additions & 1 deletion internal/provider/providers/opendns/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strings"

"github.com/qdm12/ddns-updater/internal/models"
"github.com/qdm12/ddns-updater/internal/provider/constants"
"github.com/qdm12/ddns-updater/internal/provider/errors"
"github.com/qdm12/ddns-updater/internal/provider/headers"
"github.com/qdm12/ddns-updater/internal/provider/utils"
Expand Down Expand Up @@ -65,7 +66,7 @@ func (p *Provider) isValid() error {
}

func (p *Provider) String() string {
return fmt.Sprintf("[domain: %s | host: %s | provider: Opendns]", p.domain, p.host)
return utils.ToString(p.domain, p.host, constants.OpenDNS, p.ipVersion)
}

func (p *Provider) Domain() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/providers/ovh/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (p *Provider) isValid() error {
}

func (p *Provider) String() string {
return fmt.Sprintf("[domain: %s | host: %s | provider: OVH]", p.domain, p.host)
return utils.ToString(p.domain, p.host, constants.OVH, p.ipVersion)
}

func (p *Provider) Domain() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/providers/porkbun/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (p *Provider) isValid() error {
}

func (p *Provider) String() string {
return fmt.Sprintf("[domain: %s | host: %s | provider: Porkbun]", p.domain, p.host)
return utils.ToString(p.domain, p.host, constants.Porkbun, p.ipVersion)
}

func (p *Provider) Domain() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/providers/selfhostde/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (p *Provider) isValid() error {
}

func (p *Provider) String() string {
return fmt.Sprintf("[domain: %s | host: %s | provider: Selfhost.de]", p.domain, p.host)
return utils.ToString(p.domain, p.host, constants.SelfhostDe, p.ipVersion)
}

func (p *Provider) Domain() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/providers/spdyn/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (p *Provider) isValid() error {
}

func (p *Provider) String() string {
return fmt.Sprintf("[domain: %s | host: %s | provider: Spdyn]", p.domain, p.host)
return utils.ToString(p.domain, p.host, constants.Spdyn, p.ipVersion)
}

func (p *Provider) Domain() string {
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/providers/variomedia/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (p *Provider) isValid() error {
}

func (p *Provider) String() string {
return fmt.Sprintf("[domain: %s | host: %s | provider: Variomedia]", p.domain, p.host)
return utils.ToString(p.domain, p.host, constants.Variomedia, p.ipVersion)
}

func (p *Provider) Domain() string {
Expand Down

0 comments on commit becdbc8

Please sign in to comment.