Skip to content

Commit

Permalink
fix: Add check for invalid modern forwarding config
Browse files Browse the repository at this point in the history
  • Loading branch information
JustPyrrha committed Aug 20, 2020
1 parent 4c0ac7e commit 86265b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class FabricForwarding implements DedicatedServerModInitializer {
@Override
public void onInitializeServer() {
if(Config.getInstance().getMode().equals(ForwardingMode.MODERN) && Config.getInstance().getSecret().length == 0) {
LOGGER.fatal("Modern IP forwarding enabled but no secret provided, please enter the same secret as the one in your proxy's config.");
LOGGER.fatal("Modern IP forwarding enabled but no secret provided, please enter the same secret as the one in your proxy's config. Disabling forwarding.");
Config.getInstance().invalidMode();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ static Config getInstance() {

ForwardingMode getMode();
byte[] getSecret();

void invalidMode();
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ public ForwardingMode getMode() {
public byte[] getSecret() {
return this.secret.getBytes(Charsets.UTF_8);
}

@Override
public void invalidMode() {
this.mode = "OFF";
}
}

0 comments on commit 86265b9

Please sign in to comment.