Documentation ¶
Overview ¶
testutil is a package that implements a set of functions for testing.
Index ¶
- func ConnectTCPServer(address string) (net.Conn, error)
- func FreeLocalAddress() string
- func FreePort() uint16
- func StartTCPServer(ctx context.Context, handler func(net.Conn)) (net.Listener, error)
- type MockConn
- func (mock *MockConn) Close() error
- func (mock *MockConn) LocalAddr() net.Addr
- func (mock *MockConn) Read(b []byte) (n int, err error)
- func (mock *MockConn) RemoteAddr() net.Addr
- func (mock *MockConn) SetDeadline(t time.Time) error
- func (mock *MockConn) SetReadDeadline(t time.Time) error
- func (mock *MockConn) SetWriteDeadline(t time.Time) error
- func (mock *MockConn) Write(b []byte) (n int, err error)
- type MockListener
- type ReadMessageResult
- type SecureTunnelServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FreeLocalAddress ¶
func FreeLocalAddress() string
FreeLocalAddress returns free local address. -> 127.0.0.1:<free port>
Types ¶
type MockConn ¶
type MockConn struct { ChReadArgs chan []byte MockRead func(b []byte) (n int, err error) ChWriteArgs chan []byte MockWrite func(b []byte) (n int, err error) MockClose func() error MockLocalAddr func() net.Addr MockRemoteAddr func() net.Addr }
func NewMockConn ¶
func NewMockConn() *MockConn
func (*MockConn) RemoteAddr ¶
type MockListener ¶
type MockListener struct { MockAccept func() (net.Conn, error) MockClose func() error MockAddr func() net.Addr }
func NewMockListener ¶
func NewMockListener() *MockListener
func (*MockListener) Addr ¶
func (mock *MockListener) Addr() net.Addr
func (*MockListener) Close ¶
func (mock *MockListener) Close() error
type ReadMessageResult ¶
func (*ReadMessageResult) UnmarshalMessage ¶
func (result *ReadMessageResult) UnmarshalMessage() (*aws.Message, error)
type SecureTunnelServer ¶
type SecureTunnelServer struct { Host string Endpoint *url.URL ChRequest chan *http.Request ChMessage chan *ReadMessageResult ChWebSocket chan *websocket.Conn ChPing chan string RequestHandler func(w http.ResponseWriter, r *http.Request) (endResponse bool) }
func NewSecureTunnelServer ¶
func NewSecureTunnelServer() *SecureTunnelServer
func (*SecureTunnelServer) Start ¶
func (server *SecureTunnelServer) Start(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.