![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
tcp-balance
Advanced tools
A simple TCP load balancer.
一个简单的TCP负载均衡器。
$ npm install -g tcp-balance
$ tcp-balance [-b [host:]port] [-a single|robin|random|weighted] host:port[%weight] [host:port[%weight]...]
-b, --bind
Bind to the specified address and port. Default: 127.0.0.1:8080.
绑定到指定的地址和端口。默认:127.0.0.1:8080。
-a, --algorithm
Load balancing algorithm. Algorithms: single, robin, random, weighted. Default: robin.
负载均衡算法。可选值:single, robin, random, weighted。默认:robin。
host:port[%weight]
Upstream server address and port. Weight is a optional numeric leading with percentage sign. If not specified, the default weight is 100. It's only effective when algorithm is weighted.
上游服务的地址和端口。权重是一个可选的数值,以百分号开头。如果未指定,默认权重为100。仅在weighted算法下有效。
Single. Load balance to the first available server only. For example: Failover.
Single. 只负载到第一个可用的服务器。例如:故障转移。
$ tcp-balance -b 0.0.0.0:1883 -a single s1.example.com:1883 s2.example.com:1883
Weighted round robin. For example: HTTP load balancing.
权重轮询。例如:HTTP负载均衡。
$ tcp-balance -b 0.0.0.0:80 -a weighted s1.example.com:80%30 s2.example.com:80%70
Install tcp-balance as npm dependency.
安装tcp-balance为npm依赖。
$ npm i tcp-balance
Import and use it.
引入并使用。
// Import tcp-balance components
// 导入tcp-balance组件
import { Agent } from 'tcp-balance/bin/agent';
import { SingleBalancer } from 'tcp-balance/bin/balancer';
import { Logger } from 'tcp-balance/bin/logger';
// Optional, using console for log output.
// 可选的,使用console输出日志。
Logger.setChannel(console);
// Create a balancer and register upstream servers.
// 创建一个负载均衡器并注册上游服务器。
const balancer = new SingleBalancer();
balancer.putUpstream('s1.example.com', 80);
balancer.putUpstream('s2.example.com', 80);
// Create an agent and start it.
// 创建一个代理并启动。
const agent = new Agent(balancer);
agent.start(0.0.0.0, 80);
$ npm i -g typescript
$ git clone https://github.com/iwares/tcp-balance.git
$ cd tcp-balance
$ npm i
$ npm run build
MIT
FAQs
A server that provides load balancing function for TCP connections.
The npm package tcp-balance receives a total of 2 weekly downloads. As such, tcp-balance popularity was classified as not popular.
We found that tcp-balance demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.