go-rdp

module
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2026 License: MIT

README

Go RDP Client

Logo

A browser-based Remote Desktop Protocol (RDP) client built with Go and WebAssembly, originally inspired by kulaginda/rdp-html5 but completely rewritten from scratch to pass all the reference tests in Microsoft's MS-RDPBCGR specification and be a reference implementation for RDP in Go.

⚠️ Note: While functional, this implementation has known limitations.

Quick Start

# Run with default settings (TLS validation enabled)
docker run -d -p 8080:8080 ghcr.io/rcarmo/go-rdp:latest

# Run with TLS validation disabled (for self-signed certs)
docker run -d -p 8080:8080 -e TLS_SKIP_VERIFY=true ghcr.io/rcarmo/rdp-html5:latest

# Run with debug logging
docker run -d -p 8080:8080 -e LOG_LEVEL=debug ghcr.io/rcarmo/rdp-html5:latest

Then open http://localhost:8080 in your browser.

Using Docker Compose
git clone https://github.com/rcarmo/go-rdp.git
cd go-rdp
docker-compose up -d
Building from Source

Prerequisites:

  • Go 1.21+
  • TinyGo 0.34+ (for WASM)
  • Node.js 18+ (for JS bundling)
# Clone and build
git clone https://github.com/rcarmo/go-rdp.git
cd go-rdp
make deps    # Install dependencies
make build   # Build everything (WASM + JS + binary)

# Run
./bin/go-rdp

Configuration

Environment variables:

Variable Default Description
SERVER_PORT 8080 HTTP server port
LOG_LEVEL info Logging level: debug, info, warn, error
TLS_SKIP_VERIFY false Skip RDP server TLS certificate validation
TLS_ALLOW_ANY_SERVER_NAME false Allow connecting without enforcing SNI (lab/testing)
ENABLE_TLS false Enable HTTPS for the web interface
TLS_CERT_FILE - Path to TLS certificate
TLS_KEY_FILE - Path to TLS private key
RDP_ENABLE_RFX true Enable RemoteFX codec support
RDP_ENABLE_UDP false Enable UDP transport (experimental)
RDP_PREFER_PCM_AUDIO false Prefer PCM audio (best quality, high bandwidth)

Command-line flags:

Flag Description
-host Server listen host (default: 0.0.0.0)
-port Server listen port (default: 8080)
-log-level Log level: debug, info, warn, error
-tls-skip-verify Skip TLS certificate validation
-tls-server-name Override TLS server name (SNI)
-tls-allow-any-server-name Allow connecting without enforcing SNI (lab/testing only)
-nla Enable Network Level Authentication
-no-rfx Disable RemoteFX codec support
-udp Enable UDP transport (experimental)
-prefer-pcm-audio Prefer PCM audio (best quality, high bandwidth)
-version Show version information
-help Show help message

See docs/configuration.md for full configuration options.

Documentation

User Documentation
Implementation Documentation
  • NSCodec - Bitmap codec implementation
  • RemoteFX - RemoteFX wavelet codec implementation
  • WebGL - WebGL rendering implementation
Protocol Specifications

This implementation follows Microsoft's open protocol specifications:

Protocol Description Specification
MS-RDPBCGR Basic Connectivity Link
MS-RDPEA Audio Output Link
MS-RDPEDYC Dynamic Channels Link
MS-RDPEDISP Display Control Link
MS-RDPEMT Multitransport Link
MS-RDPEUDP UDP Transport Link

Features

  • Secure Credentials - Passwords sent via WebSocket, not URL
  • TLS Support - TLS 1.2+ encryption for RDP connections
  • NLA Authentication - Network Level Authentication (with limitations)
  • Clipboard - Bidirectional text clipboard
  • Audio - Audio redirection with PCM, AAC, and MP3 support
  • WebAssembly - RLE/NSCodec/RemoteFX decoding via WASM
  • Configurable - Environment-based configuration

Limitations

  • Windows Compatibility - Primarily tested with XRDP; Windows servers may have issues
  • Graphics - RemoteFX codec implemented; H.264 not yet supported
  • NLA - Works with many configurations but not all (see limitations below)

Development

make help       # Show all targets
make dev        # Run in development mode
make test       # Run tests
make lint       # Run linters
make build-all  # Build for all platforms

License

MIT License - see LICENSE

Directories

