Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Frp | 68,101 | 9 | 2 days ago | 78 | July 10, 2022 | 97 | apache-2.0 | Go | ||
A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet. | ||||||||||
Caddy | 47,601 | 118 | 334 | 19 hours ago | 85 | October 26, 2020 | 80 | apache-2.0 | Go | |
Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS | ||||||||||
Vapor | 22,858 | 6 days ago | November 16, 2021 | 113 | mit | Swift | ||||
💧 A server-side Swift HTTP web framework. | ||||||||||
Postgrest | 20,617 | 4 | 3 days ago | 37 | July 12, 2022 | 207 | mit | Haskell | ||
REST API for any Postgres database | ||||||||||
Aiohttp | 13,602 | 7,355 | 4,894 | a day ago | 220 | November 14, 2021 | 497 | other | Python | |
Asynchronous HTTP client/server framework for asyncio and Python | ||||||||||
Node Http Proxy | 13,363 | 398,065 | 2,932 | a day ago | 103 | May 17, 2020 | 579 | other | JavaScript | |
A full-featured http proxy for node.js | ||||||||||
Http Server | 12,688 | 46,303 | 7,932 | 2 months ago | 49 | May 31, 2022 | 135 | mit | JavaScript | |
a simple zero-configuration command-line http server | ||||||||||
Chisel | 9,160 | 2 | 21 | 4 days ago | 27 | February 03, 2022 | 184 | mit | Go | |
A fast TCP/UDP tunnel over HTTP | ||||||||||
Warp | 8,137 | 73 | 355 | 3 days ago | 34 | November 09, 2021 | 218 | mit | Rust | |
A super-easy, composable, web server framework for warp speeds. | ||||||||||
Proxygen | 7,826 | 7 hours ago | 40 | other | C++ | |||||
A collection of C++ HTTP libraries including an easy to use HTTP server. |
Package go-casper
is Golang implementation of H2O's CASPer (cache-aware server-push).
Go 1.8 is going to support HTTP/2 server push. Server push allows us to send resources like CSS or JavaScript files before the client asks (so we can expect faster page rendering). As described on this post or this issue, one of the important things to use server push is to know when to push. Since it's waste of the network bandwidth (and cause negative effects on response time), you should avoid to push the asset which has already been cached by the client.
To solve these problem, H2O, a server that provides full advantage of HTTP/2 features, introduces CASPer. CASPer maintains a fingerprint of the browser caches (Golomb-compressed bloom filter) as a cookie, and cancels server-push if the fingerprint indicates the client is known to be in possession of the contents.
go-casper
implements H2O's CASPer and provides similar fucntinality in any golang http server. It wraps go's standard server push method (see "HTTP/2 Server Push · Go, the unwritten parts" if you don't how to use it) and maintains a fingerprint of browser caches and decides to push or cancel. The fingerprint is generated by using golomb-coded sets (a compressed encoding of Bloom filter).
The full documentation is available on Godoc.
NOTE1: This project is still a proof of concept and still under heavy implementation. API may be changed in future and documentaion is incomplete. This code should not be run in production. Comments are all welcome!
NOTE2: There is a draft by H2O author which defines a HTTP/2 frame type to allow clients to inform the server of their cache's contents 👏 This pacakage can be replace with it in future.
Below is a simple example of usage.
// Initialize casper with false-positive probability
// 1/64 and number of assets 10.
pusher := casper.New(1<<6, 10)
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
// Execute cache aware server push.
//
// In this example, it generates a fingerprint "JA" and set it
// as "x-go-casper" cookie value.
//
// If you access this handler first time, it runs server-push.
// But from next time, with same client, it cancels pushing since
// cookie indicates asset has already been cached by the client.
if _, err := pusher.Push(w, r, []string{"/static/example.js"}, nil); err != nil {
log.Printf("[ERROR] Failed to push assets: %s", err)
}
// ...
})
You can find the complete example here.