Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Jan 24, 2025
1 parent 48bc1e8 commit 3c0b224
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ afterEvaluate {
spotless {
java {
trimTrailingWhitespace()
indentWithSpaces(2)
leadingTabsToSpaces(2)
endWithNewline()

importOrder("", "javax|java", "\\#")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@
package com.soulfiremc.server.protocol.netty;

import com.soulfiremc.server.SoulFireScheduler;
import com.soulfiremc.server.proxy.SFProxy;
import com.soulfiremc.server.util.SFHelpers;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.handler.proxy.HttpProxyHandler;
import io.netty.handler.proxy.Socks4ProxyHandler;
import io.netty.handler.proxy.Socks5ProxyHandler;
import org.geysermc.mcprotocollib.network.helper.TransportHelper;

public class SFNettyHelper {
Expand All @@ -40,19 +34,4 @@ public static EventLoopGroup createEventLoopGroup(String name, SoulFireScheduler

return group;
}

public static void addProxy(ChannelPipeline pipeline, SFProxy proxy) {
var address = proxy.getSocketAddress();
SFHelpers.mustSupply(() -> switch (proxy.type()) {
case HTTP -> () -> {
if (proxy.username() != null && proxy.password() != null) {
pipeline.addLast("proxy", new HttpProxyHandler(address, proxy.username(), proxy.password()));
} else {
pipeline.addLast("proxy", new HttpProxyHandler(address));
}
};
case SOCKS4 -> () -> pipeline.addLast("proxy", new Socks4ProxyHandler(address, proxy.username()));
case SOCKS5 -> () -> pipeline.addLast("proxy", new Socks5ProxyHandler(address, proxy.username(), proxy.password()));
});
}
}

0 comments on commit 3c0b224

Please sign in to comment.