-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(shulker-proxy-agent): proper support of cluster reconnection
- Loading branch information
1 parent
7c55347
commit 94ef4ba
Showing
29 changed files
with
422 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,4 @@ try = ["lobby", "limbo"] | |
[advanced] | ||
haproxy-protocol = true | ||
tcp-fast-open = true | ||
|
||
|
||
accepts-transfers = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...src/bungeecord/kotlin/io/shulkermc/proxyagent/bungeecord/commands/GlobalControlCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package io.shulkermc.proxyagent.bungeecord.commands | ||
|
||
import io.shulkermc.proxyagent.ShulkerProxyAgentCommon | ||
import io.shulkermc.proxyagent.commands.ControlCommandHandler | ||
import net.kyori.adventure.audience.Audience | ||
import net.kyori.adventure.platform.bungeecord.BungeeAudiences | ||
import net.kyori.adventure.text.Component | ||
import net.kyori.adventure.text.format.NamedTextColor | ||
import net.md_5.bungee.api.CommandSender | ||
import net.md_5.bungee.api.plugin.Command | ||
|
||
class GlobalControlCommand( | ||
private val agent: ShulkerProxyAgentCommon, | ||
private val adventure: BungeeAudiences, | ||
) : Command(ControlCommandHandler.NAME, ControlCommandHandler.PERMISSION) { | ||
companion object { | ||
private val USAGE_MESSAGE = | ||
Component.text("Usage: /shulker:ctl <...>").color(NamedTextColor.RED) | ||
.appendNewline() | ||
.append(Component.text("- drain <proxy>")) | ||
.appendNewline() | ||
.append(Component.text("- reconnect <proxy>")) | ||
} | ||
|
||
override fun execute( | ||
sender: CommandSender, | ||
args: Array<out String>, | ||
) { | ||
val audience = this.adventure.sender(sender) | ||
if (!BungeeCordCommandHelper.testPermissionOrMessage(sender, audience, this.permission)) { | ||
return | ||
} | ||
|
||
if (args.isEmpty()) { | ||
audience.sendMessage(USAGE_MESSAGE) | ||
return | ||
} | ||
|
||
val subArguments = args.copyOfRange(1, args.size) | ||
|
||
when (args[0]) { | ||
"drain" -> executeDrainSubcommand(audience, subArguments) | ||
"reconnect" -> this.executeReconnectSubcommand(audience, subArguments) | ||
} | ||
} | ||
|
||
private fun executeDrainSubcommand( | ||
audience: Audience, | ||
args: Array<out String>, | ||
) { | ||
if (args.isEmpty()) { | ||
audience.sendMessage(USAGE_MESSAGE) | ||
return | ||
} | ||
|
||
val proxyName = args[0] | ||
ControlCommandHandler.executeDrainProxy(this.agent, audience, proxyName) | ||
} | ||
|
||
private fun executeReconnectSubcommand( | ||
audience: Audience, | ||
args: Array<out String>, | ||
) { | ||
if (args.isEmpty()) { | ||
audience.sendMessage(USAGE_MESSAGE) | ||
return | ||
} | ||
|
||
val proxyName = args[0] | ||
ControlCommandHandler.executeReconnectProxy(this.agent, audience, proxyName) | ||
} | ||
} |
Oops, something went wrong.