network_exchange

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoginDC

func LoginDC(sock io.ReadWriteCloser, protocol uint8) *rawStream

do not reobfuscate connection to dc (there are really no need for it)

func ObfuscateDC

func ObfuscateDC(sock io.ReadWriteCloser, ctx *tgcrypt_encryption.DcCtx) *obfuscatedStream

in case you need to obfuscate connection to dc, you can do it

Types

type ClientHandler

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

func NewClient

func NewClient(cfg *config.Config, statsHandle *stats.StatsHandle, client net.Conn) *ClientHandler

func (*ClientHandler) HandleClient

func (o *ClientHandler) HandleClient() (err error)

type DCConnector

type DCConnector interface {
	// Connect to the specified DC by it's number (may be negative)
	ConnectDC(dc int16) (c io.ReadWriteCloser, err error)
	// Connects to specific host (for fallback connections)
	ConnectHost(host string) (c net.Conn, err error)
}

Connects client to the specified DC or fallback host

type DcDirectConnector

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

Directly connects client

func NewDcDirectConnector

func NewDcDirectConnector(allowIPv6 bool) *DcDirectConnector

creates a new DcDirectConnector

func (*DcDirectConnector) ConnectDC

func (dcc *DcDirectConnector) ConnectDC(dc int16) (stream io.ReadWriteCloser, err error)

Connects client to the specified DC directly

func (*DcDirectConnector) ConnectHost

func (dcc *DcDirectConnector) ConnectHost(host string) (net.Conn, error)

type DcSocksConnector

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

Connects client over SOCKS5 proxy

func NewDcSocksConnector

func NewDcSocksConnector(allowIPv6 bool, socks5 string, user, pass *string) *DcSocksConnector

Create a new DcSocksConnector

func (*DcSocksConnector) ConnectDC

func (dsc *DcSocksConnector) ConnectDC(dc int16) (io.ReadWriteCloser, error)

connect to the specified DC over socks5

func (*DcSocksConnector) ConnectHost

func (dsc *DcSocksConnector) ConnectHost(host string) (net.Conn, error)

type MiddleProxyManager

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

func NewMiddleProxyManager

func NewMiddleProxyManager(cfg *config.Config) (*MiddleProxyManager, error)

func (*MiddleProxyManager) GetProxy

func (m *MiddleProxyManager) GetProxy(dc int16) (url4, url6 string, err error)

func (*MiddleProxyManager) GetSecret

func (m *MiddleProxyManager) GetSecret() []byte

get secret for middle proxies

type MiddleProxyStream

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

func NewMiddleProxyStream

func NewMiddleProxyStream(mpStream dataStream, client, mp net.Conn, addTag []byte, clientProtocol uint8) *MiddleProxyStream

func (*MiddleProxyStream) CloseStream

func (s *MiddleProxyStream) CloseStream() error

func (*MiddleProxyStream) Initiate

func (s *MiddleProxyStream) Initiate() (err error)

func (*MiddleProxyStream) ReadSrvMsg

func (m *MiddleProxyStream) ReadSrvMsg() (*message, error)

func (*MiddleProxyStream) WriteSrvMsg

func (m *MiddleProxyStream) WriteSrvMsg(msg *message) error

type MsgStreanCloser

type MsgStreanCloser interface {
	CloseStream() error
}

Jump to

Keyboard shortcuts

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