Class UnixDomainSocketConnector
- java.lang.Object
-
- org.eclipse.jgit.transport.sshd.agent.AbstractConnector
-
- org.eclipse.jgit.internal.transport.sshd.agent.connector.UnixDomainSocketConnector
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Connector
public class UnixDomainSocketConnector extends AbstractConnector
JNA-based implementation of communication through a Unix domain socket.
-
-
Field Summary
Fields Modifier and Type Field Description static ConnectorFactory.ConnectorDescriptor
DESCRIPTOR
-
Fields inherited from class org.eclipse.jgit.transport.sshd.agent.AbstractConnector
DEFAULT_MAX_REPLY_LENGTH
-
-
Constructor Summary
Constructors Constructor Description UnixDomainSocketConnector(String socketFile)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
connect()
Connects to an SSH agent if there is one running.byte[]
rpc(byte command, byte[] message)
Performs a remote call to the SSH agent and returns the result.-
Methods inherited from class org.eclipse.jgit.transport.sshd.agent.AbstractConnector
getMaximumMessageLength, prepareMessage, toLength
-
-
-
-
Field Detail
-
DESCRIPTOR
public static final ConnectorFactory.ConnectorDescriptor DESCRIPTOR
-
-
Constructor Detail
-
UnixDomainSocketConnector
public UnixDomainSocketConnector(String socketFile)
Creates a new instance.- Parameters:
socketFile
- to use; ifnull
or empty, use environment variable SSH_AUTH_SOCK
-
-
Method Detail
-
connect
public boolean connect() throws IOException
Description copied from interface:Connector
Connects to an SSH agent if there is one running. If called when already connected just returnstrue
.- Returns:
true
if an SSH agent is available and connected, if no SSH agent is available- Throws:
IOException
- if connecting to the SSH agent failed
-
close
public void close() throws IOException
- Throws:
IOException
-
rpc
public byte[] rpc(byte command, byte[] message) throws IOException
Description copied from interface:Connector
Performs a remote call to the SSH agent and returns the result.- Parameters:
command
- to sendmessage
- to send; must have at least 5 bytes, and must have 5 unused bytes at the front.- Returns:
- the result received
- Throws:
IOException
- if an error occurs
-
-