package proxy import ( "log" "net" "fmt" // "time" "github.com/xvzc/SpoofDPI/util" ) func HandleHttps(clientConn net.Conn, ip string) { defer clientConn.Close() remoteConn, err := net.Dial("tcp", ip+":443") // create connection to server if err != nil { log.Fatal(err) return } defer remoteConn.Close() log.Println("Connected to the server.") // established := []byte("HTTP/1.1 204 No Content\n\n") log.Println("Sending 204 No Content to the client..") fmt.Fprintf(clientConn, "HTTP/1.1 204 No Content\n\n") clientHello, err := util.ReadMessage(clientConn) if err != nil { log.Fatal(err) } log.Println("Client sent Client Hello. length:", len(clientHello)) fmt.Fprintf(remoteConn, string(clientHello)) serverHello, err := util.ReadMessage(clientConn) if err != nil { log.Fatal(err) } log.Println("Client sent Client Hello. length:", len(serverHello)) fmt.Fprintf(clientConn, string(serverHello)) /* serverHello, err := util.WriteAndRead(remoteConn, clientHello) log.Println("Server sent data. length:", len(serverHello)) clientFinish, err := util.WriteAndRead(clientConn, serverHello) log.Println("Client sent data. length:", len(clientFinish)) _, err = remoteConn.Write(clientFinish) if err != nil { log.Fatal("Error writing to client:", err) } log.Println("Written") */ }