fix(core): pass mtproxy info
This commit is contained in:
parent
36abe3defd
commit
7eaacc5343
2 changed files with 7 additions and 3 deletions
|
@ -1,10 +1,11 @@
|
||||||
import type { ReconnectionStrategy } from '@fuman/net'
|
import type { ReconnectionStrategy } from '@fuman/net'
|
||||||
|
import type { tl } from '@mtcute/tl'
|
||||||
import type { BasicDcOption, ICryptoProvider, Logger } from '../utils/index.js'
|
import type { BasicDcOption, ICryptoProvider, Logger } from '../utils/index.js'
|
||||||
import type { IPacketCodec, ITelegramConnection, TelegramTransport } from './transports/abstract.js'
|
import type { IPacketCodec, ITelegramConnection, TelegramTransport } from './transports/abstract.js'
|
||||||
|
|
||||||
import { FramedReader, FramedWriter } from '@fuman/io'
|
import { FramedReader, FramedWriter } from '@fuman/io'
|
||||||
|
|
||||||
import { PersistentConnection as FumanPersistentConnection } from '@fuman/net'
|
import { PersistentConnection as FumanPersistentConnection } from '@fuman/net'
|
||||||
|
|
||||||
import { Emitter, timers } from '@fuman/utils'
|
import { Emitter, timers } from '@fuman/utils'
|
||||||
|
|
||||||
export interface PersistentConnectionParams {
|
export interface PersistentConnectionParams {
|
||||||
|
@ -99,6 +100,8 @@ export abstract class PersistentConnection {
|
||||||
|
|
||||||
private _writer?: FramedWriter
|
private _writer?: FramedWriter
|
||||||
|
|
||||||
|
protected _mtproxyInfo?: tl.RawInputClientProxy
|
||||||
|
|
||||||
private async _onOpen(conn: ITelegramConnection) {
|
private async _onOpen(conn: ITelegramConnection) {
|
||||||
this._updateLogPrefix()
|
this._updateLogPrefix()
|
||||||
this.log.debug('connected')
|
this.log.debug('connected')
|
||||||
|
@ -108,6 +111,8 @@ export abstract class PersistentConnection {
|
||||||
await conn.write(tag)
|
await conn.write(tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._mtproxyInfo = conn.getMtproxyInfo?.()
|
||||||
|
|
||||||
const reader = new FramedReader(conn, this._codec)
|
const reader = new FramedReader(conn, this._codec)
|
||||||
this._writer = new FramedWriter(conn, this._codec)
|
this._writer = new FramedWriter(conn, this._codec)
|
||||||
|
|
||||||
|
|
|
@ -1388,13 +1388,12 @@ export class SessionConnection extends PersistentConnection {
|
||||||
// either acked or returns rpc_result
|
// either acked or returns rpc_result
|
||||||
|
|
||||||
this.log.debug('wrapping %s with initConnection, layer: %d', method, this.params.layer)
|
this.log.debug('wrapping %s with initConnection, layer: %d', method, this.params.layer)
|
||||||
// const proxy = this._transport.getMtproxyInfo?.()
|
|
||||||
obj = {
|
obj = {
|
||||||
_: 'invokeWithLayer',
|
_: 'invokeWithLayer',
|
||||||
layer: this.params.layer,
|
layer: this.params.layer,
|
||||||
query: {
|
query: {
|
||||||
...this.params.initConnection,
|
...this.params.initConnection,
|
||||||
// proxy,
|
proxy: this._mtproxyInfo,
|
||||||
query: obj,
|
query: obj,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue