Package org.bluezoo.gumdrop.socks.client
Class SOCKSClientConfig
java.lang.Object
org.bluezoo.gumdrop.socks.client.SOCKSClientConfig
Configuration for a SOCKS client connection.
Holds the SOCKS protocol version preference, optional authentication credentials, and timeout settings.
- Author:
- Chris Burdess
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSOCKS version preference for the client. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a config with default settings (SOCKS5, no auth).SOCKSClientConfig(String username, String password) Creates a config with username/password authentication. -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the handshake timeout in milliseconds.Returns the authentication password.Returns the authentication username.Returns the SOCKS version preference.booleanReturns whether credentials are configured.setHandshakeTimeoutMs(long timeoutMs) Sets the handshake timeout for the SOCKS negotiation.setPassword(String password) Sets the authentication password.setUsername(String username) Sets the authentication username.setVersion(SOCKSClientConfig.Version version) Sets the SOCKS version preference.
-
Constructor Details
-
SOCKSClientConfig
public SOCKSClientConfig()Creates a config with default settings (SOCKS5, no auth). -
SOCKSClientConfig
Creates a config with username/password authentication.- Parameters:
username- the usernamepassword- the password
-
-
Method Details
-
getVersion
Returns the SOCKS version preference.- Returns:
- the version preference
-
setVersion
Sets the SOCKS version preference.- Parameters:
version- the version preference- Returns:
- this config for chaining
-
getUsername
Returns the authentication username. Used for SOCKS5 username/password authentication (RFC 1929 §2).- Returns:
- the username, or null if no authentication
-
setUsername
Sets the authentication username. Used for SOCKS5 username/password authentication (RFC 1929 §2).- Parameters:
username- the username- Returns:
- this config for chaining
-
getPassword
Returns the authentication password. Used for SOCKS5 username/password authentication (RFC 1929 §2).- Returns:
- the password, or null if no authentication
-
setPassword
Sets the authentication password. Used for SOCKS5 username/password authentication (RFC 1929 §2).- Parameters:
password- the password- Returns:
- this config for chaining
-
getHandshakeTimeoutMs
public long getHandshakeTimeoutMs()Returns the handshake timeout in milliseconds.- Returns:
- the timeout
-
setHandshakeTimeoutMs
Sets the handshake timeout for the SOCKS negotiation.- Parameters:
timeoutMs- the timeout in milliseconds- Returns:
- this config for chaining
-
hasCredentials
public boolean hasCredentials()Returns whether credentials are configured.- Returns:
- true if both username and password are non-null
-