Add support for listening and connecting to servers listening on Unix sockets

This commit is contained in:
Andrew Steinborn
2020-10-22 02:01:29 -04:00
parent 29890d7c20
commit b00389029f
16 changed files with 183 additions and 68 deletions

View File

@@ -3,6 +3,7 @@ package com.velocitypowered.api.proxy;
import com.velocitypowered.api.network.ProtocolVersion;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Optional;
/**
@@ -11,11 +12,11 @@ import java.util.Optional;
public interface InboundConnection {
/**
* Returns the player's IP address.
* Returns the player's remote address.
*
* @return the player's IP
* @return the player's remote address
*/
InetSocketAddress getRemoteAddress();
SocketAddress getRemoteAddress();
/**
* Returns the hostname that the user entered into the client, if applicable.

View File

@@ -28,7 +28,6 @@ public interface Player extends CommandSource, Identified, InboundConnection,
*/
String getUsername();
/**
* Returns the player's UUID.
*

View File

@@ -10,7 +10,7 @@ import com.velocitypowered.api.proxy.server.RegisteredServer;
import com.velocitypowered.api.proxy.server.ServerInfo;
import com.velocitypowered.api.scheduler.Scheduler;
import com.velocitypowered.api.util.ProxyVersion;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Collection;
import java.util.Optional;
import java.util.UUID;
@@ -163,7 +163,7 @@ public interface ProxyServer extends Audience {
*
* @return the address the proxy is bound to
*/
InetSocketAddress getBoundAddress();
SocketAddress getBoundAddress();
/**
* Gets the {@link ProxyConfig} instance.

View File

@@ -2,6 +2,7 @@ package com.velocitypowered.api.proxy.server;
import com.google.common.base.Preconditions;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -12,7 +13,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public final class ServerInfo implements Comparable<ServerInfo> {
private final String name;
private final InetSocketAddress address;
private final SocketAddress address;
/**
* Creates a new ServerInfo object.
@@ -20,7 +21,7 @@ public final class ServerInfo implements Comparable<ServerInfo> {
* @param name the name for the server
* @param address the address of the server to connect to
*/
public ServerInfo(String name, InetSocketAddress address) {
public ServerInfo(String name, SocketAddress address) {
this.name = Preconditions.checkNotNull(name, "name");
this.address = Preconditions.checkNotNull(address, "address");
}
@@ -29,7 +30,7 @@ public final class ServerInfo implements Comparable<ServerInfo> {
return name;
}
public final InetSocketAddress getAddress() {
public final SocketAddress getAddress() {
return address;
}