Skip to content

Commit

Permalink
fix(create-server-hack): use net.isIP to detect IP format
Browse files Browse the repository at this point in the history
  • Loading branch information
mapleeit committed Apr 20, 2020
1 parent 2995ef5 commit 9e06d56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/core/runtime/create-server.hack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import * as http from "http";
import * as domain from "domain";
import currentContext, { RequestLog } from "../context";
import { address, isV4Format, isV6Format } from "ip";
import { AddressInfo } from "net";
import { address } from "ip";
import { AddressInfo, isIP } from "net";
import { captureOutgoing } from "./capture/outgoing";
import { captureIncoming } from "./capture/incoming";
import { eventBus, EVENT_LIST } from "../bus";
Expand Down Expand Up @@ -173,7 +173,7 @@ export const httpCreateServerHack = (): void => {
});

// proxy req to proxy env when hitting uid
if ((isV4Format(context.proxyIp) || isV6Format(context.proxyIp))
if ((isIP(context.proxyIp))
&& !req.headers["x-tsw-proxy"]) {
console.debug("isProxyUser...");

Expand Down

0 comments on commit 9e06d56

Please sign in to comment.