Skip to content

Commit

Permalink
fix: 同步93的修正ip.isPrivate
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroWolf233 committed Nov 29, 2024
1 parent f82b6e1 commit 3916ca0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ import type {TokenManager} from './token.js'
import type {IFileList} from './types.js'
import {setupUpnp} from './upnp.js'
import {checkSign, hashToFilename} from './util.js'
import pkg from 'ip';
const { isPrivate } = pkg;
import * as ipPkg from 'ip'

interface ICounters {
hits: number
Expand Down Expand Up @@ -138,7 +137,7 @@ export class Cluster {
if (config.enableUpnp) {
await setupUpnp(config.port, config.clusterPublicPort)
const ip = await setupUpnp(config.port, config.clusterPublicPort)
if (isPrivate(ip)) {
if (ipPkg.isPrivate(ip)) {
throw new Error(`不对啊,你这IP(${ip})也不是公网IP啊`)
}
logger.info(`upnp映射成功,公网IP: ${ip}`)
Expand Down

0 comments on commit 3916ca0

Please sign in to comment.