mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
* K8S: dont send OPTIONS pings * fix missing ref * k8s pre-stop hook added * k8s pre-stop hook changes * chmod +x utility * more k8s pre-stop changes * pre stop * fix healthcheck * k8s pre-stop working * add readiness probe * fix bug in pre-stop * logging * revamp k8s pre-stop a bit * initial support for cognigy bot * more cognigy changes * switch to use transcribe for cognigy * #54 include callInfo in dialogflow event payload
17 lines
502 B
JavaScript
17 lines
502 B
JavaScript
const CIDRMatcher = require('cidr-matcher');
|
|
const cidrs = process.env.JAMBONES_NETWORK_CIDR
|
|
.split(',')
|
|
.map((s) => s.trim());
|
|
const matcher = new CIDRMatcher(cidrs);
|
|
|
|
module.exports = (sbcList) => {
|
|
const obj = sbcList
|
|
.split(',')
|
|
.map((str) => {
|
|
const arr = /^(.*)\/(.*):(\d+)$/.exec(str);
|
|
return {protocol: arr[1], host: arr[2], port: arr[3]};
|
|
})
|
|
.find((obj) => 'udp' == obj.protocol && matcher.contains(obj.host));
|
|
if (obj) return `${obj.host}:${obj.port}`;
|
|
};
|