48 changed files with 1730 additions and 1112 deletions
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* ZeroTier One - Network Virtualization Everywhere |
||||
* Copyright (C) 2011-2015 ZeroTier, Inc. |
||||
* |
||||
* This program is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* |
||||
* -- |
||||
* |
||||
* ZeroTier may be used and distributed under the terms of the GPLv3, which |
||||
* are available at: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
* |
||||
* If you would like to embed ZeroTier into a commercial application or |
||||
* redistribute it in a modified binary form, please contact ZeroTier Networks |
||||
* LLC. Start here: http://www.zerotier.com/
|
||||
*/ |
||||
|
||||
#include "Path.hpp" |
||||
#include "AntiRecursion.hpp" |
||||
#include "RuntimeEnvironment.hpp" |
||||
#include "Node.hpp" |
||||
|
||||
namespace ZeroTier { |
||||
|
||||
bool Path::send(const RuntimeEnvironment *RR,const void *data,unsigned int len,uint64_t now) |
||||
{ |
||||
if (RR->node->putPacket(_localAddress,address(),data,len)) { |
||||
sent(now); |
||||
RR->antiRec->logOutgoingZT(data,len); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
} // namespace ZeroTier
|
||||
@ -1,161 +0,0 @@
|
||||
/*
|
||||
* ZeroTier One - Network Virtualization Everywhere |
||||
* Copyright (C) 2011-2015 ZeroTier, Inc. |
||||
* |
||||
* This program is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* |
||||
* -- |
||||
* |
||||
* ZeroTier may be used and distributed under the terms of the GPLv3, which |
||||
* are available at: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
* |
||||
* If you would like to embed ZeroTier into a commercial application or |
||||
* redistribute it in a modified binary form, please contact ZeroTier Networks |
||||
* LLC. Start here: http://www.zerotier.com/
|
||||
*/ |
||||
|
||||
#ifndef ZT_REMOTEPATH_HPP |
||||
#define ZT_REMOTEPATH_HPP |
||||
|
||||
#include <stdint.h> |
||||
#include <string.h> |
||||
|
||||
#include <stdexcept> |
||||
#include <algorithm> |
||||
|
||||
#include "Path.hpp" |
||||
#include "Node.hpp" |
||||
#include "AntiRecursion.hpp" |
||||
#include "RuntimeEnvironment.hpp" |
||||
|
||||
namespace ZeroTier { |
||||
|
||||
/**
|
||||
* Path to a remote peer |
||||
* |
||||
* This extends Path to include status information about path activity. |
||||
*/ |
||||
class RemotePath : public Path |
||||
{ |
||||
public: |
||||
RemotePath() : |
||||
Path(), |
||||
_lastSend(0), |
||||
_lastReceived(0), |
||||
_localAddress(), |
||||
_flags(0) {} |
||||
|
||||
RemotePath(const InetAddress &localAddress,const InetAddress &addr) : |
||||
Path(addr,0,TRUST_NORMAL), |
||||
_lastSend(0), |
||||
_lastReceived(0), |
||||
_localAddress(localAddress), |
||||
_flags(0) {} |
||||
|
||||
inline const InetAddress &localAddress() const throw() { return _localAddress; } |
||||
|
||||
inline uint64_t lastSend() const throw() { return _lastSend; } |
||||
inline uint64_t lastReceived() const throw() { return _lastReceived; } |
||||
|
||||
/**
|
||||
* Called when a packet is sent to this remote path |
||||
* |
||||
* This is called automatically by RemotePath::send(). |
||||
* |
||||
* @param t Time of send |
||||
*/ |
||||
inline void sent(uint64_t t) |
||||
throw() |
||||
{ |
||||
_lastSend = t; |
||||
} |
||||
|
||||
/**
|
||||
* Called when a packet is received from this remote path |
||||
* |
||||
* @param t Time of receive |
||||
*/ |
||||
inline void received(uint64_t t) |
||||
throw() |
||||
{ |
||||
_lastReceived = t; |
||||
} |
||||
|
||||
/**
|
||||
* @param now Current time |
||||
* @return True if this path appears active |
||||
*/ |
||||
inline bool active(uint64_t now) const |
||||
throw() |
||||
{ |
||||
return ((now - _lastReceived) < ZT_PEER_ACTIVITY_TIMEOUT); |
||||
} |
||||
|
||||
/**
|
||||
* Send a packet via this path |
||||
* |
||||
* @param RR Runtime environment |
||||
* @param data Packet data |
||||
* @param len Packet length |
||||
* @param now Current time |
||||
* @return True if transport reported success |
||||
*/ |
||||
inline bool send(const RuntimeEnvironment *RR,const void *data,unsigned int len,uint64_t now) |
||||
{ |
||||
if (RR->node->putPacket(_localAddress,address(),data,len)) { |
||||
sent(now); |
||||
RR->antiRec->logOutgoingZT(data,len); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
template<unsigned int C> |
||||
inline void serialize(Buffer<C> &b) const |
||||
{ |
||||
b.append((uint8_t)1); // version
|
||||
_addr.serialize(b); |
||||
b.append((uint8_t)_trust); |
||||
b.append((uint64_t)_lastSend); |
||||
b.append((uint64_t)_lastReceived); |
||||
_localAddress.serialize(b); |
||||
b.append((uint16_t)_flags); |
||||
} |
||||
|
||||
template<unsigned int C> |
||||
inline unsigned int deserialize(const Buffer<C> &b,unsigned int startAt = 0) |
||||
{ |
||||
unsigned int p = startAt; |
||||
if (b[p++] != 1) |
||||
throw std::invalid_argument("invalid serialized RemotePath"); |
||||
p += _addr.deserialize(b,p); |
||||
_ipScope = _addr.ipScope(); |
||||
_trust = (Path::Trust)b[p++]; |
||||
_lastSend = b.template at<uint64_t>(p); p += 8; |
||||
_lastReceived = b.template at<uint64_t>(p); p += 8; |
||||
p += _localAddress.deserialize(b,p); |
||||
_flags = b.template at<uint16_t>(p); p += 2; |
||||
return (p - startAt); |
||||
} |
||||
|
||||
protected: |
||||
uint64_t _lastSend; |
||||
uint64_t _lastReceived; |
||||
InetAddress _localAddress; |
||||
uint16_t _flags; |
||||
}; |
||||
|
||||
} // namespace ZeroTier
|
||||
|
||||
#endif |
||||
@ -0,0 +1,24 @@
|
||||
FROM centos:latest |
||||
|
||||
MAINTAINER https://www.zerotier.com/ |
||||
|
||||
EXPOSE 9993/udp |
||||
|
||||
ADD nodesource-el.repo /etc/yum.repos.d/nodesource-el.repo |
||||
RUN yum -y update && yum install -y nodejs && yum clean all |
||||
|
||||
RUN mkdir -p /var/lib/zerotier-one |
||||
RUN mkdir -p /var/lib/zerotier-one/networks.d |
||||
RUN touch /var/lib/zerotier-one/networks.d/ffffffffffffffff.conf |
||||
|
||||
ADD package.json / |
||||
RUN npm install |
||||
|
||||
ADD zerotier-one / |
||||
RUN chmod a+x /zerotier-one |
||||
|
||||
ADD agent.js / |
||||
ADD docker-main.sh / |
||||
RUN chmod a+x /docker-main.sh |
||||
|
||||
CMD ["./docker-main.sh"] |
||||
@ -0,0 +1,12 @@
|
||||
HTTP one-to-all test |
||||
====== |
||||
|
||||
*This is really internal use code. You're free to test it out but expect to do some editing/tweaking to make it work. We used this to run some massive scale tests of our new geo-cluster-based root server infrastructure prior to taking it live.* |
||||
|
||||
Before using this code you will want to edit agent.js to change SERVER_HOST to the IP address of where you will run server.js. This should typically be an open Internet IP, since this makes reporting not dependent upon the thing being tested. Also note that this thing does no security of any kind. It's designed for one-off tests run over a short period of time, not to be anything that runs permanently. You will also want to edit the Dockerfile if you want to build containers and change the network ID to the network you want to run tests over. |
||||
|
||||
This code can be deployed across a large number of VMs or containers to test and benchmark HTTP traffic within a virtual network at scale. The agent acts as a server and can query other agents, while the server collects agent data and tells agents about each other. It's designed to use RFC4193-based ZeroTier IPv6 addresses within the cluster, which allows the easy provisioning of a large cluster without IP conflicts. |
||||
|
||||
The Dockerfile builds an image that launches the agent. The image must be "docker run" with "--device=/dev/net/tun --privileged" to permit it to open a tun/tap device within the container. (Unfortunately CAP_NET_ADMIN may not work due to a bug in Docker and/or Linux.) You can run a bunch with a command like: |
||||
|
||||
for ((n=0;n<10;n++)); do docker run --device=/dev/net/tun --privileged -d zerotier/http-test; done |
||||
@ -0,0 +1,277 @@
|
||||
// ZeroTier distributed HTTP test agent
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Customizable parameters:
|
||||
|
||||
// Maximum interval between test attempts
|
||||
var TEST_INTERVAL_MAX = 60000; |
||||
|
||||
// Test timeout in ms
|
||||
var TEST_TIMEOUT = 30000; |
||||
|
||||
// Where should I contact to register and query a list of other test agents?
|
||||
var SERVER_HOST = '104.238.141.145'; |
||||
var SERVER_PORT = 18080; |
||||
|
||||
// Which port should agents use for their HTTP?
|
||||
var AGENT_PORT = 18888; |
||||
|
||||
// Payload size in bytes
|
||||
var PAYLOAD_SIZE = 10000; |
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
var ipaddr = require('ipaddr.js'); |
||||
var os = require('os'); |
||||
var http = require('http'); |
||||
var async = require('async'); |
||||
|
||||
var express = require('express'); |
||||
var app = express(); |
||||
|
||||
// Find our ZeroTier-assigned RFC4193 IPv6 address
|
||||
var thisAgentId = null; |
||||
var interfaces = os.networkInterfaces(); |
||||
if (!interfaces) { |
||||
console.error('FATAL: os.networkInterfaces() failed.'); |
||||
process.exit(1); |
||||
} |
||||
for(var ifname in interfaces) { |
||||
var ifaddrs = interfaces[ifname]; |
||||
if (Array.isArray(ifaddrs)) { |
||||
for(var i=0;i<ifaddrs.length;++i) { |
||||
if (ifaddrs[i].family == 'IPv6') { |
||||
try { |
||||
var ipbytes = ipaddr.parse(ifaddrs[i].address).toByteArray(); |
||||
if ((ipbytes.length === 16)&&(ipbytes[0] == 0xfd)&&(ipbytes[9] == 0x99)&&(ipbytes[10] == 0x93)) { |
||||
thisAgentId = ''; |
||||
for(var j=0;j<16;++j) { |
||||
var tmp = ipbytes[j].toString(16); |
||||
if (tmp.length === 1) |
||||
thisAgentId += '0'; |
||||
thisAgentId += tmp; |
||||
} |
||||
} |
||||
} catch (e) { |
||||
console.error(e); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
if (thisAgentId === null) { |
||||
console.error('FATAL: no ZeroTier-assigned RFC4193 IPv6 addresses found on any local interface!'); |
||||
process.exit(1); |
||||
} |
||||
|
||||
//console.log(thisAgentId);
|
||||
|
||||
// Create a random (and therefore not very compressable) payload
|
||||
var payload = new Buffer(PAYLOAD_SIZE); |
||||
for(var xx=0;xx<PAYLOAD_SIZE;++xx) { |
||||
payload.writeUInt8(Math.round(Math.random() * 255.0),xx); |
||||
} |
||||
|
||||
function agentIdToIp(agentId) |
||||
{ |
||||
var ip = ''; |
||||
ip += agentId.substr(0,4); |
||||
ip += ':'; |
||||
ip += agentId.substr(4,4); |
||||
ip += ':'; |
||||
ip += agentId.substr(8,4); |
||||
ip += ':'; |
||||
ip += agentId.substr(12,4); |
||||
ip += ':'; |
||||
ip += agentId.substr(16,4); |
||||
ip += ':'; |
||||
ip += agentId.substr(20,4); |
||||
ip += ':'; |
||||
ip += agentId.substr(24,4); |
||||
ip += ':'; |
||||
ip += agentId.substr(28,4); |
||||
return ip; |
||||
}; |
||||
|
||||
var lastTestResult = null; |
||||
var allOtherAgents = []; |
||||
|
||||
function doTest() |
||||
{ |
||||
var submit = http.request({ |
||||
host: SERVER_HOST, |
||||
port: SERVER_PORT, |
||||
path: '/'+thisAgentId, |
||||
method: 'POST' |
||||
},function(res) { |
||||
var body = ''; |
||||
res.on('data',function(chunk) { body += chunk.toString(); }); |
||||
res.on('end',function() { |
||||
|
||||
if (body) { |
||||
try { |
||||
var peers = JSON.parse(body); |
||||
if (Array.isArray(peers)) |
||||
allOtherAgents = peers; |
||||
} catch (e) {} |
||||
} |
||||
|
||||
if (allOtherAgents.length > 1) { |
||||
|
||||
var target = allOtherAgents[Math.floor(Math.random() * allOtherAgents.length)]; |
||||
while (target === thisAgentId) |
||||
target = allOtherAgents[Math.floor(Math.random() * allOtherAgents.length)]; |
||||
|
||||
var testRequest = null; |
||||
var timeoutId = null; |
||||
timeoutId = setTimeout(function() { |
||||
if (testRequest !== null) |
||||
testRequest.abort(); |
||||
timeoutId = null; |
||||
},TEST_TIMEOUT); |
||||
var startTime = Date.now(); |
||||
|
||||
testRequest = http.get({ |
||||
host: agentIdToIp(target), |
||||
port: AGENT_PORT, |
||||
path: '/' |
||||
},function(res) { |
||||
var bytes = 0; |
||||
res.on('data',function(chunk) { bytes += chunk.length; }); |
||||
res.on('end',function() { |
||||
lastTestResult = { |
||||
source: thisAgentId, |
||||
target: target, |
||||
time: (Date.now() - startTime), |
||||
bytes: bytes, |
||||
timedOut: (timeoutId === null), |
||||
error: null |
||||
}; |
||||
if (timeoutId !== null) |
||||
clearTimeout(timeoutId); |
||||
return setTimeout(doTest,Math.round(Math.random() * TEST_INTERVAL_MAX) + 1); |
||||
}); |
||||
}).on('error',function(e) { |
||||
lastTestResult = { |
||||
source: thisAgentId, |
||||
target: target, |
||||
time: (Date.now() - startTime), |
||||
bytes: 0, |
||||
timedOut: (timeoutId === null), |
||||
error: e.toString() |
||||
}; |
||||
if (timeoutId !== null) |
||||
clearTimeout(timeoutId); |
||||
return setTimeout(doTest,Math.round(Math.random() * TEST_INTERVAL_MAX) + 1); |
||||
}); |
||||
|
||||
} else { |
||||
return setTimeout(doTest,1000); |
||||
} |
||||
|
||||
}); |
||||
}).on('error',function(e) { |
||||
console.log('POST failed: '+e.toString()); |
||||
return setTimeout(doTest,1000); |
||||
}); |
||||
if (lastTestResult !== null) { |
||||
submit.write(JSON.stringify(lastTestResult)); |
||||
lastTestResult = null; |
||||
} |
||||
submit.end(); |
||||
}; |
||||
|
||||
/* |
||||
function performTestOnAllPeers(peers,callback) |
||||
{ |
||||
var allResults = {}; |
||||
var allRequests = []; |
||||
var timedOut = false; |
||||
var endOfTestTimer = setTimeout(function() { |
||||
timedOut = true; |
||||
for(var x=0;x<allRequests.length;++x) |
||||
allRequests[x].abort(); |
||||
},TEST_DURATION); |
||||
|
||||
async.each(peers,function(peer,next) { |
||||
if (timedOut) |
||||
return next(null); |
||||
if (peer.length !== 32) |
||||
return next(null); |
||||
|
||||
var connectionStartTime = Date.now(); |
||||
allResults[peer] = { |
||||
start: connectionStartTime, |
||||
end: 0, |
||||
error: null, |
||||
timedOut: false, |
||||
bytes: 0 |
||||
}; |
||||
|
||||
allRequests.push(http.get({ |
||||
host: agentIdToIp(peer), |
||||
port: AGENT_PORT, |
||||
path: '/' |
||||
},function(res) { |
||||
var bytes = 0; |
||||
res.on('data',function(chunk) { |
||||
bytes += chunk.length; |
||||
}); |
||||
res.on('end',function() { |
||||
allResults[peer] = { |
||||
start: connectionStartTime, |
||||
end: Date.now(), |
||||
error: null, |
||||
timedOut: timedOut, |
||||
bytes: bytes |
||||
}; |
||||
return next(null); |
||||
}); |
||||
}).on('error',function(e) { |
||||
allResults[peer] = { |
||||
start: connectionStartTime, |
||||
end: Date.now(), |
||||
error: e.toString(), |
||||
timedOut: timedOut, |
||||
bytes: 0 |
||||
}; |
||||
return next(null); |
||||
})); |
||||
},function(err) { |
||||
if (!timedOut) |
||||
clearTimeout(endOfTestTimer); |
||||
return callback(allResults); |
||||
}); |
||||
}; |
||||
|
||||
function doTestsAndReport() |
||||
{ |
||||
registerAndGetPeers(function(err,peers) { |
||||
if (err) { |
||||
console.error('WARNING: skipping test: unable to contact or query server: '+err.toString()); |
||||
} else { |
||||
performTestOnAllPeers(peers,function(results) { |
||||
var submit = http.request({ |
||||
host: SERVER_HOST, |
||||
port: SERVER_PORT, |
||||
path: '/'+thisAgentId, |
||||
method: 'POST' |
||||
},function(res) { |
||||
}).on('error',function(e) { |
||||
console.error('WARNING: unable to submit results to server: '+err.toString()); |
||||
}); |
||||
submit.write(JSON.stringify(results)); |
||||
submit.end(); |
||||
}); |
||||
} |
||||
}); |
||||
}; |
||||
*/ |
||||
|
||||
// Agents just serve up a test payload
|
||||
app.get('/',function(req,res) { return res.status(200).send(payload); }); |
||||
|
||||
var expressServer = app.listen(AGENT_PORT,function () { |
||||
// Start timeout-based loop
|
||||
doTest(); |
||||
}); |
||||
@ -0,0 +1,2 @@
|
||||
root@104.156.246.48 |
||||
root@104.156.252.136 |
||||
@ -0,0 +1,18 @@
|
||||
#!/bin/bash |
||||
|
||||
# Edit as needed -- note that >1000 per host is likely problematic due to Linux kernel limits |
||||
NUM_CONTAINERS=100 |
||||
CONTAINER_IMAGE=zerotier/http-test |
||||
|
||||
# |
||||
# This script is designed to be run on Docker hosts to run NUM_CONTAINERS |
||||
# |
||||
# It can then be run on each Docker host via pssh or similar to run very |
||||
# large scale tests. |
||||
# |
||||
|
||||
export PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:/sbin |
||||
|
||||
pssh -h big-test-hosts -i -t 0 -p 256 "docker ps -aq | xargs -r docker rm -f" |
||||
|
||||
exit 0 |
||||
@ -0,0 +1,30 @@
|
||||
#!/bin/bash |
||||
|
||||
# Edit as needed -- note that >1000 per host is likely problematic due to Linux kernel limits |
||||
NUM_CONTAINERS=100 |
||||
CONTAINER_IMAGE=zerotier/http-test |
||||
|
||||
# |
||||
# This script is designed to be run on Docker hosts to run NUM_CONTAINERS |
||||
# |
||||
# It can then be run on each Docker host via pssh or similar to run very |
||||
# large scale tests. |
||||
# |
||||
|
||||
export PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:/sbin |
||||
|
||||
# Kill and clean up old test containers if any -- note that this kills all containers on the system! |
||||
#docker ps -q | xargs -n 1 docker kill |
||||
#docker ps -aq | xargs -n 1 docker rm |
||||
|
||||
# Pull latest if needed -- change this to your image name and/or where to pull it from |
||||
#docker pull $CONTAINER_IMAGE |
||||
|
||||
# Run NUM_CONTAINERS |
||||
#for ((n=0;n<$NUM_CONTAINERS;n++)); do |
||||
# docker run --device=/dev/net/tun --privileged -d $CONTAINER_IMAGE |
||||
#done |
||||
|
||||
pssh -h big-test-hosts -i -t 0 -p 256 "docker pull $CONTAINER_IMAGE" |
||||
|
||||
exit 0 |
||||
@ -0,0 +1,30 @@
|
||||
#!/bin/bash |
||||
|
||||
# Edit as needed -- note that >1000 per host is likely problematic due to Linux kernel limits |
||||
NUM_CONTAINERS=50 |
||||
CONTAINER_IMAGE=zerotier/http-test |
||||
|
||||
# |
||||
# This script is designed to be run on Docker hosts to run NUM_CONTAINERS |
||||
# |
||||
# It can then be run on each Docker host via pssh or similar to run very |
||||
# large scale tests. |
||||
# |
||||
|
||||
export PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:/sbin |
||||
|
||||
# Kill and clean up old test containers if any -- note that this kills all containers on the system! |
||||
#docker ps -q | xargs -n 1 docker kill |
||||
#docker ps -aq | xargs -n 1 docker rm |
||||
|
||||
# Pull latest if needed -- change this to your image name and/or where to pull it from |
||||
#docker pull $CONTAINER_IMAGE |
||||
|
||||
# Run NUM_CONTAINERS |
||||
#for ((n=0;n<$NUM_CONTAINERS;n++)); do |
||||
# docker run --device=/dev/net/tun --privileged -d $CONTAINER_IMAGE |
||||
#done |
||||
|
||||
pssh -h big-test-hosts -o big-test-out -t 0 -p 256 "for ((n=0;n<$NUM_CONTAINERS;n++)); do docker run --device=/dev/net/tun --privileged -d $CONTAINER_IMAGE; sleep 0.25; done" |
||||
|
||||
exit 0 |
||||
@ -0,0 +1,14 @@
|
||||
#!/bin/bash |
||||
|
||||
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin |
||||
|
||||
/zerotier-one -d >>zerotier-one.out 2>&1 |
||||
|
||||
while [ ! -d "/proc/sys/net/ipv6/conf/zt0" ]; do |
||||
sleep 0.25 |
||||
done |
||||
|
||||
sleep 2 |
||||
|
||||
exec node --harmony /agent.js >>agent.out 2>&1 |
||||
#exec node --harmony /agent.js |
||||
@ -0,0 +1,6 @@
|
||||
[nodesource] |
||||
name=Node.js Packages for Enterprise Linux 7 - $basearch |
||||
baseurl=https://rpm.nodesource.com/pub_4.x/el/7/$basearch |
||||
failovermethod=priority |
||||
enabled=1 |
||||
gpgcheck=0 |
||||
@ -0,0 +1,16 @@
|
||||
{ |
||||
"name": "zerotier-test-http", |
||||
"version": "1.0.0", |
||||
"description": "ZeroTier in-network HTTP test", |
||||
"main": "agent.js", |
||||
"scripts": { |
||||
"test": "echo \"Error: no test specified\" && exit 1" |
||||
}, |
||||
"author": "ZeroTier, Inc.", |
||||
"license": "GPL-3.0", |
||||
"dependencies": { |
||||
"async": "^1.5.0", |
||||
"express": "^4.13.3", |
||||
"ipaddr.js": "^1.0.3" |
||||
} |
||||
} |
||||
@ -0,0 +1,44 @@
|
||||
// ZeroTier distributed HTTP test coordinator and result-reporting server
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Customizable parameters:
|
||||
|
||||
var SERVER_PORT = 18080; |
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
var fs = require('fs'); |
||||
|
||||
var express = require('express'); |
||||
var app = express(); |
||||
|
||||
app.use(function(req,res,next) { |
||||
req.rawBody = ''; |
||||
req.on('data', function(chunk) { req.rawBody += chunk.toString(); }); |
||||
req.on('end', function() { return next(); }); |
||||
}); |
||||
|
||||
var knownAgents = {}; |
||||
|
||||
app.post('/:agentId',function(req,res) { |
||||
var agentId = req.params.agentId; |
||||
if ((!agentId)||(agentId.length !== 32)) |
||||
return res.status(404).send(''); |
||||
|
||||
if (req.rawBody) { |
||||
var receiveTime = Date.now(); |
||||
var resultData = null; |
||||
try { |
||||
resultData = JSON.parse(req.rawBody); |
||||
console.log(resultData.source+','+resultData.target+','+resultData.time+','+resultData.bytes+','+resultData.timedOut+',"'+((resultData.error) ? resultData.error : '')+'"'); |
||||
} catch (e) {} |
||||
} |
||||
|
||||
knownAgents[agentId] = Date.now(); |
||||
return res.status(200).send(JSON.stringify(Object.keys(knownAgents))); |
||||
}); |
||||
|
||||
var expressServer = app.listen(SERVER_PORT,function () { |
||||
console.log('LISTENING ON '+SERVER_PORT); |
||||
console.log(''); |
||||
}); |
||||
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
INFO: generating and signing id==149604618 ts==1445276046447 |
||||
INFO: wrote 257 bytes to stdout |
||||
INFO: generating and signing id==149604618 ts==1445899592846 |
||||
INFO: wrote 582 bytes to stdout |
||||
|
||||
#define ZT_DEFAULT_WORLD_LENGTH 257 |
||||
static const unsigned char ZT_DEFAULT_WORLD[ZT_DEFAULT_WORLD_LENGTH] = {0x01,0x00,0x00,0x00,0x00,0x08,0xea,0xc9,0x0a,0x00,0x00,0x01,0x50,0x81,0x2a,0x54,0x6f,0x72,0xb0,0x3b,0xbe,0x73,0xda,0xbd,0xfb,0x85,0x77,0x9f,0xc9,0x2e,0x17,0xc8,0x11,0x6e,0xda,0x61,0x80,0xd1,0x41,0xcb,0x7c,0x2d,0x2b,0xa4,0x34,0x75,0x19,0x64,0x20,0x80,0x0a,0x22,0x32,0xf2,0x01,0x6c,0xfe,0x79,0xa6,0x7d,0xec,0x10,0x7e,0x03,0xf3,0xa2,0xa0,0x19,0xc8,0x7c,0xfd,0x6c,0x56,0x52,0xa8,0xfb,0xdc,0xfb,0x93,0x81,0x3e,0x63,0x8b,0xb3,0xb6,0x72,0x45,0xa9,0x81,0x81,0xcc,0xea,0x7f,0x2f,0xd9,0x59,0xce,0xc8,0x51,0x12,0xc3,0xe3,0x44,0x76,0x54,0xed,0xe7,0x8d,0x34,0x0b,0x5d,0x10,0x3d,0x52,0x04,0x9b,0xe1,0xb2,0x36,0x51,0x75,0x14,0x30,0x53,0xe8,0x4b,0xe4,0x91,0x9a,0xed,0x99,0x56,0xa3,0x8d,0x5e,0x14,0xff,0x66,0xd8,0x4f,0xf7,0x3c,0x23,0xbe,0x02,0xbb,0x1e,0xb6,0x7e,0x07,0xfa,0x7c,0x7e,0x50,0xe8,0x40,0xf9,0x37,0x70,0x1a,0x75,0xcf,0x19,0xe6,0x83,0xe1,0x5c,0x20,0x1d,0x1e,0x5b,0xe5,0x6a,0xbe,0xe7,0xab,0xec,0x01,0xd6,0xdd,0xca,0x6a,0xb5,0x00,0x4e,0x76,0x12,0x07,0xd8,0xb4,0x20,0x0b,0xe4,0x4f,0x47,0x8e,0x3d,0xa1,0x48,0xc1,0x60,0x99,0x11,0x0e,0xe7,0x1b,0x64,0x58,0x6d,0xda,0x11,0x8e,0x40,0x22,0xab,0x63,0x68,0x2c,0xe1,0x37,0xda,0x8b,0xa8,0x17,0xfc,0x7f,0x73,0xaa,0x31,0x63,0xf2,0xe3,0x33,0x93,0x3e,0x29,0x94,0xc4,0x6b,0x4f,0x41,0x19,0x30,0x7b,0xe8,0x85,0x5a,0x72,0x00,0x01,0x04,0xa9,0x39,0x8f,0x68,0x27,0x09}; |
||||
#define ZT_DEFAULT_WORLD_LENGTH 582 |
||||
static const unsigned char ZT_DEFAULT_WORLD[ZT_DEFAULT_WORLD_LENGTH] = {0x01,0x00,0x00,0x00,0x00,0x08,0xea,0xc9,0x0a,0x00,0x00,0x01,0x50,0xa6,0x54,0xe4,0x8e,0x72,0xb0,0x3b,0xbe,0x73,0xda,0xbd,0xfb,0x85,0x77,0x9f,0xc9,0x2e,0x17,0xc8,0x11,0x6e,0xda,0x61,0x80,0xd1,0x41,0xcb,0x7c,0x2d,0x2b,0xa4,0x34,0x75,0x19,0x64,0x20,0x80,0x0a,0x22,0x32,0xf2,0x01,0x6c,0xfe,0x79,0xa6,0x7d,0xec,0x10,0x7e,0x03,0xf3,0xa2,0xa0,0x19,0xc8,0x7c,0xfd,0x6c,0x56,0x52,0xa8,0xfb,0xdc,0xfb,0x93,0x81,0x3e,0xe4,0xe9,0x51,0xc1,0xe1,0x39,0x50,0xcd,0x17,0x82,0x9d,0x74,0xf1,0xa9,0x5b,0x03,0x14,0x2c,0xa7,0xc0,0x7f,0x21,0x8b,0xad,0xdd,0xa5,0x04,0x26,0x35,0xa6,0xab,0xc1,0x49,0x64,0x2c,0xda,0x65,0x52,0x77,0xf3,0xf0,0x70,0x00,0xcd,0xc3,0xff,0x3b,0x19,0x77,0x4c,0xab,0xb6,0x35,0xbb,0x77,0xcf,0x54,0xe5,0x6d,0x01,0x9d,0x43,0x92,0x0a,0x6d,0x00,0x23,0x8e,0x0a,0x3d,0xba,0x36,0xc3,0xa1,0xa4,0xad,0x13,0x8f,0x46,0xff,0xcc,0x8f,0x9e,0xc2,0x3c,0x06,0xf8,0x3b,0xf3,0xa2,0x5f,0x71,0xcc,0x07,0x35,0x7f,0x02,0xd6,0xdd,0xca,0x6a,0xb5,0x00,0x4e,0x76,0x12,0x07,0xd8,0xb4,0x20,0x0b,0xe4,0x4f,0x47,0x8e,0x3d,0xa1,0x48,0xc1,0x60,0x99,0x11,0x0e,0xe7,0x1b,0x64,0x58,0x6d,0xda,0x11,0x8e,0x40,0x22,0xab,0x63,0x68,0x2c,0xe1,0x37,0xda,0x8b,0xa8,0x17,0xfc,0x7f,0x73,0xaa,0x31,0x63,0xf2,0xe3,0x33,0x93,0x3e,0x29,0x94,0xc4,0x6b,0x4f,0x41,0x19,0x30,0x7b,0xe8,0x85,0x5a,0x72,0x00,0x0a,0x04,0xbc,0xa6,0x5e,0xb1,0x27,0x09,0x06,0x2a,0x03,0xb0,0xc0,0x00,0x02,0x00,0xd0,0x00,0x00,0x00,0x00,0x00,0x7d,0x00,0x01,0x27,0x09,0x04,0x9f,0xcb,0x61,0xab,0x27,0x09,0x06,0x26,0x04,0xa8,0x80,0x08,0x00,0x00,0xa1,0x00,0x00,0x00,0x00,0x00,0x54,0x60,0x01,0x27,0x09,0x04,0xa9,0x39,0x8f,0x68,0x27,0x09,0x06,0x26,0x07,0xf0,0xd0,0x1d,0x01,0x00,0x57,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x27,0x09,0x04,0x68,0xee,0xb6,0x53,0x27,0x09,0x06,0x20,0x01,0x19,0xf0,0xac,0x00,0x08,0x09,0x54,0x00,0x00,0xff,0xfe,0x15,0xf3,0xf4,0x27,0x09,0x04,0x80,0xc7,0xb6,0x09,0x27,0x09,0x06,0x24,0x00,0x61,0x80,0x00,0x00,0x00,0xd0,0x00,0x00,0x00,0x00,0x00,0x1b,0x10,0x01,0x27,0x09,0x16,0xeb,0xbd,0x6c,0x5d,0x00,0x47,0xd3,0x9b,0xca,0x9d,0x0a,0x5c,0xf7,0x01,0x48,0xe3,0x9f,0x6c,0x45,0x19,0x9e,0x17,0xe0,0xe3,0x2e,0x4e,0x46,0xca,0xc0,0x1a,0xe5,0xbc,0xb2,0x12,0x24,0x13,0x7b,0x09,0x7f,0x40,0xbd,0xd9,0x82,0xa9,0x21,0xc3,0xaa,0xbd,0xcb,0x9a,0xda,0x8b,0x4f,0x2b,0xb0,0x59,0x37,0x53,0xbf,0xdb,0x21,0xcf,0x12,0xea,0xc2,0x8c,0x8d,0x90,0x42,0x00,0x0a,0x04,0x2d,0x21,0x04,0x43,0x27,0x09,0x06,0x26,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0xf0,0x3c,0x91,0xff,0xfe,0x67,0xb7,0x04,0x27,0x09,0x04,0x8b,0xa2,0x9d,0xf3,0x27,0x09,0x06,0x2a,0x01,0x7e,0x01,0x00,0x00,0x00,0x00,0xf0,0x3c,0x91,0xff,0xfe,0x67,0x3f,0xfd,0x27,0x09,0x04,0x2d,0x20,0xf6,0xb3,0x27,0x09,0x06,0x20,0x01,0x19,0xf0,0x58,0x00,0x8b,0xf8,0x54,0x00,0x00,0xff,0xfe,0x15,0xb3,0x9a,0x27,0x09,0x04,0x2d,0x20,0xf8,0x57,0x27,0x09,0x06,0x20,0x01,0x19,0xf0,0x70,0x00,0x9b,0xc9,0x54,0x00,0x00,0xff,0xfe,0x15,0xc4,0xf5,0x27,0x09,0x04,0x9f,0xcb,0x02,0x9a,0x27,0x09,0x06,0x26,0x04,0xa8,0x80,0x0c,0xad,0x00,0xd0,0x00,0x00,0x00,0x00,0x00,0x26,0x70,0x01,0x27,0x09}; |
||||
|
||||
Loading…
Reference in new issue