_3_send_func_to_channel

package
v0.0.0-...-a7c7adb Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

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

func NewHost

func NewHost() *Host

func (*Host) AddPeer

func (h *Host) AddPeer(p *Peer)

func (*Host) Broadcast

func (h *Host) Broadcast(msg string)

func (*Host) GetPeer

func (h *Host) GetPeer(pid string) *Peer

获取

func (*Host) Remove

func (h *Host) Remove(pid string)

func (*Host) SendTo

func (h *Host) SendTo(pid, msg string)

只向一个Peer发送消息

type Operation

type Operation func(peers map[string]*Peer)

type Peer

type Peer struct {
	ID string
}

Peer代表一个节点

func (*Peer) WriteMsg

func (p *Peer) WriteMsg(msg string)

Jump to

Keyboard shortcuts

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