forked from I2P_Developers/i2p.i2p
Check in the UI parts
This commit is contained in:
@ -245,9 +245,9 @@ public class TunnelController implements Logging {
|
||||
}
|
||||
|
||||
/**
|
||||
* The I2PTunnel
|
||||
* The I2PTunnel
|
||||
*
|
||||
* @since 0.9.53 for advanced plugin usage
|
||||
* @since 0.9.53 for advanced plugin usage
|
||||
*/
|
||||
public I2PTunnel getTunnel() {
|
||||
return _tunnel;
|
||||
@ -1134,6 +1134,7 @@ public class TunnelController implements Logging {
|
||||
TYPE_SOCKS_IRC.equals(type) ||
|
||||
TYPE_CONNECT.equals(type) ||
|
||||
TYPE_STREAMR_CLIENT.equals(type) ||
|
||||
TYPE_UDP_CLIENT.equals(type) ||
|
||||
TYPE_IRC_CLIENT.equals(type);
|
||||
}
|
||||
|
||||
|
@ -1,62 +1,137 @@
|
||||
package net.i2p.i2ptunnel.udpTunnel;
|
||||
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.i2p.client.I2PSession;
|
||||
import net.i2p.i2ptunnel.I2PTunnel;
|
||||
import net.i2p.i2ptunnel.Logging;
|
||||
import net.i2p.i2ptunnel.udp.I2PSink;
|
||||
import net.i2p.i2ptunnel.udp.I2PSource;
|
||||
//import net.i2p.i2ptunnel.streamr.Pinger;
|
||||
import net.i2p.i2ptunnel.udp.UDPSink;
|
||||
import net.i2p.i2ptunnel.udp.UDPSource;
|
||||
import net.i2p.util.EventDispatcher;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* This is a UDP "Client" which has only a "Sink" for recieving datagrams
|
||||
* from the I2P "Source" and sending them to a UDP Client.
|
||||
*
|
||||
* Client side:
|
||||
*
|
||||
* - permanent DatagramSocket at e.g. localhost:5353
|
||||
* - For EVERY incoming IP datagram request, assign a new I2CP source port,
|
||||
* store the source IP/port in a table keyed by the I2CP source port
|
||||
* - send a REPLIABLE datagram to the server with the I2CP source port
|
||||
*
|
||||
* Server side:
|
||||
*
|
||||
* - receive request, store source I2P Dest/port associated with the request
|
||||
* - For EVERY incoming I2P datagram request, open a NEW DatagramSocket on
|
||||
* localhost with an EPHEMERAL port. Send the request out the socket and wait
|
||||
* for a single reply.
|
||||
* - Send reply as a RAW datagram to the stored I2P Dest/port. and CLOSE the
|
||||
* DatagramSocket.
|
||||
*
|
||||
* Client side:
|
||||
*
|
||||
* - receive reply on the destination I2CP port. Look up source IP/port in the
|
||||
* table by the destination I2CP port.
|
||||
* - Send reply to the stored IP/port, and remove entry from table.
|
||||
*
|
||||
* @author idk
|
||||
*/
|
||||
|
||||
public class I2PTunnelUDPClient extends I2PTunnelUDPClientBase {
|
||||
// private final I2PSource source;
|
||||
private final UDPSink sink;
|
||||
// private final InetAddress UDP_HOSTNAME;
|
||||
// private final Pinger pinger;
|
||||
private final Log _log = new Log(I2PTunnelUDPClient.class);
|
||||
|
||||
// UDP Side
|
||||
// permanent DatagramSocket at e.g. localhost:5353
|
||||
private final DatagramSocket _socket;
|
||||
// InetAddress corresponding to local DatagramSocket
|
||||
private final InetAddress UDP_HOSTNAME;
|
||||
// UDP port corresponding to local DatagramSocket
|
||||
private final int UDP_PORT;
|
||||
private final UDPSink _sink;
|
||||
private final UDPSource _source;
|
||||
|
||||
// SourceIP/Port table
|
||||
private ArrayList<InetSocketAddress> _sourceIPPortTable;
|
||||
|
||||
public I2PTunnelUDPClient(String host, int port, String destination, Logging l, EventDispatcher notifyThis,
|
||||
I2PTunnel tunnel) {
|
||||
// super(host, port,
|
||||
super(destination, l, notifyThis, tunnel);
|
||||
UDPSink _sink = null;
|
||||
// I2PSource _source = null;
|
||||
// I2PSession session = tunnel.getSession();
|
||||
UDPSink sink = null;
|
||||
UDP_PORT = port;
|
||||
InetAddress udpHostname = null;
|
||||
_sourceIPPortTable = new ArrayList<InetSocketAddress>();
|
||||
try {
|
||||
// _source = new I2PSource(port);
|
||||
_sink = new UDPSink(InetAddress.getByName(host), port);
|
||||
udpHostname = InetAddress.getByName(host);
|
||||
} catch (Exception e) {
|
||||
_sink = null;
|
||||
// TODO: Log an error and indicate that the tunnel will fail to start.
|
||||
} finally {
|
||||
this.sink = _sink;
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Failed to resolve hostname, using default(localhost): " + host, e);
|
||||
udpHostname = null;
|
||||
}
|
||||
// this.pinger = new Pinger(this.sink);
|
||||
this.setSink(this.sink);
|
||||
UDP_HOSTNAME = udpHostname;
|
||||
DatagramSocket socket = null;
|
||||
try {
|
||||
socket = new DatagramSocket(UDP_PORT, UDP_HOSTNAME);
|
||||
} catch (Exception e) {
|
||||
socket = null;
|
||||
}
|
||||
_socket = socket;
|
||||
try {
|
||||
sink = new UDPSink(socket, InetAddress.getByName(host), port);
|
||||
} catch (Exception e) {
|
||||
sink = null;
|
||||
}
|
||||
this._sink = sink;
|
||||
this._source = new UDPSource(this._sink.getSocket());
|
||||
this.setSink(this._sink);
|
||||
}
|
||||
|
||||
private void sendRepliableI2PDatagram(DatagramPacket packet) {
|
||||
try {
|
||||
_socket.send(packet);
|
||||
} catch (Exception e) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Failed to send UDP packet", e);
|
||||
}
|
||||
}
|
||||
|
||||
private DatagramPacket recieveRAWReplyPacket() {
|
||||
DatagramPacket packet = new DatagramPacket(new byte[1024], 1024);
|
||||
try {
|
||||
_socket.receive(packet);
|
||||
} catch (Exception e) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Failed to receive UDP packet", e);
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void startRunning() {
|
||||
super.startRunning();
|
||||
// send subscribe-message
|
||||
// this.pinger.start();
|
||||
l.log("I2PTunnelUDPClient client ready");
|
||||
while (true) {
|
||||
DatagramPacket packet = recieveRAWReplyPacket();
|
||||
if (packet != null) {
|
||||
InetSocketAddress sourceIPPort = new InetSocketAddress(packet.getAddress(), packet.getPort());
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Received UDP packet from " + sourceIPPort);
|
||||
_sourceIPPortTable.add(sourceIPPort);
|
||||
sendRepliableI2PDatagram(packet);
|
||||
}
|
||||
}
|
||||
|
||||
// this._sink.send(src, fromPort, toPort, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean close(boolean forced) {
|
||||
// send unsubscribe-message
|
||||
// this.pinger.stop();
|
||||
this.sink.stop();
|
||||
return super.close(forced);
|
||||
}
|
||||
}
|
||||
|
@ -21,29 +21,29 @@ import net.i2p.i2ptunnel.Logging;
|
||||
import net.i2p.i2ptunnel.udp.*;
|
||||
import net.i2p.util.EventDispatcher;
|
||||
|
||||
/**
|
||||
* Base client class that sets up an I2P Datagram client destination.
|
||||
* The UDP side is not implemented here, as there are at least
|
||||
* two possibilities:
|
||||
*
|
||||
* 1) UDP side is a "server"
|
||||
* Example: Streamr Consumer
|
||||
* - Configure a destination host and port
|
||||
* - External application sends no data
|
||||
* - Extending class must have a constructor with host and port arguments
|
||||
*
|
||||
* 2) UDP side is a client/server
|
||||
* Example: SOCKS UDP (DNS requests?)
|
||||
* - configure an inbound port and a destination host and port
|
||||
* - External application sends and receives data
|
||||
* - Extending class must have a constructor with host and 2 port arguments
|
||||
*
|
||||
* So the implementing class must create a UDPSource and/or UDPSink,
|
||||
* and must call setSink().
|
||||
*
|
||||
* @author zzz with portions from welterde's streamr
|
||||
*/
|
||||
public abstract class I2PTunnelUDPClientBase extends I2PTunnelTask implements Source, Sink {
|
||||
/**
|
||||
* Base client class that sets up an I2P Datagram client destination.
|
||||
* The UDP side is not implemented here, as there are at least
|
||||
* two possibilities:
|
||||
*
|
||||
* 1) UDP side is a "server"
|
||||
* Example: Streamr Consumer
|
||||
* - Configure a destination host and port
|
||||
* - External application sends no data
|
||||
* - Extending class must have a constructor with host and port arguments
|
||||
*
|
||||
* 2) UDP side is a client/server
|
||||
* Example: SOCKS UDP (DNS requests?)
|
||||
* - configure an inbound port and a destination host and port
|
||||
* - External application sends and receives data
|
||||
* - Extending class must have a constructor with host and 2 port arguments
|
||||
*
|
||||
* So the implementing class must create a UDPSource and/or UDPSink,
|
||||
* and must call setSink().
|
||||
*
|
||||
* @author zzz with portions from welterde's streamr
|
||||
*/
|
||||
public abstract class I2PTunnelUDPClientBase extends I2PTunnelTask implements Source, Sink {
|
||||
|
||||
protected I2PAppContext _context;
|
||||
protected Logging l;
|
||||
@ -54,7 +54,7 @@ import net.i2p.util.EventDispatcher;
|
||||
protected long _clientId;
|
||||
|
||||
private final Object startLock = new Object();
|
||||
|
||||
|
||||
private final I2PSession _session;
|
||||
private final Source _i2pSource;
|
||||
private final Sink _i2pSink;
|
||||
@ -63,8 +63,8 @@ import net.i2p.util.EventDispatcher;
|
||||
* @throws IllegalArgumentException if the I2CP configuration is b0rked so
|
||||
* badly that we cant create a socketManager
|
||||
*/
|
||||
public I2PTunnelUDPClientBase(String destination, Logging l, EventDispatcher notifyThis,
|
||||
I2PTunnel tunnel) throws IllegalArgumentException {
|
||||
public I2PTunnelUDPClientBase(String destination, Logging l, EventDispatcher notifyThis,
|
||||
I2PTunnel tunnel) throws IllegalArgumentException {
|
||||
super("UDPServer", notifyThis, tunnel);
|
||||
_clientId = __clientId.incrementAndGet();
|
||||
this.l = l;
|
||||
@ -72,7 +72,7 @@ import net.i2p.util.EventDispatcher;
|
||||
_context = tunnel.getContext();
|
||||
|
||||
tunnel.getClientOptions().setProperty("i2cp.dontPublishLeaseSet", "true");
|
||||
|
||||
|
||||
// create i2pclient and destination
|
||||
I2PClient client = I2PClientFactory.createClient();
|
||||
byte[] key;
|
||||
@ -89,7 +89,7 @@ import net.i2p.util.EventDispatcher;
|
||||
}
|
||||
client.createDestination(out, stype);
|
||||
key = out.toByteArray();
|
||||
} catch(Exception exc) {
|
||||
} catch (Exception exc) {
|
||||
throw new RuntimeException("failed to create i2p-destination", exc);
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ import net.i2p.util.EventDispatcher;
|
||||
// FIXME this may not pick up non-default I2CP host/port settings from tunnel
|
||||
_session = client.createSession(in, tunnel.getClientOptions());
|
||||
connected(_session);
|
||||
} catch(Exception exc) {
|
||||
} catch (Exception exc) {
|
||||
throw new RuntimeException("failed to create session", exc);
|
||||
}
|
||||
|
||||
@ -117,9 +117,9 @@ import net.i2p.util.EventDispatcher;
|
||||
_i2pSink = new I2PSink(_session, addr.getAddress(), false, addr.getPort());
|
||||
} else {
|
||||
_i2pSink = new I2PSinkAnywhere(_session, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Actually start working on outgoing connections.
|
||||
* Classes should override to start UDP side as well.
|
||||
@ -132,7 +132,7 @@ import net.i2p.util.EventDispatcher;
|
||||
synchronized (startLock) {
|
||||
try {
|
||||
_session.connect();
|
||||
} catch(I2PSessionException exc) {
|
||||
} catch (I2PSessionException exc) {
|
||||
throw new RuntimeException("failed to connect session", exc);
|
||||
}
|
||||
start();
|
||||
@ -147,11 +147,13 @@ import net.i2p.util.EventDispatcher;
|
||||
* Classes should override to close UDP side as well
|
||||
*/
|
||||
public boolean close(boolean forced) {
|
||||
if (!open) return true;
|
||||
if (!open)
|
||||
return true;
|
||||
if (_session != null) {
|
||||
try {
|
||||
_session.destroySession();
|
||||
} catch (I2PSessionException ise) {}
|
||||
} catch (I2PSessionException ise) {
|
||||
}
|
||||
}
|
||||
l.log("Closing client " + toString());
|
||||
open = false;
|
||||
@ -159,11 +161,11 @@ import net.i2p.util.EventDispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Source Methods
|
||||
* Source Methods
|
||||
*
|
||||
* Sets the receiver of the UDP datagrams from I2P
|
||||
* Subclass must call this after constructor
|
||||
* and before start()
|
||||
* Sets the receiver of the UDP datagrams from I2P
|
||||
* Subclass must call this after constructor
|
||||
* and before start()
|
||||
*/
|
||||
public void setSink(Sink s) {
|
||||
_i2pSource.setSink(s);
|
||||
@ -175,10 +177,10 @@ import net.i2p.util.EventDispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sink Methods
|
||||
* Sink Methods
|
||||
*
|
||||
* @param to - ignored if configured for a single destination
|
||||
* (we use the dest specified in the constructor)
|
||||
* (we use the dest specified in the constructor)
|
||||
* @since 0.9.53 added fromPort and toPort parameters
|
||||
* @throws RuntimeException if session is closed
|
||||
*/
|
||||
|
@ -1,71 +0,0 @@
|
||||
package net.i2p.i2ptunnel.udpTunnel;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetAddress;
|
||||
|
||||
import net.i2p.i2ptunnel.I2PTunnel;
|
||||
import net.i2p.i2ptunnel.Logging;
|
||||
import net.i2p.i2ptunnel.streamr.Pinger;
|
||||
import net.i2p.i2ptunnel.udp.UDPSink;
|
||||
import net.i2p.i2ptunnel.udp.UDPSource;
|
||||
import net.i2p.util.EventDispatcher;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* This is a UDP "Server" which is a UDP tunnel which has both a "Sink" for
|
||||
* sending and a "Source" for receiving.
|
||||
*
|
||||
* @author idk
|
||||
*/
|
||||
public class I2PTunnelUDPServer extends I2PTunnelUDPServerBase {
|
||||
private final Log _log = new Log(I2PTunnelUDPServer.class);
|
||||
private final UDPSink sink;
|
||||
private final UDPSource source;
|
||||
private final InetAddress UDP_HOSTNAME;
|
||||
private final int UDP_PORT;
|
||||
|
||||
public I2PTunnelUDPServer(String host, int port, File privkey, String privkeyname, Logging l,
|
||||
EventDispatcher notifyThis,
|
||||
I2PTunnel tunnel) {
|
||||
super(privkey, privkeyname, l, notifyThis, tunnel);
|
||||
// File privkey, String privkeyname, Logging l,EventDispatcher notifyThis,
|
||||
// I2PTunnel tunnel
|
||||
InetAddress _udpHostname = null;
|
||||
try {
|
||||
_udpHostname = InetAddress.getByName(host);
|
||||
} catch (Exception e) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Failed to resolve hostname, using default(localhost): " + host, e);
|
||||
try {
|
||||
_udpHostname = InetAddress.getLocalHost();
|
||||
} catch (Exception crite) {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.warn("Failed to resolve localhost, UDP tunnel will fail.: " + host, crite);
|
||||
_udpHostname = null;
|
||||
}
|
||||
} finally {
|
||||
if (_udpHostname == null) {
|
||||
_log.error("Failed to resolve UDP hostname: " + host);
|
||||
}
|
||||
}
|
||||
this.UDP_HOSTNAME = _udpHostname;
|
||||
this.UDP_PORT = port;
|
||||
this.sink = new UDPSink(this.UDP_HOSTNAME, this.UDP_PORT);
|
||||
this.source = new UDPSource(this.UDP_PORT);
|
||||
this.setSink(this.sink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void startRunning() {
|
||||
super.startRunning();
|
||||
// send subscribe-message
|
||||
l.log("I2PTunnelUDPServer server ready");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean close(boolean forced) {
|
||||
// send unsubscribe-message
|
||||
this.sink.stop();
|
||||
return super.close(forced);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -4,11 +4,11 @@
|
||||
if (curTunnel >= 0) {
|
||||
tunnelTypeName = editBean.getTunnelType(curTunnel);
|
||||
tunnelType = editBean.getInternalType(curTunnel);
|
||||
%><h2><%=intl._t("Edit proxy settings")%> (<%=editBean.getTunnelName(curTunnel)%>)</h2><%
|
||||
%><h2><%=intl._t("Edit proxy settings")%> (<%=editBean.getTunnelName(curTunnel)%>)</h2><%
|
||||
} else {
|
||||
tunnelTypeName = editBean.getTypeName(request.getParameter("type"));
|
||||
tunnelType = net.i2p.data.DataHelper.stripHTML(request.getParameter("type"));
|
||||
%><h2><%=intl._t("New proxy settings")%></h2><%
|
||||
%><h2><%=intl._t("New proxy settings")%></h2><%
|
||||
} %>
|
||||
<input type="hidden" name="tunnel" value="<%=curTunnel%>" />
|
||||
<input type="hidden" name="nonce" value="<%=net.i2p.i2ptunnel.web.IndexBean.getNextNonce()%>" />
|
||||
@ -75,7 +75,7 @@
|
||||
String phdisabled = (canChangePort && isShared) ? "" : tstopFirst;
|
||||
%>
|
||||
<th colspan="2" <%=phdisabled%>>
|
||||
<% if ("streamrclient".equals(tunnelType)) { %>
|
||||
<% if ("streamrclient".equals(tunnelType) || "udpclient".equals(tunnelType)) { %>
|
||||
<%=intl._t("Target")%>
|
||||
<% } else { %>
|
||||
<%=intl._t("Access Point")%>
|
||||
@ -98,7 +98,7 @@
|
||||
<input type="text" size="6" maxlength="5" name="port" title="<%=ptext%>" value="<%=editBean.getClientPort(curTunnel)%>" class="freetext port" placeholder="required" <%=pdisabled%>/>
|
||||
</td>
|
||||
<%
|
||||
if ("streamrclient".equals(tunnelType)) {
|
||||
if ("streamrclient".equals(tunnelType) || "udpclient".equals(tunnelType)) {
|
||||
%>
|
||||
<td>
|
||||
<b><%=intl._t("Host")%>:</b>
|
||||
@ -192,7 +192,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
} else if ("client".equals(tunnelType) || "ircclient".equals(tunnelType) || "streamrclient".equals(tunnelType)) {
|
||||
} else if ("client".equals(tunnelType) || "ircclient".equals(tunnelType) || "streamrclient".equals(tunnelType) || "udpclient".equals(tunnelType)) {
|
||||
%>
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
@ -210,7 +210,7 @@
|
||||
<input type="text" size="30" id="targetDestination" name="targetDestination" title="<%=intl._t("Specify the .i2p address or destination (b32 or b64) of the tunnel here.")%> <%=intl._t("For a random selection from a pool, separate with commas e.g. server1.i2p,server2.i2p")%>" value="<%=editBean.getClientDestination(curTunnel)%>" class="freetext destination" placeholder="required" />
|
||||
<%=intl._t("name, name:port, or destination")%>
|
||||
<%
|
||||
if ("streamrclient".equals(tunnelType)) {
|
||||
if ("streamrclient".equals(tunnelType) || "udpclient".equals(tunnelType)) {
|
||||
/* deferred resolution unimplemented in streamr client */
|
||||
%>
|
||||
- <%=intl._t("b32 not recommended")%>
|
||||
@ -222,7 +222,7 @@
|
||||
<%
|
||||
}
|
||||
|
||||
if (!"streamrclient".equals(tunnelType)) {
|
||||
if (!"streamrclient".equals(tunnelType) || !"udpclient".equals(tunnelType)) {
|
||||
%>
|
||||
<tr>
|
||||
<th colspan="2" <%=phdisabled%>>
|
||||
@ -234,7 +234,7 @@
|
||||
// we don't actually disable the field for a new tunnel, but we provide a warning
|
||||
String shtitle = (canChangePort && isShared) ?
|
||||
intl._t("Traffic from all clients with this feature enabled will be routed over the same set of tunnels. This will make profiling the tunnels by an adversary more difficult, but will link the clients together.") :
|
||||
(isShared ? bStopFirst : aStopFirst);
|
||||
(isShared ? bStopFirst : aStopFirst);
|
||||
String shdisabled = canChangePort ? "" : " disabled=\"disabled\" ";
|
||||
%>
|
||||
<label title="<%=shtitle%>">
|
||||
@ -270,7 +270,7 @@
|
||||
</table>
|
||||
<h3><%=intl._t("Advanced networking options")%></h3>
|
||||
<%
|
||||
if (!"streamrclient".equals(tunnelType) && (canChangePort || isShared)) {
|
||||
if (!"streamrclient".equals(tunnelType) || !"udpclient".equals(tunnelType) && (canChangePort || isShared)) {
|
||||
// no shared client tunnels for streamr
|
||||
// If running and not shared, this doesn't apply.
|
||||
%>
|
||||
@ -309,7 +309,7 @@
|
||||
<option value="5"<%=(tunnelDepth == 5 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 5)%></option>
|
||||
<option value="6"<%=(tunnelDepth == 6 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 6)%></option>
|
||||
<option value="7"<%=(tunnelDepth == 7 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 7)%></option>
|
||||
<% } else if (tunnelDepth > 3) {
|
||||
<% } else if (tunnelDepth > 3) {
|
||||
%> <option value="<%=tunnelDepth%>" selected="selected"><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", tunnelDepth)%></option>
|
||||
<%
|
||||
}
|
||||
@ -355,7 +355,7 @@
|
||||
<option value="3"<%=(tunnelBackupQuantity == 3 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 3)%><%=editBean.unlessAdvanced("high redundancy, high resource usage")%></option>
|
||||
<%
|
||||
if (tunnelBackupQuantity > 3) {
|
||||
%> <option value="<%=tunnelBackupQuantity%>" selected="selected"><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", tunnelBackupQuantity)%></option>
|
||||
%> <option value="<%=tunnelBackupQuantity%>" selected="selected"><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", tunnelBackupQuantity)%></option>
|
||||
<%
|
||||
}
|
||||
%></select>
|
||||
@ -393,7 +393,7 @@
|
||||
} // client
|
||||
%>
|
||||
<%
|
||||
if (!"streamrclient".equals(tunnelType)) {
|
||||
if (!"streamrclient".equals(tunnelType) || !"udpclient".equals(tunnelType)) {
|
||||
// streamr client sends pings so it will never be idle
|
||||
%>
|
||||
<tr>
|
||||
|
@ -4,11 +4,11 @@
|
||||
if (curTunnel >= 0) {
|
||||
tunnelTypeName = editBean.getTunnelType(curTunnel);
|
||||
tunnelType = editBean.getInternalType(curTunnel);
|
||||
%><h2><%=intl._t("Edit Server Settings")%> (<%=editBean.getTunnelName(curTunnel)%>)</h2><%
|
||||
%><h2><%=intl._t("Edit Server Settings")%> (<%=editBean.getTunnelName(curTunnel)%>)</h2><%
|
||||
} else {
|
||||
tunnelTypeName = editBean.getTypeName(request.getParameter("type"));
|
||||
tunnelType = net.i2p.data.DataHelper.stripHTML(request.getParameter("type"));
|
||||
%><h2><%=intl._t("New Server Settings")%></h2><%
|
||||
%><h2><%=intl._t("New Server Settings")%></h2><%
|
||||
} %>
|
||||
<input type="hidden" name="tunnel" value="<%=curTunnel%>" />
|
||||
<input type="hidden" name="nonce" value="<%=net.i2p.i2ptunnel.web.IndexBean.getNextNonce()%>" />
|
||||
@ -66,13 +66,15 @@
|
||||
String tstopFirst = " title=\"" + stopFirst + "\" ";
|
||||
boolean canChangeDest = editBean.canChangePort(curTunnel);
|
||||
boolean isStreamrServer = "streamrserver".equals(tunnelType);
|
||||
boolean isUDPServer = "udpserver".equals(tunnelType);
|
||||
boolean isUDPClient = "udpclient".equals(tunnelType);
|
||||
boolean isBidirServer = "httpbidirserver".equals(tunnelType);
|
||||
boolean canChangePort = canChangeDest || !(isStreamrServer || isBidirServer);
|
||||
boolean canChangePort = canChangeDest || !(isStreamrServer || isBidirServer || isUDPClient || isUDPServer);
|
||||
String phdisabled = canChangePort ? "" : tstopFirst;
|
||||
%>
|
||||
<th colspan="2" <%=phdisabled%>>
|
||||
<%
|
||||
if (isStreamrServer) { %>
|
||||
if (isStreamrServer || isUDPServer) { %>
|
||||
<%=intl._t("Access Point")%>
|
||||
<% } else { %>
|
||||
<%=intl._t("Target")%>
|
||||
@ -80,7 +82,7 @@
|
||||
</th>
|
||||
</tr><tr>
|
||||
<%
|
||||
if (!isStreamrServer) {
|
||||
if (!isStreamrServer || !isUDPServer) {
|
||||
%>
|
||||
<td>
|
||||
<b><%=intl._t("Host")%>:</b>
|
||||
@ -101,7 +103,7 @@
|
||||
String pdisabled = canChangePort ? "" : " readonly=\"readonly\" ";
|
||||
%>
|
||||
<input type="text" size="6" maxlength="5" id="targetPort" name="targetPort" title="<%=ptext%>" value="<%=editBean.getTargetPort(curTunnel)%>" class="freetext port" placeholder="required" <%=pdisabled%>/>
|
||||
<% if (!isStreamrServer) { %>
|
||||
<% if (!isStreamrServer || !isUDPClient || !isUDPServer) { %>
|
||||
<label title="<%=intl._t("To avoid traffic sniffing if connecting to a remote server, you can enable an SSL connection. Note that the target server must be configured to accept SSL connections.")%>"><input value="1" type="checkbox" name="useSSL"<%=(editBean.isSSLEnabled(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||
<%=intl._t("Use SSL to connect to target")%></label>
|
||||
<% } /* !streamrserver */ %>
|
||||
@ -127,7 +129,7 @@
|
||||
<input type="text" size="6" maxlength="5" name="port" title="<%=dsphelp%>" value="<%=editBean.getClientPort(curTunnel)%>" class="freetext port" placeholder="required" <%=pdisabled%>/>
|
||||
</td>
|
||||
<% } /* httpbidirserver */
|
||||
if (isBidirServer || isStreamrServer) {
|
||||
if (isBidirServer || isStreamrServer || isUDPServer) {
|
||||
%>
|
||||
<td>
|
||||
<b><%=intl._t("Reachable by")%>:</b>
|
||||
@ -153,7 +155,7 @@
|
||||
%>
|
||||
</select>
|
||||
</td>
|
||||
<% } /* httpbidirserver || streamrserver */ %>
|
||||
<% } /* httpbidirserver || streamrserver || udpserver */ %>
|
||||
</tr>
|
||||
<% if ("httpserver".equals(tunnelType) || isBidirServer) {
|
||||
%>
|
||||
@ -301,7 +303,7 @@
|
||||
<option value="5"<%=(tunnelDepth == 5 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 5)%></option>
|
||||
<option value="6"<%=(tunnelDepth == 6 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 6)%></option>
|
||||
<option value="7"<%=(tunnelDepth == 7 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 7)%></option>
|
||||
<% } else if (tunnelDepth > 3) {
|
||||
<% } else if (tunnelDepth > 3) {
|
||||
%> <option value="<%=tunnelDepth%>" selected="selected"><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", tunnelDepth)%></option>
|
||||
<% }
|
||||
%></select>
|
||||
@ -395,7 +397,7 @@
|
||||
<option value="3"<%=(tunnelBackupQuantity == 3 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 3)%><%=editBean.unlessAdvanced("high redundancy, high resource usage")%></option>
|
||||
<%
|
||||
if (tunnelBackupQuantity > 3) {
|
||||
%> <option value="<%=tunnelBackupQuantity%>" selected="selected"><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", tunnelBackupQuantity)%></option>
|
||||
%> <option value="<%=tunnelBackupQuantity%>" selected="selected"><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", tunnelBackupQuantity)%></option>
|
||||
<% }
|
||||
%></select>
|
||||
</td>
|
||||
@ -426,7 +428,7 @@
|
||||
<option value="2"<%=(tunnelBackupQuantityOut == 2 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 2)%></option>
|
||||
<option value="3"<%=(tunnelBackupQuantityOut == 3 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 3)%></option>
|
||||
<% if (tunnelBackupQuantityOut > 3) {
|
||||
%> <option value="<%=tunnelBackupQuantityOut%>" selected="selected"><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", tunnelBackupQuantity)%></option>
|
||||
%> <option value="<%=tunnelBackupQuantityOut%>" selected="selected"><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", tunnelBackupQuantity)%></option>
|
||||
<% }
|
||||
%></select>
|
||||
</td>
|
||||
@ -717,7 +719,7 @@
|
||||
<%
|
||||
/* alternate dest, only if current dest is set and is DSA_SHA1 */
|
||||
|
||||
if (currentSigType == 0 && !"".equals(b64) && !isStreamrServer) {
|
||||
if (currentSigType == 0 && !"".equals(b64) && (!isStreamrServer || !isUDPClient || !isUDPServer)) {
|
||||
String attitle = canChangeEncType ? "" : tstopFirst;
|
||||
String atitle = canChangeEncType ? intl._t("Path to Private Key File") : stopFirst;
|
||||
String adisabled = canChangeEncType ? "" : " readonly=\"readonly\" ";
|
||||
@ -817,7 +819,7 @@
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td colspan="8">
|
||||
<%=intl._t("You can define an advanced filter for this tunnel.")%> (<a href="http://i2p-projekt.i2p/spec/filter-format" target="_blank"><%=intl._t("Format Specification")%></a>)
|
||||
<%=intl._t("You can define an advanced filter for this tunnel.")%> (<a href="http://i2p-projekt.i2p/spec/filter-format" target="_blank"><%=intl._t("Format Specification")%></a>)
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td colspan="8">
|
||||
@ -867,7 +869,7 @@
|
||||
</th>
|
||||
</tr>
|
||||
<%
|
||||
if (!isStreamrServer) {
|
||||
if (!isStreamrServer || !isUDPClient || !isUDPServer) {
|
||||
%>
|
||||
<tr>
|
||||
<th colspan="5">
|
||||
|
Reference in New Issue
Block a user