net

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package net provides a net.Conn implementation for UDP packets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithUDPConnBufferedWrite

func WithUDPConnBufferedWrite(buffered bool) func(*UDPConnOptions)

WithUDPConnBufferedWrite change the behaviour of UDPConn to buffer or not all write calls until Flush is called. By default it will buffer all write calls.

Types

type UDPConn

type UDPConn struct {
	net.PacketConn
	// contains filtered or unexported fields
}

UDPConn is a net.Conn implementation for UDP packets. It will buffer all write calls and write them to the connection when Flush is called.

func NewUDPConn

func NewUDPConn(conn net.PacketConn, optFuncs ...func(*UDPConnOptions)) *UDPConn

NewUDPConn creates a new UDPConn.

func (*UDPConn) Close

func (c *UDPConn) Close() error

Close writes the internal buffer to the connection.

func (*UDPConn) Read

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

Read reads data from the connection.

func (*UDPConn) Receive

func (c *UDPConn) Receive() (int, error)

Receive reads data from the connection.

func (*UDPConn) RemoteAddr

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

RemoteAddr returns the remote network address, if known.

func (*UDPConn) Write

func (c *UDPConn) Write(p []byte) (int, error)

Write writes data to an internal buffer.

type UDPConnOptions

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

UDPConnOptions are options for UDPConn.

Jump to

Keyboard shortcuts

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