network

package
v0.0.0-...-7f98e96 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 6 Imported by: 23

Documentation

Overview

Package network defines abstractions used for handling network connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptGreeting

func AcceptGreeting(conn io.Reader) (pid uint16, sid uint64, err error)

AcceptGreeting accepts a greeting and returns the information it learned from it.

func Greet

func Greet(w io.Writer, pid uint16, sid uint64) error

Greet sends a greeting to the given conn.

Types

type Connection

type Connection interface {
	Read([]byte) (int, error)
	Write([]byte) (int, error)
	Flush() error
	Close() error
	Interrupt() error
	RemoteAddr() net.Addr
}

Connection represents a network connection between two processes.

type Server

type Server interface {
	// Dial connects to a committee member identified by pid and returns the resulting connection or an error.
	Dial(pid uint16) (Connection, error)
	// Listen for an incoming connection for the given time. Returns the connection if successful, otherwise an error.
	Listen() (Connection, error)
	// Stop stops this Server and cancels all ongoing executions of Dial and Listen.
	Stop()
}

Server establishes network connections.

func NewTimeoutConnectionServer

func NewTimeoutConnectionServer(server Server, baseTimeout time.Duration) Server

NewTimeoutConnectionServer creates an instance of a network Server that wrapes a given Server by creating instance of potentially infinitely long timing-out connections.

Directories

Path Synopsis
Package persistent implements "virtual connections", many of which utilize the same underlying TCP link.
Package persistent implements "virtual connections", many of which utilize the same underlying TCP link.
Package tcp implements network.Connections that wrap around TCP connections.
Package tcp implements network.Connections that wrap around TCP connections.
Package udp wraps UDP packets in network.Connections.
Package udp wraps UDP packets in network.Connections.

Jump to

Keyboard shortcuts

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