udp

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 9 Imported by: 13

README


Pion UDP

A connection-oriented listener over a UDP PacketConn

Pion UDP Slack Widget
Build Status GoDoc Coverage Status Go Report Card


Roadmap

This package is used in the DTLS and SCTP transport to provide a connection-oriented listener over a UDP.

Community

Pion has an active community on the Golang Slack. You can also use Pion mailing list.

We are always looking to support your projects. Please reach out if you have something to build!

If you need commercial support or don't want to use public methods you can contact us at team@pion.ly

Contributing

Check out the contributing wiki to join the group of amazing people making this project possible:

License

MIT License - see LICENSE for full text

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosedListener      = errors.New("udp: listener closed")
	ErrListenQueueExceeded = errors.New("udp: listen queue exceeded")
)

Typed errors

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 reads from c into p

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.

Directories

Path Synopsis
pkg
sync
Package sync extends basic synchronization primitives.
Package sync extends basic synchronization primitives.

Jump to

Keyboard shortcuts

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