Clean up reverse connection ability, remove some annoyingly redundent code.

Place all settings in the console. It works!
This commit is contained in:
sponge
2010-01-14 05:45:01 +00:00
parent 865116b3f4
commit 11249657ac
13 changed files with 294 additions and 67 deletions

View File

@ -236,6 +236,8 @@ public class I2PTunnel implements Logging, EventDispatcher {
runServer(args, l); runServer(args, l);
} else if ("httpserver".equals(cmdname)) { } else if ("httpserver".equals(cmdname)) {
runHttpServer(args, l); runHttpServer(args, l);
} else if ("httpbidirserver".equals(cmdname)) {
runHttpBidirServer(args, l);
} else if ("ircserver".equals(cmdname)) { } else if ("ircserver".equals(cmdname)) {
runIrcServer(args, l); runIrcServer(args, l);
} else if ("textserver".equals(cmdname)) { } else if ("textserver".equals(cmdname)) {
@ -300,6 +302,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
l.log("ping <args>"); l.log("ping <args>");
l.log("server <host> <port> <privkeyfile>"); l.log("server <host> <port> <privkeyfile>");
l.log("httpserver <host> <port> <spoofedhost> <privkeyfile>"); l.log("httpserver <host> <port> <spoofedhost> <privkeyfile>");
l.log("httpbidirserver <host> <port> <proxyport> <spoofedhost> <privkeyfile>");
l.log("textserver <host> <port> <privkey>"); l.log("textserver <host> <port> <privkey>");
l.log("genkeys <privkeyfile> [<pubkeyfile>]"); l.log("genkeys <privkeyfile> [<pubkeyfile>]");
l.log("gentextkeys"); l.log("gentextkeys");
@ -503,6 +506,80 @@ public class I2PTunnel implements Logging, EventDispatcher {
} }
} }
/**
* Run the HTTP server pointing at the host and port specified using the private i2p
* destination loaded from the specified file, replacing the HTTP headers
* so that the Host: specified is the one spoofed. Also runs an HTTP proxy for
* bidirectional communications on the same tunnel destination.<p />
*
* Sets the event "serverTaskId" = Integer(taskId) after the tunnel has been started (or -1 on error)
* Also sets the event "openServerResult" = "ok" or "error" (displaying "Ready!" on the logger after
* 'ok'). So, success = serverTaskId != -1 and openServerResult = ok.
*
* @param args {hostname, portNumber, proxyPortNumber, spoofedHost, privKeyFilename}
* @param l logger to receive events and output
*/
public void runHttpBidirServer(String args[], Logging l) {
if (args.length == 5) {
InetAddress serverHost = null;
int portNum = -1;
int port2Num = -1;
File privKeyFile = null;
try {
serverHost = InetAddress.getByName(args[0]);
} catch (UnknownHostException uhe) {
l.log("unknown host");
_log.error(getPrefix() + "Error resolving " + args[0], uhe);
notifyEvent("serverTaskId", Integer.valueOf(-1));
return;
}
try {
portNum = Integer.parseInt(args[1]);
} catch (NumberFormatException nfe) {
l.log("invalid port");
_log.error(getPrefix() + "Port specified is not valid: " + args[1], nfe);
notifyEvent("serverTaskId", Integer.valueOf(-1));
return;
}
try {
port2Num = Integer.parseInt(args[2]);
} catch (NumberFormatException nfe) {
l.log("invalid port");
_log.error(getPrefix() + "Port specified is not valid: " + args[2], nfe);
notifyEvent("serverTaskId", Integer.valueOf(-1));
return;
}
String spoofedHost = args[3];
privKeyFile = new File(args[4]);
if (!privKeyFile.isAbsolute())
privKeyFile = new File(_context.getConfigDir(), args[4]);
if (!privKeyFile.canRead()) {
l.log("private key file does not exist");
_log.error(getPrefix() + "Private key file does not exist or is not readable: " + args[4]);
notifyEvent("serverTaskId", Integer.valueOf(-1));
return;
}
I2PTunnelHTTPBidirServer serv = new I2PTunnelHTTPBidirServer(serverHost, portNum, port2Num, privKeyFile, args[3], spoofedHost, l, (EventDispatcher) this, this);
serv.setReadTimeout(readTimeout);
serv.startRunning();
addtask(serv);
notifyEvent("serverTaskId", Integer.valueOf(serv.getId()));
return;
} else {
l.log("httpserver <host> <port> <proxyport> <spoofedhost> <privkeyfile>");
l.log(" creates a bidirectional HTTP server that sends all incoming data\n"
+ " of its destination to host:port., filtering the HTTP\n"
+ " headers so it looks like the request is to the spoofed host,"
+ " and listens to host:proxyport to proxy HTTP requests.");
notifyEvent("serverTaskId", Integer.valueOf(-1));
}
}
/** /**
* Run the server pointing at the host and port specified using the private i2p * Run the server pointing at the host and port specified using the private i2p
* destination loaded from the given base64 stream. <p /> * destination loaded from the given base64 stream. <p />

View File

@ -93,12 +93,12 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
// true if we are chained from a server. // true if we are chained from a server.
private boolean chained = false; private boolean chained = false;
public I2PTunnelClientBase(int localPort, Logging l, I2PSocketManager MGR, public I2PTunnelClientBase(int localPort, Logging l, I2PSocketManager SktMgr,
I2PTunnel tunnel, EventDispatcher notifyThis, long clientId ) I2PTunnel tunnel, EventDispatcher notifyThis, long clientId )
throws IllegalArgumentException { throws IllegalArgumentException {
super(localPort + " (uninitialized)", notifyThis, tunnel); super(localPort + " (uninitialized)", notifyThis, tunnel);
chained = true; chained = true;
sockMgr = MGR; sockMgr = SktMgr;
_clientId = clientId; _clientId = clientId;
this.localPort = localPort; this.localPort = localPort;
this.l = l; this.l = l;

View File

@ -0,0 +1,54 @@
/**
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* Version 2, December 2004
*
* Copyright (C) sponge
* Planet Earth
* Everyone is permitted to copy and distribute verbatim or modified
* copies of this license document, and changing it is allowed as long
* as the name is changed.
*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
* TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
*
* 0. You just DO WHAT THE FUCK YOU WANT TO.
*
* See...
*
* http://sam.zoy.org/wtfpl/
* and
* http://en.wikipedia.org/wiki/WTFPL
*
* ...for any additional details and liscense questions.
*/
package net.i2p.i2ptunnel;
import java.util.ArrayList;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.util.EventDispatcher;
/**
* Reuse HTTP server's I2PSocketManager for a proxy with no outproxy capability.
*
* @author sponge
*/
public class I2PTunnelHTTPBidirProxy extends I2PTunnelHTTPClient implements Runnable {
/**
* @throws IllegalArgumentException if the I2PTunnel does not contain
* valid config to contact the router
*/
public I2PTunnelHTTPBidirProxy(int localPort, Logging l, I2PSocketManager sockMgr, I2PTunnel tunnel, EventDispatcher notifyThis, long clientId) {
super(localPort, l, sockMgr, tunnel, notifyThis, clientId);
proxyList = new ArrayList();
setName(getLocalPort() + " -> HTTPClient [NO PROXIES]");
startRunning();
notifyEvent("openHTTPClientResult", "ok");
}
}

