ICE bullshit

This commit is contained in:
LAX1DUDE 2022-08-23 18:28:46 -07:00
parent b2868af8b6
commit 4470365d6c
7 changed files with 18030 additions and 18045 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -139,9 +139,8 @@ public class EaglerSPRelayConfigRelayList {
}
private static void add(String filename, Collection<RelayServer> loading, RelayType type, String url, String user, String pass) {
if(url == null) {
EaglerSPRelay.logger.error("Error: Invalid [STUN] in {}, missing 'url'", filename);
EaglerSPRelay.logger.error("Error: Invalid relay in {}, missing 'url'", filename);
}else {
loading.add(new RelayServer(type, url, user, pass));
}

View File

@ -24,15 +24,14 @@ public class IPacket01ICEServers extends IPacket {
RelayServer srv = itr.next();
if(srv.type == RelayType.STUN) {
output.write('S');
writeASCII16(output, srv.address);
}else if(srv.type == RelayType.TURN) {
output.write('T');
writeASCII16(output, srv.address);
writeASCII8(output, srv.username);
writeASCII8(output, srv.password);
}else {
throw new IOException("Unknown/Unsupported Relay Type: " + srv.type.name());
}
writeASCII16(output, srv.address);
writeASCII8(output, srv.username);
writeASCII8(output, srv.password);
}
}

View File

@ -71,7 +71,7 @@ public class GuiScreenLANConnecting extends GuiScreen {
LANClientNetworkManager netMgr = LANClientNetworkManager.connectToWorld(sock, code, sock.getURI());
if(netMgr == null) {
this.mc.displayGuiScreen(new GuiDisconnected(parent, "connect.failed", "disconnect.genericReason", "noRelay.worldFail", ""));
this.mc.displayGuiScreen(new GuiDisconnected(parent, "connect.failed", "disconnect.genericReason", st.translateKey("noRelay.worldFail"), ""));
return;
}

View File

@ -28,12 +28,10 @@ public class ICEServerSet {
}
public String getICEString() {
if(type == RelayType.STUN) {
if(username == null) {
return address;
}else if(type == RelayType.TURN) {
return address + ";" + username + ";" + password;
}else {
throw new IllegalStateException("Unknown relay type: " + (type == null ? "null" : type.name()));
return address + ";" + username + ";" + password;
}
}

View File

@ -18,22 +18,20 @@ public class IPacket01ICEServers extends IPacket {
int l = input.readUnsignedShort();
for(int i = 0; i < l; ++i) {
char type = (char)input.read();
ICEServerSet.RelayType typeEnum;
if(type == 'S') {
servers.add(new ICEServerSet.RelayServer(
ICEServerSet.RelayType.STUN,
readASCII16(input),
null, null
));
typeEnum = ICEServerSet.RelayType.STUN;
}else if(type == 'T') {
servers.add(new ICEServerSet.RelayServer(
ICEServerSet.RelayType.TURN,
readASCII16(input),
readASCII8(input),
readASCII8(input)
));
typeEnum = ICEServerSet.RelayType.TURN;
}else {
throw new IOException("Unknown/Unsupported Relay Type: '" + type + "'");
}
servers.add(new ICEServerSet.RelayServer(
typeEnum,
readASCII16(input),
readASCII8(input),
readASCII8(input)
));
}
}