Documentation
¶
Index ¶
Constants ¶
View Source
const ChatRoomBufSize = 128
ChatRoomBufSize is the number of incoming messages to buffer for each topic.
View Source
const RSABits = 2048
Variables ¶
This section is empty.
Functions ¶
func GenerateRandString ¶
Types ¶
type ChatMessage ¶
type ChatMessage struct {
Message string
SenderID string
SenderNick string
ReceiverNickName string
}
ChatMessage gets converted to/from JSON and sent in the body of pubsub messages.
type ChatRoom ¶
type ChatRoom struct {
// Messages is a channel of messages received from other peers in the chat room
Messages chan *ChatMessage
// contains filtered or unexported fields
}
ChatRoom represents a subscription to a single PubSub topic. Messages can be published to the topic with ChatRoom.Publish, and received messages are pushed to the Messages channel.
type Config ¶
type Config struct {
RendezvousString string
BootstrapPeers addrList
ListenAddresses addrList
NickName string
RoomName string
FindPeersTimeSecs int
Port int
PrivateKey string
OutputPrivateKey bool
Help bool
}
func ParseFlags ¶
func ParseFlags() *Config
func (Config) BoostrapPeersMultiAdresses ¶
func (Config) FindPeersTimeSecsDuration ¶
func (Config) ListenMultiAdresses ¶
type MyDiscovery ¶
type MyDiscovery struct {
// contains filtered or unexported fields
}
func NewMyDicovery ¶
func (MyDiscovery) AdvertiseAndFindPeers ¶
func (discovery MyDiscovery) AdvertiseAndFindPeers(config Config)
Click to show internal directories.
Click to hide internal directories.