network

package
v0.0.0-...-967d326 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockNetwork

type MockNetwork struct {
	Connexions map[string]chan []byte
}

MockNetwork ..

func (*MockNetwork) GetConnexion

func (net *MockNetwork) GetConnexion(address string) chan []byte

GetConnexion returns a connexion channel if it does not exist, it creates one

func (*MockNetwork) Send

func (net *MockNetwork) Send(msg []byte, to string) error

Send push the message in the indicated channel

type MockWhiteListProvider

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

MockWhiteListProvider is a backend that retrieves a list of authorized peers

func NewMockWhiteListProvider

func NewMockWhiteListProvider() *MockWhiteListProvider

NewMockWhiteListProvider ....

func (*MockWhiteListProvider) Add

func (m *MockWhiteListProvider) Add(p []byte)

Add ...

func (*MockWhiteListProvider) GetPeers

func (m *MockWhiteListProvider) GetPeers() ([][]byte, error)

GetPeers ......

func (*MockWhiteListProvider) GetPeersChan

func (m *MockWhiteListProvider) GetPeersChan() (chan [][]byte, error)

GetPeersChan ....

func (*MockWhiteListProvider) Rm

func (m *MockWhiteListProvider) Rm(p []byte)

Rm ...

type PubSub

type PubSub interface {
	GetTopic(ctx context.Context, topic string) Topic
	Publish(topic string, msg []byte) error
}

PubSub is a generic network interface used y

type Topic

type Topic interface {
	Close()
	Publish(msg []byte) error
	Chan() (<-chan []byte, error)
}

A Topic is a pubsub abstraction that can be subscribed and published

type WhiteListProvider

type WhiteListProvider interface {
	GetPeersChan() (chan [][]byte, error)
	GetPeers() ([][]byte, error)
}

WhiteListProvider is a backend that retrieves a list of authorized peers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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