forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p' (head e606c473eb1e461a477e45419f6295b6430a7353)
to branch 'i2p.i2p.zzz.test2' (head 6212892778308db10a86e58f9f275c838f604973)
This commit is contained in:
@@ -182,6 +182,10 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
||||
if (getTunnel() != tunnel)
|
||||
return;
|
||||
setupPostThrottle();
|
||||
Properties props = tunnel.getClientOptions();
|
||||
// see TunnelController.setSessionOptions()
|
||||
String spoofHost = props.getProperty(TunnelController.PROP_SPOOFED_HOST);
|
||||
_spoofHost = (spoofHost != null && spoofHost.trim().length() > 0) ? spoofHost.trim() : null;
|
||||
super.optionsUpdated(tunnel);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -50,8 +51,8 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
protected final Object slock = new Object();
|
||||
protected final Object sslLock = new Object();
|
||||
|
||||
protected final InetAddress remoteHost;
|
||||
protected final int remotePort;
|
||||
protected InetAddress remoteHost;
|
||||
protected int remotePort;
|
||||
private final boolean _usePool;
|
||||
protected final Logging l;
|
||||
private I2PSSLSocketFactory _sslFactory;
|
||||
@@ -265,6 +266,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
* Copy input stream to a byte array, so we can retry
|
||||
* @since 0.7.10
|
||||
*/
|
||||
/****
|
||||
private static ByteArrayInputStream copyOfInputStream(InputStream is) throws IOException {
|
||||
byte[] buf = new byte[128];
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream(768);
|
||||
@@ -279,6 +281,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
}
|
||||
return new ByteArrayInputStream(os.toByteArray());
|
||||
}
|
||||
****/
|
||||
|
||||
/**
|
||||
* Start running the I2PTunnelServer.
|
||||
@@ -348,6 +351,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
|
||||
/**
|
||||
* Update the I2PSocketManager.
|
||||
* And since 0.9.15, the target host and port.
|
||||
*
|
||||
* @since 0.9.1
|
||||
*/
|
||||
@@ -357,6 +361,27 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
return;
|
||||
Properties props = tunnel.getClientOptions();
|
||||
sockMgr.setDefaultOptions(sockMgr.buildOptions(props));
|
||||
// see TunnelController.setSessionOptions()
|
||||
String h = props.getProperty(TunnelController.PROP_TARGET_HOST);
|
||||
if (h != null) {
|
||||
try {
|
||||
remoteHost = InetAddress.getByName(h);
|
||||
} catch (UnknownHostException uhe) {
|
||||
l.log("Unknown host: " + h);
|
||||
}
|
||||
}
|
||||
String p = props.getProperty(TunnelController.PROP_TARGET_PORT);
|
||||
if (p != null) {
|
||||
try {
|
||||
int port = Integer.parseInt(p);
|
||||
if (port > 0 && port <= 65535)
|
||||
remotePort = port;
|
||||
else
|
||||
l.log("Bad port: " + port);
|
||||
} catch (NumberFormatException nfe) {
|
||||
l.log("Bad port: " + p);
|
||||
}
|
||||
}
|
||||
buildSocketMap(props);
|
||||
}
|
||||
|
||||
|
||||
@@ -487,6 +487,17 @@ public class TunnelController implements Logging {
|
||||
String proxies = getProxyList();
|
||||
if (proxies != null)
|
||||
opts.setProperty(PROP_PROXIES, proxies);
|
||||
// Ditto spoof host. Since 0.9.15.
|
||||
String spoofhost = getSpoofedHost();
|
||||
if (spoofhost != null)
|
||||
opts.setProperty(PROP_SPOOFED_HOST, spoofhost);
|
||||
// Ditto target host/port. Since 0.9.15.
|
||||
String targethost = getTargetHost();
|
||||
if (targethost != null)
|
||||
opts.setProperty(PROP_TARGET_HOST, targethost);
|
||||
String targetport = getTargetPort();
|
||||
if (targetport != null)
|
||||
opts.setProperty(PROP_TARGET_PORT, targetport);
|
||||
_tunnel.setClientOptions(opts);
|
||||
}
|
||||
|
||||
|
||||
@@ -258,6 +258,7 @@ public class IndexBean {
|
||||
// give the messages a chance to make it to the window
|
||||
try { Thread.sleep(1000); } catch (InterruptedException ie) {}
|
||||
// and give them something to look at in any case
|
||||
// FIXME name will be HTML escaped twice
|
||||
return _("Starting tunnel") + ' ' + getTunnelName(_tunnel) + "...";
|
||||
}
|
||||
|
||||
@@ -271,6 +272,7 @@ public class IndexBean {
|
||||
// give the messages a chance to make it to the window
|
||||
try { Thread.sleep(1000); } catch (InterruptedException ie) {}
|
||||
// and give them something to look at in any case
|
||||
// FIXME name will be HTML escaped twice
|
||||
return _("Stopping tunnel") + ' ' + getTunnelName(_tunnel) + "...";
|
||||
}
|
||||
|
||||
@@ -352,6 +354,7 @@ public class IndexBean {
|
||||
List<String> msgs = doSave();
|
||||
if (ksMsg != null)
|
||||
msgs.add(ksMsg);
|
||||
// FIXME name will be HTML escaped twice
|
||||
return getMessages(msgs);
|
||||
}
|
||||
|
||||
@@ -402,7 +405,8 @@ public class IndexBean {
|
||||
name = Long.toString(_context.clock().now());
|
||||
}
|
||||
}
|
||||
name = "i2ptunnel-deleted-" + name.replace(' ', '_') + '-' + _context.clock().now() + "-privkeys.dat";
|
||||
name = name.replace(' ', '_').replace(':', '_').replace("..", "_").replace('/', '_').replace('\\', '_');
|
||||
name = "i2ptunnel-deleted-" + name + '-' + _context.clock().now() + "-privkeys.dat";
|
||||
File backupDir = new SecureFile(_context.getConfigDir(), TunnelController.KEY_BACKUP_DIR);
|
||||
File to;
|
||||
if (backupDir.isDirectory() || backupDir.mkdir())
|
||||
@@ -451,13 +455,11 @@ public class IndexBean {
|
||||
}
|
||||
|
||||
public boolean allowCSS() {
|
||||
String css = _context.getProperty(PROP_CSS_DISABLED);
|
||||
return (css == null);
|
||||
return !_context.getBooleanProperty(PROP_CSS_DISABLED);
|
||||
}
|
||||
|
||||
public boolean allowJS() {
|
||||
String js = _context.getProperty(PROP_JS_DISABLED);
|
||||
return (js == null);
|
||||
return !_context.getBooleanProperty(PROP_JS_DISABLED);
|
||||
}
|
||||
|
||||
public int getTunnelCount() {
|
||||
@@ -727,8 +729,9 @@ public class IndexBean {
|
||||
_name = (name != null ? name.trim() : null);
|
||||
}
|
||||
/** one line description */
|
||||
public void setDescription(String description) {
|
||||
_description = (description != null ? description.trim() : null);
|
||||
public void setNofilter_description(String description) {
|
||||
// '#' will blow up DataHelper.storeProps()
|
||||
_description = (description != null ? description.replace('#', ' ').trim() : null);
|
||||
}
|
||||
/** I2CP host the router is on, ignored when in router context */
|
||||
public void setClientHost(String host) {
|
||||
|
||||
@@ -79,7 +79,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
<label for="description" accesskey="e">
|
||||
<%=intl._("Description")%>:(<span class="accessKey">E</span>)
|
||||
</label>
|
||||
<input type="text" size="60" maxlength="80" name="description" id="description" title="Tunnel Description" value="<%=editBean.getTunnelDescription(curTunnel)%>" class="freetext" />
|
||||
<input type="text" size="60" maxlength="80" name="nofilter_description" id="description" title="Tunnel Description" value="<%=editBean.getTunnelDescription(curTunnel)%>" class="freetext" />
|
||||
</div>
|
||||
|
||||
<div class="subdivider">
|
||||
@@ -341,6 +341,23 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
<div class="subdivider">
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div id="optionsField" class="rowItem">
|
||||
<label for="reduce" accesskey="c">
|
||||
<%=intl._("Delay tunnel open until required")%>(<span class="accessKey">D</span>):
|
||||
</label>
|
||||
</div>
|
||||
<div id="portField" class="rowItem">
|
||||
<label for="access" accesskey="c">
|
||||
<%=intl._("Enable")%>:
|
||||
</label>
|
||||
<input value="1" type="checkbox" id="startOnLoad" name="delayOpen" title="Delay Tunnel Open"<%=(editBean.getDelayOpen(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% } // !streamrclient %>
|
||||
|
||||
<div class="subdivider">
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div id="optionsField" class="rowItem">
|
||||
<label for="reduce" accesskey="d">
|
||||
@@ -405,23 +422,6 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<div id="optionsField" class="rowItem">
|
||||
<label for="reduce" accesskey="c">
|
||||
<%=intl._("Delay tunnel open until required")%>(<span class="accessKey">D</span>):
|
||||
</label>
|
||||
</div>
|
||||
<div id="portField" class="rowItem">
|
||||
<label for="access" accesskey="c">
|
||||
<%=intl._("Enable")%>:
|
||||
</label>
|
||||
<input value="1" type="checkbox" id="startOnLoad" name="delayOpen" title="Delay Tunnel Open"<%=(editBean.getDelayOpen(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
</div>
|
||||
<% } // !streamrclient %>
|
||||
|
||||
<div class="subdivider">
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
<% if ("client".equals(tunnelType) || "ircclient".equals(tunnelType) || "socksirctunnel".equals(tunnelType) || "sockstunnel".equals(tunnelType)) { %>
|
||||
<div id="optionsField" class="rowItem">
|
||||
<label for="privKeyFile" accesskey="k">
|
||||
|
||||
@@ -79,7 +79,7 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
|
||||
<label for="description" accesskey="e">
|
||||
<%=intl._("Description")%>(<span class="accessKey">e</span>):
|
||||
</label>
|
||||
<input type="text" size="60" maxlength="80" name="description" id="description" title="Tunnel Description" value="<%=editBean.getTunnelDescription(curTunnel)%>" class="freetext" />
|
||||
<input type="text" size="60" maxlength="80" name="nofilter_description" id="description" title="Tunnel Description" value="<%=editBean.getTunnelDescription(curTunnel)%>" class="freetext" />
|
||||
</div>
|
||||
<div id="startupField" class="rowItem">
|
||||
<label for="startOnLoad" accesskey="a">
|
||||
|
||||
@@ -233,11 +233,11 @@
|
||||
<label for="description" accesskey="e">
|
||||
<%=intl._("Description")%>:(<span class="accessKey">E</span>)
|
||||
</label>
|
||||
<input type="text" size="60" maxlength="80" name="description" id="description" title="Tunnel Description" value="<%=(!"null".equals(request.getParameter("description")) ? net.i2p.data.DataHelper.stripHTML(request.getParameter("description")) : "" ) %>" class="freetext" />
|
||||
<input type="text" size="60" maxlength="80" name="nofilter_description" id="description" title="Tunnel Description" value="<%=(!"null".equals(request.getParameter("description")) ? net.i2p.data.DataHelper.stripHTML(request.getParameter("description")) : "" ) %>" class="freetext" />
|
||||
</div><%
|
||||
} else {
|
||||
%><input type="hidden" name="name" value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("name"))%>" />
|
||||
<input type="hidden" name="description" value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("description"))%>" /><%
|
||||
<input type="hidden" name="nofilter_description" value="<%=net.i2p.data.DataHelper.stripHTML(request.getParameter("description"))%>" /><%
|
||||
} /* curPage 3 */
|
||||
|
||||
/* End page 3 */ %>
|
||||
@@ -484,7 +484,7 @@
|
||||
<input type="hidden" name="tunnelBackupQuantity" value="0" />
|
||||
<input type="hidden" name="clientHost" value="internal" />
|
||||
<input type="hidden" name="clientport" value="internal" />
|
||||
<input type="hidden" name="customOptions" value="" />
|
||||
<input type="hidden" name="nofilter_customOptions" value="" />
|
||||
|
||||
<%
|
||||
if (!"streamrclient".equals(tunnelType)) {
|
||||
@@ -501,9 +501,9 @@
|
||||
}
|
||||
if ("httpclient".equals(tunnelType) || "connectclient".equals(tunnelType) || "sockstunnel".equals(tunnelType) || "socksirctunnel".equals(tunnelType)) {
|
||||
%><input type="hidden" name="proxyUsername" value="" />
|
||||
<input type="hidden" name="proxyPassword" value="" />
|
||||
<input type="hidden" name="nofilter_proxyPassword" value="" />
|
||||
<input type="hidden" name="outproxyUsername" value="" />
|
||||
<input type="hidden" name="outproxyPassword" value="" /><%
|
||||
<input type="hidden" name="nofilter_outproxyPassword" value="" /><%
|
||||
}
|
||||
if ("httpclient".equals(tunnelType)) {
|
||||
%><input type="hidden" name="jumpList" value="http://i2host.i2p/cgi-bin/i2hostjump?
|
||||
|
||||
Reference in New Issue
Block a user