INNER CODE UNIT · Go

SSHListenOnPort

GoMudEngine/GoMud · main.go:1382

func SSHListenOnPort(portNum int, sshConfig *ssh.ServerConfig, wg *sync.WaitGroup, maxConnections int) net.Listener {

	server, err := net.Listen("tcp", fmt.Sprintf(":%d", portNum))
	if err != nil {
		mudlog.Error("Error creating SSH server", "error", err)
		return nil
	}

	mudlog.Info("SSH", "status", "listening", "port", portNum)

	go func() {
		for {
			conn, err := server.Accept()

			if !serverAlive.Load() {
				mudlog.Warn("SSH connections disabled.")
				return
			}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…