79 lines
11 KiB
Markdown
79 lines
11 KiB
Markdown
# EasyDNS REST API mapping
|
|
|
|
The native API contract was reviewed against the supplied **EasyDNS Rust 0.1.4** source (`docs/api.md`, `crates/dns-api/src/handlers.rs`, `crates/dns-api/src/lib.rs`). All endpoints in the main table below have the EasyDNS prefix `/api/v1`, except `/readyz`. Panel routes such as `/zones`, `/servers`, `/metrics` and `/configuration` belong to the standalone **Go web UI**, not to the Rust server.
|
|
|
|
## Single-server pages (also available for the selected server in multi-server mode)
|
|
|
|
| Panel screen | Native EasyDNS endpoint | HTTP | JSON fields / request | Supported UI operations and limits |
|
|
|---|---|---|---|---|
|
|
| Overview | `/status`, `/stats`, `/health`, `/audit?n=6` | GET | `version,mode,uptime_seconds,roles,queries_total,responses,cache_hit_rate,blocked,rate_limited,latency_p95_s,status,expired_zones,items` | Read status and true counters; no claimed 24-hour native history or native cluster status |
|
|
| Zones | `/zones?page=&per_page=&name=&kind=` | GET | `items[]:{name,kind,serial,loaded,expired,records,status}`, `pagination:{page,per_page,total}` | Search by supported filters and paginate; no fictional server-side sorting |
|
|
| Create primary zone | `/zones` | POST | `{name,ns[],hostmaster?,transfer_acl[],notify[]}` | Only creates Primary zones; native validation/status errors apply |
|
|
| Create from zone file | `/zones` | POST | `{name,zone_file,transfer_acl[],notify[]}` | Upload the entire zone text as JSON; cannot fetch the existing source file |
|
|
| Zone details | `/zones/{zone}` | GET | `name,kind,serial,loaded,expired,records,status,config,journal_entries,dnssec`, `ETag` | Inspect current zone and configuration; most `config` values are read-only |
|
|
| DNS records | `/zones/{zone}/records?name=&type=&page=&per_page=` | GET | `items[]:{id,name,type,ttl,data}`, `pagination`, `serial`, `ETag` | List and filter; there is no native GET by record ID |
|
|
| Add record | `/zones/{zone}/records` | POST | `{name,type,ttl,data}`, `If-Match` | Primary zones only; SOA is excluded; 412 conflict on stale serial |
|
|
| Edit record | `/zones/{zone}/records/{id}` | PUT | `{name,type,ttl,data}`, `If-Match` | Replace record; ID is found from paginated list; 400/404/409/412/422 possible |
|
|
| Delete record | `/zones/{zone}/records/{id}` | DELETE | ID in path, `If-Match` | Explicit confirmation; cannot delete SOA through record CRUD |
|
|
| Replace zone contents | `/zones/{zone}` | PUT | `{zone_file}`, `If-Match` | Full replacement only, with confirmation; 412 serial conflict, 422 invalid zone text |
|
|
| Delete zone | `/zones/{zone}` | DELETE | Zone identifier in path | Deletes API-created overlay zones; 409 for config-file zones; exact-name confirmation |
|
|
| Transfer history | `/zones/{zone}/transfers` | GET | `items[]:{time_unix,direction,kind,peer,serial,records,ok,error,duration_ms}` | Completed transfer history; **not** a live queue or progress percentage |
|
|
| Secondary synchronization | `/zones/{zone}/sync` | POST | `result,serial` | Refresh an existing Secondary; 409 for the wrong zone type; 502 on transfer errors |
|
|
| DNS NOTIFY | `/zones/{zone}/notify` | POST | `targets` | Request NOTIFY for configured targets; 202 means accepted, not guaranteed delivered |
|
|
| DNSSEC status | `/zones/{zone}` | GET | `dnssec`, `config.dnssec` | Inspect existing status; no key/signing CRUD |
|
|
| DNS lookup | `/query?name=&type=` | GET | `rcode,aa,answers[],authority[],elapsed_ms` | Run a query now; the API has no query log |
|
|
| Upstreams | `/upstreams` | GET | `items[]:{group,strategy,servers[]:{address,stats:{queries,failures,healthy,ewma_rtt_ms,...}}}` | Read resolver groups/health |
|
|
| Add upstream | `/upstreams` | POST | `{address}` | Add to overlay; no update/delete upstream endpoints |
|
|
| Policies | `/policies` | GET | `policy,rate_limit,views,acls,api_allowed_clients,recursion_allowed_clients` | Read effective policy |
|
|
| Writable policy fields | `/policies` | PUT | `{allowlist:[],block_action}` | Only these two fields are writable |
|
|
| Views | `/policies` | GET | `views[]` | Read-only; no Views CRUD |
|
|
| ACL | `/policies` | GET | `acls,recursion_allowed_clients,api_allowed_clients` | Read-only; no ACL CRUD |
|
|
| Rate limiting | `/policies`, `/stats` | GET | `rate_limit,rate_limited` | Read-only configuration and aggregate counter |
|
|
| Blocklists | `/blocklists` | GET | `lists[],loaded[],rules,update_interval,state` | Read feed state/aggregate counts; no per-rule listing |
|
|
| Add block rule | `/blocklists` | POST | `{rule}` | Add a single rule; no edit/delete per-rule |
|
|
| Cache | `/cache` | GET | `entries,capacity,hits,misses,inserts,evictions,expired,stale_served,prefetches` | Counters only; no key browser |
|
|
| Flush cache | `/cache`, `/cache?domain=...` | DELETE | Response `removed` | Full invalidation with confirmation, or targeted invalidation |
|
|
| Metrics | `/stats` | GET | `queries_total,responses,sources,latency_p50_s,latency_p95_s,latency_p99_s,cache,blocked,rate_limited,uptime_seconds` | Real snapshots; Go samples every 15 seconds in RAM |
|
|
| Audit log | `/audit?n=` | GET | `items[]:{time_unix,actor,action,target,result,detail}` | Recent administrative operations; not client DNS query history |
|
|
| Server status | `/status`, `/health`, `/readyz` | GET | `listeners,roles,zones,version,mode,uptime_seconds,expired_zones`; `/readyz` plain response | Five-item status strip, listeners and zone states; no restart/stop |
|
|
| Configuration | `/status`, `/policies` | GET | `mode,version,roles.default_resolution,dnssec_validation,policy.block_action,...` | Selected runtime settings, mostly read-only |
|
|
| Hot reload | `/config/reload` | POST | Native reload result | Reload config from disk, preserving the prior active state if validation fails |
|
|
|
|
## Optional multi-server screens: no new EasyDNS endpoints
|
|
|
|
| Go panel screen/action | Go panel HTTP route | Native REST performed | Operation and boundary |
|
|
|---|---|---|---|
|
|
| Enable/disable multi-server | `POST /configuration/multi-server` | **None** | Save panel-only preference to a private local file; retain remote definitions on disable |
|
|
| Server inventory and topology | `GET /servers` | `GET /api/v1/health` and `GET /api/v1/status` **per managed instance** | Live connectivity, reported mode/version/role counts; panel-supplied labels only |
|
|
| Add managed server | `GET /servers/new`, `POST /servers` | None during registration | Save its URL, panel label and its existing remote generated token in private panel files; API is probed on the inventory screen |
|
|
| Change display role | `POST /servers/{id}/role` | **None** | Update Primary/Secondary/Unassigned label in panel metadata; no DNS server mutation |
|
|
| Remove remote connection | `GET/POST /servers/{id}/remove` | **None** | Remove panel metadata and panel-stored remote token; does not remove DNS server |
|
|
| Select active server | `POST /servers/select` | **None** | Set browser's HttpOnly server-context cookie; subsequent standard pages use that server's native API |
|
|
| Compare zone SOA serials | `GET /servers/compare?zone=...` | `GET /api/v1/zones/{zone}` **per managed instance** | Read-only comparison against panel-labeled Primary; no automatic transfer or failure inference |
|
|
| Selected server's normal pages | All existing Go panel pages | Unchanged native methods from the table above | One server API client per request, never a new or generic API proxy |
|
|
| Sampled charts — Single | `GET /ui/telemetry` | `GET /api/v1/stats` for selected server (Go polling) | Authenticated Go-local JSON for measured per-node history; no new EasyDNS endpoint |
|
|
| Sampled charts — Split | `GET /ui/telemetry?mode=split` | `GET /api/v1/stats` per enabled node (Go polling) | JSON `mode,nodes[]:{id,name,role,samples[],error,lastPoll}`; measured per-node series, no invented data |
|
|
| Sampled charts — Aggregate | `GET /ui/telemetry?mode=aggregate` | Same native `/stats` per node (Go polling) | JSON `nodes[],samples[]:{time,queryRate,noerror,nxdomain,servfail,refused,blocked,cacheHitRate,contributors}`; strict complete rates, weighted cache, no percentile aggregation |
|
|
| Fleet Metrics snapshot | `GET /metrics?mode=…` (aggregate / split / single) | `GET /api/v1/stats` per registered server (concurrent reads) | Aggregate cumulative counters from responding servers only; Split individual stats; Single selected node |
|
|
|
|
The maximum is 15 remote servers plus the local instance. HTTP API transport is restricted to loopback; remote addresses must use verified HTTPS.
|
|
|
|
## Authentication and error handling
|
|
|
|
- **Local TCP EasyDNS:** Rust generates `control.token` automatically under its configured data directory. The Go backend reads that file and sends `Authorization: Bearer <token>`; the token is never exposed in HTML or logs.
|
|
- **Local Unix socket:** Requires OS filesystem access; native EasyDNS may audit the peer's UID/PID; no bearer header is used.
|
|
- **Remote TCP:** Each remote installation has its *own* generated token. An administrator supplies it once when adding the connection; Go stores it with mode `0600`. There is no REST endpoint to fetch or rotate a remote token.
|
|
- **Error responses:** Native envelope `{"error":{"status":412,"message":"..."}}`. Typical statuses include 400 invalid parameters, 401/403 access denied, 404 missing resource, 409 conflict, **412 stale ETag**, **422 invalid zone/RDATA**, 502 secondary transfer failure, and 503 unavailable. UI shows a safe message and preserves form state where possible.
|
|
- **Concurrency:** Current zone serial/ETag is sent using `If-Match` for record editing and full zone replacement.
|
|
- **Native OpenAPI:** `GET /api/v1/openapi.json` exists but is not used to invent UI operations.
|
|
|
|
See [MULTI-SERVER.md](MULTI-SERVER.md) and [API-GAPS.md](API-GAPS.md) for role semantics and unsupported operations.
|
|
|
|
## EasyDNS Web 0.1.2 — time-series presentation
|
|
|
|
The **Go Web panel** continues to poll the existing native EasyDNS `GET /api/v1/stats` endpoint every 15 s. It does **not** scrape `/metrics`, Prometheus or Grafana; it does not depend on new Rust APIs or call the Rust `/api/v1/stats/history` endpoint. Stored measurements live in Go memory for at most 24 h; restarts discard the panel's series.
|
|
|
|
The authenticated panel-only `GET /ui/telemetry?mode=single|split|aggregate&range=15m|1h|6h|12h|24h&step=auto|15s|30s|1m|5m|15m|1h` returns `samples`, `range`, `step`, `stepSeconds`, `from`, `to`, `intervalSeconds` and retention metadata. Fleet modes include `nodes`, and Aggregate includes strict complete-coverage rate buckets. Parameters are whitelisted and bounded. Without an explicit `step`, the legacy response retains raw 15-second data.
|
|
|
|
Downsampling averages observed per-second rates, weights cache hit ratios by actual hit/miss rates, retains the maximum observed per-sample p50/p95/p99 within a bucket (not a recalculated quantile), and preserves gaps or counter resets as `null`. Chart controls in Overview and Metrics request these reduced series. Client-side CSV export contains only currently displayed measured values, not synthetic history. Additional source-rate charts are derived from the native `sources` map (recursive, authoritative, cache and forward); host CPU/memory data are deliberately not invented.
|