lightclient

package
v0.0.0-...-2797e35 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalWsClientManager = ClientManager{
	Broadcast:     make(chan []byte),
	Connected:     make(chan *Client),
	Disconnected:  make(chan *Client),
	P2PData:       make(chan []byte),
	ClientsMap:    make(map[*Client]bool),
	OnlineUserMap: make(map[string]*Client),
}
View Source
var P2PLocalPeerId string

Functions

func ConnP2PServer

func ConnP2PServer(dest string) (string, error)

func InitRouter

func InitRouter(conn *grpc.ClientConn) *gin.Engine

func SendP2PMsg

func SendP2PMsg(remoteP2PPeerId string, msg string) error

func StartP2PServer

func StartP2PServer()

Types

type Client

type Client struct {
	Id          string
	User        *bean.User
	Socket      *websocket.Conn
	SendChannel chan []byte
}

func FindUserOnLine

func FindUserOnLine(peerId *string) (*Client, error)

func (*Client) FindUser

func (client *Client) FindUser(peerId *string) (*Client, error)

func (*Client) Read

func (client *Client) Read()

func (*Client) Write

func (client *Client) Write()

type ClientManager

type ClientManager struct {
	Broadcast     chan []byte
	Connected     chan *Client
	Disconnected  chan *Client
	P2PData       chan []byte
	ClientsMap    map[*Client]bool
	OnlineUserMap map[string]*Client
}

func (*ClientManager) Send

func (clientManager *ClientManager) Send(message []byte, myself *Client)

func (*ClientManager) Start

func (clientManager *ClientManager) Start()

type P2PChannel

type P2PChannel struct {
	IsLocalChannel bool
	Address        string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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