Package org.ametys.core.util
Class IPRestrictedSocket
java.lang.Object
java.net.Socket
org.ametys.core.util.IPRestrictedSocket
- All Implemented Interfaces:
Closeable,AutoCloseable
A socket implementation that will block connection to a set of IP address
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classException indicating that the connection to host was refused due to security restriction set on the client -
Constructor Summary
ConstructorsConstructorDescriptionIPRestrictedSocket(Pattern pattern) Create a socket that block connection to a set of IP address.IPRestrictedSocket(Pattern pattern, Proxy proxy) Create a socket that block connection to a set of IP address -
Method Summary
Methods inherited from class java.net.Socket
bind, close, connect, getChannel, getInetAddress, getInputStream, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOption, getOutputStream, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setOption, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, supportedOptions, toString
-
Constructor Details
-
IPRestrictedSocket
Create a socket that block connection to a set of IP address.- Parameters:
pattern- a regex to match against IP address (v4 or v6). Any address that matches the regex will be block.
-
IPRestrictedSocket
Create a socket that block connection to a set of IP address- Parameters:
pattern- a regex to match against IP address (v4 or v6). Any address that matches the regex will be block.proxy- the kind of proxy to use
-
-
Method Details
-
connect
- Overrides:
connectin classSocket- Throws:
IOException
-