mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Use namespaced strings for Transport IDs
This commit is contained in:
@@ -9,6 +9,8 @@ import org.briarproject.api.keyagreement.Payload;
|
||||
import org.briarproject.api.keyagreement.PayloadParser;
|
||||
import org.briarproject.api.keyagreement.TransportDescriptor;
|
||||
import org.briarproject.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.api.plugins.BluetoothConstants;
|
||||
import org.briarproject.api.plugins.TorConstants;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
@@ -55,10 +57,10 @@ class PayloadParserImpl implements PayloadParser {
|
||||
BdfList descriptor = payload.getList(i);
|
||||
long transportId = descriptor.getLong(0);
|
||||
if (transportId == TRANSPORT_ID_BLUETOOTH) {
|
||||
TransportId id = new TransportId("bt");
|
||||
TransportId id = BluetoothConstants.ID;
|
||||
recognised.add(new TransportDescriptor(id, descriptor));
|
||||
} else if (transportId == TRANSPORT_ID_LAN) {
|
||||
TransportId id = new TransportId("lan");
|
||||
TransportId id = TorConstants.ID;
|
||||
recognised.add(new TransportDescriptor(id, descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,14 +33,13 @@ import java.util.logging.Logger;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static org.briarproject.api.keyagreement.KeyAgreementConstants.TRANSPORT_ID_LAN;
|
||||
import static org.briarproject.api.plugins.LanTcpConstants.ID;
|
||||
import static org.briarproject.util.ByteUtils.MAX_16_BIT_UNSIGNED;
|
||||
import static org.briarproject.util.PrivacyUtils.scrubSocketAddress;
|
||||
|
||||
@NotNullByDefault
|
||||
class LanTcpPlugin extends TcpPlugin {
|
||||
|
||||
static final TransportId ID = new TransportId("lan");
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(LanTcpPlugin.class.getName());
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import org.briarproject.api.plugins.duplex.DuplexPluginFactory;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import static org.briarproject.api.plugins.LanTcpConstants.ID;
|
||||
|
||||
public class LanTcpPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
private static final int MAX_LATENCY = 30 * 1000; // 30 seconds
|
||||
@@ -28,7 +30,7 @@ public class LanTcpPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
@Override
|
||||
public TransportId getId() {
|
||||
return LanTcpPlugin.ID;
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,12 +16,12 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import static org.briarproject.api.plugins.WanTcpConstants.ID;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
class WanTcpPlugin extends TcpPlugin {
|
||||
|
||||
static final TransportId ID = new TransportId("wan");
|
||||
|
||||
private static final String PROP_IP_PORT = "ipPort";
|
||||
|
||||
private final PortMapper portMapper;
|
||||
|
||||
@@ -10,6 +10,8 @@ import org.briarproject.api.plugins.duplex.DuplexPluginFactory;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import static org.briarproject.api.plugins.WanTcpConstants.ID;
|
||||
|
||||
public class WanTcpPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
private static final int MAX_LATENCY = 30 * 1000; // 30 seconds
|
||||
@@ -31,7 +33,7 @@ public class WanTcpPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
@Override
|
||||
public TransportId getId() {
|
||||
return WanTcpPlugin.ID;
|
||||
return ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user