![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
tcp-surrogate
Advanced tools
Surrogate is a dynamic TCP proxy implemented in nodejs. Surrogate proxies traffic to an upstream in a round-robin fashion.
npm install tcp-surrogate
To get started, simply require tcp-surrogate
in your program, and instantiate a new Surrogate object. Once instantiated, you are free to spawn new surrogates.
var Surrogate = require("tcp-surrogate");
var surrogate = new Surrogate();
If you want to configure your surrogate, pass in an object with the values you would like to configure during instantiation.
var Surrogate = require("tcp-surrogate");
var surrogate = new Surrogate({
port: 12345
});
The possible configuration values are as follows:
port
- Integer (optional) - Port the surrogate should run on. Defaults to a random port between 1024 and 2048.retries
- Integer (optional) - Number of times to attempt to create the surrogate. Defaults to 3.upstreams
- Array (optional) - List of upstreams in "host:port" format. Defaults to [].self_update
- Function (optional) - Function which will run on interval and populate upstreams. Defaults to undefined.self_update_interval
- Integer (optional) - Interval (in milliseconds) on which to run the self_update
function. Defaults to 60000.To modify upstreams after the surrogate has been spawned, you can use the edit_upstreams
function.
var Surrogate = require("tcp-surrogate");
var surrogate = new Surrogate({
port: 12345,
upstreams: ["myupstream:myport"]
});
surrogate.on("listening", function(){
surrogate.edit_upstreams(["myusptream:myport", "mysecondupstream:mysecondport"]);
});
Alternatively you can rely on the self_update
function to keep upstreams in sync. This function runs on an interval set by self_update_interval
, or can be triggered manually by calling force_population
.
var Surrogate = require("tcp-surrogate");
var surrogate = new Surrogate({
port: 12345,
self_update: function(){
return [Math.random()]
},
self_update_interval: 10000
});
surrogate.on("listening", function(){
surrogate.force_population();
});
To deactivate a surrogate in use, you can use the deactivate
function.
var Surrogate = require("tcp-surrogate");
var surrogate = new Surrogate({
port: 12345,
upstreams: ["myupstream:myport"]
});
surrogate.on("listening", function(){
surrogate.deactivate();
});
surrogate.on("close", function(){
console.log("deactivated!");
});
Surrogate emits two events, listening
and close
. listening
is emitted when the surrogate can start accepting connections. close
is emitted when the surrogate is deactivated, and can no longer accept connections.
var Surrogate = require("tcp-surrogate");
var surrogate = new Surrogate();
surrogate.on("listening", function(){
console.log("accepting connections ...");
});
surrogate.on("close", function(){
console.log("... no longer accepting connections");
});
FAQs
Dynamic TCP proxy
The npm package tcp-surrogate receives a total of 0 weekly downloads. As such, tcp-surrogate popularity was classified as not popular.
We found that tcp-surrogate demonstrated a not healthy version release cadence and project activity because the last version was released 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.