![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@nohost/router
Advanced tools
Readme
以下需要使用最新版的 nohost:https://github.com/nohosts/nohost
nohost 集群部署时,用来分发请求到各个节点的路由器。
npm i --save @nohost/router
const Router = require('@nohost/router');
const {
SPACE_NAME,
GROUP_NAME,
ENV_NAME,
NOHOST_RULE,
NOHOST_VALUE,
CLIENT_ID,
CLIENT_ID_FILTER,
writeHead,
writeError,
} = Router;
// 初始化传人部署的 nohost 服务器列表
const router = new Router([
{
host: '10.11.12.13',
port: 8080
},
...
]);
// 更新服务器列表
// 支持http、websocket、tunnel
try {
const svrRes = await router.proxy(req, res);
writeHead(res, svrRes);
svrRes.pipe(res);
} catch (err) {
writeError(res, err);
}
// 查看抓包请求
router.proxyUI(req, res);
router.update([
{
host: '10.11.12.13',
port: 8080
},
{
host: '10.31.32.33',
port: 8080
},
...
]);
router 每 12s 会检测一遍所有服务,并剔除不可用的
const getOptions = (req) => {
const { headers } = req;
const spaceName = 'imweb';
let gruopName;
let envName;
if (headers.host === 'km.oa2.com') {
gruopName = 'avenwu';
envName = '测试'; // 可选
} else if (req.headers.host !== 'km.oa.com') {
gruopName = 'avenwu2';
envName = '测试2'; // 可选
}
return {
rules: 'file://{test.html} km.oa2.com www.test2.com',
values: { 'test.html': 'hell world.' },
spaceName,
gruopName,
envName,
callback: console.log, // 可选
// clientId: 'test', // 如果从外网转发过来的带登录态请求,设置下 clientId 方便插件当前用户的请求抓包
};
};
router.proxy(req, res, getOptions(req));
// 或自己处理响应
// const svrRes = await router.proxy(req);
router.proxyUI(req, res, getOptions(req));
const Router = require('@nohost/router');
const router = new Router({
host: '10.x.x.x',
port: 8080,
});
router.proxy(req, res); // 同测试用例,无需设置 space / group,env 按需设置
router.proxyUI(req, res); // 同测试用例,无需设置 space / group,env 按需设置
具体实现参考:测试用例
FAQs
Nohost cluster router
We found that @nohost/router 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.