sync

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdguardSyncResult added in v0.1.0

type AdguardSyncResult struct {
	HostnameMap    map[string]string
	ToAdd          []string
	ToUpdate       []string
	ToRemove       []string
	ChangesApplied bool
	SyncRewrites   []api.Rewrite
	OtherRewrites  []api.Rewrite
	ExistingCount  int
}

AdguardSyncResult contains the results of the AdguardHome sync operation

func SyncCaddyWithAdguard added in v0.1.0

func SyncCaddyWithAdguard(
	adguardClient *api.AdguardClient,
	options CaddyAdguardSyncOptions,
) (*AdguardSyncResult, error)

SyncCaddyWithAdguard synchronizes DNS rewrites between Caddy and AdguardHome

type CaddyAdguardSyncOptions added in v0.1.0

type CaddyAdguardSyncOptions struct {
	DryRun             bool
	CaddyServerIP      string
	CaddyServerPort    int
	EntryDescription   string
	LegacyDescriptions []string
	Verbose            bool
}

CaddyAdguardSyncOptions contains options for the Caddy to AdguardHome sync operation

type CaddyCloudflareSyncOptions added in v0.1.0

type CaddyCloudflareSyncOptions struct {
	DryRun             bool
	CaddyServerIP      string
	CaddyServerPort    int
	EntryDescription   string
	LegacyDescriptions []string
	DirectSubdomain    string
	CaddySubdomain     string
	SyncDirect         bool
	SyncCaddy          bool
	Verbose            bool
}

CaddyCloudflareSyncOptions contains options for the Caddy-Cloudflare sync operation

type CaddyCloudflareSyncResult added in v0.1.0

type CaddyCloudflareSyncResult struct {
	HostnameMap    map[string]string
	DirectEntries  map[string]string // hostname -> service IP
	CaddyEntries   map[string]string // hostname -> caddy IP
	ToAdd          []CloudflareEntry
	ToUpdate       []CloudflareEntry
	ToRemove       []api.DNSOverride
	ChangesApplied bool
	SyncOverrides  map[string]api.DNSOverride
	OtherOverrides map[string]api.DNSOverride
}

CaddyCloudflareSyncResult contains the result of the Caddy-Cloudflare sync operation

func SyncCaddyWithCloudflare added in v0.1.0

func SyncCaddyWithCloudflare(unboundClient *api.Client, options CaddyCloudflareSyncOptions) (*CaddyCloudflareSyncResult, error)

SyncCaddyWithCloudflare synchronizes DNS entries for dual-mode Cloudflare tunnel routing

type CaddySyncOptions

type CaddySyncOptions struct {
	DryRun             bool
	CaddyServerIP      string
	CaddyServerPort    int
	EntryDescription   string
	LegacyDescriptions []string
	Verbose            bool
}

CaddySyncOptions contains options for the Caddy sync operation

type CloudflareEntry added in v0.1.0

type CloudflareEntry struct {
	Hostname    string
	Domain      string
	IP          string
	Description string
	Mode        string // "direct" or "caddy"
}

CloudflareEntry represents a DNS entry to be created for Cloudflare routing

type CloudflareSyncOptions added in v0.1.0

type CloudflareSyncOptions struct {
	DryRun             bool
	TunnelID           string
	EntryDescription   string
	LegacyDescriptions []string
	Verbose            bool
}

CloudflareSyncOptions contains options for the Cloudflare sync operation

type CloudflareUI added in v0.1.0

type CloudflareUI struct {
	Styles tui.StyleConfig
}

CloudflareUI provides Cloudflare-specific UI rendering functions

func NewCloudflareUI added in v0.1.0

func NewCloudflareUI() *CloudflareUI

NewCloudflareUI creates a new CloudflareUI instance

func (*CloudflareUI) RenderError added in v0.1.0

func (ui *CloudflareUI) RenderError(err error) string

RenderError renders an error message

func (*CloudflareUI) RenderFetchingMessage added in v0.1.0

func (ui *CloudflareUI) RenderFetchingMessage() string

RenderFetchingMessage renders a message indicating that Cloudflare tunnel config is being fetched

func (*CloudflareUI) RenderHeader added in v0.1.0

func (ui *CloudflareUI) RenderHeader() string

RenderHeader renders the Cloudflare header

func (*CloudflareUI) RenderInfo added in v0.1.0

func (ui *CloudflareUI) RenderInfo(message string) string

RenderInfo renders an informational message

func (*CloudflareUI) RenderNoTunnelID added in v0.1.0

func (ui *CloudflareUI) RenderNoTunnelID() string

RenderNoTunnelID renders a message indicating that no tunnel ID was provided

func (*CloudflareUI) RenderSourceSection added in v0.1.0

