Cherry-pick full Unix domain socket support from b00389029f

Closes #991. We can't properly support this without an API break, so let's just do it in 5.0.0.
This commit is contained in:
Andrew Steinborn
2020-10-22 02:01:29 -04:00
parent 02ed711573
commit 771dfa8d0e
18 changed files with 218 additions and 89 deletions

View File

@@ -9,22 +9,22 @@ package com.velocitypowered.api.event.proxy;
import com.google.common.base.Preconditions;
import com.velocitypowered.api.network.ListenerType;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
/**
* This event is fired by the proxy after a listener starts accepting connections.
*/
public final class ListenerBoundEvent {
private final InetSocketAddress address;
private final SocketAddress address;
private final ListenerType listenerType;
public ListenerBoundEvent(InetSocketAddress address, ListenerType listenerType) {
public ListenerBoundEvent(SocketAddress address, ListenerType listenerType) {
this.address = Preconditions.checkNotNull(address, "address");
this.listenerType = Preconditions.checkNotNull(listenerType, "listenerType");
}
public InetSocketAddress getAddress() {
public SocketAddress getAddress() {
return address;
}

View File

@@ -9,22 +9,22 @@ package com.velocitypowered.api.event.proxy;
import com.google.common.base.Preconditions;
import com.velocitypowered.api.network.ListenerType;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
/**
* This event is fired by the proxy before the proxy stops accepting connections.
*/
public final class ListenerCloseEvent {
private final InetSocketAddress address;
private final SocketAddress address;
private final ListenerType listenerType;
public ListenerCloseEvent(InetSocketAddress address, ListenerType listenerType) {
public ListenerCloseEvent(SocketAddress address, ListenerType listenerType) {
this.address = Preconditions.checkNotNull(address, "address");
this.listenerType = Preconditions.checkNotNull(listenerType, "listenerType");
}
public InetSocketAddress getAddress() {
public SocketAddress getAddress() {
return address;
}

View File

@@ -9,6 +9,7 @@ package com.velocitypowered.api.proxy;
import com.velocitypowered.api.network.ProtocolVersion;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Optional;
/**
@@ -17,11 +18,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

@@ -31,7 +31,6 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.text.event.HoverEventSource;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.NotNull;
/**

View File

@@ -18,7 +18,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;
@@ -179,7 +179,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

@@ -8,7 +8,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;
@@ -19,7 +19,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.
@@ -27,7 +27,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");
}
@@ -36,7 +36,7 @@ public final class ServerInfo implements Comparable<ServerInfo> {
return name;
}
public final InetSocketAddress getAddress() {
public final SocketAddress getAddress() {
return address;
}