Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and rename some config options, add section notes #5390

Draft
wants to merge 6 commits into
base: feature/configurate
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private void onClient2ProxyChannelInitialize(Client2ProxyChannelInitializeEvent
if (event.getType() != ITyped.Type.POST || event.isLegacyPassthrough()) {
return;
}
// TODO remove
if (System.getProperty("geyser.viaproxy.disableIpPassthrough") != null) { // Temporary until Configurate branch is merged
return;
}
Expand Down
27 changes: 24 additions & 3 deletions core/src/main/java/org/geysermc/geyser/GeyserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,27 @@ private void startInstance() {

Registries.RESOURCE_PACKS.load();

// Warnings to users who enable options that they might not need.
if (config.bedrock().useProxyProtocol()) {
logger.warning("Geyser is configured to expect proxy protocol for Bedrock connections.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we make these infos? Most people using the setting are using it correctly.

logger.warning("If you do not know what this is, open the Geyser config, and set \"use-proxy-protocol\" under the \"bedrock\" section to \"false\".");
}

if (config.java().useProxyProtocol()) {
logger.warning("Geyser is configured to use proxy protocol when connecting to the Java server.");
logger.warning("If you do not know what this is, open the Geyser config, and set \"use-proxy-protocol\" under the \"java\" section to \"false\".");
}

if (config.advanced().disableXboxAuth()) {
logger.error(" / \\");
logger.error(" / \\");
logger.error(" / | \\ " + "XBOX AUTHENTICATION IS DISABLED ON THIS GEYSER INSTANCE!");
logger.error(" / | \\ " + "While this allows using Bedrock edition proxies, it also opens up the ability for hackers to connect with any username they choose.");
logger.error(" / \\ " + "To change this, set \"disable-xbox-auth\" to \"false\" in Geyser's config-advanced.yml file.");
logger.error(" / o \\");
logger.error("/_____________\\");
}

String geyserUdpPort = System.getProperty("geyserUdpPort", "");
String pluginUdpPort = geyserUdpPort.isEmpty() ? System.getProperty("pluginUdpPort", "") : geyserUdpPort;
if ("-1".equals(pluginUdpPort)) {
Expand Down Expand Up @@ -426,10 +447,10 @@ private void startInstance() {
logger.debug("Epoll is not available; Erosion's Unix socket handling will not work.");
}

BedrockDimension.changeBedrockNetherId(config.aboveBedrockNetherBuilding()); // Apply End dimension ID workaround to Nether
BedrockDimension.changeBedrockNetherId(config.netherRoofWorkaround()); // Apply End dimension ID workaround to Nether

Integer bedrockThreadCount = Integer.getInteger("Geyser.BedrockNetworkThreads");
if (bedrockThreadCount == null) {
int bedrockThreadCount = Integer.getInteger("Geyser.BedrockNetworkThreads", config.advanced().bedrockNetworkThreadCount());
if (bedrockThreadCount == -1) {
// Copy the code from Netty's default thread count fallback
bedrockThreadCount = Math.max(1, SystemPropertyUtil.getInt("io.netty.eventLoopThreads", NettyRuntime.availableProcessors() * 2));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public void execute(CommandContext<GeyserCommandSource> context) {
}

// Issue: did someone turn on enable-proxy-protocol, and they didn't mean it?
if (config.bedrock().enableProxyProtocol()) {
source.sendMessage("You have the `enable-proxy-protocol` setting enabled. " +
if (config.bedrock().useProxyProtocol()) {
source.sendMessage("You have the `use-proxy-protocol` setting enabled. " +
"Unless you're deliberately using additional software that REQUIRES this setting, you may not need it enabled.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,32 +76,64 @@ This should point to the public key generated by Floodgate (BungeeCord, Spigot o
@DefaultNumeric(20)
int scoreboardPacketThreshold();

@Comment("""
Whether Geyser should send team names in command suggestions.
Disable this if you have a lot of teams used that you don't need as suggestions.
""")
@DefaultBoolean(true)
boolean addTeamSuggestions();

@Comment("""
The internet supports a maximum MTU of 1492 but could cause issues with packet fragmentation.
1400 is the default.""")
@DefaultNumeric(1400)
int mtu();

@Comment("""
This option can only be changed if SO_REUSEPORT is available on the system (Linux / macOS only).
When this option is available, it is possible to modify how many times Geyser re-binds to the same port,
thereby improving performance on multi-core systems with a lot of incoming connections.
""")
@DefaultNumeric(1)
int listenCount();

@Comment("""
This option specifies the amount of network threads in the Bedrock network event loop group.
When set to -1, this count will be automatically determined based on the amount of available processors.""")
@DefaultNumeric(-1)
int bedrockNetworkThreadCount();

@Comment("""
Whether to connect directly into the Java server without creating a TCP connection.
This should only be disabled if a plugin that interfaces with packets or the network does not work correctly with Geyser.
If enabled, the remote address and port sections are ignored
If disabled, expect performance decrease and latency increase
If enabled, the remote address and port sections are ignored.
If disabled, expect performance decrease and latency increase.
""")
@DefaultBoolean(true)
@PluginSpecific
boolean useDirectConnection();

@Comment("""
Whether Geyser should attempt to disable compression for Bedrock players. This should be a benefit as there is no need to compress data
when Java packets aren't being handled over the network.
Whether Geyser should attempt to disable packet compression (from the Java Server to Geyser) for Bedrock players.
This should be a benefit as there is no need to compress data when Java packets aren't being handled over the network.
This requires use-direct-connection to be true.
""")
@DefaultBoolean(true)
@PluginSpecific
boolean disableCompression();

@Comment("Do not touch!")
@Comment("""
This option disables the auth step Geyser performs for connecting Bedrock players.
It can be used to allow connections from ProxyPass and WaterdogPE. In these cases, make sure that users
cannot directly connect to this Geyser instance. See https://www.spigotmc.org/wiki/firewall-guide/ for
assistance - and use UDP instead of TCP.
Disabling xbox authentication for other use-cases is NOT SUPPORTED, as it allows anyone to spoof usernames,
and is therefore a security risk. All Floodgate functionality (including skin uploading and account linking) will also not work when xbox auth is disabled.
""")
// if u have offline mode enabled pls be safe
boolean disableXboxAuth();

@Comment("The bstats metrics uuid. Do not touch!")
@ExcludePlatform(platforms = {"BungeeCord", "Spigot", "Velocity"}) // bStats platform versions used
default UUID metricsUuid() {
return UUID.randomUUID();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ private <T extends GeyserConfig> T load0(Class<T> configClass) throws IOExceptio
}
return null;
})
.addAction(path("addNonBedrockItems"), rename("enableCustomContent"))
.addAction(path("aboveBedrockNetherBuilding"), rename("netherRoofWorkaround"))
.addAction(path("metrics", "uuid"), (path, value) -> {
if ("generateduuid".equals(value.getString())) {
// Manually copied config without Metrics UUID creation?
Expand All @@ -191,6 +193,8 @@ private <T extends GeyserConfig> T load0(Class<T> configClass) throws IOExceptio
})
.addAction(path("bedrock", "motd1"), rename("primary-motd"))
.addAction(path("bedrock", "motd2"), rename("secondary-motd"))
.addAction(path("bedrock", "enableProxyProtocol"), rename("useProxyProtocol"))
.addAction(path("enableProxyConnections"), rename("performXboxAuthentication"))
.build())
.build();

Expand Down Expand Up @@ -248,7 +252,7 @@ private <T extends GeyserConfig> T load0(Class<T> configClass) throws IOExceptio

private AdvancedConfig migrateToAdvancedConfig(File file, ConfigurationNode configRoot) throws IOException {
Stream<NodePath> copyFromOldConfig = Stream.of("max-visible-custom-skulls", "custom-skull-render-distance", "scoreboard-packet-threshold", "mtu",
"floodgate-key-file", "use-direct-connection", "disable-compression")
"floodgate-key-file", "use-direct-connection", "disable-compression", "performXboxAuthentication")
.map(NodePath::path);

var loader = createLoader(file, ADVANCED_HEADER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@

@ConfigSerializable
public interface GeyserConfig {
@Comment("This section contains config options related to Geyser's Bedrock listener.")
BedrockConfig bedrock();

@Comment("This section contains config options related to Geyser's Java server connection.")
JavaConfig java();

@Comment("""
Expand All @@ -65,6 +67,7 @@ default List<String> savedUserLogins() {
}

@Comment("""
For online mode authentication type only.
Specify how many seconds to wait while user authorizes Geyser to access their Microsoft account.
User is allowed to disconnect from the server during this period.""")
@DefaultNumeric(128)
Expand Down Expand Up @@ -143,13 +146,13 @@ default CooldownUtils.CooldownType showCooldown() {
Geyser's block, item, and skull mappings systems will also be disabled.
This option requires a restart of Geyser in order to change its setting.""")
@DefaultBoolean(true)
boolean addNonBedrockItems();
boolean enableCustomContent();

@Comment("""
Bedrock prevents building and displaying blocks above Y127 in the Nether.
This config option works around that by changing the Nether dimension ID to the End ID.
The main downside to this is that the entire Nether will have the same red fog rather than having different fog for each biome.""")
boolean aboveBedrockNetherBuilding();
boolean netherRoofWorkaround();

@Comment("""
Force clients to load all resource packs if there are any.
Expand Down Expand Up @@ -199,23 +202,25 @@ default CooldownUtils.CooldownType showCooldown() {
interface BedrockConfig extends BedrockListener {
@Override
@Comment("""
The IP address that will listen for connections.
The IP address that Geyser will bind on to listen for connections.
Generally, you should only uncomment and change this if you want to limit what IPs can connect to your server.""")
@NonNull
@DefaultString("0.0.0.0")
@AsteriskSerializer.Asterisk
String address();

@Override
@Comment("The port that will listen for connections")
@Comment("""
The port that will listen for connections.
Since Minecraft: Bedrock Edition uses UDP, this port must allow UDP traffic.""")
@DefaultNumeric(19132)
@NumericRange(from = 0, to = 65535)
int port();

@Override
@Comment("""
The port to broadcast to Bedrock clients with the MOTD that they should use to connect to the server.
DO NOT change this unless Geyser runs on a different internal port than the one that is used to connect.""")
DO NOT change this unless Geyser runs on a different port than the one that is used to connect.""")
@DefaultNumeric(0)
@NumericRange(from = 0, to = 65535)
int broadcastPort();
Expand Down Expand Up @@ -257,10 +262,11 @@ interface BedrockConfig extends BedrockListener {
int compressionLevel();

@Comment("""
Whether to enable PROXY protocol or not for clients. You DO NOT WANT this feature unless you run UDP reverse proxy
in front of your Geyser instance.""")
Whether to expect PROXY protocol for connecting Bedrock clients.
This is useful only when you are running a UDP reverse proxy in front of your Geyser instance.
IF YOU DON'T KNOW WHAT THIS IS, DON'T TOUCH IT!""")
@DefaultBoolean
boolean enableProxyProtocol();
boolean useProxyProtocol();

@Comment("""
A list of allowed PROXY protocol speaking proxy IP addresses/subnets. Only effective when "enable-proxy-protocol" is enabled, and
Expand Down Expand Up @@ -291,9 +297,9 @@ default AuthType authType() {
void authType(AuthType authType);

@Comment("""
Whether to enable PROXY protocol or not while connecting to the server.
Whether to enable PROXY protocol when connecting to the Java server.
This is useful only when:
1) Your server supports PROXY protocol (it probably doesn't)
1) Your Java server supports PROXY protocol (it probably doesn't)
2) You run Velocity or BungeeCord with the option enabled in the proxy's main config.
IF YOU DON'T KNOW WHAT THIS IS, DON'T TOUCH IT!""")
boolean useProxyProtocol();
Expand All @@ -319,12 +325,6 @@ default boolean resolveSrv() {
}
}

@Comment("""
Allow connections from ProxyPass and Waterdog.
See https://www.spigotmc.org/wiki/firewall-guide/ for assistance - use UDP instead of TCP.""")
// if u have offline mode enabled pls be safe
boolean enableProxyConnections();

@Comment("Do not change!")
@SuppressWarnings("unused")
default int configVersion() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ interface RemoteConfig extends JavaConfig {

@Override
@Comment("""
Forward the hostname that the Bedrock client used to connect over to the Java server
This is designed to be used for forced hosts on proxies""")
Forward the hostname that the Bedrock client used to connect over to the Java server.
This is designed to be used for forced hosts on proxies.""")
boolean forwardHostname();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public final class GeyserServer {

public GeyserServer(GeyserImpl geyser, int threadCount) {
this.geyser = geyser;
this.listenCount = Bootstraps.isReusePortAvailable() ? Integer.getInteger("Geyser.ListenCount", 2) : 1;
this.listenCount = Bootstraps.isReusePortAvailable() ? Integer.getInteger("Geyser.ListenCount", geyser.config().advanced().listenCount()) : 1;
GeyserImpl.getInstance().getLogger().debug("Listen thread count: " + listenCount);
this.group = TRANSPORT.eventLoopGroupFactory().apply(listenCount);
this.childGroup = TRANSPORT.eventLoopGroupFactory().apply(threadCount);
Expand All @@ -141,7 +141,7 @@ public GeyserServer(GeyserImpl geyser, int threadCount) {
this.listenCount = 1;
}

if (this.geyser.config().bedrock().enableProxyProtocol()) {
if (this.geyser.config().bedrock().useProxyProtocol()) {
this.proxiedAddresses = ExpiringMap.builder()
.expiration(30 + 1, TimeUnit.MINUTES)
.expirationPolicy(ExpirationPolicy.ACCESSED).build();
Expand Down Expand Up @@ -171,7 +171,7 @@ private void modifyHandlers(ChannelFuture future) {
.addAfter(RakServerOfflineHandler.NAME, RakPingHandler.NAME, new RakPingHandler(this));

// Add proxy handler
boolean isProxyProtocol = this.geyser.config().bedrock().enableProxyProtocol();
boolean isProxyProtocol = this.geyser.config().bedrock().useProxyProtocol();
if (isProxyProtocol) {
channel.pipeline().addFirst("proxy-protocol-decoder", new ProxyServerHandler());
}
Expand Down Expand Up @@ -248,7 +248,7 @@ private ServerBootstrap createBootstrap() {

public boolean onConnectionRequest(InetSocketAddress inetSocketAddress) {
List<String> allowedProxyIPs = geyser.config().bedrock().proxyProtocolWhitelistedIps();
if (geyser.config().bedrock().enableProxyProtocol() && !allowedProxyIPs.isEmpty()) {
if (geyser.config().bedrock().useProxyProtocol() && !allowedProxyIPs.isEmpty()) {
boolean isWhitelistedIP = false;
for (CIDRMatcher matcher : getWhitelistedIPsMatchers()) {
if (matcher.matches(inetSocketAddress.getAddress())) {
Expand All @@ -265,7 +265,7 @@ public boolean onConnectionRequest(InetSocketAddress inetSocketAddress) {

String ip;
if (geyser.config().logPlayerIpAddresses()) {
if (geyser.config().bedrock().enableProxyProtocol()) {
if (geyser.config().bedrock().useProxyProtocol()) {
ip = this.proxiedAddresses.getOrDefault(inetSocketAddress, inetSocketAddress).toString();
} else {
ip = inetSocketAddress.toString();
Expand Down Expand Up @@ -294,7 +294,7 @@ public BedrockPong onQuery(Channel channel, InetSocketAddress inetSocketAddress)
if (geyser.config().debugMode() && PRINT_DEBUG_PINGS) {
String ip;
if (geyser.config().logPlayerIpAddresses()) {
if (geyser.config().bedrock().enableProxyProtocol()) {
if (geyser.config().bedrock().useProxyProtocol()) {
ip = this.proxiedAddresses.getOrDefault(inetSocketAddress, inetSocketAddress).toString();
} else {
ip = inetSocketAddress.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class SkullResourcePackManager {

Path packPath = cachePath.resolve("player_skulls.mcpack");
File packFile = packPath.toFile();
if (BlockRegistries.CUSTOM_SKULLS.get().isEmpty() || !GeyserImpl.getInstance().config().addNonBedrockItems()) {
if (BlockRegistries.CUSTOM_SKULLS.get().isEmpty() || !GeyserImpl.getInstance().config().enableCustomContent()) {
packFile.delete(); // No need to keep resource pack
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public enum Stage {
* @param stage the stage to populate
*/
public static void populate(Stage stage) {
if (!GeyserImpl.getInstance().config().addNonBedrockItems()) {
if (!GeyserImpl.getInstance().config().enableCustomContent()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void populate() {
SkullResourcePackManager.SKULL_SKINS.clear(); // Remove skins after reloading
BlockRegistries.CUSTOM_SKULLS.set(Object2ObjectMaps.emptyMap());

if (!GeyserImpl.getInstance().config().addNonBedrockItems()) {
if (!GeyserImpl.getInstance().config().enableCustomContent()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public static void populate() {
throw new AssertionError("Unable to load Bedrock item components", e);
}

boolean customItemsAllowed = GeyserImpl.getInstance().config().addNonBedrockItems();
boolean customItemsAllowed = GeyserImpl.getInstance().config().enableCustomContent();

// List values here is important compared to HashSet - we need to preserve the order of what's given to us
// (as of 1.19.2 Java) to replicate some edge cases in Java predicate behavior where it checks from the bottom
Expand Down
Loading