func()

in pkg/sshd/ssh.go [334:367]


func (scon *Server) handleServerConnRequests(ctx context.Context, reqs <-chan *gossh.Request, nConn net.Conn, conn *gossh.ServerConn) {
	for r := range reqs {
		// Global types.
		switch r.Type {
		// "-R": we expect at least one R with 0.0.0.0 and port 5222, corresponding to the main mux dispatcher.
		// SSHClientConn clients will only accept back connections with this particular host:port, and srcIP:srcPort.
		// Other reverse accept ports can be opened as well.
		case "tcpip-forward":
			var req tcpipForwardRequest
			err := gossh.Unmarshal(r.Payload, &req)
			if err != nil {
				log.Println("malformed-tcpip-request", err)
				r.Reply(false, nil)
				continue
			}

			go scon.forwardHandler.HandleSSHRequest(ctx, scon, r, conn)

			continue

		case "keepalive@openssh.com":
			//n.LastSeen = time.Now()
			//log.Println("SSHD: client keepalive", n.VIP)
			r.Reply(true, nil)

		default:
			log.Println("SSHD: unknown global REQUEST ", r.Type)
			if r.WantReply {
				log.Println(r.Type)
				r.Reply(false, nil)
			}
		}
	}
}