mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2025-01-03 04:50:11 +00:00
28 lines
571 B
Go
28 lines
571 B
Go
package proxy
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
|
|
"github.com/xvzc/SpoofDPI/packet"
|
|
// "github.com/xvzc/SpoofDPI/util"
|
|
)
|
|
|
|
func HandleHttp(clientConn net.Conn, ip string, p *packet.HttpPacket) {
|
|
remoteConn, err := net.Dial("tcp", ip+":80") // create connection to server
|
|
if err != nil {
|
|
// util.Debug(err)
|
|
return
|
|
}
|
|
defer remoteConn.Close()
|
|
|
|
// util.Debug("[HTTP] Connected to the server.")
|
|
|
|
go Serve(remoteConn, clientConn, "HTTP")
|
|
|
|
// util.Debug("[HTTP] Sending request to the server")
|
|
fmt.Fprintf(remoteConn, string(*p.Raw))
|
|
|
|
Serve(clientConn, remoteConn, "HTTP")
|
|
}
|