问题描述:

My code looks like this at the moment:

package main

import (

"io"

"net/http"

"fmt"

"net"

)

const (

PORT = ":443"

KEY = "./localhost.key"

CERT = "./localhost.crt"

)

func hello(w http.ResponseWriter, r *http.Request) {

io.WriteString(w, "Hello world! :)")

}

func main() {

http.HandleFunc("/", hello)

http.ListenAndServeTLS(PORT, CERT, KEY, nil)

}

What I would like to be able to do is to use the net.Conn that is created when a client reaches my host. The reason behind this is to use golang.org/x/net/http2 in order to create custom frames and edit the transmission of data at a lower level. And for example http2.NewFramer requires a writer and a reader, which I guess would be the actual net.Conn in both cases.

I am pretty to new to Golang so any advice on how to improve myself is well welcomed. Thank you in advance everyone! :)

相关阅读:
Top