fix(core): pass mtproxy info

This commit is contained in:
alina 🌸 2024-12-18 05:50:40 +03:00
parent 36abe3defd
commit 7eaacc5343
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI
2 changed files with 7 additions and 3 deletions

View file

@ -1,10 +1,11 @@
import type { ReconnectionStrategy } from '@fuman/net'
import type { tl } from '@mtcute/tl'
import type { BasicDcOption, ICryptoProvider, Logger } from '../utils/index.js'
import type { IPacketCodec, ITelegramConnection, TelegramTransport } from './transports/abstract.js'
import { FramedReader, FramedWriter } from '@fuman/io'
import { PersistentConnection as FumanPersistentConnection } from '@fuman/net'
import { Emitter, timers } from '@fuman/utils'
export interface PersistentConnectionParams {
@ -99,6 +100,8 @@ export abstract class PersistentConnection {
private _writer?: FramedWriter
protected _mtproxyInfo?: tl.RawInputClientProxy
private async _onOpen(conn: ITelegramConnection) {
this._updateLogPrefix()
this.log.debug('connected')
@ -108,6 +111,8 @@ export abstract class PersistentConnection {
await conn.write(tag)
}
this._mtproxyInfo = conn.getMtproxyInfo?.()
const reader = new FramedReader(conn, this._codec)
this._writer = new FramedWriter(conn, this._codec)

View file

@ -1388,13 +1388,12 @@ export class SessionConnection extends PersistentConnection {
// either acked or returns rpc_result
this.log.debug('wrapping %s with initConnection, layer: %d', method, this.params.layer)
// const proxy = this._transport.getMtproxyInfo?.()
obj = {
_: 'invokeWithLayer',
layer: this.params.layer,
query: {
...this.params.initConnection,
// proxy,
proxy: this._mtproxyInfo,
query: obj,
},
}