summaryrefslogtreecommitdiff
path: root/tcp-proxy
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-21 15:22:41 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-21 15:22:41 -0700
commit0f7dcb3ef20f408df96307e19442cce2a1f5c6b5 (patch)
treef3a830b655a0ef6ff649e03abf872b885abf2d21 /tcp-proxy
parent61021fc77819a34e6d84031fe8a1dbec954cc8da (diff)
downloadinfinitytier-0f7dcb3ef20f408df96307e19442cce2a1f5c6b5.tar.gz
infinitytier-0f7dcb3ef20f408df96307e19442cce2a1f5c6b5.zip
Add some proxy debugging, and auto-resolve and periodically re-resolve TCP fallback tunnel hostname.
Diffstat (limited to 'tcp-proxy')
-rw-r--r--tcp-proxy/tcp-proxy.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tcp-proxy/tcp-proxy.cpp b/tcp-proxy/tcp-proxy.cpp
index 9e3f5d07..e30981cc 100644
--- a/tcp-proxy/tcp-proxy.cpp
+++ b/tcp-proxy/tcp-proxy.cpp
@@ -45,6 +45,9 @@
#define ZT_TCP_PROXY_UDP_POOL_START_PORT 10000
#define ZT_TCP_PROXY_CONNECTION_TIMEOUT_SECONDS 300
+// Uncomment to print tracing output to stdout
+#define ZT_TCP_PROXY_TRACE
+
using namespace ZeroTier;
/*
@@ -135,6 +138,10 @@ struct TcpProxyService
if (rm != reverseMappings.end()) {
Client &c = *(rm->second);
+#ifdef ZT_TCP_PROXY_TRACE
+ printf("UDP [%u] %s >> %.16llx\n",len,reinterpret_cast<const InetAddress *>(from)->toString().c_str(),(unsigned long long)&c);
+#endif
+
unsigned long mlen = len;
if (c.newVersion)
mlen += 7; // new clients get IP info
@@ -161,6 +168,10 @@ struct TcpProxyService
for(unsigned long i=0;i<len;++i)
c.tcpWriteBuf[c.tcpWritePtr++] = ((const char *)data)[i];
}
+ } else {
+#ifdef ZT_TCP_PROXY_TRACE
+ printf("UDP [%u] %s >> (unknown, discarded)\n",len,reinterpret_cast<const InetAddress *>(from)->toString().c_str());
+#endif
}
}
}
@@ -180,6 +191,10 @@ struct TcpProxyService
c.lastActivity = time((time_t *)0);
c.newVersion = false;
*uptrN = (void *)&c;
+
+#ifdef ZT_TCP_PROXY_TRACE
+ printf("TCP connect from %s -> %.16llx\n",reinterpret_cast<const InetAddress *>(from)->toString().c_str(),(unsigned long long)&c);
+#endif
}
void phyOnTcpClose(PhySocket *sock,void **uptr)