Skip to content

Commit

Permalink
http3: rename ListenAndServe to ListenAndServeTLS (#4522)
Browse files Browse the repository at this point in the history
* http3: rename ListenAndServe to ListenAndServeTLS

* http3: fix golanglint

---------

Co-authored-by: Shunxin Zhang <shunxin.zhang@shopee.com>
  • Loading branch information
ETZhangSX and Shunxin Zhang committed May 15, 2024
1 parent e41d1f9 commit f3cecf9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func main() {
go func() {
var err error
if *tcp {
err = http3.ListenAndServe(bCap, certFile, keyFile, handler)
err = http3.ListenAndServeTLS(bCap, certFile, keyFile, handler)
} else {
server := http3.Server{
Handler: handler,
Expand Down
9 changes: 7 additions & 2 deletions http3/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,11 +666,16 @@ func ListenAndServeQUIC(addr, certFile, keyFile string, handler http.Handler) er
return server.ListenAndServeTLS(certFile, keyFile)
}

// ListenAndServe listens on the given network address for both TLS/TCP and QUIC
// Deprecated: use ListenAndServeTLS instead.
func ListenAndServe(addr, certFile, keyFile string, handler http.Handler) error {
return ListenAndServeTLS(addr, certFile, keyFile, handler)
}

// ListenAndServeTLS listens on the given network address for both TLS/TCP and QUIC
// connections in parallel. It returns if one of the two returns an error.
// http.DefaultServeMux is used when handler is nil.
// The correct Alt-Svc headers for QUIC are set.
func ListenAndServe(addr, certFile, keyFile string, handler http.Handler) error {
func ListenAndServeTLS(addr, certFile, keyFile string, handler http.Handler) error {
// Load certs
var err error
certs := make([]tls.Certificate, 1)
Expand Down

0 comments on commit f3cecf9

Please sign in to comment.