import { BaseIdentifierStrategy } from '@solid/community-server'; import type { ResourceIdentifier } from '@solid/community-server'; export interface SubdomainPodIdentifierStrategyOptions { /** 基础域名,如 pods.undefineds.site */ baseDomain: string; } /** * Subdomain Pod Identifier Strategy * * 支持格式: {node-id}.baseDomain/{pod-name}/resource * * 示例: * - https://node1.pods.undefineds.site/alice/data.ttl * - https://node1.pods.undefineds.site/bob/profile/card * * 路径结构: * - /{pod-name}/ 表示一个 Pod 的根容器 * - /{pod-name}/resource 表示 Pod 内的资源 */ export declare class SubdomainPodIdentifierStrategy extends BaseIdentifierStrategy { private readonly logger; private readonly baseDomain; constructor(options: SubdomainPodIdentifierStrategyOptions); /** * 检查 identifier 是否被支持 * * 条件: * 1. hostname 必须匹配 *.baseDomain * 2. 路径必须以 /{pod-name}/ 开头 */ supportsIdentifier(identifier: ResourceIdentifier): boolean; /** * 检查是否是根容器 * * 根容器是 /{pod-name}/ */ isRootContainer(identifier: ResourceIdentifier): boolean; /** * 从 hostname 提取 node-id * node1.pods.undefineds.site -> node1 */ extractNodeId(hostname: string): string | undefined; /** * 从 identifier 提取 Pod 名称 */ extractPodName(identifier: ResourceIdentifier): string | undefined; /** * 从路径提取 Pod 名称 * /alice/data.ttl -> alice * / -> undefined */ private extractPodNameFromPath; /** * 获取 Pod 的根容器 identifier */ getPodRootIdentifier(podName: string, nodeId: string): ResourceIdentifier; /** * 验证 node-id 格式 * 允许: 字母、数字、连字符 * 不允许: 空、点、特殊字符 */ private isValidNodeId; /** * 验证 pod 名称格式 * 允许: 字母、数字、连字符、下划线 */ private isValidPodName; }