DC represents connection pool to one data center. // immutableclosedatomic.Bool DC context. Will be canceled by Run on exit. // immutable Free connections.freeReq*reqMap Connections supervisor.idint Wrappers for external world, like logs or PRNG. // immutable Limit of connections. // immutable DC mutex. Connection constructor. Connection id monotonic counter. Signal connection for cases when all connections are dead, but all requests waiting for
free connection in 3rd acquire case. Total connections. Close waits while all ongoing requests will be done or until given context is done.
Then, closes the DC. Invoke sends MTProto request using one of pool connection.(*DC) acquire(ctx context.Context) (r *poolConn, err error)(*DC) createConnection(id int64) *poolConn(*DC) dead(r *poolConn, deadErr error)(*DC) pop() (r *poolConn, ok bool)(*DC) release(r *poolConn)
*DC : github.com/gotd/td/telegram.CloseInvoker
*DC : github.com/gotd/td/tg.Invoker
*DC : io.Closer
func NewDC(ctx context.Context, id int, newConn func() Conn, opts DCOptions) *DC
func github.com/gotd/td/telegram.(*Client).createPool(dc int, max int64, creator func() Conn) (*DC, error)
func github.com/gotd/td/telegram.(*Client).dc(ctx context.Context, dcID int, max int64, dialer mtproto.Dialer) (*DC, error)
DCOptions is a Telegram data center connections pool options. Logger is instance of zap.Logger. No logs by default. MTProto options for connections.
Opened connection limit to the DC.(*DCOptions) setDefaults()
func NewDC(ctx context.Context, id int, newConn func() Conn, opts DCOptions) *DC
SyncSession is synchronization helper for Session.dataSessionmuxsync.RWMutex Load gets session and returns it. Migrate changes current DC and its addr, zeroes AuthKey and Salt. Options fills Key and Salt field of given Options using stored session and returns it. Store saves given Session.
func NewSyncSession(data Session) *SyncSession
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.