MLab: Switch to name server that supports SSL

swingemu cleanups
This commit is contained in:
zzz
2018-11-16 17:12:32 +00:00
parent 9a254aec55
commit 9b9810ea1e
3 changed files with 14 additions and 12 deletions

View File

@ -38,6 +38,7 @@ import net.minidev.json.parser.ParseException;
import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.util.EepGet;
import net.i2p.util.SSLEepGet;
import net.i2p.util.I2PAppThread;
import net.i2p.util.Log;
@ -49,9 +50,9 @@ import net.i2p.util.Log;
public class MLabRunner {
// ns.measurementlab.net does not support https
// use ndt_ssl for test over ssl? but Tcpbw100 doesn't support it
private static final String NS_URL = "http://ns.measurementlab.net/ndt?format=json";
//private static final String NS_URL = "http://ns.measurementlab.net/ndt?format=json";
private static final String NS_URL_SSL = "https://mlab-ns.appspot.com/ndt?format=json";
private static final long NS_TIMEOUT = 20*1000;
private boolean test_active;
private final I2PAppContext _context;
private final Log _log;
private final AtomicBoolean _running = new AtomicBoolean();
@ -119,9 +120,10 @@ public class MLabRunner {
// public EepGet(I2PAppContext ctx, boolean shouldProxy, String proxyHost, int proxyPort,
// int numRetries, long minSize, long maxSize, String outputFile, OutputStream outputStream,
// String url, boolean allowCaching, String etag, String postData) {
EepGet eepget = new EepGet(_context, false, null, 0,
0, 2, 1024, null, baos,
NS_URL, false, null, null);
//EepGet eepget = new EepGet(_context, false, null, 0,
// 0, 2, 1024, null, baos,
// NS_URL, false, null, null);
EepGet eepget = new SSLEepGet(_context, baos, NS_URL_SSL);
boolean ok = eepget.fetch(NS_TIMEOUT, NS_TIMEOUT, NS_TIMEOUT);
if (!ok)
throw new IOException("ns fetch failed");

View File

@ -33,7 +33,7 @@ JTextArea
extends Component
{
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(Tcpbw100.class);
private String text = "";
private final StringBuilder text = new StringBuilder();
public
JTextArea(
@ -41,7 +41,7 @@ JTextArea
int a,
int b )
{
text = str;
text.append(str);
}
public void
@ -50,13 +50,13 @@ JTextArea
{
if (_log.shouldWarn())
_log.warn(str.trim());
text += str;
text.append(str);
}
public String
getText()
{
return( text );
return text.toString();
}
public void

View File

@ -32,12 +32,12 @@ public class
StyledDocument
{
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(Tcpbw100.class);
public String str = "";
private final StringBuilder text = new StringBuilder();
public int
getLength()
{
return( str.length());
return text.length();
}
public void
@ -50,6 +50,6 @@ StyledDocument
{
if (_log.shouldWarn())
_log.warn(s.trim());
str += s;
text.append(s);
}
}