ip-china-location
Version:
通过 IPv4 地址获取用户的地理位置信息,精确到省。
10 lines (9 loc) • 599 B
TypeScript
import { VercelRequest } from '@vercel/node';
/** 查询指定 IP 的地址(仅支持国内) */
export declare function findIPv4(ip: string, databasePath?: string): string | undefined;
/** 在 Vercel 上查找 IP 的地址(仅支持国内,优先使用 Vercel 定位) */
export declare function findOnVercel(request: VercelRequest, databasePath: string, ip?: string): string | undefined;
/** 将字符串形式的 IPv4 地址转换为整数 */
export declare function ipv4ToLong(ip: string): number;
/** 加载数据库 */
export declare function loadDatabase(databasePath?: string): void;