Path Synopsis
cmd
server command
Package main implements the RDP HTML5 gateway server.
Package main implements the RDP HTML5 gateway server.
internal
auth
Package auth implements authentication for RDP NLA (NTLMv2 + CredSSP).
Package auth implements authentication for RDP NLA (NTLMv2 + CredSSP).
codec
Package codec implements RDP bitmap decompression algorithms including interleaved RLE, planar, and NSCodec as specified in MS-RDPBCGR and MS-RDPNSC.
Package codec implements RDP bitmap decompression algorithms including interleaved RLE, planar, and NSCodec as specified in MS-RDPBCGR and MS-RDPNSC.
codec/rfx
Package rfx implements the RemoteFX (RFX) codec decoder as specified in MS-RDPRFX.
Package rfx implements the RemoteFX (RFX) codec decoder as specified in MS-RDPRFX.
config
Package config provides configuration loading from environment variables and command-line flags for the RDP HTML5 gateway server.
Package config provides configuration loading from environment variables and command-line flags for the RDP HTML5 gateway server.
handler
Package handler implements HTTP handlers for the RDP HTML5 gateway, including WebSocket connection management and RDP session proxying.
Package handler implements HTTP handlers for the RDP HTML5 gateway, including WebSocket connection management and RDP session proxying.
logging
Package logging provides a simple leveled logger for the RDP client.
Package logging provides a simple leveled logger for the RDP client.
protocol/audio
Package audio implements RDP audio virtual channel protocols.
Package audio implements RDP audio virtual channel protocols.
protocol/drdynvc
Package drdynvc implements the Dynamic Virtual Channel Protocol (MS-RDPEDYC).
Package drdynvc implements the Dynamic Virtual Channel Protocol (MS-RDPEDYC).
protocol/encoding
Package encoding provides ASN.1/BER/PER encoding for RDP protocol
Package encoding provides ASN.1/BER/PER encoding for RDP protocol
protocol/fastpath
Package fastpath implements the RDP Fast-Path protocol as specified in MS-RDPBCGR.
Package fastpath implements the RDP Fast-Path protocol as specified in MS-RDPBCGR.
protocol/gcc
Package gcc implements Generic Conference Control (T.124) structures used in RDP connection sequence as specified in MS-RDPBCGR.
Package gcc implements Generic Conference Control (T.124) structures used in RDP connection sequence as specified in MS-RDPBCGR.
protocol/mcs
Package mcs implements the Multipoint Communication Service (T.125) protocol layer for RDP connections as specified in MS-RDPBCGR.
Package mcs implements the Multipoint Communication Service (T.125) protocol layer for RDP connections as specified in MS-RDPBCGR.
protocol/pdu
Package pdu implements RDP Protocol Data Units for the connection sequence, capabilities exchange, input/output events, and licensing as specified in MS-RDPBCGR.
Package pdu implements RDP Protocol Data Units for the connection sequence, capabilities exchange, input/output events, and licensing as specified in MS-RDPBCGR.
protocol/rdpedisp
Package rdpedisp implements the Display Control Virtual Channel Extension (MS-RDPEDISP).
Package rdpedisp implements the Display Control Virtual Channel Extension (MS-RDPEDISP).
protocol/rdpemt
Package rdpemt implements the RDP Multitransport Extension Protocol (MS-RDPEMT).
Package rdpemt implements the RDP Multitransport Extension Protocol (MS-RDPEMT).
protocol/rdpeudp
Package rdpeudp implements the RDP UDP Transport Protocol (MS-RDPEUDP).
Package rdpeudp implements the RDP UDP Transport Protocol (MS-RDPEUDP).
protocol/tpkt
Package tpkt implements the TPKT transport protocol (RFC 1006) used as the base transport layer for RDP connections.
Package tpkt implements the TPKT transport protocol (RFC 1006) used as the base transport layer for RDP connections.
protocol/x224
Package x224 implements the X.224 connection-oriented transport protocol used in the RDP connection sequence for initial negotiation.
Package x224 implements the X.224 connection-oriented transport protocol used in the RDP connection sequence for initial negotiation.
rdp
Package rdp implements a Remote Desktop Protocol client supporting RDP 5+ with NLA authentication, bitmap updates, and virtual channels.
Package rdp implements a Remote Desktop Protocol client supporting RDP 5+ with NLA authentication, bitmap updates, and virtual channels.
transport/udp
Package udp implements the MS-RDPEUDP transport layer for RDP over UDP.
Package udp implements the MS-RDPEUDP transport layer for RDP over UDP.
web
Package web provides embedded static assets for the RDP HTML5 client.
Package web provides embedded static assets for the RDP HTML5 client.
src/wasm command
Package main provides WebAssembly bindings for the RDP codec functions.
Package main provides WebAssembly bindings for the RDP codec functions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL