agent

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Nickname

func Nickname(nick string) string

Types

type Channel

type Channel struct {
	ID      int
	Type    ChannelType
	Name    string
	Topic   string
	Clients map[int]*Client

	*sync.Mutex
}

func NewChannel

func NewChannel(id int, t ChannelType) *Channel

type ChannelList

type ChannelList []*ChannelListing

func (ChannelList) Len

func (c ChannelList) Len() int

func (ChannelList) Less

func (c ChannelList) Less(i, j int) bool

func (ChannelList) Swap

func (c ChannelList) Swap(i, j int)

type ChannelListing

type ChannelListing struct {
	ID    int
	Type  ChannelType
	Name  string
	Topic string
}

type ChannelType

type ChannelType int
const (
	ChannelUnknown ChannelType = 0
	ChannelText    ChannelType = 1
	ChannelVoice   ChannelType = 2
)

type Client

type Client struct {
	ID        int
	Name      string
	Status    int
	Conn      *websocket.Conn
	Connected bool

	PeerConns    map[int]*webrtc.PeerConnection
	PeerConnLock *sync.Mutex

	In  chan *Message
	Out chan *Message

	AudioIn  *audio.In
	AudioOut *audio.Out

	Channel *Channel

	Terminated chan bool
}

func NewClient

func NewClient(conn *websocket.Conn) *Client

func (*Client) Close

func (c *Client) Close()

func (*Client) CloseAudio

func (c *Client) CloseAudio()

func (*Client) ClosePeerConn

func (c *Client) ClosePeerConn(id int)

func (*Client) ClosePeerConns

func (c *Client) ClosePeerConns()

type Message

type Message struct {
	S  int         // Source
	N  string      // Source nickname
	PC int         // PeerConn
	C  int         // Channel
	T  MessageType // Type
	M  []byte      // Message
}

type MessageType

type MessageType int
const (
	MessageBinary        MessageType = 2
	MessagePing          MessageType = 101
	MessagePong          MessageType = 102
	MessageCall          MessageType = 103
	MessageAnswer        MessageType = 104
	MessageConnect       MessageType = 110
	MessageJoin          MessageType = 111
	MessageQuit          MessageType = 112
	MessageNick          MessageType = 113
	MessageTopic         MessageType = 114
	MessageAction        MessageType = 115
	MessageDisconnect    MessageType = 119
	MessageChat          MessageType = 120
	MessageTypingStart   MessageType = 121
	MessageTypingStop    MessageType = 122
	MessageTransmitStart MessageType = 123
	MessageTransmitStop  MessageType = 124
	MessageServers       MessageType = 130
	MessageChannels      MessageType = 131
	MessageUsers         MessageType = 132
)

func (MessageType) String

func (t MessageType) String() string

type User

type User struct {
	ID int
	N  string // Nickname
	C  int    // Channel
}

type UserList

type UserList []*User

func (UserList) Len

func (u UserList) Len() int

func (UserList) Less

func (u UserList) Less(i, j int) bool

func (UserList) Swap

func (u UserList) Swap(i, j int)

Jump to

Keyboard shortcuts

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