View File

@ -0,0 +1,44 @@
/* I2PTunnel is GPL'ed (with the exception mentioned in I2PTunnel.java)
* (c) 2003 - 2004 mihi
*/
package net.i2p.i2ptunnel;
import java.io.File;
import java.io.InputStream;
import java.net.InetAddress;
import net.i2p.util.EventDispatcher;
import net.i2p.util.Log;
public class I2PTunnelHTTPBidirServer extends I2PTunnelHTTPServer {
private final static Log log = new Log(I2PTunnelHTTPBidirServer.class);
public I2PTunnelHTTPBidirServer(InetAddress host, int port, int proxyport, String privData, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) {
super(host, port, privData, spoofHost, l, notifyThis, tunnel);
I2PTunnelHTTPBidirServerSet(tunnel, l, proxyport);
}
public I2PTunnelHTTPBidirServer(InetAddress host, int port, int proxyport, File privkey, String privkeyname, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) {
super(host, port, privkey, privkeyname, spoofHost, l, notifyThis, tunnel);
I2PTunnelHTTPBidirServerSet(tunnel, l, proxyport);
}
public I2PTunnelHTTPBidirServer(InetAddress host, int port, int proxyport, InputStream privData, String privkeyname, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) {
super(host, port, privData, privkeyname, spoofHost, l, notifyThis, tunnel);
I2PTunnelHTTPBidirServerSet(tunnel, l, proxyport);
}
private void I2PTunnelHTTPBidirServerSet(I2PTunnel tunnel, Logging l, int proxyport) {
localPort = proxyport;
bidir = true;
/* start the httpclient */
task = new I2PTunnelHTTPBidirProxy(localPort, l, sockMgr, getTunnel(), getEventDispatcher(), __serverId);
sockMgr.setName("Server"); // TO-DO: Need to change this to "Bidir"!
getTunnel().addSession(sockMgr.getSession());
l.log("Ready!");
notifyEvent("openServerResult", "ok");
}
}

