Categorygithub.com/evangwt/go-vncproxy
modulepackage
1.1.0
Repository: https://github.com/evangwt/go-vncproxy.git
Documentation: pkg.go.dev

# README

go-vncproxy

A tiny vnc websocket proxy written by golang supports noVNC client.

Feature

  • Token handler: like websockify, you can customlize the token handler to access multiple vnc backends by a single proxy instance.
  • Authentication: it depends on your vnc servers, since the proxy just copy the stream of both clients and servers.

Usage

package main

import (
	"net/http"

	"github.com/evangwt/go-vncproxy"

	"github.com/gin-gonic/gin"
	"golang.org/x/net/websocket"
)

func main() {
	r := gin.Default()

	vncProxy := NewVNCProxy()
	r.GET("/ws", func(ctx *gin.Context) {
		h := websocket.Handler(vncProxy.ServeWS)
		h.ServeHTTP(ctx.Writer, ctx.Request)
	})

	if err := r.Run(); err != nil {
		panic(err)
	}
}

func NewVNCProxy() *vncproxy.Proxy {
	return vncproxy.New(&vncproxy.Config{
		LogLevel: vncproxy.DebugLevel,
		TokenHandler: func(r *http.Request) (addr string, err error) {
      		// validate token and get forward vnc addr
      		// ...
      		addr = ":5901"
      		return
		},
	})
}

# Functions

New returns a vnc proxy If token handler is nil, vnc backend address will always be :5901.
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

Config represents vnc proxy config.
Proxy represents vnc proxy.

# Interfaces

No description provided by the author

# Type aliases

No description provided by the author