{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 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 String versionBrand = "lax1dude";
public static final int protocolVersion = 1; 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(); private static final Map<String,DebugLogger> loggers = new HashMap();
public static DebugLogger getLogger(String name) { public static DebugLogger getLogger(String name) {
DebugLogger ret = loggers.get(name); synchronized(loggers) {
if(ret == null) { DebugLogger ret = loggers.get(name);
ret = new DebugLogger(name); if(ret == null) {
loggers.put(name, ret); ret = new DebugLogger(name);
loggers.put(name, ret);
}
return ret;
} }
return ret;
} }
private final String name; private final String name;
@ -189,7 +191,9 @@ public class DebugLogger implements IRelayLogger {
} }
public void log(Level lvl, Throwable stackTrace) { public void log(Level lvl, Throwable stackTrace) {
stackTrace.printStackTrace(getPrintStream(lvl)); synchronized(this) {
stackTrace.printStackTrace(getPrintStream(lvl));
}
} }
public void debug(String msg) { public void debug(String msg) {

View File

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

View File

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

View File

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