Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tatsuhiro-t/go-nghttp2
HTTP/2 implementation in golang using nghttp2 C library
https://github.com/tatsuhiro-t/go-nghttp2
Last synced: about 1 month ago
JSON representation
HTTP/2 implementation in golang using nghttp2 C library
- Host: GitHub
- URL: https://github.com/tatsuhiro-t/go-nghttp2
- Owner: tatsuhiro-t
- License: mit
- Created: 2014-12-14T16:09:12.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-01-25T09:10:20.000Z (8 months ago)
- Last Synced: 2024-06-18T18:48:39.938Z (3 months ago)
- Language: Go
- Size: 27.3 KB
- Stars: 34
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
go-nghttp2
==========The experimental project to use nghttp2 C library from Go using cgo.
Currently, server implementation is available.How to run demo server
----------------------First, build and install `nghttp2 `_. Do git
clone https://github.com/tatsuhiro-t/go-nghttp2.git and enter demo
directory. Then run ``go run demo.go``. It fires up HTTP/2 capable
https server listening at port 3000. It also supports HTTP/1
connection.nghttp2.Server only supports https HTTP/2 connection right now.
Example
-------.. code-block:: go
package main
import (
"github.com/tatsuhiro-t/go-nghttp2"
"io"
"log"
"net/http"
)func main() {
var srv http.Server
srv.Addr = "localhost:3000"http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "hello world")
})
// Set up srv so that if HTTP/2 is negotiated in TLS NPN,
// connection is intercepted by nghttp2.Server.
nghttp2.ConfigureServer(&srv, &nghttp2.Server{})log.Printf("Listening on " + srv.Addr)
log.Fatal(srv.ListenAndServeTLS("server.crt", "server.key"))
}