caddy-dns / netcup

netcup DNS module for caddy: dns.providers.netcup
MIT License
13 stars 6 forks source link

Getting build errors with xcaddy #4

Closed Monviech closed 7 months ago

Monviech commented 7 months ago

Hello :)

My current caddy build:

https://github.com/Monviech/os-caddy-plugin/blob/main/usr/local/bin/README.md#current-build

Error I'm getting:

# github.com/libdns/netcup
/root/go/pkg/mod/github.com/libdns/netcup@v0.1.0/util.go:27:14: cannot use record.Priority (variable of type int) as uint value in struct literal
/root/go/pkg/mod/github.com/libdns/netcup@v0.1.0/util.go:43:17: cannot use record.Priority (variable of type uint) as int value in struct literal
// Converts netcup records to libdns records. Since the netcup records don't have individual TTLs, the given TTL is used for all libdns rec
ords.
func toLibdnsRecords(netcupRecords []dnsRecord, ttl int64) []libdns.Record {
        var libdnsRecords []libdns.Record
        for _, record := range netcupRecords {
                libdnsRecord := libdns.Record{
                        ID:       record.ID,
                        Type:     record.RecType,
                        Name:     record.HostName,
                        Value:    record.Destination,
                        TTL:      time.Duration(ttl * int64(time.Second)),
                        Priority: record.Priority,
                }
                libdnsRecords = append(libdnsRecords, libdnsRecord)
        }
        return libdnsRecords
}

// Converts libdns records to netcup records.
func toNetcupRecords(libnsRecords []libdns.Record) []dnsRecord {
        var netcupRecords []dnsRecord
        for _, record := range libnsRecords {
                netcupRecord := dnsRecord{
                        ID:          record.ID,
                        HostName:    record.Name,
                        RecType:     record.Type,
                        Destination: record.Value,
                        Priority:    record.Priority,
                }
                netcupRecords = append(netcupRecords, netcupRecord)
        }
        return netcupRecords
}

How I solve this build error:

  1. in func toLibdnsRecords I change record.Priority to uint(record.Priority)
  2. in func toNetcupRecords I change record.Priority to int(record.Priority)

Then the build works for me.

Monviech commented 7 months ago

It's an incompability in the build between this and another DNS Provider --with github.com/caddy-dns/vultr

I'm closing this here, thank you.