mcxweb

package
v0.0.0-...-2b5d22d Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2017 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Overview

Webserver for mcxhub

Index

Constants

View Source
const (
	FRONTPAGE           = "index.html"
	DefaultErrorMessage = "ERROR\n\n\nS A T O R\nA R E P O\nT E N E T\nO P E R A\nR O T A S"
)

Variables

This section is empty.

Functions

func IRCWebSocket

func IRCWebSocket(ws *websocket.Conn)

HTTP/WebSocket suitable for connecting javascript clients, and whatnot.

Takes a websocket and attaches it to the IRC server, such that whatever you write to the websocket is handled just like as it was an IRC connection. It also does some rewriting of the TCP stream, so that each websocket frame replied back to you will consist of only one IRC command/response message, and also removes trailing \r\n (weird IRC-syntax newlines). All commands you send to the socket NEED to end with newlines (either \n or \r\n), and you are allowed to send frames that contain multiple lines. See also RawIRCWebSocket(). Blocks until connection disconnect.

func RawIRCWebSocket

func RawIRCWebSocket(ws *websocket.Conn)

Takes a websocket and attaches it to the IRC server. Does not reformat the datastream. Useful if you want to connect *anything*. Blocks until the (servers internal representation of the) IRCUser dies.

func StartWebServer

func StartWebServer()

Starts the mcxhub web server. Assumes the presence of an initialized mcxconfig. Does not return, unless error or shutdown occured.

Types

type WebVariables

type WebVariables struct {
	FullName  string
	ShortName string
	Software  string
	Version   string
	Quote     string
	IRCPort   int
	WebPort   int
	Host      string
}

func MakeWebVariables

func MakeWebVariables(r *http.Request) WebVariables

Extracts and creates a WebVariables datastruct, to be used in http templates

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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