transport

package
v0.0.0-...-5aa7747 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialProxy

func DialProxy(s *url.URL, network, addr string) (net.Conn, error)

func DialSocks4

func DialSocks4(s *url.URL, network, addr string) (net.Conn, error)

func DialSocks5

func DialSocks5(s *url.URL, network, addr string) (net.Conn, error)

Types

type CancelableReader

type CancelableReader struct {
	// contains filtered or unexported fields
}

CancelableReader is a wrapper around io.Reader, that allows to cancel read operation.

func NewCancelableReader

func NewCancelableReader(ctx context.Context, r io.Reader) *CancelableReader

func (*CancelableReader) Read

func (c *CancelableReader) Read(p []byte) (int, error)

func (*CancelableReader) ReadByte

func (c *CancelableReader) ReadByte() (byte, error)

type Conn

type Conn io.ReadWriteCloser

func NewTCP

func NewTCP(cfg TCPConnConfig) (Conn, error)

type ConnConfig

type ConnConfig interface{}

type ErrCode

type ErrCode int

func (ErrCode) Error

func (e ErrCode) Error() string

type ErrNotMultiple

type ErrNotMultiple struct {
	Len int
}

func (*ErrNotMultiple) Error

func (e *ErrNotMultiple) Error() string

type Mode

type Mode interface {
	WriteMsg(msg []byte) error // this is not same as the io.Writer
	ReadMsg() ([]byte, error)
}

type ModeConfig

type ModeConfig = func(Conn) (Mode, error)

type TCPConnConfig

type TCPConnConfig struct {
	Ctx     context.Context
	Host    string
	Timeout time.Duration
	Socks   *url.URL
}

type Transport

type Transport interface {
	Close() error
	WriteMsg(msg messages.Common, requireToAck bool, seqNo int32) error
	ReadMsg() (messages.Common, error)
}

func NewTransport

func NewTransport(m messages.MessageInformator, conn ConnConfig, modeVariant mode.Variant) (Transport, error)

Jump to

Keyboard shortcuts

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