Documentation ¶
Index ¶
- Variables
- func Factory() (net.PacketConn, error)
- func NewCountedFakePacketConn(limit uint64) (net.PacketConn, chan struct{})
- func NewFakePacketConn() net.PacketConn
- type FakePacketConn
- func (fpc *FakePacketConn) Close() error
- func (fpc *FakePacketConn) LocalAddr() net.Addr
- func (fpc *FakePacketConn) Read(b []byte) (int, error)
- func (fpc *FakePacketConn) ReadFrom(b []byte) (int, net.Addr, error)
- func (fpc *FakePacketConn) RemoteAddr() net.Addr
- func (fpc *FakePacketConn) SetDeadline(t time.Time) error
- func (fpc *FakePacketConn) SetReadDeadline(t time.Time) error
- func (fpc *FakePacketConn) SetWriteDeadline(t time.Time) error
- func (fpc *FakePacketConn) Write(b []byte) (int, error)
- func (fpc *FakePacketConn) WriteTo(b []byte, addr net.Addr) (int, error)
- type FakeRandomPacketConn
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAlreadyClosedConnection = errors.New("Connection is already closed")
View Source
var ErrClosedConnection = errors.New("Connection is closed")
View Source
var FakeAddr = &net.UDPAddr{ IP: net.IPv4(127, 0, 0, 1), Port: 8181, }
FakeAddr is a fake net.Addr
View Source
var FakeMetric = []byte("foo.bar.baz:2|c")
FakeMetric is a fake metric.
Functions ¶
func Factory ¶
func Factory() (net.PacketConn, error)
Factory is a replacement for net.ListenPacket() that produces instances of FakeRandomPacketConn.
func NewCountedFakePacketConn ¶
func NewCountedFakePacketConn(limit uint64) (net.PacketConn, chan struct{})
func NewFakePacketConn ¶
func NewFakePacketConn() net.PacketConn
Types ¶
type FakePacketConn ¶
type FakePacketConn struct {
// contains filtered or unexported fields
}
FakePacketConn is a fake net.PacketConn (and net.Conn) providing FakeMetric when read from.
func (*FakePacketConn) LocalAddr ¶
func (fpc *FakePacketConn) LocalAddr() net.Addr
LocalAddr dummy impl.
func (*FakePacketConn) Read ¶
func (fpc *FakePacketConn) Read(b []byte) (int, error)
Read copies FakeMetric into b To satisfy net.Conn
func (*FakePacketConn) RemoteAddr ¶
func (fpc *FakePacketConn) RemoteAddr() net.Addr
RemoteAddr dummy impl. To satisfy net.Conn
func (*FakePacketConn) SetDeadline ¶
func (fpc *FakePacketConn) SetDeadline(t time.Time) error
SetDeadline dummy impl.
func (*FakePacketConn) SetReadDeadline ¶
func (fpc *FakePacketConn) SetReadDeadline(t time.Time) error
SetReadDeadline dummy impl.
func (*FakePacketConn) SetWriteDeadline ¶
func (fpc *FakePacketConn) SetWriteDeadline(t time.Time) error
SetWriteDeadline dummy impl.
type FakeRandomPacketConn ¶
type FakeRandomPacketConn struct {
FakePacketConn
}
FakeRandomPacketConn is a fake net.PacketConn providing random fake metrics.
Click to show internal directories.
Click to hide internal directories.