renew-ip
Version:
A module for renewing 4G/LTE IP addresses on tethered Android phones from Node JS.
89 lines • 2.45 kB
TypeScript
/// <reference types="node" />
import EventEmitter from "events";
import { IpHistory, PartialRouterConfig, RenewableRouter, RouterConfig } from "./types";
/**
* Renewable 4G Router
*
* @class
* @classdesc Renews an IP address on a device connected with Automate.
* @extends {EventEmitter}
* @implements {RenewableRouter}
*/
export declare class Router extends EventEmitter implements RenewableRouter {
/**
* Tracks the successful renewals.
* @type {Set<IpHistory>}
* @protected
*/
protected readonly _history: Set<IpHistory>;
/**
* Tracks the current session renewals.
* Is cleared at the end of each session.
*
* @type {Set<IpHistory>}
* @protected
*/
protected readonly _cache: Set<IpHistory>;
/**
* Defines some basic configuration using env file or passed in object.
* @type {RouterConfig}
* @protected
*/
protected readonly _config: RouterConfig;
/**
* Constructor
* Accepts an optional configuration if not using env file.
*
* @param {PartialRouterConfig} config
*/
constructor(config?: PartialRouterConfig);
/**
* Readonly accessor for current ip address.
*
* @return {string | undefined}
*/
get ip(): string | undefined;
/**
* Readonly accessor to show current renewal attempts.
*
* @return {number}
*/
get attempts(): number;
/**
* Allow users to observe last cached public ip.
*
* @return {string | undefined}
*/
get lastCachedIp(): string | undefined;
/**
* Public readonly accessor for history as array.
*
* @return {IpHistory[]}
*/
get history(): IpHistory[];
/**
* Inform user when a new ip has been obtained or drop if dirty address.
*
* @return {boolean}
*/
validateIp(data: IpHistory | undefined): boolean;
/**
* Return the module to a clean state.
*
* @return {Promise<void>}
*/
init(): Promise<void>;
/**
* Connects to the IPData API and checks the current public ip.
*
* @return {Promise<IpHistory>}
*/
lookup(): Promise<IpHistory>;
/**
* Primary entry point that triggers the renewal.
*
* @return {Promise<boolean>}
*/
renew(): Promise<boolean>;
}
//# sourceMappingURL=router.d.ts.map