mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2025-01-03 04:50:11 +00:00
remove unneccesary go routines
This commit is contained in:
parent
68c1633995
commit
ce40143581
15
net/conn.go
15
net/conn.go
@ -91,15 +91,16 @@ func (lConn *Conn) HandleHttp(p packet.HttpPacket) {
|
||||
|
||||
log.Debug("[HTTP] Connected to the server.")
|
||||
|
||||
go rConn.Serve(lConn, "[HTTP]")
|
||||
go lConn.Serve(rConn, "[HTTP]")
|
||||
|
||||
_, err = rConn.Write(p.Raw())
|
||||
if err != nil {
|
||||
log.Debug("[HTTP] Error sending request to the server: ", err)
|
||||
return
|
||||
}
|
||||
log.Debug("[HTTP] Sent a request to the server")
|
||||
|
||||
go rConn.Serve(lConn, "[HTTP]")
|
||||
lConn.Serve(rConn, "[HTTP]")
|
||||
|
||||
}
|
||||
|
||||
func (lConn *Conn) HandleHttps(p packet.HttpPacket) {
|
||||
@ -135,10 +136,6 @@ func (lConn *Conn) HandleHttps(p packet.HttpPacket) {
|
||||
|
||||
log.Debug("[HTTPS] Client "+lConn.RemoteAddr().String()+" sent hello: ", len(clientHello), "bytes")
|
||||
|
||||
// Generate a go routine that reads from the server
|
||||
go rConn.Serve(lConn, "[HTTPS]")
|
||||
go lConn.Serve(rConn, "[HTTPS]")
|
||||
|
||||
pkt := packet.NewHttpsPacket(clientHello)
|
||||
|
||||
chunks := pkt.SplitInChunks()
|
||||
@ -147,6 +144,10 @@ func (lConn *Conn) HandleHttps(p packet.HttpPacket) {
|
||||
log.Debug("[HTTPS] Error writing client hello: ", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Generate a go routine that reads from the server
|
||||
go rConn.Serve(lConn, "[HTTPS]")
|
||||
lConn.Serve(rConn, "[HTTPS]")
|
||||
}
|
||||
|
||||
func (from *Conn) Serve(to *Conn, proto string) {
|
||||
|
@ -56,10 +56,10 @@ func (p *Proxy) Start() {
|
||||
|
||||
if pkt.IsConnectMethod() {
|
||||
log.Debug("[HTTPS] Start")
|
||||
go conn.HandleHttps(pkt)
|
||||
conn.HandleHttps(pkt)
|
||||
} else {
|
||||
log.Debug("[HTTP] Start")
|
||||
go conn.HandleHttp(pkt)
|
||||
conn.HandleHttp(pkt)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user