udp

package
v5.17.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: MIT Imports: 24 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DispatcherConnectionTerminationSignalReceiverMark = "DispatcherConnectionTerminationSignalReceiverMark"
View Source
var File_transport_internet_udp_config_proto protoreflect.FileDescriptor

Functions

func CopyPacketConn added in v5.0.2

func DialDispatcher

func DialDispatcher(ctx context.Context, dispatcher routing.Dispatcher) (net.PacketConn, error)

func ReadUDPMsg

func ReadUDPMsg(conn *net.UDPConn, payload []byte, oob []byte) (int, int, int, *net.UDPAddr, error)

func RetrieveOriginalDest

func RetrieveOriginalDest(oob []byte) net.Destination

Types

type Config

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

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type CopyOption added in v5.0.2

type CopyOption func(*copyHandler)

func UpdateActivity added in v5.0.2

func UpdateActivity(timer signal.ActivityUpdater) CopyOption

type Dispatcher

type Dispatcher struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Dispatcher) Close added in v5.0.2

func (v *Dispatcher) Close() error

func (*Dispatcher) Dispatch

func (v *Dispatcher) Dispatch(ctx context.Context, destination net.Destination, payload *buf.Buffer)

func (*Dispatcher) RemoveRay

func (v *Dispatcher) RemoveRay(dest net.Destination)

type DispatcherConnectionTerminationSignalReceiver added in v5.9.0

type DispatcherConnectionTerminationSignalReceiver interface {
	io.Closer
}

type DispatcherI added in v5.0.2

type DispatcherI interface {
	common.Closable
	Dispatch(ctx context.Context, destination net.Destination, payload *buf.Buffer)
}

func NewSplitDispatcher added in v5.0.2

func NewSplitDispatcher(dispatcher routing.Dispatcher, callback ResponseCallback) DispatcherI

type Hub

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

func ListenUDP

func ListenUDP(ctx context.Context, address net.Address, port net.Port, streamSettings *internet.MemoryStreamConfig, options ...HubOption) (*Hub, error)

func (*Hub) Addr

func (h *Hub) Addr() net.Addr

Addr implements net.Listener.

func (*Hub) Close

func (h *Hub) Close() error

Close implements net.Listener.

func (*Hub) Receive

func (h *Hub) Receive() <-chan *udp.Packet

func (*Hub) WriteTo

func (h *Hub) WriteTo(payload []byte, dest net.Destination) (int, error)

type HubOption

type HubOption func(h *Hub)

func HubCapacity

func HubCapacity(capacity int) HubOption

func HubReceiveOriginalDestination

func HubReceiveOriginalDestination(r bool) HubOption

type MonoDestUDPConn added in v5.12.0

type MonoDestUDPConn struct {
	internet.AbstractPacketConn
	// contains filtered or unexported fields
}

func NewMonoDestUDPConn added in v5.12.0

func NewMonoDestUDPConn(conn internet.AbstractPacketConn, addr net.Addr) *MonoDestUDPConn

func (*MonoDestUDPConn) Read added in v5.12.0

func (m *MonoDestUDPConn) Read(p []byte) (n int, err error)

func (*MonoDestUDPConn) ReadMultiBuffer added in v5.12.0

func (m *MonoDestUDPConn) ReadMultiBuffer() (buf.MultiBuffer, error)

func (*MonoDestUDPConn) Write added in v5.12.0

func (m *MonoDestUDPConn) Write(p []byte) (n int, err error)

func (*MonoDestUDPConn) WriteMultiBuffer added in v5.12.0

func (m *MonoDestUDPConn) WriteMultiBuffer(buffer buf.MultiBuffer) error

type PacketAddrDispatcher added in v5.0.2

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

func (PacketAddrDispatcher) Close added in v5.0.2

func (p PacketAddrDispatcher) Close() error

func (PacketAddrDispatcher) Dispatch added in v5.0.2

func (p PacketAddrDispatcher) Dispatch(ctx context.Context, destination net.Destination, payload *buf.Buffer)

type PacketAddrDispatcherCreator added in v5.0.2

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

func NewPacketAddrDispatcherCreator added in v5.0.2

func NewPacketAddrDispatcherCreator(ctx context.Context) PacketAddrDispatcherCreator

func (*PacketAddrDispatcherCreator) NewPacketAddrDispatcher added in v5.0.2

func (pdc *PacketAddrDispatcherCreator) NewPacketAddrDispatcher(
	dispatcher routing.Dispatcher, callback ResponseCallback,
) DispatcherI

type ResponseCallback

type ResponseCallback func(ctx context.Context, packet *udp.Packet)

Jump to

Keyboard shortcuts

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