server

package
v0.0.0-...-652815c Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NOMessage = resp.SimpleStringValue("")

Functions

func ListenAndServe

func ListenAndServe(
	host string, port int,
	protected func() bool,
	handler func(conn *Conn, msg *Message, rd *PipelineReader, w io.Writer, websocket bool) error,
	opened func(conn *Conn),
	closed func(conn *Conn),
	lnp *net.Listener,
	http bool,
) error

ListenAndServe starts a tile38 server at the specified address.

func OKMessage

func OKMessage(msg *Message, start time.Time) resp.Value

OKMessage returns a default OK message in JSON or RESP.

func WriteWebSocketMessage

func WriteWebSocketMessage(w io.Writer, data []byte) error

WriteWebSocketMessage write a websocket message to an io.Writer.

Types

type Conn

type Conn struct {
	net.Conn
	Authenticated bool
}

Conn represents a server connection.

func (Conn) SetKeepAlive

func (conn Conn) SetKeepAlive(period time.Duration) error

SetKeepAlive sets the connection keepalive

type Message

type Message struct {
	Command    string
	Values     []resp.Value
	ConnType   Type
	OutputType Type
	Auth       string
}

Message is a resp message

type PipelineReader

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

PipelineReader ...

func NewPipelineReader

func NewPipelineReader(rd io.ReadWriter) *PipelineReader

NewPipelineReader ...

func (*PipelineReader) ReadMessages

func (rd *PipelineReader) ReadMessages() ([]*Message, error)

ReadMessages ...

type Type

type Type int

Type is resp type

const (
	Null Type = iota
	RESP
	Telnet
	Native
	HTTP
	WebSocket
	JSON
)

Jump to

Keyboard shortcuts

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