mirror of
https://github.com/GeyserMC/Geyser.git
synced 2026-01-04 15:31:36 +00:00
Rename and migrate proxy-protocol-whitelisted-ips to haproxy-protocol-whitelisted-ips
This commit is contained in:
@@ -113,15 +113,15 @@ public class ConfigMigrations {
|
||||
|
||||
// Bedrock
|
||||
.addAction(path("bedrock", "broadcast-port"), moveTo("advanced", "bedrock"))
|
||||
.addAction(path("bedrock", "compression-level"), renameAndMove("advanced", "bedrock", "compression-level"))
|
||||
.addAction(path("bedrock", "compression-level"), moveTo("advanced", "bedrock"))
|
||||
.addAction(path("bedrock", "enable-proxy-protocol"), renameAndMove("advanced", "bedrock", "use-haproxy-protocol"))
|
||||
.addAction(path("bedrock", "proxy-protocol-whitelisted-ips"), renameAndMove("advanced", "bedrock", "proxy-protocol-whitelisted-ips"))
|
||||
.addAction(path("bedrock", "proxy-protocol-whitelisted-ips"), renameAndMove("advanced", "bedrock", "haproxy-protocol-whitelisted-ips"))
|
||||
.addAction(path("mtu"), moveTo("advanced", "bedrock"))
|
||||
|
||||
// Java
|
||||
.addAction(path("remote", "use-proxy-protocol"), renameAndMove("advanced", "java", "use-haproxy-protocol"))
|
||||
.addAction(path("disable-compression"), renameAndMove("advanced", "java", "disable-compression"))
|
||||
.addAction(path("use-direct-connection"), renameAndMove("advanced", "java", "use-direct-connection"))
|
||||
.addAction(path("disable-compression"), moveTo("advanced", "java"))
|
||||
.addAction(path("use-direct-connection"), moveTo("advanced", "java"))
|
||||
|
||||
// Other
|
||||
.addAction(path("default-locale"), (path, value) -> {
|
||||
|
||||
@@ -367,7 +367,7 @@ public interface GeyserConfig {
|
||||
should really only be used when you are not able to use a proper firewall (usually true with shared hosting providers etc.).
|
||||
Keeping this list empty means there is no IP address whitelist.
|
||||
IP addresses, subnets, and links to plain text files are supported.""")
|
||||
default List<String> proxyProtocolWhitelistedIps() {
|
||||
default List<String> haproxyProtocolWhitelistedIps() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ public final class GeyserServer {
|
||||
channel.pipeline().addFirst("proxy-protocol-decoder", new ProxyServerHandler());
|
||||
}
|
||||
|
||||
boolean isWhitelistedProxyProtocol = isProxyProtocol && !this.geyser.config().advanced().bedrock().proxyProtocolWhitelistedIps().isEmpty();
|
||||
boolean isWhitelistedProxyProtocol = isProxyProtocol && !this.geyser.config().advanced().bedrock().haproxyProtocolWhitelistedIps().isEmpty();
|
||||
if (Boolean.parseBoolean(System.getProperty("Geyser.RakRateLimitingDisabled", "false")) || isWhitelistedProxyProtocol) {
|
||||
// We would already block any non-whitelisted IP addresses in onConnectionRequest so we can remove the rate limiter
|
||||
channel.pipeline().remove(RakServerRateLimiter.NAME);
|
||||
@@ -242,7 +242,7 @@ public final class GeyserServer {
|
||||
}
|
||||
|
||||
public boolean onConnectionRequest(InetSocketAddress inetSocketAddress) {
|
||||
List<String> allowedProxyIPs = geyser.config().advanced().bedrock().proxyProtocolWhitelistedIps();
|
||||
List<String> allowedProxyIPs = geyser.config().advanced().bedrock().haproxyProtocolWhitelistedIps();
|
||||
if (geyser.config().advanced().bedrock().useHaproxyProtocol() && !allowedProxyIPs.isEmpty()) {
|
||||
boolean isWhitelistedIP = false;
|
||||
for (CIDRMatcher matcher : getWhitelistedIPsMatchers()) {
|
||||
@@ -392,7 +392,7 @@ public final class GeyserServer {
|
||||
private List<CIDRMatcher> whitelistedIPsMatchers = null;
|
||||
|
||||
/**
|
||||
* @return Unmodifiable list of {@link CIDRMatcher}s from {@link GeyserConfig.AdvancedBedrockConfig#proxyProtocolWhitelistedIps()}
|
||||
* @return Unmodifiable list of {@link CIDRMatcher}s from {@link GeyserConfig.AdvancedBedrockConfig#haproxyProtocolWhitelistedIps()}
|
||||
*/
|
||||
public List<CIDRMatcher> getWhitelistedIPsMatchers() {
|
||||
// Effective Java, Third Edition; Item 83: Use lazy initialization judiciously
|
||||
@@ -401,7 +401,7 @@ public final class GeyserServer {
|
||||
synchronized (this) {
|
||||
// Check if proxyProtocolWhitelistedIPs contains URLs we need to fetch and parse by line
|
||||
List<String> whitelistedCIDRs = new ArrayList<>();
|
||||
for (String ip: geyser.config().advanced().bedrock().proxyProtocolWhitelistedIps()) {
|
||||
for (String ip: geyser.config().advanced().bedrock().haproxyProtocolWhitelistedIps()) {
|
||||
if (!ip.startsWith("http")) {
|
||||
whitelistedCIDRs.add(ip);
|
||||
continue;
|
||||
|
||||
@@ -211,7 +211,7 @@ advanced:
|
||||
# should really only be used when you are not able to use a proper firewall (usually true with shared hosting providers etc.).
|
||||
# Keeping this list empty means there is no IP address whitelist.
|
||||
# IP addresses, subnets, and links to plain text files are supported.
|
||||
proxy-protocol-whitelisted-ips:
|
||||
haproxy-protocol-whitelisted-ips:
|
||||
- 127.0.0.1
|
||||
- 172.18.0.0/13
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ advanced:
|
||||
# should really only be used when you are not able to use a proper firewall (usually true with shared hosting providers etc.).
|
||||
# Keeping this list empty means there is no IP address whitelist.
|
||||
# IP addresses, subnets, and links to plain text files are supported.
|
||||
proxy-protocol-whitelisted-ips:
|
||||
haproxy-protocol-whitelisted-ips:
|
||||
- 127.0.0.1
|
||||
- 172.18.0.0/13
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ advanced:
|
||||
# should really only be used when you are not able to use a proper firewall (usually true with shared hosting providers etc.).
|
||||
# Keeping this list empty means there is no IP address whitelist.
|
||||
# IP addresses, subnets, and links to plain text files are supported.
|
||||
proxy-protocol-whitelisted-ips: []
|
||||
haproxy-protocol-whitelisted-ips: []
|
||||
|
||||
# The internet supports a maximum MTU of 1492 but could cause issues with packet fragmentation.
|
||||
# 1400 is the default.
|
||||
|
||||
@@ -201,7 +201,7 @@ advanced:
|
||||
# should really only be used when you are not able to use a proper firewall (usually true with shared hosting providers etc.).
|
||||
# Keeping this list empty means there is no IP address whitelist.
|
||||
# IP addresses, subnets, and links to plain text files are supported.
|
||||
proxy-protocol-whitelisted-ips: []
|
||||
haproxy-protocol-whitelisted-ips: []
|
||||
|
||||
# The internet supports a maximum MTU of 1492 but could cause issues with packet fragmentation.
|
||||
# 1400 is the default.
|
||||
|
||||
@@ -211,7 +211,7 @@ advanced:
|
||||
# should really only be used when you are not able to use a proper firewall (usually true with shared hosting providers etc.).
|
||||
# Keeping this list empty means there is no IP address whitelist.
|
||||
# IP addresses, subnets, and links to plain text files are supported.
|
||||
proxy-protocol-whitelisted-ips: []
|
||||
haproxy-protocol-whitelisted-ips: []
|
||||
|
||||
# The internet supports a maximum MTU of 1492 but could cause issues with packet fragmentation.
|
||||
# 1400 is the default.
|
||||
|
||||
@@ -201,7 +201,7 @@ advanced:
|
||||
# should really only be used when you are not able to use a proper firewall (usually true with shared hosting providers etc.).
|
||||
# Keeping this list empty means there is no IP address whitelist.
|
||||
# IP addresses, subnets, and links to plain text files are supported.
|
||||
proxy-protocol-whitelisted-ips: []
|
||||
haproxy-protocol-whitelisted-ips: []
|
||||
|
||||
# The internet supports a maximum MTU of 1492 but could cause issues with packet fragmentation.
|
||||
# 1400 is the default.
|
||||
|
||||
Reference in New Issue
Block a user