p2p

package
v0.0.0-...-c8fc2fc Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package p2p (point to point) defines a net.PacketConn implementation where messages are exchanged via channels.

Index

Constants

View Source
const (
	// Number of packets that can fit into Conn buffers until the writer blocks
	PktBufferSize = 16
)

Variables

This section is empty.

Functions

func New

func New() (*Conn, *Conn)

New creates two paired connection objects. A message sent on the first conn is received on the second conn, and viceversa.

Types

type Addr

type Addr struct{}

func (*Addr) Network

func (a *Addr) Network() string

Network always returns "p2p".

func (*Addr) String

func (a *Addr) String() string

String always returns "p2p address".

type Conn

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

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

LocalAddr always returns nil.

func (*Conn) ReadFrom

func (c *Conn) ReadFrom(b []byte) (int, net.Addr, error)

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

SetDeadline is a NOP.

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

SetReadDeadline is a NOP.

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline is a NOP.

func (*Conn) WriteTo

func (c *Conn) WriteTo(b []byte, a net.Addr) (n int, err error)

Jump to

Keyboard shortcuts

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