connection

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MaxUDPPacketBytes = 9000

Variables

This section is empty.

Functions

func CreateConnection

func CreateConnection(addr net.Addr) (conn net.Conn, err error)

CreateConnection returns a newly created connection with connInfo or an error

func ReceiveMessage

func ReceiveMessage(conn net.Conn) (*message.Message, error)

ReceiveMessage receives and unmarshals one message.Message from conn. conn can either be a datagram (PacketConn) or a stream connection.

func ReceiveMessageAsync

func ReceiveMessageAsync(conn net.Conn, tok token.Token, done chan<- message.Message, ec chan<- error)

func WriteMessage

func WriteMessage(conn net.Conn, msg *message.Message) error

WriteMessage marshals one message.Message and writes it to conn. conn can either be a datagram (PacketConn) or a stream connection.

Types

type Info

type Info struct {
	Type Type
	Addr net.Addr
}

Info contains address information about one actor of a connection of the declared type

func (*Info) UnmarshalJSON

func (c *Info) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the JSONUnmarshaler interface.

type Type

type Type int

Type enumerates connection types

const (
	TCP Type = iota + 1
	SCION
)

run 'go generate' in this directory if a new networkAddrType is added [source https://github.com/campoy/jsonenums]

func UnmarshalNetAddr

func UnmarshalNetAddr(data []byte) (Type, net.Addr, error)

UnmarshalNetAddr is a helper function that unmarshals network addresses.

func (Type) MarshalJSON

func (r Type) MarshalJSON() ([]byte, error)

MarshalJSON is generated so Type satisfies json.Marshaler.

func (Type) String

func (i Type) String() string

func (*Type) UnmarshalJSON

func (r *Type) UnmarshalJSON(data []byte) error

UnmarshalJSON is generated so Type satisfies json.Unmarshaler.

Directories

Path Synopsis
Package connection/scion provides a simplified and functionally extended wrapper interface to the scionproto/scion package snet.
Package connection/scion provides a simplified and functionally extended wrapper interface to the scionproto/scion package snet.

Jump to

Keyboard shortcuts

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