mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 23:16:37 +08:00
1.4 KiB
1.4 KiB
Task 2 report — Zone domain and API
Delivered
- Added the
internal/apps/openflare/zonedomain layer. Zone roots and explicit hostnames are normalized withpublicsuffix.EffectiveTLDPlusOne; root creation requires exact eTLD+1 equality and hostnames must belong to the selected Zone. - Wildcards, empty values, protocols, paths, query/fragment/userinfo forms are rejected. A supplied certificate is checked before persistence.
- Added
migrate-zones, an explicit transactional and idempotent importer. It reads route domains throughrouteidentity.DecodeDomains, aligns legacydomain_cert_idsby index, only usesof_managed_domainswhen no route domains exist, and rolls back with all discovered conflicts. - Registered authenticated
/api/v1/d/zoneslist/create,/:id/overview, and/:id/domainscreate endpoints. Retired themanaged-domainsroute block and its Swagger paths, while preserving the legacy model/table and logic for migration compatibility. - Added focused TDD tests for wildcard rejection and PSL handling, plus authenticated integration coverage for Zone/domain creation and the 400 response envelope.
Verification
go test ./internal/apps/openflare/zone ./internal/apps/openflare/integration -count=1make code-checkmake swagger(the generator prints pre-existing octal-constant evaluation warnings; generation succeeds)- Confirmed generated Swagger contains
/zonesand no/managed-domainspaths.