Skip to content
/ http2 Public

HTTP/2 implementation for fasthttp (Under construction...)

License

Notifications You must be signed in to change notification settings

fasthttp/http2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1cedba2 · Jan 13, 2022
Dec 10, 2021
Sep 24, 2021
Jan 13, 2022
Jan 13, 2022
Jan 11, 2022
Jun 14, 2021
Dec 10, 2021
Aug 22, 2021
Aug 26, 2018
Jan 11, 2022
Jan 13, 2022
Sep 24, 2021
Sep 24, 2021
Aug 9, 2021
Jan 11, 2022
Jan 12, 2022
Sep 24, 2021
Sep 24, 2021
Jan 13, 2022
Sep 24, 2021
Jan 11, 2022
Jan 12, 2022
Oct 5, 2021
Oct 5, 2021
Sep 24, 2021
Jan 3, 2022
Nov 12, 2021
Jan 11, 2022
Jan 11, 2022
Sep 24, 2021
Sep 24, 2021
Sep 24, 2021
Sep 24, 2021
Sep 24, 2021
Sep 24, 2021
Sep 24, 2021
Jan 12, 2022
Jan 13, 2022
Sep 24, 2021
Jan 13, 2022
Jan 13, 2022
Jun 11, 2021
Sep 24, 2021

Repository files navigation

HTTP2

http2 is an implementation of HTTP/2 protocol for fasthttp.

Download

go get github.com/dgrr/[email protected]

Help

If you need any help to set up, contributing or understanding this repo, you can contact me on gofiber's Discord.

How to use the server?

The server can only be used if your server supports TLS. Then, you can call ConfigureServer.

package main

import (
	"github.com/valyala/fasthttp"
	"github.com/dgrr/http2"
)

func main() {
    s := &fasthttp.Server{
        Handler: yourHandler,
        Name:    "HTTP2 test",
    }

    http2.ConfigureServer(s, http2.ServerConfig{})
    
    s.ListenAndServeTLS(...)
}

How to use the client?

The HTTP/2 client only works with the HostClient.

package main

import (
        "fmt"
        "log"

        "github.com/dgrr/http2"
        "github.com/valyala/fasthttp"
)

func main() {
        hc := &fasthttp.HostClient{
                Addr:  "api.binance.com:443",
        }

        if err := http2.ConfigureClient(hc, http2.ClientOpts{}); err != nil {
                log.Printf("%s doesn't support http/2\n", hc.Addr)
        }

        statusCode, body, err := hc.Get(nil, "https://api.binance.com/api/v3/time")
        if err != nil {
                log.Fatalln(err)
        }

        fmt.Printf("%d: %s\n", statusCode, body)
}

About

HTTP/2 implementation for fasthttp (Under construction...)

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published