cluster

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 19 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

Overview

Package cluster contains Telegram multi-DC setup utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

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

Cluster is a cluster of multiple servers, representing multiple Telegram datacenters.

func NewCluster

func NewCluster(opts Options) *Cluster

NewCluster creates new server Cluster.

func (*Cluster) Common

func (c *Cluster) Common() *tgtest.Dispatcher

Common returns common dispatcher.

func (*Cluster) DC

func (c *Cluster) DC(id int, name string) (*tgtest.Server, *tgtest.Dispatcher)

DC registers new server and returns it.

func (*Cluster) Dispatch

func (c *Cluster) Dispatch(id int, name string) *tgtest.Dispatcher

Dispatch registers new server and returns its dispatcher.

func (*Cluster) Keys

func (c *Cluster) Keys() []exchange.PublicKey

Keys returns all servers public keys.

func (*Cluster) List

func (c *Cluster) List() dcs.List

List returns DCs list.

func (*Cluster) Ready

func (c *Cluster) Ready() <-chan struct{}

Ready returns signal channel to await readiness.

func (*Cluster) Resolver

func (c *Cluster) Resolver() dcs.Resolver

Resolver returns dcs.Resolver to use.

func (*Cluster) Up

func (c *Cluster) Up(ctx context.Context) error

Up runs all servers in a cluster.

type Options

type Options struct {
	// Web denotes to use websocket listener.
	Web bool
	// Random is random source. Used to generate RSA keys.
	// Defaults to rand.Reader.
	Random io.Reader
	// Logger is the structured logger. No logs by default.
	Logger log.Logger
	// Codec constructor.
	// Defaults to nil (underlying transport server detects protocol automatically).
	Protocol dcs.Protocol
	// Config is an initial cluster config.
	Config tg.Config
	// CDNConfig is an initial cluster CDN config.
	CDNConfig tg.CDNConfig
}

Options of Cluster.

Jump to

Keyboard shortcuts

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