io

package
v0.0.0-...-e57939f Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Commands []Command

Functions

This section is empty.

Types

type Buffer

type Buffer struct {
	Client *Client
	Input  string
}

func NewBuffer

func NewBuffer(client *Client, input string) *Buffer

func (*Buffer) CreateOutput

func (b *Buffer) CreateOutput(messageToRequestCreator string, messageToTarget string, messageToObservers string) *Output

func (*Buffer) CreateOutputToRequestCreator

func (b *Buffer) CreateOutputToRequestCreator(messageToRequestCreator string) *Output

func (*Buffer) GetCommand

func (b *Buffer) GetCommand() Command

func (*Buffer) MatchesSubject

func (b *Buffer) MatchesSubject(s []string) bool

func (*Buffer) ToString

func (b *Buffer) ToString() string

type Client

type Client struct {

	//mob     *gomud.Mob
	Message string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(c net.Conn) *Client

func (*Client) Read

func (c *Client) Read() *Client

func (*Client) String

func (c *Client) String() string

func (*Client) WritePrompt

func (c *Client) WritePrompt(m string)

type Command

type Command string
const (
	LookCommand      Command = "look"
	NorthCommand     Command = "north"
	SouthCommand     Command = "south"
	EastCommand      Command = "east"
	WestCommand      Command = "west"
	UpCommand        Command = "up"
	DownCommand      Command = "down"
	GetCommand       Command = "get"
	DropCommand      Command = "drop"
	WearCommand      Command = "wear"
	RemoveCommand    Command = "remove"
	KillCommand      Command = "kill"
	FleeCommand      Command = "flee"
	InventoryCommand Command = "inventory"
	SitCommand       Command = "sit"
	WakeCommand      Command = "wake"
	SleepCommand     Command = "sleep"
	ListCommand      Command = "list"
	SellCommand      Command = "sell"
	BuyCommand       Command = "buy"
	NoopCommand      Command = "noop"
)

type Output

type Output struct {
	Buffer                  *Buffer
	Status                  Status
	MessageToRequestCreator string
	MessageToTarget         string
	MessageToObservers      string
}

func NewOutput

func NewOutput(buffer *Buffer, status Status, messageToRequestCreator string, messageToTarget string, messageToObservers string) *Output

func NewOutputToRequestCreator

func NewOutputToRequestCreator(buffer *Buffer, status Status, messageToRequestCreator string) *Output

type Server

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

func NewServer

func NewServer(port int) (*Server, error)

func (*Server) Listen

func (s *Server) Listen(bufferWriter chan *Buffer) error

type Status

type Status string
const (
	CompletedStatus Status = "completed"
	ErrorStatus     Status = "error"
	FailedStatus    Status = "failed"
)

Jump to

Keyboard shortcuts

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