Documentation
¶
Overview ¶
Package dcs contains Telegram DCs list and some helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindPrimaryDCs ¶
FindPrimaryDCs searches new primary DC from given config. Unlike FindDC, it filters CDNs and MediaOnly servers, returns error if not found.
Types ¶
type MTProxyOptions ¶
type MTProxyOptions struct {
// Dialer to use. net.Dialer will be used by default.
Dialer transport.Dialer
// Network to use.
Network string
// Random source for MTProxy obfuscator.
Rand io.Reader
}
MTProxyOptions is MTProxy resolver creation options.
type PlainOptions ¶
type PlainOptions struct {
// Transport to use.
Transport Transport
// Dialer to use. Default net.Dialer will be used by default.
Dialer transport.Dialer
// Network to use.
Network string
// PreferIPv6 gives IPv6 DCs higher precedence.
// Default is to prefer IPv4 DCs over IPv6.
PreferIPv6 bool
}
PlainOptions is plain resolver creation options.
type Resolver ¶
type Resolver interface {
Primary(ctx context.Context, dc int, dcOptions []tg.DCOption) (transport.Conn, error)
MediaOnly(ctx context.Context, dc int, dcOptions []tg.DCOption) (transport.Conn, error)
CDN(ctx context.Context, dc int, dcOptions []tg.DCOption) (transport.Conn, error)
}
Resolver resolves DC and creates transport MTProto connection.
func MTProxyResolver ¶
func MTProxyResolver(addr string, secret []byte, opts MTProxyOptions) (Resolver, error)
MTProxyResolver creates MTProxy obfuscated DC resolver.
See https://core.telegram.org/mtproto/mtproto-transports#transport-obfuscation.
func PlainResolver ¶
func PlainResolver(opts PlainOptions) Resolver
PlainResolver creates plain DC resolver.
Click to show internal directories.
Click to hide internal directories.