feat(cloudflare): add DNS pointing integration

Implement Cloudflare connection management, pointing groups and members, asynchronous A-record reconciliation, node IP triggers, admin APIs, management pages, migrations, tests, and documentation.
This commit is contained in:
ryan
2026-08-04 12:32:37 +08:00
parent 99f0f63b99
commit 3edcdb9e9f
47 changed files with 7019 additions and 49 deletions
@@ -11,6 +11,7 @@ import (
"testing"
"time"
cf "github.com/Rain-kl/Wavelet/internal/apps/openflare/cloudflare"
db "github.com/Rain-kl/Wavelet/internal/infra/persistence"
"github.com/Rain-kl/Wavelet/internal/model"
"github.com/Rain-kl/Wavelet/internal/repository"
@@ -130,6 +131,27 @@ func TestUpdateNode(t *testing.T) {
assert.True(t, updated.AutoUpdateEnabled)
}
func TestUpdateNodeDispatchesCloudflareSyncWhenIPChanges(t *testing.T) {
cleanup := setupNodeTestDB(t)
defer cleanup()
ctx := context.Background()
created, err := CreateNode(ctx, Input{Name: "edge-update", IP: "192.0.2.10"})
require.NoError(t, err)
var dispatchedNodeID uint
restore := cf.SetDispatchTaskForTest(func(_ context.Context, taskType string, payload []byte, _ string) (string, error) {
assert.Equal(t, cf.TaskTypeSyncByNode, taskType)
assert.Contains(t, string(payload), `"node_id":`)
dispatchedNodeID = created.ID
return "task-1", nil
})
defer restore()
_, err = UpdateNode(ctx, created.ID, Input{Name: "edge-update", IP: "192.0.2.11"})
require.NoError(t, err)
assert.Equal(t, created.ID, dispatchedNodeID)
}
func TestDeleteNode(t *testing.T) {
cleanup := setupNodeTestDB(t)
defer cleanup()