add logs
This commit is contained in:
		
							parent
							
								
									1e2334dbff
								
							
						
					
					
						commit
						1442f37df8
					
				@ -21,6 +21,7 @@ public class AppleTunneler extends JavaPlugin {
 | 
			
		||||
        }
 | 
			
		||||
        sshSession = jsch.getSession(getUsername(), getHost(), getPort());
 | 
			
		||||
        sshSession.connect(2000);
 | 
			
		||||
        getLogger().info("Ssh connection started successfully!");
 | 
			
		||||
        loadRemoteToLocalPortForwarding();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -49,13 +50,15 @@ public class AppleTunneler extends JavaPlugin {
 | 
			
		||||
        for (File id : files) {
 | 
			
		||||
            jsch.addIdentity(id.getPath());
 | 
			
		||||
        }
 | 
			
		||||
        getLogger().info("Ids were loaded!");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void loadRemoteToLocalPortForwarding() throws JSchException {
 | 
			
		||||
        for (String line : getConfig().getStringList("ports")) {
 | 
			
		||||
            String[] array = line.split(":");
 | 
			
		||||
            sshSession.setPortForwardingL(Integer.parseInt(array[0]), array[1], Integer.parseInt(array[2]));
 | 
			
		||||
            sshSession.setPortForwardingL(line);
 | 
			
		||||
            getLogger().info(line);
 | 
			
		||||
        }
 | 
			
		||||
        getLogger().info("ports has been set!");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void loadKnownHostFile() throws FileNotFoundException, JSchException {
 | 
			
		||||
@ -68,6 +71,7 @@ public class AppleTunneler extends JavaPlugin {
 | 
			
		||||
            throw new RuntimeException("Known host file does not exists in plugin folder");
 | 
			
		||||
        }
 | 
			
		||||
        this.jsch.setKnownHosts(new FileInputStream(knownHosts));
 | 
			
		||||
        getLogger().info("host file was loaded!");
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user