Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
结合smartsport项目架构使用,接口使用node-consul搭建,在node-consul的基础上封装易于结合smartsport项目使用的接口
install via NPM
$ npm install --save xyj-consul
创建实例:
const Consul = require('xyj-consul');
const consul = new Consul({host: '127.0.0.1', port: 8500}); // default: host-127.0.0.1, port-8500
服务注册:
const opts = {
name: 'example',
tags: ['example'],
address: '127.0.0.1',
servicePort: '10001'
};
consul.register(opts);
服务发现(格式化适用于web层):
consul.listFormat((err, result) => {
if(err) throw err;
console.log(result);
/*
{ example: { host: '127.0.0.1', port: 8500 },
example1: { host: '127.0.0.1', port: 8500 },
example2: { host: '127.0.0.1', port: 8500 } }
*/
})
Registers a new service.
Options
15s
)10s
)60s
)check
above)Usage
consul.register('example', function(err) {
if (err) throw err;
});
Returns the services the agent is managing.
Usage
consul.list(function(err, result) {
if (err) throw err;
});
Result
{
"example": {
"ID": "example",
"Service": "example",
"Tags": [
"dev",
"web"
],
"Port": 80
}
}
返回格式化后适合web服务层使用的列表格式
Usage
consul.listFormat(function(err, result) {
if (err) throw err;
});
Result
{
example: {
host: '127.0.0.1',
port: 8500
},
example1: {
host: '127.0.0.1',
port: 8500
},
example2: {
host: '127.0.0.1',
port: 8500
}
}
直接返回node-consul实例
@MIT
FAQs
smart sport consul service
We found that xyj-consul 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.