mirror of
				https://github.com/shazow/ssh-chat.git
				synced 2025-11-04 05:25:33 +01:00 
			
		
		
		
	Also print bind information on startup. An alternative to this approach would be to use info level logging, but the issue makes me think we want it all the time. I altered the README to show use of non-default port 22 which makes the note about root/sudo below still make sense.
		
			
				
	
	
		
			35 lines
		
	
	
		
			520 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			520 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package sshd
 | 
						|
 | 
						|
/*
 | 
						|
 | 
						|
	signer, err := ssh.ParsePrivateKey(privateKey)
 | 
						|
 | 
						|
	config := MakeNoAuth()
 | 
						|
	config.AddHostKey(signer)
 | 
						|
 | 
						|
	s, err := ListenSSH("0.0.0.0:2022", config)
 | 
						|
	if err != nil {
 | 
						|
		// Handle opening socket error
 | 
						|
	}
 | 
						|
	defer s.Close()
 | 
						|
 | 
						|
	terminals := s.ServeTerminal()
 | 
						|
 | 
						|
	for term := range terminals {
 | 
						|
		go func() {
 | 
						|
			defer term.Close()
 | 
						|
			term.SetPrompt("...")
 | 
						|
			term.AutoCompleteCallback = nil // ...
 | 
						|
 | 
						|
			for {
 | 
						|
				line, err := term.ReadLine()
 | 
						|
				if err != nil {
 | 
						|
					break
 | 
						|
				}
 | 
						|
				term.Write(...)
 | 
						|
			}
 | 
						|
 | 
						|
		}()
 | 
						|
	}
 | 
						|
*/
 |