a geicko-2 based round robin ranking system designed to test c++ battleship submissions battleship.dunkirk.sh
1/* 2Package ssh wraps the crypto/ssh package with a higher-level API for building 3SSH servers. The goal of the API was to make it as simple as using net/http, so 4the API is very similar. 5 6You should be able to build any SSH server using only this package, which wraps 7relevant types and some functions from crypto/ssh. However, you still need to 8use crypto/ssh for building SSH clients. 9 10ListenAndServe starts an SSH server with a given address, handler, and options. The 11handler is usually nil, which means to use DefaultHandler. Handle sets DefaultHandler: 12 13 ssh.Handle(func(s ssh.Session) { 14 io.WriteString(s, "Hello world\n") 15 }) 16 17 log.Fatal(ssh.ListenAndServe(":2222", nil)) 18 19If you don't specify a host key, it will generate one every time. This is convenient 20except you'll have to deal with clients being confused that the host key is different. 21It's a better idea to generate or point to an existing key on your system: 22 23 log.Fatal(ssh.ListenAndServe(":2222", nil, ssh.HostKeyFile("/Users/progrium/.ssh/id_rsa"))) 24 25Although all options have functional option helpers, another way to control the 26server's behavior is by creating a custom Server: 27 28 s := &ssh.Server{ 29 Addr: ":2222", 30 Handler: sessionHandler, 31 PublicKeyHandler: authHandler, 32 } 33 s.AddHostKey(hostKeySigner) 34 35 log.Fatal(s.ListenAndServe()) 36 37This package automatically handles basic SSH requests like setting environment 38variables, requesting PTY, and changing window size. These requests are 39processed, responded to, and any relevant state is updated. This state is then 40exposed to you via the Session interface. 41 42The one big feature missing from the Session abstraction is signals. This was 43started, but not completed. Pull Requests welcome! 44*/ 45package ssh