mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 16:44:03 +03:00
Add support of EventDomainFronting event
This commit is contained in:
+14
-2
@@ -215,7 +215,7 @@ func (p *Proxy) doTelegramCall(ctx *streamContext) error {
|
||||
}
|
||||
|
||||
ctx.telegramConn = obfuscated2.Conn{
|
||||
Conn: connTelegramTraffic{
|
||||
Conn: connTraffic{
|
||||
Conn: conn,
|
||||
connID: ctx.connID,
|
||||
stream: p.eventStream,
|
||||
@@ -235,7 +235,12 @@ func (p *Proxy) doTelegramCall(ctx *streamContext) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Proxy) doDomainFronting(ctx context.Context, conn *connRewind) {
|
||||
func (p *Proxy) doDomainFronting(ctx *streamContext, conn *connRewind) {
|
||||
p.eventStream.Send(p.ctx, EventDomainFronting{
|
||||
CreatedAt: time.Now(),
|
||||
ConnID: ctx.connID,
|
||||
})
|
||||
|
||||
conn.Rewind()
|
||||
|
||||
frontConn, err := p.network.DialContext(ctx, "tcp", p.domainFrontAddress)
|
||||
@@ -245,6 +250,13 @@ func (p *Proxy) doDomainFronting(ctx context.Context, conn *connRewind) {
|
||||
return
|
||||
}
|
||||
|
||||
frontConn = connTraffic{
|
||||
Conn: frontConn,
|
||||
ctx: ctx,
|
||||
connID: ctx.connID,
|
||||
stream: p.eventStream,
|
||||
}
|
||||
|
||||
rel := relay.AcquireRelay(ctx,
|
||||
p.logger.Named("domain-fronting"), p.bufferSize, p.idleTimeout)
|
||||
defer relay.ReleaseRelay(rel)
|
||||
|
||||
Reference in New Issue
Block a user