2021-12-29 17:08:30 +00:00
|
|
|
package proxy
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net"
|
|
|
|
|
|
|
|
"github.com/xvzc/SpoofDPI/util"
|
|
|
|
)
|
|
|
|
|
2022-01-07 17:03:46 +00:00
|
|
|
func HandleHttp(clientConn net.Conn, ip string, message []byte) {
|
|
|
|
remoteConn, err := net.Dial("tcp", ip+":80") // create connection to server
|
|
|
|
if err != nil {
|
|
|
|
util.Debug(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
defer remoteConn.Close()
|
2021-12-29 17:08:30 +00:00
|
|
|
|
2022-01-07 17:03:46 +00:00
|
|
|
util.Debug("[HTTP] Connected to the server.")
|
2021-12-29 17:08:30 +00:00
|
|
|
|
2022-01-07 17:03:46 +00:00
|
|
|
go Serve(remoteConn, clientConn, "HTTP")
|
2021-12-29 17:08:30 +00:00
|
|
|
|
2022-01-07 17:03:46 +00:00
|
|
|
util.Debug("[HTTP] Sending request to the server")
|
|
|
|
fmt.Fprintf(remoteConn, string(message))
|
2021-12-29 17:08:30 +00:00
|
|
|
|
2022-01-07 17:03:46 +00:00
|
|
|
Serve(clientConn, remoteConn, "HTTP")
|
2021-12-29 17:08:30 +00:00
|
|
|
}
|