{1.0} Fix various issues with the shared world relay

This commit is contained in:
lax1dude 2024-07-04 16:16:39 -07:00
parent 9433fd8251
commit 7a9c154254
6 changed files with 36 additions and 29 deletions

Binary file not shown.

View File

@ -17,7 +17,7 @@ package net.lax1dude.eaglercraft.v1_8.sp.relay.server;
*/
public class Constants {
public static final String versionName = "0.2a";
public static final String versionName = "1.0";
public static final String versionBrand = "lax1dude";
public static final int protocolVersion = 1;

View File

@ -46,12 +46,14 @@ public class DebugLogger implements IRelayLogger {
private static final Map<String,DebugLogger> loggers = new HashMap();
public static DebugLogger getLogger(String name) {
DebugLogger ret = loggers.get(name);
if(ret == null) {
ret = new DebugLogger(name);
loggers.put(name, ret);
synchronized(loggers) {
DebugLogger ret = loggers.get(name);
if(ret == null) {
ret = new DebugLogger(name);
loggers.put(name, ret);
}
return ret;
}
return ret;
}
private final String name;
@ -189,7 +191,9 @@ public class DebugLogger implements IRelayLogger {
}
public void log(Level lvl, Throwable stackTrace) {
stackTrace.printStackTrace(getPrintStream(lvl));
synchronized(this) {
stackTrace.printStackTrace(getPrintStream(lvl));
}
}
public void debug(String msg) {

View File

@ -53,7 +53,7 @@ public class EaglerSPRelayConfig {
private boolean enableRealIpHeader = false;
private String realIpHeaderName = "X-Real-IP";
private boolean enableShowLocals = true;
private String serverComment = "Eags. Public LAN Relay";
private String serverComment = "Eags. Shared World Relay";
public void load(File conf) {
if(!conf.isFile()) {

View File

@ -55,12 +55,12 @@ public class EaglerSPRelayConfigRelayList {
String line;
while((line = reader.readLine()) != null) {
line = line.trim();
if(line.length() == 0) {
if(line.length() == 0 || line.startsWith("#")) {
continue;
}
boolean isSTUNHead = line.equals("[STUN]");
boolean isTURNHead = line.equals("[TURN]");
if(isSTUNHead || isTURNHead) {
boolean isNOPASSHead = line.equals("[NO_PASSWD]") || line.equals("[STUN]");
boolean isPASSHead = line.equals("[PASSWD]") || line.equals("[TURN]");
if(isNOPASSHead || isPASSHead) {
if(addType != null) {
add(list.getName(), loading, addType, addAddress, addUsername, addPassword);
}
@ -69,9 +69,9 @@ public class EaglerSPRelayConfigRelayList {
addPassword = null;
addType = null;
}
if(isSTUNHead) {
if(isNOPASSHead) {
addType = RelayPacket01ICEServers.RelayType.NO_PASSWD;
}else if(isTURNHead) {
}else if(isPASSHead) {
addType = RelayPacket01ICEServers.RelayType.PASSWD;
}else if(line.startsWith("url")) {
int spidx = line.indexOf('=') + 1;

View File

@ -1,28 +1,31 @@
[STUN]
[NO_PASSWD]
url=stun:stun.l.google.com:19302
[STUN]
[NO_PASSWD]
url=stun:stun1.l.google.com:19302
[STUN]
[NO_PASSWD]
url=stun:stun2.l.google.com:19302
[STUN]
[NO_PASSWD]
url=stun:stun3.l.google.com:19302
[STUN]
[NO_PASSWD]
url=stun:stun4.l.google.com:19302
[STUN]
url=stun:openrelay.metered.ca:80
[TURN]
url=turn:openrelay.metered.ca:443
username=openrelayproject
password=openrelayproject
# These no longer work in 2024, just provided for example:
[TURN]
url=turn:openrelay.metered.ca:443?transport=tcp
username=openrelayproject
password=openrelayproject
#[NO_PASSWD]
#url=stun:openrelay.metered.ca:80
#[PASSWD]
#url=turn:openrelay.metered.ca:443
#username=openrelayproject
#password=openrelayproject
#[PASSWD]
#url=turn:openrelay.metered.ca:443?transport=tcp
#username=openrelayproject
#password=openrelayproject