network

package
v0.0.0-...-96774e6 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalTransport

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

func (*LocalTransport) Addr

func (t *LocalTransport) Addr() NetAddr

func (*LocalTransport) Connect

func (t *LocalTransport) Connect(tr Transport) error

func (*LocalTransport) Consume

func (t *LocalTransport) Consume() <-chan RPC

func (*LocalTransport) SendMessage

func (t *LocalTransport) SendMessage(to NetAddr, payload []byte) error

type NetAddr

type NetAddr string

type RPC

type RPC struct {
	From    NetAddr
	Payload []byte
}

type Server

type Server struct {
	ServerOpts
	// contains filtered or unexported fields
}

func NewServer

func NewServer(opts ServerOpts) *Server

func (*Server) Start

func (s *Server) Start()

type ServerOpts

type ServerOpts struct {
	Transports []Transport
}

type Transport

type Transport interface {
	Addr() NetAddr
	Consume() <-chan RPC
	Connect(Transport) error
	SendMessage(NetAddr, []byte) error
}

func NewLocalTransport

func NewLocalTransport(addr NetAddr) Transport

Jump to

Keyboard shortcuts

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