MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / ConnectToNode

Method ConnectToNode

internal/vnc/service.go:92–116  ·  view source on GitHub ↗

ConnectToNode opens a VNC shell connection to a node in the user's browser.

(nodeName string)

Source from the content-addressed store, hash-verified

90
91// ConnectToNode opens a VNC shell connection to a node in the user's browser.
92func (s *Service) ConnectToNode(nodeName string) error {
93 s.logger.Info("Connecting to node VNC shell: %s", nodeName)
94
95 // Generate the VNC shell URL
96 vncURL, err := s.client.GenerateNodeVNCURL(nodeName)
97 if err != nil {
98 s.logger.Error("Failed to generate VNC shell URL for node %s: %v", nodeName, err)
99
100 return fmt.Errorf("failed to generate VNC shell URL: %w", err)
101 }
102
103 s.logger.Debug("Generated VNC shell URL for node %s: %s", nodeName, vncURL)
104
105 // Open the URL in the default browser
106 err = openBrowser(vncURL)
107 if err != nil {
108 s.logger.Error("Failed to open browser for node %s VNC shell: %v", nodeName, err)
109
110 return err
111 }
112
113 s.logger.Info("Successfully opened VNC shell connection for node %s", nodeName)
114
115 return nil
116}
117
118// openBrowser opens the specified URL in the user's default browser.
119func openBrowser(url string) error {

Callers

nothing calls this directly

Calls 5

openBrowserFunction · 0.85
GenerateNodeVNCURLMethod · 0.80
InfoMethod · 0.65
ErrorMethod · 0.65
DebugMethod · 0.65

Tested by

no test coverage detected