lan

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgTypeChat = iota
	MsgTypeCmd
	MsgTypeAdmin
	MsgTypePing
)

Variables

View Source
var MsgHandlers = map[string]MsgHandler{
	":help": {noOpInHandler, helpOutHandler, "Show available commands"},
	":id":   {idInHandler, idOutHandler, "Change username. Example: \":id my_new_name\""},
}

Functions

This section is empty.

Types

type Client

type Client struct {
	Name     string
	HostPort int
	ToUI     chan ui.Packet
	FromUI   chan ui.Packet
	Scanner  NetScanner
	// contains filtered or unexported fields
}

func (*Client) Start

func (c *Client) Start(ctx context.Context)

type DefaultScanner

type DefaultScanner struct {
	Local bool
}

func (*DefaultScanner) FindHost

func (s *DefaultScanner) FindHost(port int) (string, bool)

type InboundHandler

type InboundHandler func(*Client, Packet, peerID)

type MsgHandler

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

type MsgType

type MsgType int

type NetScanner

type NetScanner interface {
	FindHost(int) (string, bool)
}

type NullScanner

type NullScanner struct{}

func (*NullScanner) FindHost

func (s *NullScanner) FindHost(port int) (string, bool)

type OutboundHandler

type OutboundHandler func(*Client, ui.Packet)

type Packet

type Packet struct {
	User string
	Msg  string
	Type int
}

Jump to

Keyboard shortcuts

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