Microsoft Office 365 IP intelligence
Problem this snippet solves: This snippet adds Microsoft Office 365 IP intelligence. This snippet parses the O365IPAddresses.xml file that Microsoft supplies to help identify Microsoft URLs and IP a...
Updated Jun 05, 2023
Version 2.0Nov 13, 2018
Nice, so you are testing this code. Thanks for the feedback 🙂
It seems the getJson function needs some extra error handling. This works for me:
// helper to call the webservice
function getJson(methodName, instanceName, clientRequestId, callback) {
var ws = "https://endpoints.office.com";
var requestPath = ws + '/' + methodName + '/' + instanceName + '?clientRequestId=' + clientRequestId;
var req = https.get(requestPath, function(res) {
var data = '';
res.on('data', function(chunk) {
data += chunk;
});
res.on('error', function(e) {
callback(e, null);
});
res.on('timeout', function(e) {
callback(e, null);
});
res.on('end', function() {
if(res.statusCode == 200) {
callback(null, data);
}
});
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
}
Now the error message will be logged, but not throw an error.
Nov 13 14:41:54 nielsvs-bigip info sdmd[7798]: 018e0017:6: pid[5428] plugin[/Common/office365_endpoints_plugin.office365_endpoints_extension] Got error: getaddrinfo EAI_AGAIN endpoints.office.com:443
Nov 13 14:41:54 nielsvs-bigip info sdmd[7798]: 018e0017:6: pid[5428] plugin[/Common/office365_endpoints_plugin.office365_endpoints_extension] Got error: getaddrinfo EAI_AGAIN endpoints.office.com:443
Nov 13 14:41:54 nielsvs-bigip info sdmd[7798]: 018e0017:6: pid[5429] plugin[/Common/office365_endpoints_plugin.office365_endpoints_extension] Got error: getaddrinfo EAI_AGAIN endpoints.office.com:443
Nov 13 14:41:54 nielsvs-bigip info sdmd[7798]: 018e0017:6: pid[5429] plugin[/Common/office365_endpoints_plugin.office365_endpoints_extension] Got error: getaddrinfo EAI_AGAIN endpoints.office.com:443