func (ui *CloudflareUI) RenderSourceSection() string

RenderSourceSection renders a section title for Cloudflare tunnel source

func (*CloudflareUI) RenderTunnelInfo added in v0.1.0

func (ui *CloudflareUI) RenderTunnelInfo(tunnelID string, tunnelName string) string

RenderTunnelInfo renders information about a Cloudflare tunnel

func (*CloudflareUI) RenderTunnelsList added in v0.1.0

func (ui *CloudflareUI) RenderTunnelsList(tunnels []api.CloudflareTunnel) string

RenderTunnelsList renders a list of available Cloudflare tunnels

func (*CloudflareUI) RenderWarning added in v0.1.0

func (ui *CloudflareUI) RenderWarning(message string) string

RenderWarning renders a warning message

type CommonSyncOptions added in v0.1.0

type CommonSyncOptions struct {
	DryRun             bool
	CaddyServerIP      string
	CaddyServerPort    int
	EntryDescription   string
	LegacyDescriptions []string
	Verbose            bool
}

CommonSyncOptions contains common options for unified sync operations

type SyncResult

type SyncResult struct {
	HostnameMap    map[string]string
	ToAdd          []string
	ToUpdate       []string
	ToUpdateDesc   []string
	ToRemove       []string
	ChangesApplied bool
	SyncOverrides  map[string]api.DNSOverride
	OtherOverrides map[string]api.DNSOverride
	ExistingCount  int
}

SyncResult contains the results of the sync operation

func SyncCaddyWithUnbound

func SyncCaddyWithUnbound(
	unboundClient *api.Client,
	options CaddySyncOptions,
) (*SyncResult, error)

SyncCaddyWithUnbound synchronizes DNS entries between Caddy and Unbound

func SyncCloudflareWithUnbound added in v0.1.0

func SyncCloudflareWithUnbound(
	unboundClient *api.Client,
	cfClient *api.CloudflareClient,
	options CloudflareSyncOptions,
) (*SyncResult, error)

SyncCloudflareWithUnbound synchronizes DNS entries between Cloudflare tunnel and Unbound

type SyncUI

type SyncUI struct {
	Styles tui.StyleConfig
}

SyncUI handles the UI rendering for the sync operation

func NewSyncUI

func NewSyncUI() *SyncUI

NewSyncUI creates a new SyncUI with default styles

func (*SyncUI) RenderAddEntries

func (ui *SyncUI) RenderAddEntries(result *SyncResult) string

RenderAddEntries renders the entries to be added

func (*SyncUI) RenderAdguardAddEntries added in v0.1.0

func (ui *SyncUI) RenderAdguardAddEntries(result *AdguardSyncResult) string

RenderAdguardAddEntries renders the AdguardHome rewrites to be added

func (*SyncUI) RenderAdguardChanges added in v0.1.0

func (ui *SyncUI) RenderAdguardChanges(result *AdguardSyncResult, entryDescription string) string

RenderAdguardChanges renders the AdguardHome changes as they are applied

func (*SyncUI) RenderAdguardDryRunOutput added in v0.1.0

func (ui *SyncUI) RenderAdguardDryRunOutput(result *AdguardSyncResult, entryDescription string) string

RenderAdguardDryRunOutput renders the complete AdguardHome dry run output

func (*SyncUI) RenderAdguardRemoveEntries added in v0.1.0

func (ui *SyncUI) RenderAdguardRemoveEntries(result *AdguardSyncResult) string

RenderAdguardRemoveEntries renders the AdguardHome rewrites to be removed

func (*SyncUI) RenderAdguardSummary added in v0.1.0

func (ui *SyncUI) RenderAdguardSummary(result *AdguardSyncResult) string

RenderAdguardSummary renders a summary of the AdguardHome sync operation

func (*SyncUI) RenderAdguardUpdateEntries added in v0.1.0

func (ui *SyncUI) RenderAdguardUpdateEntries(result *AdguardSyncResult) string

RenderAdguardUpdateEntries renders the AdguardHome rewrites to be updated

func (*SyncUI) RenderChanges

func (ui *SyncUI) RenderChanges(result *SyncResult, entryDescription string) string

RenderChanges renders the changes as they are applied

func (*SyncUI) RenderCloudflareChanges added in v0.1.0

func (ui *SyncUI) RenderCloudflareChanges(result *CaddyCloudflareSyncResult, description string) string

RenderCloudflareChanges renders the changes as they are applied

func (*SyncUI) RenderCloudflareDryRunOutput added in v0.1.0

func (ui *SyncUI) RenderCloudflareDryRunOutput(result *CaddyCloudflareSyncResult, description string) string

RenderCloudflareDryRunOutput renders what would happen in dry run mode

