http_network

package
v0.0.0-...-8cfcfd0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(nodeAddrs []config.NodeAddr, local string, nodeID string, cfg *config.Configure) network.SwitcherI

Types

type HTTPMsg

type HTTPMsg struct {
	*network.BroadcastMsg
	*network.Peer
}

type HTTPNetWork

type HTTPNetWork struct {
	Addrs        []string // 所有的节点地址
	PeerIDs      []string //
	LocalAddress string   // 本机地址
	NodeID       string   // 节点ID

	sync.RWMutex
	// contains filtered or unexported fields
}

func (*HTTPNetWork) Broadcast

func (hn *HTTPNetWork) Broadcast(modelID string, msg *network.BroadcastMsg) error

func (*HTTPNetWork) BroadcastExceptPeer

func (hn *HTTPNetWork) BroadcastExceptPeer(modelID string, msg *network.BroadcastMsg, p *network.Peer) error

func (*HTTPNetWork) BroadcastToPeer

func (hn *HTTPNetWork) BroadcastToPeer(modelID string, msg *network.BroadcastMsg, p *network.Peer) error

func (*HTTPNetWork) Peers

func (hn *HTTPNetWork) Peers() ([]*network.Peer, error)

func (*HTTPNetWork) Recv

func (hn *HTTPNetWork) Recv()

func (*HTTPNetWork) RegisterOnReceive

func (hn *HTTPNetWork) RegisterOnReceive(modelID string, callBack network.OnReceive) error

func (*HTTPNetWork) RemovePeer

func (hn *HTTPNetWork) RemovePeer(p *network.Peer) error

func (*HTTPNetWork) Start

func (hn *HTTPNetWork) Start() error

Jump to

Keyboard shortcuts

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