dsh-mobile 0.3.8 → 0.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.mts CHANGED
@@ -187,6 +187,12 @@ declare function parseCidr(source: string): ParsedCidr;
187
187
  declare function addressAllowed(address: string | undefined, cidrs: readonly ParsedCidr[]): boolean;
188
188
  /** Whether an IP literal is loopback and therefore eligible for HTTP-only development. */
189
189
  declare function isLoopbackAddress(address: string): boolean;
190
+ /**
191
+ * Whether a dotted-quad IPv4 literal is globally routable and therefore usable
192
+ * as a public VPS / remote HTTPS endpoint. Rejects documentation addresses such
193
+ * as 203.0.113.10 alongside private, shared, and reserved space.
194
+ */
195
+ declare function isGloballyRoutableIpv4(address: string): boolean;
190
196
  /** Parse a bare host or host:port authority without accepting URL components. */
191
197
  declare function parseAuthority(source: string): AuthoritySpec;
192
198
  /** Resolve an authority against the actual listener port. */
@@ -685,7 +691,15 @@ declare class FrpComponentManager {
685
691
  //#region src/frp-template.d.ts
686
692
  /** Loopback-only HTTP vhost port used between Caddy and frps. */
687
693
  declare const FRP_VHOST_HTTP_PORT = 7080;
688
- /** Build the only supported frps and Caddy configuration from validated user inputs. */
694
+ /** Caddy snippet owned entirely by DSH Mobile; the main Caddyfile only imports it. */
695
+ declare const FRP_CADDY_SNIPPET_PATH = "/etc/caddy/dsh-mobile-dsh.caddy";
696
+ /** First line of the owned snippet; also the legacy whole-file marker. */
697
+ declare const FRP_CADDY_SNIPPET_MARKER = "# Managed by DSH Mobile - snippet, safe to delete";
698
+ /** Exact line the main Caddyfile must contain (uncommented) for the site to load. */
699
+ declare const FRP_CADDY_IMPORT_LINE = "import /etc/caddy/dsh-mobile-dsh.caddy";
700
+ /** Build the Caddy site for one public host (without markers or import wiring). */
701
+ declare function createCaddySite(publicHost: string, certDir?: string): string;
702
+ /** Build the only supported frps config and Caddy snippet from validated user inputs. */
689
703
  declare function createRestrictedFrpServerTemplate(serverPort: number, token: string, publicOrigin: string): string;
690
704
  //#endregion
691
705
  //#region src/frp-config.d.ts
@@ -717,6 +731,18 @@ declare function validateFrpToken(value: unknown): string;
717
731
  declare function validateFrpPublicOrigin(value: unknown): string;
718
732
  /** Parse FRP settings at the loopback request and filesystem boundaries. */
719
733
  declare function parseFrpSettings(value: unknown): FrpSettings;
734
+ /**
735
+ * Merge a partial VPS request body with the saved configuration so a blank
736
+ * field keeps its saved value ("已保存时可留空"). Every merged field is still
737
+ * validated; with nothing saved and nothing supplied the result reports a
738
+ * missing configuration instead of silently deploying blanks.
739
+ */
740
+ declare function mergeSavedFrpSettings(partial: Readonly<Record<string, unknown>>, saved: FrpSettings | undefined): FrpSettings;
741
+ /** Merge a VPS target (address and control port) with the saved configuration. */
742
+ declare function mergeSavedFrpTarget(partial: Readonly<Record<string, unknown>>, saved: FrpSettings | undefined): {
743
+ readonly serverAddress: string;
744
+ readonly serverPort: number;
745
+ };
720
746
  /** Build the single-purpose frpc configuration for the current loopback gateway. */
721
747
  declare function createFrpcToml(settings: FrpSettings, localPort: number): string;
722
748
  /** Build the matching restricted frps and Caddy templates for one VPS. */
@@ -852,5 +878,5 @@ declare const inject: string[];
852
878
  /** Mount the resident control route and its optional authenticated LAN gateway. */
853
879
  declare function apply(ctx: Context, config: PluginConfig): Promise<void>;
854
880
  //#endregion
855
- export { AUTH_PREFIX, AccessController, type AccessControllerOptions, AccessError, type AuthoritySpec, BoundedRateLimiter, CSRF_COOKIE, CSRF_HEADER, Config, FRP_VHOST_HTTP_PORT as DEFAULT_VHOST_HTTP_PORT, FRP_VHOST_HTTP_PORT, DEVICE_COOKIE, type DeviceSnapshot, type DeviceStore, type DeviceSummary, type DisabledTlsConfig, EXTENSION_LIMITS, FRP_COMPONENT_RELEASES, FrpComponentManager, type FrpComponentStatus, FrpConfigStore, type FrpConfigurationStatus, FrpController, type FrpControllerOptions, type FrpSettings, type FrpState, type FrpStatus, JsonDeviceStore, JsonMobileAccessControlStore, JsonRemoteProviderStore, LOCAL_ADMIN_PREFIX, type LocalExtensionManifest, MemoryDeviceStore, type MobileAccessControlState, type MobileAccessControlStore, MobileAccessGateway, MobileAccessGatewayController, type MobileAccessService as MobileAccessRegistry, MobileAccessService, type MobileAccessRuntime, type MobileActionContext, type MobileExtensionClientEntry, type MobileExtensionDefinition, MobileExtensionError, type MobileExtensionManifest, type MobileExtensionStatus, type MobileHostAction, type MobileHostRoute, type MobileRouteRequest, type MobileRouteResponse, type PairingResult, type ParsedCidr, type PluginConfig, type ProvidedTlsConfig, type RemoteProvider, type RemoteProviderController, type RemoteProviderState, type RemoteProviderStatus, type RenewalResult, RequestTrustPolicy, type ResolvedGatewayConfig, SESSION_COOKIE, type SessionAuthorization, type StoredDevice, type TlsConfig, WS_PATHS, addressAllowed, apply, assertExtensionId, configuredRemoteProvider, createFrpServerTemplate, createFrpcToml, createMobileAccessService, createRestrictedFrpServerTemplate, inject, isLoopbackAddress, name, parseAuthority, parseCidr, parseControlFile, parseDeviceSnapshot, parseExtensionManifest, parseFrpSettings, parseGatewayConfig, parseMobileAccessControlState, parseRemoteProviderState, resolveAuthority, rewriteMobileIndex, validateFrpPublicOrigin, validateFrpServerAddress, validateFrpServerPort, validateFrpToken };
881
+ export { AUTH_PREFIX, AccessController, type AccessControllerOptions, AccessError, type AuthoritySpec, BoundedRateLimiter, CSRF_COOKIE, CSRF_HEADER, Config, FRP_VHOST_HTTP_PORT as DEFAULT_VHOST_HTTP_PORT, FRP_VHOST_HTTP_PORT, DEVICE_COOKIE, type DeviceSnapshot, type DeviceStore, type DeviceSummary, type DisabledTlsConfig, EXTENSION_LIMITS, FRP_CADDY_IMPORT_LINE, FRP_CADDY_SNIPPET_MARKER, FRP_CADDY_SNIPPET_PATH, FRP_COMPONENT_RELEASES, FrpComponentManager, type FrpComponentStatus, FrpConfigStore, type FrpConfigurationStatus, FrpController, type FrpControllerOptions, type FrpSettings, type FrpState, type FrpStatus, JsonDeviceStore, JsonMobileAccessControlStore, JsonRemoteProviderStore, LOCAL_ADMIN_PREFIX, type LocalExtensionManifest, MemoryDeviceStore, type MobileAccessControlState, type MobileAccessControlStore, MobileAccessGateway, MobileAccessGatewayController, type MobileAccessService as MobileAccessRegistry, MobileAccessService, type MobileAccessRuntime, type MobileActionContext, type MobileExtensionClientEntry, type MobileExtensionDefinition, MobileExtensionError, type MobileExtensionManifest, type MobileExtensionStatus, type MobileHostAction, type MobileHostRoute, type MobileRouteRequest, type MobileRouteResponse, type PairingResult, type ParsedCidr, type PluginConfig, type ProvidedTlsConfig, type RemoteProvider, type RemoteProviderController, type RemoteProviderState, type RemoteProviderStatus, type RenewalResult, RequestTrustPolicy, type ResolvedGatewayConfig, SESSION_COOKIE, type SessionAuthorization, type StoredDevice, type TlsConfig, WS_PATHS, addressAllowed, apply, assertExtensionId, configuredRemoteProvider, createCaddySite, createFrpServerTemplate, createFrpcToml, createMobileAccessService, createRestrictedFrpServerTemplate, inject, isGloballyRoutableIpv4, isLoopbackAddress, mergeSavedFrpSettings, mergeSavedFrpTarget, name, parseAuthority, parseCidr, parseControlFile, parseDeviceSnapshot, parseExtensionManifest, parseFrpSettings, parseGatewayConfig, parseMobileAccessControlState, parseRemoteProviderState, resolveAuthority, rewriteMobileIndex, validateFrpPublicOrigin, validateFrpServerAddress, validateFrpServerPort, validateFrpToken };
856
882
  //# sourceMappingURL=index.d.mts.map