cluster

package
v0.0.0-...-87e9d67 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 19 Imported by: 0

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 instance of zap.Logger. No logs by default.
	Logger *zap.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