Fix android ping

This commit is contained in:
9seconds
2026-03-13 16:20:18 +01:00
parent 6d8d2961e8
commit 45b0964afd
3 changed files with 21 additions and 34 deletions
+7 -14
View File
@@ -78,8 +78,7 @@ func (p *Proxy) ServeConn(conn essentials.Conn) {
ctx.logger.Info("Stream has been finished")
}()
noise, ok := p.doFakeTLSHandshake(ctx)
if !ok {
if !p.doFakeTLSHandshake(ctx) {
return
}
@@ -90,11 +89,6 @@ func (p *Proxy) ServeConn(conn essentials.Conn) {
}
defer clientConn.Stop()
if _, err := clientConn.SyncWrite(noise); err != nil {
ctx.logger.InfoError("cannot send the first packet", err)
return
}
ctx.clientConn = clientConn
if err := p.doObfuscatedHandshake(ctx); err != nil {
@@ -176,7 +170,7 @@ func (p *Proxy) Shutdown() {
p.blocklist.Shutdown()
}
func (p *Proxy) doFakeTLSHandshake(ctx *streamContext) ([]byte, bool) {
func (p *Proxy) doFakeTLSHandshake(ctx *streamContext) bool {
rewind := newConnRewind(ctx.clientConn)
clientHello, err := fake.ReadClientHello(
@@ -188,25 +182,24 @@ func (p *Proxy) doFakeTLSHandshake(ctx *streamContext) ([]byte, bool) {
if err != nil {
p.logger.InfoError("cannot read client hello", err)
p.doDomainFronting(ctx, rewind)
return nil, false
return false
}
if p.antiReplayCache.SeenBefore(clientHello.SessionID) {
p.logger.Warning("replay attack has been detected!")
p.eventStream.Send(p.ctx, NewEventReplayAttack(ctx.streamID))
p.doDomainFronting(ctx, rewind)
return nil, false
return false
}
noise, err := fake.SendServerHello(ctx.clientConn, p.secret.Key[:], clientHello)
if err != nil {
if err := fake.SendServerHello(ctx.clientConn, p.secret.Key[:], clientHello); err != nil {
p.logger.InfoError("cannot send welcome packet", err)
return nil, false
return false
}
ctx.clientConn = tls.New(ctx.clientConn, true, false)
return noise, true
return true
}
func (p *Proxy) doObfuscatedHandshake(ctx *streamContext) error {