udp

package
v2.0.0-...-2ef9d40 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package udp provides a connection-oriented listener over a UDP PacketConn

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen(network string, laddr *net.UDPAddr) (net.Listener, error)

Listen creates a new listener using default ListenConfig.

Types

type Conn

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

Conn augments a connection-oriented connection over a UDP PacketConn

func (*Conn) Close

func (c *Conn) Close() error

Close closes the conn and releases any Read calls

func (*Conn) LocalAddr

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

LocalAddr implements net.Conn.LocalAddr

func (*Conn) Read

func (c *Conn) Read(p []byte) (int, error)

Read

func (*Conn) RemoteAddr

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

RemoteAddr implements net.Conn.RemoteAddr

func (*Conn) SetDeadline

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

SetDeadline implements net.Conn.SetDeadline

func (*Conn) SetReadDeadline

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

SetReadDeadline implements net.Conn.SetDeadline

func (*Conn) SetWriteDeadline

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

SetWriteDeadline implements net.Conn.SetDeadline

func (*Conn) Write

func (c *Conn) Write(p []byte) (n int, err error)

Write writes len(p) bytes from p to the DTLS connection

type ListenConfig

type ListenConfig struct {
	// Backlog defines the maximum length of the queue of pending
	// connections. It is equivalent of the backlog argument of
	// POSIX listen function.
	// If a connection request arrives when the queue is full,
	// the request will be silently discarded, unlike TCP.
	// Set zero to use default value 128 which is same as Linux default.
	Backlog int

	// AcceptFilter determines whether the new conn should be made for
	// the incoming packet. If not set, any packet creates new conn.
	AcceptFilter func([]byte) bool
}

ListenConfig stores options for listening to an address.

func (*ListenConfig) Listen

func (lc *ListenConfig) Listen(network string, laddr *net.UDPAddr) (net.Listener, error)

Listen creates a new listener based on the ListenConfig.

Jump to

Keyboard shortcuts

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