Compare commits

..

2 Commits

Author SHA1 Message Date
amery 36347abaab dns/show: sort records
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-10-24 17:35:26 +00:00
amery 7dac96f474 dns/show: refactor Record formatting
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-10-24 17:35:26 +00:00
+9 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"net/netip"
"sort"
"strings"
"time"
"darvaza.org/core"
@@ -57,7 +58,7 @@ func (mgr *Manager) GetSyncRecords(ctx context.Context) ([]SyncAddrRecord, error
}
// AsSyncAddr converts a A or AAAA [libdns.Record] into a [SyncAddr]
func (*Manager) AsSyncAddr(rr libdns.Record) (SyncAddr, bool, error) {
func (mgr *Manager) AsSyncAddr(rr libdns.Record) (SyncAddr, bool, error) {
var out SyncAddr
var addr netip.Addr
@@ -66,6 +67,13 @@ func (*Manager) AsSyncAddr(rr libdns.Record) (SyncAddr, bool, error) {
return out, false, nil
}
// skip entries not containing our suffix
if mgr.suffix != "" {
if !strings.HasSuffix(rr.Name, mgr.suffix) {
return out, false, nil
}
}
err := addr.UnmarshalText([]byte(rr.Value))
if err != nil {
// invalid address on A or AAAA record