client

package
v0.1.82 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const TagAbridged uint32 = 0xefefefef

TagAbridged is the obfuscated2 transport tag for MTProto's abridged framing.

Variables

View Source
var ErrFakeTLSAuth = fmt.Errorf("%w: authentication failed", ErrNotProxy)

ErrFakeTLSAuth is the Fake TLS-shaped response a site or decoy sends after rejecting a domain or key.

View Source
var ErrFakeTLSProtocol = fmt.Errorf("%w: invalid Fake TLS response", ErrNotProxy)

ErrFakeTLSProtocol means the response did not have the framing of a Fake TLS ServerHello.

View Source
var ErrNotProxy = errors.New("mtproto: the answer is not a Fake TLS ServerHello for this key")

ErrNotProxy means a connection did not return the keyed Fake TLS ServerHello a client expects.

Functions

func BuildClientHello

func BuildClientHello(key [keyLen]byte, domain string, unix uint32) ([]byte, error)

BuildClientHello builds the Telegram Fake TLS ClientHello for one domain and Unix timestamp.

Types

type Client

type Client struct {
	Conn net.Conn
	// HeaderKeys are bytes 8..56 of the obfuscated2 header sent: the keys and IVs of this leg.
	HeaderKeys []byte
	// contains filtered or unexported fields
}

Client is a proxy connection after the Fake TLS handshake.

func StartClient

func StartClient(conn net.Conn, key [keyLen]byte, hello []byte) (*Client, error)

StartClient sends the Fake TLS hello and validates the keyed ServerHello answer.

func (*Client) CloseWrite

func (c *Client) CloseWrite() error

CloseWrite half-closes a TCP client connection.

func (*Client) Read

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

Read returns decrypted bytes from the server's application data records.

func (*Client) SendHeader

func (c *Client) SendHeader(tag uint32, dc int16) error

SendHeader sends the obfuscated2 abridged/intermediate/padded header for one DC.

func (*Client) Write

func (c *Client) Write(p []byte) (int, error)

Write sends encrypted bytes in Fake TLS application data records.

Jump to

Keyboard shortcuts

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