function getClientIp (req) {
var ipAddress;
var forwardIpStr = reqheaders['x-forwarded-for'];
if (forwardIpStr) {
var forwardIp = forwardIpStrsplit(',');
ipAddress = forwardIp[0];
}
if (!ipAddress) {
ipAddress = reqconnectionremoteAdress;
}
if (!ipAddress) {
ipAddress = reqsocketremoteAdress;
}
if (!ipAddress) {
if (reqconnectionsocket) {
ipAddress = reqconnectionsocketremoteAdress;
}
else if (reqheaders['remote_addr']) {
ipAddress = reqheaders['remote_addr'];
}
else if (reqheaders['client_ip']) {
ipAddress = reqheaders['client_ip'];
}
else {
ipAddress = reqip;
}
}
return ipAddress;};
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)