func (*SyncUI) RenderCloudflareHeader added in v0.1.0

func (ui *SyncUI) RenderCloudflareHeader(syncDirect, syncCaddy bool) string

RenderCloudflareHeader renders the header for Cloudflare sync operation

func (*SyncUI) RenderCloudflareSummary added in v0.1.0

func (ui *SyncUI) RenderCloudflareSummary(result *CaddyCloudflareSyncResult) string

RenderCloudflareSummary renders the summary of changes for Cloudflare sync

func (*SyncUI) RenderCloudflareSyncTargets added in v0.1.0

func (ui *SyncUI) RenderCloudflareSyncTargets(syncDirect, syncCaddy bool, directSub, caddySub string) string

RenderCloudflareSyncTargets renders the sync targets for Cloudflare operation

func (*SyncUI) RenderDryRun

func (ui *SyncUI) RenderDryRun() string

RenderDryRun renders the dry run banner

func (*SyncUI) RenderDryRunOutput

func (ui *SyncUI) RenderDryRunOutput(result *SyncResult, entryDescription string) string

RenderDryRunOutput renders the complete dry run output

func (*SyncUI) RenderError

func (ui *SyncUI) RenderError(err error) string

RenderError renders an error message

func (*SyncUI) RenderFetchingMessage

func (ui *SyncUI) RenderFetchingMessage(ip string, port int) string

RenderFetchingMessage renders a message indicating that Caddy config is being fetched

func (*SyncUI) RenderHeader

func (ui *SyncUI) RenderHeader() string

RenderHeader renders the header for the sync operation

func (*SyncUI) RenderHostnameCount

func (ui *SyncUI) RenderHostnameCount(count int) string

RenderHostnameCount renders the hostname count

func (*SyncUI) RenderHostnameList

func (ui *SyncUI) RenderHostnameList(hostnames []string) string

RenderHostnameList renders a list of hostnames

func (*SyncUI) RenderRemoveEntries

func (ui *SyncUI) RenderRemoveEntries(result *SyncResult) string

RenderRemoveEntries renders the entries to be removed

func (*SyncUI) RenderSummary

func (ui *SyncUI) RenderSummary(result *SyncResult) string

RenderSummary renders a summary of the sync operation

func (*SyncUI) RenderSyncTargets added in v0.1.0

func (ui *SyncUI) RenderSyncTargets(syncToUnbound, syncToAdguard bool) string

RenderSyncTargets renders information about sync targets

func (*SyncUI) RenderUnifiedChanges added in v0.1.0

func (ui *SyncUI) RenderUnifiedChanges(result *UnifiedSyncResult, entryDescription string) string

RenderUnifiedChanges renders the unified changes as they are applied

func (*SyncUI) RenderUnifiedDryRunOutput added in v0.1.0

func (ui *SyncUI) RenderUnifiedDryRunOutput(result *UnifiedSyncResult, entryDescription string) string

RenderUnifiedDryRunOutput renders the complete unified dry run output

func (*SyncUI) RenderUnifiedHeader added in v0.1.0

func (ui *SyncUI) RenderUnifiedHeader(syncToUnbound, syncToAdguard bool) string

RenderUnifiedHeader renders the header for unified sync operations

func (*SyncUI) RenderUnifiedSummary added in v0.1.0

func (ui *SyncUI) RenderUnifiedSummary(result *UnifiedSyncResult) string

RenderUnifiedSummary renders a summary of changes for both systems

func (*SyncUI) RenderUpdateDescEntries

func (ui *SyncUI) RenderUpdateDescEntries(result *SyncResult, entryDescription string) string

RenderUpdateDescEntries renders the entries to have their descriptions updated

func (*SyncUI) RenderUpdateEntries

func (ui *SyncUI) RenderUpdateEntries(result *SyncResult) string

RenderUpdateEntries renders the entries to be updated

func (*SyncUI) RenderWarning

func (ui *SyncUI) RenderWarning(message string) string

RenderWarning renders a warning message

type UnifiedSyncResult added in v0.1.0

type UnifiedSyncResult struct {
	HostnameMap     map[string]string
	UnboundResult   *SyncResult
	AdguardResult   *AdguardSyncResult
	SyncedToUnbound bool
	SyncedToAdguard bool
	UnboundError    error
	AdguardError    error
}

UnifiedSyncResult contains the results of syncing to both systems

func UnifiedCaddySync added in v0.1.0

func UnifiedCaddySync(
	unboundClient *api.Client,
	adguardClient *api.AdguardClient,
	options CommonSyncOptions,
) (*UnifiedSyncResult, error)

UnifiedCaddySync performs sync to both UnboundDNS and AdguardHome

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL