
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Listens to the specified port and forwards to the specified port.(监听指定的端口,并转发到指定端口。)
简体中文 | English
A lightweight port proxy tool that can forward traffic from one port to another, supporting TCP and UDP protocols, and can limit the transmission rate.
Install dependencies
npm i port-proxy
import { PortProxy } from 'port-proxy'
// Create a TCP port proxy instance
const proxy = new PortProxy({
// Source, new proxy service
source: '127.0.0.1',
sourcePort: 3001,
// Target, original service being proxied
target: '127.0.0.1',
targetPort: 3000,
// Whether to output detailed logs
verbose: false,
// Protocol type: 'tcp' or 'udp'
protocol: 'tcp',
// Single TCP service rate limit, unit B/s, rate limit has 5% fluctuation for each TCP connection
limiteRate: 400 * 1024
})
// Start the proxy service
await proxy.start()
// Check if the proxy is running
const isRunning = proxy.isRunning()
// Get proxy status
const status = proxy.getStatus()
// Get active connection count
const connectionCount = proxy.getConnectionCount()
// Stop the proxy service
await proxy.stop()
PortProxy Classnew PortProxy(options: ProxyOptions)
options: Object type, required, configuration options object
Properties of options are as follows:
source: string type, required
Listening address.
sourcePort: number type, required
Listening port.
target: string type, required
Target address.
targetPort: number type, required
Target port.
verbose: boolean type, optional
Whether to output detailed logs, default is false.
protocol: 'tcp' | 'udp' type, optional
Protocol to use, default is 'tcp'.
limiteRate: number type, optional
Single TCP service rate limit, unit B/s, rate limit has 5% fluctuation for each TCP connection. Default is 0 (no limit).
start() Promise<void>Start the port forwarding proxy.
stop() Promise<void>Stop the port forwarding proxy.
getStatus() ObjectGet the proxy status.
Return value:
{
listening: boolean, // Whether it is listening
connections: number, // Current number of connections
config: ProxyOptions // Current configuration
}
isRunning() booleanCheck if the proxy is running.
getConnectionCount() numberGet the number of active connections.
This library can also be used as a command line tool. After installing the package globally, you can use it directly:
npm install -g port-proxy
portproxy --source 127.0.0.1 --source-port 3001 --target 127.0.0.1 --target-port 3000 --verbose --protocol tcp --limite-rate 409600
Or use it in your project:
npx port-proxy --source 127.0.0.1 --source-port 3001 --target 127.0.0.1 --target-port 3000
--source <IP>: Listening address--source-port <port>: Listening port--target <IP>: Target address--target-port <port>: Target port--protocol <protocol>: Protocol (default: tcp)--verbose: Detailed output mode--limite-rate <rate>: Single TCP service rate limit, unit B/s, default is 0 (no limit)--help: Display help informationportproxy --source 192.168.196.2 --source-port 14491 --target 127.0.0.1 --target-port 14490
Enjoying this project? Show your support by giving it a star! ⭐
Your stars help the project gain visibility and encourage further development.
FAQs
Listens to the specified port and forwards to the specified port.(监听指定的端口,并转发到指定端口。)
We found that port-proxy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.