libwebsocketd

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2013 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogDebug = iota
	LogTrace
	LogAccess
	LogInfo
	LogError
	LogFatal
)
View Source
const (
	ConsoleContent = `` /* 7202-byte string literal not displayed */

)
View Source
const (
	License = `` /* 1325-byte string literal not displayed */

)

Variables

View Source
var ScriptNotFoundError = errors.New("script not found")

Functions

func Timestamp

func Timestamp() string

Types

type AssocPair

type AssocPair struct {
	Key   string
	Value string
}

type Config

type Config struct {
	CommandName    string    // Command to execute.
	CommandArgs    []string  // Additional args to pass to command.
	ReverseLookup  bool      // Perform reverse DNS lookups on hostnames (useful, but slower).
	ScriptDir      string    // Base directory for websocket scripts.
	UsingScriptDir bool      // Are we running with a script dir.
	StartupTime    time.Time // Server startup time (used for dev console caching).
	StaticDir      string    // If set, static files will be served from this dir over HTTP.
	CgiDir         string    // If set, CGI scripts will be served from this dir over HTTP.
	DevConsole     bool      // Enable dev console. This disables StaticDir and CgiDir.
	ServerSoftware string    // Value to pass to SERVER_SOFTWARE environment variable (e.g. websocketd/1.2.3).
	Env            []string  // Additional environment variables to pass to process ("key=value").
}

type Endpoint

type Endpoint interface {
	Terminate()
	Output() chan string
	Send(msg string) bool
}

type HttpWsMuxHandler

type HttpWsMuxHandler struct {
	Config *Config
	Log    *LogScope
}

func (HttpWsMuxHandler) ServeHTTP

func (h HttpWsMuxHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

Main HTTP handler. Muxes between WebSocket handler, DevConsole or 404.

type LaunchedProcess

type LaunchedProcess struct {
	// contains filtered or unexported fields
}

type LogFunc

type LogFunc func(logScope *LogScope, level LogLevel, levelName string, category string, msg string, args ...interface{})

type LogLevel

type LogLevel int

type LogScope

type LogScope struct {
	Parent     *LogScope   // Parent scope
	MinLevel   LogLevel    // Minimum log level to write out.
	Mutex      *sync.Mutex // Should be shared across all LogScopes that write to the same destination.
	Associated []AssocPair // Additional data associated with scope
	LogFunc    LogFunc
}

func RootLogScope

func RootLogScope(minLevel LogLevel, logFunc LogFunc) *LogScope

func (*LogScope) Access

func (l *LogScope) Access(category string, msg string, args ...interface{})

func (*LogScope) Associate

func (l *LogScope) Associate(key string, value string)

func (*LogScope) Debug

func (l *LogScope) Debug(category string, msg string, args ...interface{})

func (*LogScope) Error

func (l *LogScope) Error(category string, msg string, args ...interface{})

func (*LogScope) Fatal

func (l *LogScope) Fatal(category string, msg string, args ...interface{})

func (*LogScope) Info

func (l *LogScope) Info(category string, msg string, args ...interface{})

func (*LogScope) NewLevel

func (parent *LogScope) NewLevel(logFunc LogFunc) *LogScope

func (*LogScope) Trace

func (l *LogScope) Trace(category string, msg string, args ...interface{})

type ProcessEndpoint

type ProcessEndpoint struct {
	// contains filtered or unexported fields
}

func NewProcessEndpoint

func NewProcessEndpoint(process *LaunchedProcess, log *LogScope) *ProcessEndpoint

func (*ProcessEndpoint) Output

func (pe *ProcessEndpoint) Output() chan string

func (*ProcessEndpoint) ReadOutput

func (pe *ProcessEndpoint) ReadOutput(input io.ReadCloser, config *Config)

func (*ProcessEndpoint) Send

func (pe *ProcessEndpoint) Send(msg string) bool

func (*ProcessEndpoint) Terminate

func (pe *ProcessEndpoint) Terminate()

type URLInfo

type URLInfo struct {
	ScriptPath string
	PathInfo   string
	FilePath   string
}

type WebSocketEndpoint

type WebSocketEndpoint struct {
	// contains filtered or unexported fields
}

func NewWebSocketEndpoint

func NewWebSocketEndpoint(ws *websocket.Conn, log *LogScope) *WebSocketEndpoint

func (*WebSocketEndpoint) Output

func (we *WebSocketEndpoint) Output() chan string

func (*WebSocketEndpoint) ReadOutput

func (we *WebSocketEndpoint) ReadOutput(config *Config)

func (*WebSocketEndpoint) Send

func (we *WebSocketEndpoint) Send(msg string) bool

func (*WebSocketEndpoint) Terminate

func (we *WebSocketEndpoint) Terminate()

Jump to

Keyboard shortcuts

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