Go is Getting Serious About HTTP/3! New Proposal Officially Launched

Go is Getting Serious About HTTP/3! New Proposal Officially Launched

Code Little BraidMillionFans CertifiedAccount

By clicking follow, you not only gain a tool for finding resources but also an interesting soul ▶ ▶

The Go core team has made new moves. Recently, a new proposal #70914 was seen in the golang/go repository: Add experimental HTTP/3 implementation in x/net/http3.

Go is Getting Serious About HTTP/3! New Proposal Officially Launched

After all, HTTP/3 has been around for a few years:

Go is Getting Serious About HTTP/3! New Proposal Officially Launched

Correspondingly, the call for HTTP/3 support has been strong in the Go community for several years.

This is quite significant.

Background

In fact, discussions about HTTP/3 in Go have been ongoing for a long time. As early as 2019, issue #32204 was discussing the support of <span>net/http</span> package for HTTP/3.

Why is it only now that formal progress is being made? I think there are several reasons:

  • First: The underlying QUIC implementation has a foundation. The proposal for the x/net/quic package has been approved, providing the necessary underlying support for HTTP/3.
  • Second: The HTTP/3 standard has stabilized. RFC 9114 has been published, and major vendors’ support is basically in place.
  • Third: The community demand is indeed strong. In scenarios like cloud-native and edge computing, the performance advantages of HTTP/3 are quite evident.

New Proposal: Experimental HTTP/3

The appeal of this proposal is quite “simple”, aiming to:Add HTTP/3 client and server implementations in the x/net/http3 package.

The approach is exactly the same as the previous <span>x/net/quic</span> proposal (#58547):

  • First, create an experimental package.
  • The API can be adjusted at any time during development.
  • Once the implementation is complete, a separate API review proposal will be submitted.

Development Plan

The development roadmap mentioned in the proposal is quite clear:

  • Phase One: Develop in the internal package <span>x/net/internal/http3</span>, and discuss once the details are stable.
  • Phase Two: Migrate to <span>x/net/http3</span>, open for external testing.
  • Phase Three: After the API stabilizes, submit a formal API review proposal.

This gradual strategy is quite prudent.

Because HTTP/3 involves a lot, jumping straight to a complete implementation does carry certain risks.

Thoughts: Possible HTTP/3 Code Examples

Although the specific API has not been determined, based on Go’s consistent style, it is expected to be quite simple to use.

Currently, writing an HTTP/3 server using the third-party library quic-go looks something like this:

package main

import (
    "crypto/tls"
    "net/http"

    "github.com/quic-go/quic-go/http3"
)

func main() {
    mux := http.NewServeMux()
    mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        w.Write([]byte("Hello HTTP/3!"))
    })

    server := &http3.Server{
        Addr:    ":8080",
        Handler: mux,
        TLSConfig: &tls.Config{
            // TLS configuration
        },
    }

    server.ListenAndServe()
}

Once the official Go implementation is out, the API will likely align better with Go’s design philosophy.

Let’s imagine what it might look like in the future:

package main

import (
    "net/http"
    "x/net/http3"
)

func main() {
    mux := http.NewServeMux()
    mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        w.Write([]byte("Hello HTTP/3!"))
    })

    // It is expected to integrate well with the existing http package
    server := &http3.Server{
        Addr:    ":8080",
        Handler: mux,
    }

    server.ListenAndServe()
}

The client usage is also expected to be quite simple:

package main

import (
    "fmt"
    "x/net/http3"
)

func main() {
    client := &http3.Client{}

    resp, err := client.Get("https://example.com")
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    fmt.Println("Response:", resp.Status)
}

Of course, these are just my speculations; the specific API design will have to wait for the official implementation to be revealed.

Personal Opinion

To be honest, I am quite looking forward to this proposal.

Go has always been strong in network programming, and the net/http package is a classic in the Go ecosystem. However, it has indeed lagged behind in HTTP/3, and currently, using HTTP/3 basically relies on third-party libraries.

With an official implementation, I believe there will be improvements in the following areas:

  • Better Compatibility: The official implementation will definitely integrate better with the existing net/http package.
  • More Stable Maintenance: No need to worry about third-party libraries suddenly becoming unmaintained.
  • Optimized Performance: The Go core team has strong capabilities for runtime optimization.

However, the complexity of HTTP/3 is indeed considerable, and achieving production-level stability will likely require significant iterations over time.

Conclusion

This proposal, while simple in content, sends a very clear signal:Go is serious about HTTP/3.

From the strategy of the proposal, the Go core team is quite cautious, adopting a gradual development approach.

This conservative approach, while safe, is better than being aggressive for infrastructure-level features.

Next, we will see the specific development progress. I hope to soon use Go’s native HTTP/3 support and say goodbye to dependencies on various third-party libraries.

High-Quality Original Review

The most difficult IT company to get hired in China…

Did Elon Musk send a private message to a beautiful internet celebrity to have his child, and after being rejected, cut off her $21,000 advertising income every two weeks?

A colleague from outsourcing attended a dinner, and just as he arrived at the door of the private room, he heard the supervisor say: We are all insiders, in the future, any dirty or tiring work will be given to outsourcing, they are here to serve us, don’t feel bad about it.

After leaving the job, a bug appeared online, and the interface was developed by myself, and the n+1 compensation was reclaimed.

Heard that the internet is no longer hiring people over 35?

Programmers are starting to engage in “defensive programming” to protect their jobs…..

Did ByteDance’s recent actions directly change everyone’s habits?

A Huawei employee revealed: Most people in OD are at their peak upon joining! D4 level, except for a 3k monthly salary increase when promoted to D5, has never increased at any other time.

Go is Getting Serious About HTTP/3! New Proposal Officially Launched

Don’t forget to share, bookmark, read, and like!

Leave a Comment