Documentation
¶
Index ¶
- Variables
- type DispatcherToPacketConn
- type PacketDispatcher
- type PacketDispatcher0
- type PacketDispatcherOption
- func WithBufferSize(size int) PacketDispatcherOption
- func WithLinkLifetime(lifetime time.Duration) PacketDispatcherOption
- func WithRequestTimeout(timeout time.Duration) PacketDispatcherOption
- func WithResponseCallback(callback func(packet *udp.Packet)) PacketDispatcherOption
- func WithResponseTimeout(timeout time.Duration) PacketDispatcherOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClosed = errors.New("closed")
Functions ¶
This section is empty.
Types ¶
type DispatcherToPacketConn ¶
type DispatcherToPacketConn struct {
// contains filtered or unexported fields
}
func NewDispatcherToPacketConn ¶
func NewDispatcherToPacketConn(ctx context.Context, dispatcher i.FlowHandler, opts ...PacketDispatcherOption) *DispatcherToPacketConn
func (*DispatcherToPacketConn) Close ¶
func (d *DispatcherToPacketConn) Close() error
func (*DispatcherToPacketConn) ReadPacket ¶
func (d *DispatcherToPacketConn) ReadPacket() (*udp.Packet, error)
func (*DispatcherToPacketConn) WritePacket ¶
func (d *DispatcherToPacketConn) WritePacket(p *udp.Packet) error
type PacketDispatcher ¶
TODO: make it as a PacketConn
func NewPacketDispatcher ¶
func NewPacketDispatcher(ctx context.Context, dispatcher i.FlowHandler, opts ...PacketDispatcherOption) *PacketDispatcher
func (*PacketDispatcher) Close ¶
func (s *PacketDispatcher) Close() error
func (*PacketDispatcher) DispatchPacket ¶
func (s *PacketDispatcher) DispatchPacket(destination net.Destination, payload *buf.Buffer) error
payload's ownership is transferred to the dispatcher. PacketDispatcher releases it even if DispatchPacket fails.
func (*PacketDispatcher) SetResponseCallback ¶
func (p *PacketDispatcher) SetResponseCallback(callback func(packet *udp.Packet))
type PacketDispatcher0 ¶ added in v1.0.4
func NewPacketDispatcher0 ¶ added in v1.0.4
func NewPacketDispatcher0(ctx context.Context, dispatcher i.FlowHandler) *PacketDispatcher0
func (*PacketDispatcher0) Close ¶ added in v1.0.4
func (s *PacketDispatcher0) Close() error
func (*PacketDispatcher0) DispatchPacket ¶ added in v1.0.4
func (s *PacketDispatcher0) DispatchPacket(destination net.Destination, payload *buf.Buffer) error
payload's ownership is transferred to the dispatcher. PacketDispatcher0 releases it even if DispatchPacket fails.
func (*PacketDispatcher0) SetResponseCallback ¶ added in v1.0.4
func (p *PacketDispatcher0) SetResponseCallback(callback func(packet *udp.Packet))
type PacketDispatcherOption ¶
type PacketDispatcherOption func(*PacketDispatcher)
func WithBufferSize ¶
func WithBufferSize(size int) PacketDispatcherOption
func WithLinkLifetime ¶
func WithLinkLifetime(lifetime time.Duration) PacketDispatcherOption
func WithRequestTimeout ¶
func WithRequestTimeout(timeout time.Duration) PacketDispatcherOption
func WithResponseCallback ¶
func WithResponseCallback(callback func(packet *udp.Packet)) PacketDispatcherOption
func WithResponseTimeout ¶
func WithResponseTimeout(timeout time.Duration) PacketDispatcherOption
Click to show internal directories.
Click to hide internal directories.