mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 14:26:31 +00:00
commit
c8167effb4
@ -2,7 +2,6 @@ package proxy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
|
||||
// "time"
|
||||
@ -26,13 +25,7 @@ func HandleHttps(clientConn net.Conn, ip string) {
|
||||
for {
|
||||
buf, err := util.ReadMessage(remoteConn)
|
||||
if err != nil {
|
||||
if err != io.EOF {
|
||||
util.Debug("Error reading from the server:", err)
|
||||
} else {
|
||||
util.Debug("Remote connection Closed: ", err)
|
||||
}
|
||||
|
||||
util.Debug("Closing connection: ", remoteConn.RemoteAddr())
|
||||
util.Debug("Error reading from the server", err, " Closing connection ", remoteConn.RemoteAddr())
|
||||
return
|
||||
}
|
||||
|
||||
@ -40,7 +33,7 @@ func HandleHttps(clientConn net.Conn, ip string) {
|
||||
|
||||
_, write_err := clientConn.Write(buf)
|
||||
if write_err != nil {
|
||||
util.Debug("Error writing to client:", write_err)
|
||||
util.Debug("Error sending data to the client:", write_err)
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -51,17 +44,12 @@ func HandleHttps(clientConn net.Conn, ip string) {
|
||||
|
||||
clientHello, err := util.ReadMessage(clientConn)
|
||||
if err != nil {
|
||||
if err != io.EOF {
|
||||
util.Debug("Error reading from the client:", err)
|
||||
} else {
|
||||
util.Debug("Client connection Closed: ", err)
|
||||
}
|
||||
|
||||
util.Debug("Closing connection: ", clientConn.RemoteAddr())
|
||||
util.Debug("Error reading client hello", err, " Closing connection ", clientConn.RemoteAddr())
|
||||
}
|
||||
|
||||
util.Debug(clientConn.RemoteAddr(), "Client sent hello", len(clientHello))
|
||||
|
||||
chunks, err := util.SplitSliceInChunks(clientHello, config.GetConfig().MTU)
|
||||
chunks, err := util.SplitInChunks(clientHello, config.GetConfig().MTU)
|
||||
if err != nil {
|
||||
util.Debug("Error chunking client hello: ", err)
|
||||
}
|
||||
@ -77,15 +65,10 @@ func HandleHttps(clientConn net.Conn, ip string) {
|
||||
for {
|
||||
buf, err := util.ReadMessage(clientConn)
|
||||
if err != nil {
|
||||
if err != io.EOF {
|
||||
util.Debug("Error reading from the client:", err)
|
||||
} else {
|
||||
util.Debug("Client connection Closed: ", err)
|
||||
}
|
||||
|
||||
util.Debug("Closing connection: ", clientConn.RemoteAddr())
|
||||
util.Debug("Error reading from the client", err, " Closing connection ", clientConn.RemoteAddr())
|
||||
break
|
||||
}
|
||||
|
||||
util.Debug(clientConn.RemoteAddr(), "Client sent data", len(buf))
|
||||
|
||||
_, write_err := remoteConn.Write(buf)
|
||||
|
@ -109,7 +109,7 @@ func ExtractMethod(message *[]byte) (string) {
|
||||
return strings.ToUpper(method)
|
||||
}
|
||||
|
||||
func SplitSliceInChunks(a []byte, size int) ([][]byte, error) {
|
||||
func SplitInChunks(a []byte, size int) ([][]byte, error) {
|
||||
if size < 1 {
|
||||
return nil, errors.New("chuckSize must be greater than zero")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user