Documentation ¶
Overview ¶
Package debugstuff implements mock structs & functions using in unit tests in whole project
Index ¶
- func FormatMockTransportInfo(scheme string, uri url.URL, proxy *url.URL, ctx_closed bool, ...) string
- func MockConn() net.Conn
- func MockConnContent() []byte
- func MockConnTooShortContent() []byte
- func MockConnWrongVerContent() []byte
- func MockPubKey() []byte
- func MockTooShortConn() net.Conn
- func MockWrongVerConn() net.Conn
- func ReadMockTransportInfo(conn net.Conn) string
- func ReadMockTransportInfoAfterHeader(conn net.Conn) string
- type MockTransport
- type MockTransportListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatMockTransportInfo ¶
func FormatMockTransportInfo( scheme string, uri url.URL, proxy *url.URL, ctx_closed bool, key ed25519.PrivateKey, ) string
Returns json string with passed arguments.
func MockConn ¶
Return connection from witch valid handshake pkg & some pseudo payload data can be readed
func MockConnContent ¶
func MockConnContent() []byte
Return valid handshake pkg & some pseudo payload data for debug usage
func MockConnTooShortContent ¶
func MockConnTooShortContent() []byte
Returns an incorrect cropped ygg handshake pkg
func MockConnWrongVerContent ¶
func MockConnWrongVerContent() []byte
Return valid handshake pkg & some pseudo payload data but proto version is too hight
func ReadMockTransportInfo ¶
Read all data from connetion up to EOF to string.
func ReadMockTransportInfoAfterHeader ¶
Read ygg handshake pkg and then all data up to EOF to string.
Types ¶
type MockTransport ¶
Mock realistion fro Transport interface for for debugging needs.
Has mutable behavior controlled by url keys.
func (MockTransport) Connect ¶
func (t MockTransport) Connect( ctx context.Context, uri url.URL, proxy *url.URL, key ed25519.PrivateKey, ) (static.ConnResult, error)
Writes result of FormatMockTransportInfo to returned connection after handshake pkg
Peer key returned from opened connection controls by "mock_peer_key" url key. Transport key returned with opened connection controls by "mock_transport_key" url key. Delay before returning result controls by "mock_delay_conn" url key. Delay before writing handshake pkg to connection controls by "mock_delay_before_meta" url key. Delay before writing info string to connection controls by "mock_delay_after_meta" url key.
func (MockTransport) GetScheme ¶
func (t MockTransport) GetScheme() string
func (MockTransport) Listen ¶
func (t MockTransport) Listen(ctx context.Context, uri url.URL, key ed25519.PrivateKey) (static.TransportListener, error)
type MockTransportListener ¶
type MockTransportListener struct {
// contains filtered or unexported fields
}
Mock realistion fro TransportListener interface for for debugging needs.
func (*MockTransportListener) AcceptConn ¶
func (l *MockTransportListener) AcceptConn() (static.ConnResult, error)
func (*MockTransportListener) Addr ¶
func (l *MockTransportListener) Addr() net.Addr
func (*MockTransportListener) Close ¶
func (l *MockTransportListener) Close() error