fakenet

package
v2.3.12 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package fakenet contains fake network abstractions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockPacketConn added in v2.3.5

type MockPacketConn struct{}

MockPacketConn for tests

func (*MockPacketConn) Close added in v2.3.5

func (m *MockPacketConn) Close() error

func (*MockPacketConn) LocalAddr added in v2.3.5

func (m *MockPacketConn) LocalAddr() net.Addr

func (*MockPacketConn) ReadFrom added in v2.3.5

func (m *MockPacketConn) ReadFrom([]byte) (n int, addr net.Addr, err error)

func (*MockPacketConn) SetDeadline added in v2.3.5

func (m *MockPacketConn) SetDeadline(time.Time) error

func (*MockPacketConn) SetReadDeadline added in v2.3.5

func (m *MockPacketConn) SetReadDeadline(time.Time) error

func (*MockPacketConn) SetWriteDeadline added in v2.3.5

func (m *MockPacketConn) SetWriteDeadline(time.Time) error

func (*MockPacketConn) WriteTo added in v2.3.5

func (m *MockPacketConn) WriteTo([]byte, net.Addr) (n int, err error)

type PacketConn

type PacketConn struct {
	net.Conn
}

PacketConn wraps a net.Conn and emulates net.PacketConn

func (*PacketConn) ReadFrom

func (f *PacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

ReadFrom reads a packet from the connection,

func (*PacketConn) WriteTo

func (f *PacketConn) WriteTo(p []byte, _ net.Addr) (int, error)

WriteTo writes a packet with payload p to addr.

Jump to

Keyboard shortcuts

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