View File

@ -57,7 +57,7 @@ import net.i2p.util.Translate;
public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable { public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable {
private static final Log _log = new Log(I2PTunnelHTTPClient.class); private static final Log _log = new Log(I2PTunnelHTTPClient.class);
private final List proxyList; protected List proxyList;
private HashMap addressHelpers = new HashMap(); private HashMap addressHelpers = new HashMap();

View File

@ -39,21 +39,21 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
public I2PTunnelHTTPServer(InetAddress host, int port, String privData, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) { public I2PTunnelHTTPServer(InetAddress host, int port, String privData, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) {
super(host, port, privData, l, notifyThis, tunnel); super(host, port, privData, l, notifyThis, tunnel);
_spoofHost = spoofHost; I2PTunnelHTTPServerSet(spoofHost);
getTunnel().getContext().statManager().createRateStat("i2ptunnel.httpserver.blockingHandleTime", "how long the blocking handle takes to complete", "I2PTunnel", new long[] { 60*1000, 10*60*1000, 3*60*60*1000 });
getTunnel().getContext().statManager().createRateStat("i2ptunnel.httpNullWorkaround", "How often an http server works around a streaming lib or i2ptunnel bug", "I2PTunnel", new long[] { 60*1000, 10*60*1000 });
} }
public I2PTunnelHTTPServer(InetAddress host, int port, File privkey, String privkeyname, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) { public I2PTunnelHTTPServer(InetAddress host, int port, File privkey, String privkeyname, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) {
super(host, port, privkey, privkeyname, l, notifyThis, tunnel); super(host, port, privkey, privkeyname, l, notifyThis, tunnel);
_spoofHost = spoofHost; I2PTunnelHTTPServerSet(spoofHost);
getTunnel().getContext().statManager().createRateStat("i2ptunnel.httpserver.blockingHandleTime", "how long the blocking handle takes to complete", "I2PTunnel.HTTPServer", new long[] { 60*1000, 10*60*1000, 3*60*60*1000 });
getTunnel().getContext().statManager().createRateStat("i2ptunnel.httpNullWorkaround", "How often an http server works around a streaming lib or i2ptunnel bug", "I2PTunnel.HTTPServer", new long[] { 60*1000, 10*60*1000 });
} }
public I2PTunnelHTTPServer(InetAddress host, int port, InputStream privData, String privkeyname, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) { public I2PTunnelHTTPServer(InetAddress host, int port, InputStream privData, String privkeyname, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) {
super(host, port, privData, privkeyname, l, notifyThis, tunnel); super(host, port, privData, privkeyname, l, notifyThis, tunnel);
_spoofHost = spoofHost; I2PTunnelHTTPServerSet(spoofHost);
}
private void I2PTunnelHTTPServerSet(String spoofHost) {
_spoofHost = spoofHost;
getTunnel().getContext().statManager().createRateStat("i2ptunnel.httpserver.blockingHandleTime", "how long the blocking handle takes to complete", "I2PTunnel.HTTPServer", new long[] { 60*1000, 10*60*1000, 3*60*60*1000 }); getTunnel().getContext().statManager().createRateStat("i2ptunnel.httpserver.blockingHandleTime", "how long the blocking handle takes to complete", "I2PTunnel.HTTPServer", new long[] { 60*1000, 10*60*1000, 3*60*60*1000 });
getTunnel().getContext().statManager().createRateStat("i2ptunnel.httpNullWorkaround", "How often an http server works around a streaming lib or i2ptunnel bug", "I2PTunnel.HTTPServer", new long[] { 60*1000, 10*60*1000 }); getTunnel().getContext().statManager().createRateStat("i2ptunnel.httpNullWorkaround", "How often an http server works around a streaming lib or i2ptunnel bug", "I2PTunnel.HTTPServer", new long[] { 60*1000, 10*60*1000 });
} }

View File

@ -48,47 +48,29 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
protected long readTimeout = DEFAULT_READ_TIMEOUT; protected long readTimeout = DEFAULT_READ_TIMEOUT;
private static final boolean DEFAULT_USE_POOL = false; private static final boolean DEFAULT_USE_POOL = false;
protected static volatile long __serverId = 0;
private static final String PROP_HANDLER_COUNT = "i2ptunnel.blockingHandlerCount";
private static final int DEFAULT_HANDLER_COUNT = 10;
private I2PTunnelTask task = null;
private boolean bidir = false;
private int localPort = 4445;
private int DEFAULT_LOCALPORT = 4445;
protected I2PTunnelTask task = null;
protected boolean bidir = false;
private int DEFAULT_LOCALPORT = 4488;
protected int localPort = DEFAULT_LOCALPORT;
public I2PTunnelServer(InetAddress host, int port, String privData, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) { public I2PTunnelServer(InetAddress host, int port, String privData, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) {
super(host + ":" + port + " <- " + privData, notifyThis, tunnel); super(host + ":" + port + " <- " + privData, notifyThis, tunnel);
ByteArrayInputStream bais = new ByteArrayInputStream(Base64.decode(privData)); ByteArrayInputStream bais = new ByteArrayInputStream(Base64.decode(privData));
String usePool = tunnel.getClientOptions().getProperty("i2ptunnel.usePool"); SetUsePool(tunnel);
if (usePool != null)
_usePool = "true".equalsIgnoreCase(usePool);
else
_usePool = DEFAULT_USE_POOL;
String biDir = tunnel.getClientOptions().getProperty("i2ptunnel.bidir");
if (biDir != null) {
bidir = "true".equalsIgnoreCase(biDir);
String lp = tunnel.getClientOptions().getProperty("i2ptunnel.bidir.port");
if (lp != null)
localPort = Integer.parseInt(lp);
else
localPort = DEFAULT_LOCALPORT;
} else
bidir = false;
init(host, port, bais, privData, l); init(host, port, bais, privData, l);
} }
public I2PTunnelServer(InetAddress host, int port, File privkey, String privkeyname, Logging l, public I2PTunnelServer(InetAddress host, int port, File privkey, String privkeyname, Logging l,
EventDispatcher notifyThis, I2PTunnel tunnel) { EventDispatcher notifyThis, I2PTunnel tunnel) {
super(host + ":" + port + " <- " + privkeyname, notifyThis, tunnel); super(host + ":" + port + " <- " + privkeyname, notifyThis, tunnel);
String usePool = tunnel.getClientOptions().getProperty("i2ptunnel.usePool"); SetUsePool(tunnel);
if (usePool != null)
_usePool = "true".equalsIgnoreCase(usePool);
else
_usePool = DEFAULT_USE_POOL;
String biDir = tunnel.getClientOptions().getProperty("i2ptunnel.bidir");
if (biDir != null)
bidir = "true".equalsIgnoreCase(biDir);
else
bidir = false;
FileInputStream fis = null; FileInputStream fis = null;
try { try {
fis = new FileInputStream(privkey); fis = new FileInputStream(privkey);
@ -104,20 +86,18 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
public I2PTunnelServer(InetAddress host, int port, InputStream privData, String privkeyname, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) { public I2PTunnelServer(InetAddress host, int port, InputStream privData, String privkeyname, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel) {
super(host + ":" + port + " <- " + privkeyname, notifyThis, tunnel); super(host + ":" + port + " <- " + privkeyname, notifyThis, tunnel);
String usePool = tunnel.getClientOptions().getProperty("i2ptunnel.usePool"); SetUsePool(tunnel);
if (usePool != null)
_usePool = "true".equalsIgnoreCase(usePool);
else
_usePool = DEFAULT_USE_POOL;
String biDir = tunnel.getClientOptions().getProperty("i2ptunnel.bidir");
if (biDir != null)
bidir = "true".equalsIgnoreCase(biDir);
else
bidir = false;
init(host, port, privData, privkeyname, l); init(host, port, privData, privkeyname, l);
} }
private void SetUsePool(I2PTunnel Tunnel) {
String usePool = Tunnel.getClientOptions().getProperty("i2ptunnel.usePool");
if (usePool != null)
_usePool = "true".equalsIgnoreCase(usePool);
else
_usePool = DEFAULT_USE_POOL;
}
private void init(InetAddress host, int port, InputStream privData, String privkeyname, Logging l) { private void init(InetAddress host, int port, InputStream privData, String privkeyname, Logging l) {
this.l = l; this.l = l;
this.remoteHost = host; this.remoteHost = host;
@ -144,10 +124,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {} try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
} }
} }
if(bidir == true) {
/* start the httpclient */
task = new I2PTunnelHTTPClient(localPort, l, sockMgr, getTunnel(), getEventDispatcher(), __serverId);
}
sockMgr.setName("Server"); sockMgr.setName("Server");
getTunnel().addSession(sockMgr.getSession()); getTunnel().addSession(sockMgr.getSession());
l.log("Ready!"); l.log("Ready!");
@ -156,8 +133,6 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
} }
private static volatile long __serverId = 0;
/** /**
* Start running the I2PTunnelServer. * Start running the I2PTunnelServer.
* *
@ -215,9 +190,6 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
} }
} }
private static final String PROP_HANDLER_COUNT = "i2ptunnel.blockingHandlerCount";
private static final int DEFAULT_HANDLER_COUNT = 10;
protected int getHandlerCount() { protected int getHandlerCount() {
int rv = DEFAULT_HANDLER_COUNT; int rv = DEFAULT_HANDLER_COUNT;
String cnt = getTunnel().getClientOptions().getProperty(PROP_HANDLER_COUNT); String cnt = getTunnel().getClientOptions().getProperty(PROP_HANDLER_COUNT);

View File

@ -154,6 +154,8 @@ public class TunnelController implements Logging {
startServer(); startServer();
} else if ("httpserver".equals(type)) { } else if ("httpserver".equals(type)) {
startHttpServer(); startHttpServer();
} else if ("httpbidirserver".equals(type)) {
startHttpBidirServer();
} else if ("ircserver".equals(type)) { } else if ("ircserver".equals(type)) {
startIrcServer(); startIrcServer();
} else if ("streamrserver".equals(type)) { } else if ("streamrserver".equals(type)) {
@ -294,6 +296,16 @@ public class TunnelController implements Logging {
_tunnel.runHttpServer(new String[] { targetHost, targetPort, spoofedHost, privKeyFile }, this); _tunnel.runHttpServer(new String[] { targetHost, targetPort, spoofedHost, privKeyFile }, this);
} }
private void startHttpBidirServer() {
setListenOn();
String targetHost = getTargetHost();
String targetPort = getTargetPort();
String listenPort = getListenPort();
String spoofedHost = getSpoofedHost();
String privKeyFile = getPrivKeyFile();
_tunnel.runHttpBidirServer(new String[] { targetHost, targetPort, listenPort, spoofedHost, privKeyFile }, this);
}
private void startIrcServer() { private void startIrcServer() {
String targetHost = getTargetHost(); String targetHost = getTargetHost();
String targetPort = getTargetPort(); String targetPort = getTargetPort();

View File

@ -389,6 +389,7 @@ public class IndexBean {
else if ("ircserver".equals(internalType)) return _("IRC server"); else if ("ircserver".equals(internalType)) return _("IRC server");
else if ("streamrclient".equals(internalType)) return _("Streamr client"); else if ("streamrclient".equals(internalType)) return _("Streamr client");
else if ("streamrserver".equals(internalType)) return _("Streamr server"); else if ("streamrserver".equals(internalType)) return _("Streamr server");
else if ("httpbidirserver".equals(internalType)) return _("HTTP bidir");
else return internalType; else return internalType;
} }
@ -779,8 +780,11 @@ public class IndexBean {
config.setProperty("listenPort", _port); config.setProperty("listenPort", _port);
if (_reachableByOther != null) if (_reachableByOther != null)
config.setProperty("interface", _reachableByOther); config.setProperty("interface", _reachableByOther);
else else if (_reachableBy != null)
config.setProperty("interface", _reachableBy); config.setProperty("interface", _reachableBy);
else
config.setProperty("interface", "");
config.setProperty("sharedClient", _sharedClient + ""); config.setProperty("sharedClient", _sharedClient + "");
for (String p : _booleanClientOpts) for (String p : _booleanClientOpts)
config.setProperty("option." + p, "" + _booleanOptions.contains(p)); config.setProperty("option." + p, "" + _booleanOptions.contains(p));
@ -806,11 +810,22 @@ public class IndexBean {
} else if ("ircclient".equals(_type) || "client".equals(_type) || "streamrclient".equals(_type)) { } else if ("ircclient".equals(_type) || "client".equals(_type) || "streamrclient".equals(_type)) {
if (_targetDestination != null) if (_targetDestination != null)
config.setProperty("targetDestination", _targetDestination); config.setProperty("targetDestination", _targetDestination);
} else if ("httpserver".equals(_type)) { } else if ("httpserver".equals(_type) || "httpbidirserver".equals(_type)) {
if (_spoofedHost != null) if (_spoofedHost != null)
config.setProperty("spoofedHost", _spoofedHost); config.setProperty("spoofedHost", _spoofedHost);
} }
if ("httpbidirserver".equals(_type)) {
if (_port != null)
config.setProperty("listenPort", _port);
if (_reachableByOther != null)
config.setProperty("interface", _reachableByOther);
else if (_reachableBy != null)
config.setProperty("interface", _reachableBy);
else if (_targetHost != null)
config.setProperty("interface", _targetHost);
else
config.setProperty("interface", "");
}
return config; return config;
} }

View File

@ -113,11 +113,58 @@
<input type="text" size="6" maxlength="5" id="targetPort" name="targetPort" title="Target Port Number" value="<%=editBean.getTargetPort(curTunnel)%>" class="freetext" /> <input type="text" size="6" maxlength="5" id="targetPort" name="targetPort" title="Target Port Number" value="<%=editBean.getTargetPort(curTunnel)%>" class="freetext" />
</div> </div>
<% if ("httpbidirserver".equals(tunnelType)) {
%>
<div class="subdivider">
<hr />
</div>
<div id="accessField" class="rowItem">
<label><%=intl._("Access Point")%>:</label>
</div>
<div id="portField" class="rowItem">
<label for="port" accesskey="P">
<span class="accessKey">P</span>ort:
<% String value4 = editBean.getClientPort(curTunnel);
if (value4 == null || "".equals(value4.trim())) {
out.write(" <font color=\"red\">(");
out.write(intl._("required"));
out.write(")</font>");
}
%>
</label>
<input type="text" size="6" maxlength="5" id="port" name="port" title="Access Port Number" value="<%=editBean.getClientPort(curTunnel)%>" class="freetext" />
</div>
<% String otherInterface = "";
String clientInterface = editBean.getClientInterface(curTunnel);
%>
<div id="reachField" class="rowItem">
<label for="reachableBy" accesskey="r">
<%=intl._("Reachable by")%>(<span class="accessKey">R</span>):
</label>
<select id="reachableBy" name="reachableBy" title="Valid IP for Client Access" class="selectbox">
<% if (!("127.0.0.1".equals(clientInterface)) &&
!("0.0.0.0".equals(clientInterface)) &&
(clientInterface != null) &&
(clientInterface.trim().length() > 0)) {
otherInterface = clientInterface;
}
%><option value="127.0.0.1"<%=("127.0.0.1".equals(clientInterface) ? " selected=\"selected\"" : "")%>><%=intl._("Locally (127.0.0.1)")%></option>
<option value="0.0.0.0"<%=("0.0.0.0".equals(clientInterface) ? " selected=\"selected\"" : "")%>><%=intl._("Everyone (0.0.0.0)")%></option>
<option value="other"<%=(!("".equals(otherInterface)) ? " selected=\"selected\"" : "")%>><%=intl._("LAN Hosts (Please specify your LAN address)")%></option>
</select>
</div>
<div id="otherField" class="rowItem">
<label for="reachableByOther" accesskey="O">
<%=intl._("Other")%>(<span class="accessKey">O</span>):
</label>
<input type="text" size="20" id="reachableByOther" name="reachableByOther" title="Alternative IP for Client Access" value="<%=otherInterface%>" class="freetext" />
</div>
<% } %>
<div class="subdivider"> <div class="subdivider">
<hr /> <hr />
</div> </div>
<% if ("httpserver".equals(tunnelType)) { <% if (("httpserver".equals(tunnelType)) || ("httpbidirserver".equals(tunnelType))) {
%><div id="websiteField" class="rowItem"> %><div id="websiteField" class="rowItem">
<label for="spoofedHost" accesskey="W"> <label for="spoofedHost" accesskey="W">
<%=intl._("Website name")%>(<span class="accessKey">W</span>): <%=intl._("Website name")%>(<span class="accessKey">W</span>):
@ -129,8 +176,8 @@
%><div id="privKeyField" class="rowItem"> %><div id="privKeyField" class="rowItem">
<label for="privKeyFile" accesskey="k"> <label for="privKeyFile" accesskey="k">
<%=intl._("Private key file")%>(<span class="accessKey">k</span>): <%=intl._("Private key file")%>(<span class="accessKey">k</span>):
<% String value2 = editBean.getPrivateKeyFile(curTunnel); <% String value3 = editBean.getPrivateKeyFile(curTunnel);
if (value2 == null || "".equals(value2.trim())) { if (value3 == null || "".equals(value3.trim())) {
out.write(" <font color=\"red\">("); out.write(" <font color=\"red\">(");
out.write(intl._("required")); out.write(intl._("required"));
out.write(")</font>"); out.write(")</font>");
@ -139,6 +186,7 @@
</label> </label>
<input type="text" size="30" id="privKeyFile" name="privKeyFile" title="Path to Private Key File" value="<%=editBean.getPrivateKeyFile(curTunnel)%>" class="freetext" /> <input type="text" size="30" id="privKeyFile" name="privKeyFile" title="Path to Private Key File" value="<%=editBean.getPrivateKeyFile(curTunnel)%>" class="freetext" />
</div> </div>
<% if (!"streamrserver".equals(tunnelType)) { %> <% if (!"streamrserver".equals(tunnelType)) { %>
<div id="profileField" class="rowItem"> <div id="profileField" class="rowItem">
<label for="profile" accesskey="f"> <label for="profile" accesskey="f">

View File

@ -107,9 +107,9 @@
</div> </div>
<div class="targetField rowItem"> <div class="targetField rowItem">
<% <%
if ("httpserver".equals(indexBean.getInternalType(curServer)) && indexBean.getTunnelStatus(curServer) == IndexBean.RUNNING) { if (("httpserver".equals(indexBean.getInternalType(curServer)) || ("httpbidirserver".equals(indexBean.getInternalType(curServer)))) && indexBean.getTunnelStatus(curServer) == IndexBean.RUNNING) {
%><label><%=intl._("Preview")%>:</label> %><label><%=intl._("Preview")%>:</label>
<a class="control" title="Test HTTP server through I2P" href="http://<%=indexBean.getDestHashBase32(curServer)%>.b32.i2p"><%=intl._("Preview")%></a> <a class="control" title="Test HTTP server through I2P" href="http://<%=indexBean.getDestHashBase32(curServer)%>.b32.i2p"><%=intl._("Preview")%></a>
<% <%
} else if (indexBean.getTunnelStatus(curServer) == IndexBean.RUNNING) { } else if (indexBean.getTunnelStatus(curServer) == IndexBean.RUNNING) {
%><span class="text"><%=intl._("Base32 Address")%>:<br /><%=indexBean.getDestHashBase32(curServer)%>.b32.i2p</span> %><span class="text"><%=intl._("Base32 Address")%>:<br /><%=indexBean.getDestHashBase32(curServer)%>.b32.i2p</span>
@ -164,6 +164,7 @@
<select name="type"> <select name="type">
<option value="server"><%=intl._("Standard")%></option> <option value="server"><%=intl._("Standard")%></option>
<option value="httpserver">HTTP</option> <option value="httpserver">HTTP</option>
<option value="httpbidirserver">HTTP bidir</option>
<option value="ircserver">IRC</option> <option value="ircserver">IRC</option>
<option value="streamrserver">Streamr</option> <option value="streamrserver">Streamr</option>
</select> </select>

View File

@ -1,3 +1,7 @@
2010-01-14 sponge
* Clean up reverse connection ability, remove some annoyingly redundent
code. Place all settings in the console. It works!
2010-01-10 sponge 2010-01-10 sponge
* Insert reverse connection ability into the http server code so that * Insert reverse connection ability into the http server code so that
seedless can start to get worked on. It's disabled by default. seedless can start to get worked on. It's disabled by default.

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 0; public final static long BUILD = 1;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";