web

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 7 Imported by: 0

README

web

Package web provides a simple web interface for the gdb module.

Every new handler spawns a new GDB instance which is not meant to serve more than one client.

Several URLs are available:

  • a WebSocket will be bound to NotificationsUrl, every notification sent by GDB will be delivered through this WebSocket as a JSON object;

  • a WebSocket will be bound to TerminalUrl: data sent through it will be delivered to the target program's input whereas data read from it will reflect the the target program's output;

  • POST requests are expected to CommandsUrl to send commands to GDB. Commands are represented by JSON arrays [command, arguments...]. Command responses are sent back as JSON objects in the response body;

  • POST requests are expected to InterruptUrl to send interrupts to GDB, no parameters are allowed.

HTTP methods return 200 on success and 500 on error.

Example

A dummy example can be found in the example directory.

Installation

This package requires the websocket library from the additional networking packages:

go get golang.org/x/net/websocket

Documentation

Overview

Package web provides a simple web interface for the gdb module.

Every new handler spawns a new GDB instance which is not meant to serve more than one client.

Several URLs are available:

  • a WebSocket will be bound to NotificationsUrl, every notification sent by GDB will be delivered through this WebSocket as a JSON object;
  • a WebSocket will be bound to TerminalUrl: data sent through it will be delivered to the target program's input whereas data read from it will reflect the the target program's output;
  • POST requests are expected to CommandsUrl to send commands to GDB. Commands are represented by JSON arrays [command, arguments...]. Command responses are sent back as JSON objects in the response body;
  • POST requests are expected to InterruptUrl to send interrupts to GDB, no parameters are allowed.

HTTP methods return 200 on success and 500 on error.

Index

Constants

View Source
const (
	NotificationsUrl = "/notifications"
	TerminalUrl      = "/terminal"
	CommandsUrl      = "/send"
	InterruptUrl     = "/interrupt"
)

Variables

This section is empty.

Functions

func NewHandler

func NewHandler() (*http.ServeMux, error)

NewHandler returns a new http.ServeMux which automatically spawn a new instance of GDB and offers HTTP mount points to interact with. It is assumed that only one client at a time access this multiplexer.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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