Package org.apache.sshd.common.forward
Class LocalForwardingEntry
- java.lang.Object
-
- org.apache.sshd.common.forward.LocalForwardingEntry
-
public class LocalForwardingEntry extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private SshdSocketAddress
bound
private SshdSocketAddress
combined
private SshdSocketAddress
local
-
Constructor Summary
Constructors Constructor Description LocalForwardingEntry(SshdSocketAddress local, java.net.InetSocketAddress bound)
LocalForwardingEntry(SshdSocketAddress local, SshdSocketAddress bound)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
static LocalForwardingEntry
findMatchingEntry(java.lang.String host, boolean anyLocalAddress, int port, java.util.Collection<? extends LocalForwardingEntry> entries)
static LocalForwardingEntry
findMatchingEntry(java.lang.String host, int port, java.util.Collection<? extends LocalForwardingEntry> entries)
SshdSocketAddress
getBoundAddress()
SshdSocketAddress
getCombinedBoundAddress()
A combined address using the following logic: If original requested local binding has a specific port and non-wildcard address then use the local binding as-is If original requested local binding has a specific address but no specific port, then combine its address with the actual auto-allocated port at binding. If original requested local binding has neither a specific address nor a specific port then use the effective bound address.SshdSocketAddress
getLocalAddress()
int
hashCode()
static SshdSocketAddress
resolveCombinedBoundAddress(SshdSocketAddress local, SshdSocketAddress bound)
java.lang.String
toString()
-
-
-
Field Detail
-
local
private final SshdSocketAddress local
-
bound
private final SshdSocketAddress bound
-
combined
private final SshdSocketAddress combined
-
-
Constructor Detail
-
LocalForwardingEntry
public LocalForwardingEntry(SshdSocketAddress local, java.net.InetSocketAddress bound)
-
LocalForwardingEntry
public LocalForwardingEntry(SshdSocketAddress local, SshdSocketAddress bound)
-
-
Method Detail
-
getLocalAddress
public SshdSocketAddress getLocalAddress()
- Returns:
- The original requested local address for binding
-
getBoundAddress
public SshdSocketAddress getBoundAddress()
- Returns:
- The actual bound address
-
getCombinedBoundAddress
public SshdSocketAddress getCombinedBoundAddress()
A combined address using the following logic:- If original requested local binding has a specific port and non-wildcard address then use the local binding as-is
- If original requested local binding has a specific address but no specific port, then combine its address with the actual auto-allocated port at binding.
- If original requested local binding has neither a specific address nor a specific port then use the effective bound address.
- Returns:
- Combined result
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
resolveCombinedBoundAddress
public static SshdSocketAddress resolveCombinedBoundAddress(SshdSocketAddress local, SshdSocketAddress bound)
-
findMatchingEntry
public static LocalForwardingEntry findMatchingEntry(java.lang.String host, int port, java.util.Collection<? extends LocalForwardingEntry> entries)
-
findMatchingEntry
public static LocalForwardingEntry findMatchingEntry(java.lang.String host, boolean anyLocalAddress, int port, java.util.Collection<? extends LocalForwardingEntry> entries)
- Parameters:
host
- The host - ignored ifnull
/empty and not wildcard address match - i.e., no match reportedanyLocalAddress
- Is host the wildcard address - in which case, we try an exact match first for the host, and if that fails then only the port is matchedport
- The port - ignored if non-positive - i.e., no match reportedentries
- TheCollection
ofLocalForwardingEntry
to check - ignored ifnull
/empty - i.e., no match reported- Returns:
- The first entry whose local or bound address matches the host name - case
insensitive and has a matching bound port -
null
if no match found
-
-