forked from I2P_Developers/i2p.i2p
SAM:
- Don't map keys to upper case in parser, corrupts I2CP options - Register SSL and UDP ports with PortMapper
This commit is contained in:
@ -709,7 +709,9 @@ public class SAMBridge implements Runnable, ClientApp {
|
|||||||
changeState(RUNNING);
|
changeState(RUNNING);
|
||||||
if (_mgr != null)
|
if (_mgr != null)
|
||||||
_mgr.register(this);
|
_mgr.register(this);
|
||||||
I2PAppContext.getGlobalContext().portMapper().register(PortMapper.SVC_SAM, _listenPort);
|
I2PAppContext.getGlobalContext().portMapper().register(_useSSL ? PortMapper.SVC_SAM_SSL : PortMapper.SVC_SAM,
|
||||||
|
_listenHost != null ? _listenHost : "127.0.0.1",
|
||||||
|
_listenPort);
|
||||||
try {
|
try {
|
||||||
while (acceptConnections) {
|
while (acceptConnections) {
|
||||||
SocketChannel s = serverSocket.accept();
|
SocketChannel s = serverSocket.accept();
|
||||||
@ -775,7 +777,7 @@ public class SAMBridge implements Runnable, ClientApp {
|
|||||||
if (serverSocket != null)
|
if (serverSocket != null)
|
||||||
serverSocket.close();
|
serverSocket.close();
|
||||||
} catch (IOException e) {}
|
} catch (IOException e) {}
|
||||||
I2PAppContext.getGlobalContext().portMapper().unregister(PortMapper.SVC_SAM);
|
I2PAppContext.getGlobalContext().portMapper().unregister(_useSSL ? PortMapper.SVC_SAM_SSL : PortMapper.SVC_SAM);
|
||||||
stopHandlers();
|
stopHandlers();
|
||||||
changeState(STOPPED);
|
changeState(STOPPED);
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ class SAMUtils {
|
|||||||
* Parse SAM parameters, and put them into a Propetries object
|
* Parse SAM parameters, and put them into a Propetries object
|
||||||
*
|
*
|
||||||
* Modified from EepGet.
|
* Modified from EepGet.
|
||||||
* All keys, major, and minor are mapped to upper case.
|
* COMMAND and OPCODE are mapped to upper case; keys, values, and ping data are not.
|
||||||
* Double quotes around values are stripped.
|
* Double quotes around values are stripped.
|
||||||
*
|
*
|
||||||
* Possible input:
|
* Possible input:
|
||||||
@ -241,8 +241,9 @@ class SAMUtils {
|
|||||||
key = null;
|
key = null;
|
||||||
} else if (buf.length() > 0) {
|
} else if (buf.length() > 0) {
|
||||||
// key without value
|
// key without value
|
||||||
String k = buf.toString().trim().toUpperCase(Locale.US);
|
String k = buf.toString();
|
||||||
if (rv.isEmpty()) {
|
if (rv.isEmpty()) {
|
||||||
|
k = k.toUpperCase(Locale.US);
|
||||||
rv.setProperty(COMMAND, k);
|
rv.setProperty(COMMAND, k);
|
||||||
if (k.equals("PING") || k.equals("PONG")) {
|
if (k.equals("PING") || k.equals("PONG")) {
|
||||||
// eat the rest of the line
|
// eat the rest of the line
|
||||||
@ -254,7 +255,7 @@ class SAMUtils {
|
|||||||
i = length + 1;
|
i = length + 1;
|
||||||
}
|
}
|
||||||
} else if (rv.size() == 1) {
|
} else if (rv.size() == 1) {
|
||||||
rv.setProperty(OPCODE, k);
|
rv.setProperty(OPCODE, k.toUpperCase(Locale.US));
|
||||||
} else {
|
} else {
|
||||||
if (rv.setProperty(k, "true") != null)
|
if (rv.setProperty(k, "true") != null)
|
||||||
throw new SAMException("Duplicate parameter " + k);
|
throw new SAMException("Duplicate parameter " + k);
|
||||||
@ -273,7 +274,7 @@ class SAMUtils {
|
|||||||
} else {
|
} else {
|
||||||
if (buf.length() == 0)
|
if (buf.length() == 0)
|
||||||
throw new SAMException("Empty parameter name");
|
throw new SAMException("Empty parameter name");
|
||||||
key = buf.toString().toUpperCase(Locale.US);
|
key = buf.toString();
|
||||||
buf.setLength(0);
|
buf.setLength(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -24,6 +24,7 @@ import net.i2p.client.I2PSession;
|
|||||||
import net.i2p.data.DataHelper;
|
import net.i2p.data.DataHelper;
|
||||||
import net.i2p.util.I2PAppThread;
|
import net.i2p.util.I2PAppThread;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
import net.i2p.util.PortMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the thread listening on 127.0.0.1:7655 or as specified by
|
* This is the thread listening on 127.0.0.1:7655 or as specified by
|
||||||
@ -90,7 +91,7 @@ class SAMv3DatagramServer implements Handler {
|
|||||||
/** @since 0.9.24 */
|
/** @since 0.9.24 */
|
||||||
public int getPort() { return _port; }
|
public int getPort() { return _port; }
|
||||||
|
|
||||||
private static class Listener implements Runnable {
|
private class Listener implements Runnable {
|
||||||
|
|
||||||
private final DatagramChannel server;
|
private final DatagramChannel server;
|
||||||
|
|
||||||
@ -98,8 +99,17 @@ class SAMv3DatagramServer implements Handler {
|
|||||||
{
|
{
|
||||||
this.server = server ;
|
this.server = server ;
|
||||||
}
|
}
|
||||||
public void run()
|
|
||||||
{
|
public void run() {
|
||||||
|
I2PAppContext.getGlobalContext().portMapper().register(PortMapper.SVC_SAM_UDP, _host, _port);
|
||||||
|
try {
|
||||||
|
run2();
|
||||||
|
} finally {
|
||||||
|
I2PAppContext.getGlobalContext().portMapper().unregister(PortMapper.SVC_SAM_UDP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void run2() {
|
||||||
ByteBuffer inBuf = ByteBuffer.allocateDirect(SAMRawSession.RAW_SIZE_MAX+1024);
|
ByteBuffer inBuf = ByteBuffer.allocateDirect(SAMRawSession.RAW_SIZE_MAX+1024);
|
||||||
|
|
||||||
while (!Thread.interrupted())
|
while (!Thread.interrupted())
|
||||||
|
@ -69,7 +69,7 @@ public class SAMStreamSend {
|
|||||||
String port = "7656";
|
String port = "7656";
|
||||||
String user = null;
|
String user = null;
|
||||||
String password = null;
|
String password = null;
|
||||||
String opts = "";
|
String opts = "inbound.length=0 outbound.length=0";
|
||||||
int c;
|
int c;
|
||||||
while ((c = g.getopt()) != -1) {
|
while ((c = g.getopt()) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
@ -77,7 +77,7 @@ public class SAMStreamSink {
|
|||||||
String port = "7656";
|
String port = "7656";
|
||||||
String user = null;
|
String user = null;
|
||||||
String password = null;
|
String password = null;
|
||||||
String opts = "";
|
String opts = "inbound.length=0 outbound.length=0";
|
||||||
int c;
|
int c;
|
||||||
while ((c = g.getopt()) != -1) {
|
while ((c = g.getopt()) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
@ -30,6 +30,10 @@ public class PortMapper {
|
|||||||
public static final String SVC_SMTP = "SMTP";
|
public static final String SVC_SMTP = "SMTP";
|
||||||
public static final String SVC_POP = "POP3";
|
public static final String SVC_POP = "POP3";
|
||||||
public static final String SVC_SAM = "SAM";
|
public static final String SVC_SAM = "SAM";
|
||||||
|
/** @since 0.9.24 */
|
||||||
|
public static final String SVC_SAM_UDP = "SAM-UDP";
|
||||||
|
/** @since 0.9.24 */
|
||||||
|
public static final String SVC_SAM_SSL = "SAM-SSL";
|
||||||
public static final String SVC_BOB = "BOB";
|
public static final String SVC_BOB = "BOB";
|
||||||
/** not necessary, already in config? */
|
/** not necessary, already in config? */
|
||||||
public static final String SVC_I2CP = "I2CP";
|
public static final String SVC_I2CP = "I2CP";
|
||||||
|
26
history.txt
26
history.txt
@ -1,7 +1,33 @@
|
|||||||
|
2015-12-01 zzz
|
||||||
|
* i2psnark:
|
||||||
|
- Consolidate default tunnel length definition
|
||||||
|
- Increase max peers and uploaders per torrent
|
||||||
|
- Increase default max total uploaders
|
||||||
|
- Increase max peers sent and returned in DHT
|
||||||
|
* SAM:
|
||||||
|
- Don't map keys to upper case in parser, corrupts I2CP options
|
||||||
|
- Register SSL and UDP ports with PortMapper
|
||||||
|
* SSU: Allow IP and port in relay request if it matches the source
|
||||||
|
* Transport: Interrupt DH refiller thread when pool is empty,
|
||||||
|
to speed refilling and reduce pumper stalls
|
||||||
|
|
||||||
|
2015-11-30 zzz
|
||||||
|
* SAM:
|
||||||
|
- Timeout for first command after HELLO
|
||||||
|
- Send error message if no NAME key in LOOKUP
|
||||||
|
- Destination caching enhancements
|
||||||
|
- Client: Add SSL forward support, handle header line in forwarded stream
|
||||||
|
|
||||||
|
2015-11-29 zzz
|
||||||
|
* i2ptunnel:
|
||||||
|
- Change preferred sig type to Ed
|
||||||
|
- Set permissions on backup tunnel keys file
|
||||||
|
|
||||||
2015-11-28 zzz
|
2015-11-28 zzz
|
||||||
* i2psnark:
|
* i2psnark:
|
||||||
- Fix NPE caused by URL-to-URI conversion in -2 (ticket #1715)
|
- Fix NPE caused by URL-to-URI conversion in -2 (ticket #1715)
|
||||||
- Increase max pieces to 32K
|
- Increase max pieces to 32K
|
||||||
|
- BEP 21 support (upload_only)
|
||||||
* SAM:
|
* SAM:
|
||||||
- Fix parser to allow spaces in quoted values (tickets #1325, #1488)
|
- Fix parser to allow spaces in quoted values (tickets #1325, #1488)
|
||||||
- Handle UTF-8 in ReadLine (ticket #1488)
|
- Handle UTF-8 in ReadLine (ticket #1488)
|
||||||
|
@ -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 = 5;
|
public final static long BUILD = 6;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
Reference in New Issue
Block a user