/** * DDNS Repository * * 管理 Cloud 已分配的 DDNS 记录。 * * 根域名、DNS provider 和 zone 等属于 Cloud 部署配置,不在控制面表中 * 再维护一份域名池,避免配置事实和数据库事实分叉。 */ import type { IdentityDatabase } from './db'; export interface DdnsRecord { subdomain: string; domain: string; ipAddress?: string; ipv6Address?: string; recordType: 'A' | 'AAAA' | 'CNAME'; nodeId?: string; username?: string; status: 'active' | 'banned'; bannedReason?: string; ttl: number; createdAt: Date; updatedAt: Date; } export interface CreateDdnsRecordInput { subdomain: string; domain: string; ipAddress?: string; ipv6Address?: string; recordType?: 'A' | 'AAAA' | 'CNAME'; nodeId?: string; username?: string; } export interface UpdateDdnsRecordInput { ipAddress?: string | null; ipv6Address?: string | null; recordType?: 'A' | 'AAAA' | 'CNAME'; } export declare class DdnsRepository { private readonly db; private readonly schema; private readonly ready; constructor(db: IdentityDatabase); /** * 分配子域名 */ allocateSubdomain(input: CreateDdnsRecordInput): Promise; /** * 获取 DDNS 记录 */ getRecord(subdomain: string): Promise; /** * 更新 DDNS 记录的 IP 地址 */ updateRecordIp(subdomain: string, input: UpdateDdnsRecordInput): Promise; /** * 封禁子域名 */ banSubdomain(subdomain: string, reason: string): Promise; /** * 解封子域名 */ unbanSubdomain(subdomain: string): Promise; /** * 释放子域名 */ releaseSubdomain(subdomain: string): Promise; /** * 获取用户的所有子域名 */ getRecordsByUsername(username: string): Promise; /** * 获取节点的子域名 */ getRecordByNodeId(nodeId: string): Promise; }