@Override public ConnectFuture verify(long timeout) throws IOException { long startTime = System.nanoTime(); ClientSession session = verifyResult(ClientSession.class, timeout); long endTime = System.nanoTime(); if (debugEnabled) { IoSession ioSession = session.getIoSession(); log.debug("Connected to " + ioSession.getRemoteAddress() + " after " + (endTime - startTime) + " nanos"); } return this; }
@Override public ConnectFuture verify(long timeout) throws IOException { long startTime = System.nanoTime(); ClientSession session = verifyResult(ClientSession.class, timeout); long endTime = System.nanoTime(); if (debugEnabled) { IoSession ioSession = session.getIoSession(); log.debug("Connected to " + ioSession.getRemoteAddress() + " after " + (endTime - startTime) + " nanos"); } return this; }
/** * Uses the remote host address, port and current username to create a unique identifier * * @param session The {@link ClientSession} * @return The unique identifier * @see #getFileSystemIdentifier(String, int, String) */ public static String getFileSystemIdentifier(ClientSession session) { IoSession ioSession = session.getIoSession(); SocketAddress addr = ioSession.getRemoteAddress(); String username = session.getUsername(); if (addr instanceof InetSocketAddress) { InetSocketAddress inetAddr = (InetSocketAddress) addr; return getFileSystemIdentifier(inetAddr.getHostString(), inetAddr.getPort(), username); } else { return getFileSystemIdentifier(addr.toString(), ConfigFileReaderSupport.DEFAULT_PORT, username); } }
@Override public void sendClientProxyMetadata(ClientSession sshSession) throws Exception { init(sshSession); IoSession session = sshSession.getIoSession(); session.addCloseFutureListener(f -> close()); StringBuilder msg = connect(); if (proxyUser != null && !proxyUser.isEmpty() || proxyPassword != null && proxyPassword.length > 0) { authenticator = basic; basic.setParams(null); basic.start(); msg = authenticate(msg, basic.getToken()); clearPassword(); proxyUser = null; } ongoing = true; try { send(msg, session); } catch (Exception e) { ongoing = false; throw e; } }
@Override public void sendClientProxyMetadata(ClientSession sshSession) throws Exception { init(sshSession); IoSession session = sshSession.getIoSession(); // Send the initial request Buffer buffer = new ByteArrayBuffer(5, false); buffer.putByte(SOCKS_VERSION_5); context = getGSSContext(remoteAddress); authenticationProposals = getAuthenticationProposals(); buffer.putByte((byte) authenticationProposals.length); buffer.putRawBytes(authenticationProposals); state = ProtocolState.INIT; session.writePacket(buffer).verify(getTimeout()); }