///
///
import Koa from "koa";
import passport from "koa-passport";
import httpServer from "http";
import httpsServer from "https";
import { Server } from "socket.io";
import { EcoServer as IEcoServer } from "@ecoflow/types";
import { StrategyOptionsWithoutRequest } from "passport-jwt";
/**
* Represents an EcoServer that extends Koa and implements EcoServer interface.
* @constructor
* @param {object} options - The options for the EcoServer.
* @param {string} [options.env] - The environment setting.
* @param {string[]} [options.keys] - The keys for the server.
* @param {boolean} [options.proxy] - Indicates if proxy is enabled.
* @param {number} [options.subdomainOffset] - The subdomain offset value.
* @param {string} [options.proxyIpHeader] - The proxy IP header value.
* @param {number} [options.maxIpsCount] - The maximum number of IPs allowed.
*/
export declare class EcoServer extends Koa implements IEcoServer {
private _https;
private _isHttps;
private _host;
private _port;
private _httpCors;
private _server;
private _serverStatus;
/**
* A variable declaration that assigns the passport module to the passport variable.
* @param {typeof passport} passport - The passport module
* @returns The passport module assigned to the passport variable.
*/
passport: typeof passport;
/**
* The Server object representing the system socket.
*/
systemSocket: Server;
/**
* The WebSocket server instance.
*/
socket: Server;
/**
* EcoFlow Server Library interface implementation for HTTP/HTTPS connections and APIs requests.
* @param {object} [options] Application options
* @param {string} [options.env='development'] Environment
* @param {string[]} [options.keys] Signed cookie keys
* @param {boolean} [options.proxy] Trust proxy headers
* @param {number} [options.subdomainOffset] Subdomain offset
* @param {string} [options.proxyIpHeader] Proxy IP header, defaults to X-Forwarded-For
* @param {number} [options.maxIpsCount] Max IPs read from proxy IP header, default to 0 (means infinity)
* @memberof EcoServer
* @returns {EcoServer} instance of EcoServer
*/
constructor(options?: {
env?: string | undefined;
keys?: string[] | undefined;
proxy?: boolean | undefined;
subdomainOffset?: number | undefined;
proxyIpHeader?: string | undefined;
maxIpsCount?: number | undefined;
});
/**
* Processes the configuration settings for the server, setting up HTTPS if enabled,
* configuring the host, port, CORS settings, and creating HTTP and HTTPS servers.
* Also sets up socket connections for system and user sockets.
* @returns None
*/
private processConfig;
/**
* Starts the server and listens on the specified port and host.
* @returns A Promise that resolves to an HTTP or HTTPS server instance.
*/
startServer(): Promise | httpsServer.Server>;
/**
* Asynchronously closes the server.
* @param {boolean} [exit=false] - Whether to exit the process after closing the server.
* @returns {Promise} A Promise that resolves once the server is closed.
*/
closeServer(exit?: boolean): Promise;
/**
* Asynchronously restarts the server process.
* @returns A Promise that resolves when the server has been successfully restarted.
*/
restartServer(): Promise;
/**
* Initializes Passport with the provided options.
* @param {StrategyOptionsWithoutRequest} [options] - The options to configure Passport.
* @returns {Promise} A promise that resolves once Passport has been initialized.
*/
initializePassport(options?: StrategyOptionsWithoutRequest): Promise;
/**
* Returns the base URL constructed from the host, port, and protocol (http or https).
* @returns {string} The base URL formed by combining the protocol, host, and port.
*/
get baseUrl(): string;
/**
* Getter method to check if the connection is secure (HTTPS).
* @returns {boolean} - true if the connection is secure (HTTPS), false otherwise
*/
get isSecure(): boolean;
/**
* Get the current server state, which can be either "Online" or "Offline".
* @returns The current server state.
*/
get serverState(): "Online" | "Offline";
}
//# sourceMappingURL=EcoServer.d.ts.map