Documentation
¶
Overview ¶
Package rdp implements the client side of the Remote Desktop Protocol.
Index ¶
- Constants
- func Classify(err error) (Kind, Reason)
- func Fingerprint(cert *x509.Certificate) string
- func Retryable(err error) bool
- type Button
- type CertError
- type Config
- type Error
- type Kind
- type KnownCerts
- func (k *KnownCerts) Contents() ([]byte, error)
- func (k *KnownCerts) Forget(addr string) error
- func (k *KnownCerts) Known(addr string) (string, bool)
- func (k *KnownCerts) Merge(data []byte) (int, error)
- func (k *KnownCerts) Path() string
- func (k *KnownCerts) Trust(addr, fingerprint string) error
- func (k *KnownCerts) Verify(addr string, chain []*x509.Certificate) error
- type Options
- type Pointer
- type Reason
- type Security
- type Session
- func (s *Session) Close()
- func (s *Session) CopyFrame(dst *image.RGBA, since uint64) (*image.RGBA, uint64, image.Rectangle)
- func (s *Session) CtrlAltDel()
- func (s *Session) Key(scancode uint16, extended, down bool)
- func (s *Session) MouseButton(x, y int, b Button, down bool)
- func (s *Session) MouseMove(x, y int)
- func (s *Session) Pointer() Pointer
- func (s *Session) PointerPosition() (image.Point, bool)
- func (s *Session) Reconnect()
- func (s *Session) ReleaseAll()
- func (s *Session) Resize(width, height, scale int)
- func (s *Session) SetClipboard(text string)
- func (s *Session) SetConfig(cfg Config)
- func (s *Session) SetVisible(visible bool)
- func (s *Session) Start()
- func (s *Session) Status() Status
- func (s *Session) SyncLocks(capsLock, numLock, scrollLock, kanaLock bool)
- func (s *Session) Unicode(r rune, down bool)
- func (s *Session) Wheel(x, y, dx, dy int)
- type State
- type Status
- type Step
Constants ¶
const (
// KnownCertsFile is the RDP certificate pin store in the application data folder.
KnownCertsFile = "rdp_known_certs.json"
)
Variables ¶
This section is empty.
Functions ¶
func Fingerprint ¶
func Fingerprint(cert *x509.Certificate) string
Fingerprint returns the colon-separated SHA-256 digest of the leaf's DER.
Types ¶
type CertError ¶
type CertError struct {
Addr string
Fingerprint string
Known string
Subject string
NotAfter time.Time
}
CertError identifies an unknown or changed RDP leaf certificate.
type Config ¶
type Config struct {
Addr, Domain, User, ClientName string
Dial func(context.Context, string, string) (net.Conn, error)
Password func(context.Context) (string, error)
VerifyCert func(addr string, chain []*x509.Certificate) error
Security Security
Width, Height, Scale int
Admin, Clipboard bool
KeyboardLayout uint32
Timeout time.Duration
Log func(string)
}
Config is a snapshot of the settings used by one connection attempt.
type KnownCerts ¶
type KnownCerts struct {
// contains filtered or unexported fields
}
KnownCerts keeps explicit trust-on-first-use pins by host and port.
func OpenKnownCerts ¶
func OpenKnownCerts(path string) (*KnownCerts, error)
OpenKnownCerts loads path. A missing file has an empty trust store.
func (*KnownCerts) Contents ¶
func (k *KnownCerts) Contents() ([]byte, error)
Contents returns a snapshot suitable for backup.
func (*KnownCerts) Forget ¶
func (k *KnownCerts) Forget(addr string) error
Forget removes the pin for addr.
func (*KnownCerts) Known ¶
func (k *KnownCerts) Known(addr string) (string, bool)
Known returns the fingerprint trusted for addr, if any.
func (*KnownCerts) Merge ¶
func (k *KnownCerts) Merge(data []byte) (int, error)
Merge adds imported pins whose addresses are absent from this store.
func (*KnownCerts) Trust ¶
func (k *KnownCerts) Trust(addr, fingerprint string) error
Trust adds or replaces a leaf pin after explicit user approval.
func (*KnownCerts) Verify ¶
func (k *KnownCerts) Verify(addr string, chain []*x509.Certificate) error
Verify accepts only the currently pinned leaf certificate for addr.
type Options ¶
type Options struct {
AutoReconnect bool
}
Options controls session behavior across individual attempts.
type Pointer ¶
Pointer is the current remote cursor shape. Image is immutable and may be shared with earlier snapshots. HotX and HotY are relative to Image.
type Reason ¶
type Reason int
Reason is a failure detail that the application can present to the user.
const ( ReasonNone Reason = iota ReasonLogonFailure ReasonAccountLocked ReasonAccountDisabled ReasonAccountRestricted ReasonAccountExpired ReasonPasswordExpired ReasonPasswordMustChange ReasonLogonTypeNotGranted ReasonLoggedOff ReasonIdleTimeout ReasonLogonTimeout ReasonReplaced ReasonAdminEnded ReasonServerDenied ReasonProtocol )
type Security ¶
type Security string
Security selects the external security protocol used by an RDP connection.
type Session ¶
type Session struct {
OnChange func()
OnClipboard func(text string)
// contains filtered or unexported fields
}
Session owns one remote desktop and reconnects it when configured to do so. Set the callbacks before starting the session.
func (*Session) Close ¶
func (s *Session) Close()
Close cancels pending work and disconnects the desktop.
func (*Session) CopyFrame ¶
CopyFrame copies the desktop pixels changed after since. A nil or mismatched destination or a version outside the history gets a full copy.
func (*Session) CtrlAltDel ¶
func (s *Session) CtrlAltDel()
CtrlAltDel queues a secure attention chord.
func (*Session) MouseButton ¶
MouseButton queues a button press or release at a desktop position.
func (*Session) PointerPosition ¶
PointerPosition returns the last explicit position set by the server.
func (*Session) Reconnect ¶
func (s *Session) Reconnect()
Reconnect replaces any running connection with a new attempt.
func (*Session) ReleaseAll ¶
func (s *Session) ReleaseAll()
ReleaseAll releases the keys and buttons currently pressed by this client.
func (*Session) SetClipboard ¶
SetClipboard sends supported plain text when clipboard redirection is enabled.
func (*Session) SetVisible ¶
SetVisible asks an active server to suppress or resume display updates.
Source Files
¶
- activation.go
- bitmap.go
- bitmap_interleaved.go
- bitmap_planar.go
- capabilities.go
- clip.go
- clip_text.go
- config.go
- connection.go
- credssp.go
- display.go
- dynamic.go
- errors.go
- frame.go
- gcc.go
- gfx.go
- info.go
- input.go
- knowncerts.go
- license.go
- license_crypto.go
- license_encoding.go
- mcs.go
- mcs_encoding.go
- nego.go
- ntlm.go
- ntlm_seal.go
- pointer.go
- session.go
- session_input.go
- session_write.go
- share.go
- spnego.go
- vc.go