Git Product home page Git Product logo

gospdyquic's Introduction

gospdyquic, SPDY/QUIC support for Go

This is a work-in-progress SPDY/QUIC implementation for Go. This is based on goquic library. You can use this library to add SPDY/QUIC support for your existing Go HTTP server.

QUIC is an experimental protocol aimed at reducing web latency over that of TCP. On the surface, QUIC is very similar to TCP+TLS+SPDY implemented on UDP. Because TCP is implement in operating system kernels, and middlebox firmware, making significant changes to TCP is next to impossible. However, since QUIC is built on top of UDP, it suffers from no such limitations.

Key features of QUIC over existing TCP+TLS+SPDY include

  • Dramatically reduced connection establishment time
  • Improved congestion control
  • Multiplexing without head of line blocking
  • Forward error correction
  • Connection migration

Project Status

This library is highly experimental. Although libquic sources are from Chromium (which are tested), the Go bindings are still highly pre-alpha state.

See goquic for more details about current project status.

Getting Started

Dependency

Build static library files

Although prebuilt static library files already exists in the repository for convenience, it is always good practice to build library files from source. You should not trust any unverifiable third-party binaries.

To build the library files for your architecture and OS:

go get github.com/devsisters/goquic
cd $GOPATH/github.com/devsisters/goquic
./build_libs.sh

Currently Linux and Mac OS X is supprted.

How to build

Due to Go 1.4's cgo restrictions, use an environment variable like below to build your projects. This restriction will be removed from Go 1.5.

CGO_CFLAGS="-I$GOPATH/src/github.com/devsisters/goquic/libquic/boringssl/include"
CGO_LDFLAGS="-L$GOPATH/src/github.com/devsisters/goquic/lib/$GOOS_$GOARCH"

For example, building gospdyquic example server in Mac:

CGO_CFLAGS="-I$GOPATH/src/github.com/devsisters/goquic/libquic/boringssl/include" CGO_LDFLAGS="-L$GOPATH/src/github.com/devsisters/goquic/lib/darwin_amd64" go build $GOPATH/github.com/devsisters/gospdyquic/example/server.go

In Linux:

CGO_CFLAGS="-I$GOPATH/src/github.com/devsisters/goquic/libquic/boringssl/include" CGO_LDFLAGS="-L$GOPATH/src/github.com/devsisters/goquic/lib/linux_amd64" go build $GOPATH/github.com/devsisters/gospdyquic/example/server.go

How to use server

When running a HTTP server, do:

gospdyquic.ListenAndServe(":8080", 1, nil)

instead of

http.ListenAndServe(":8080", nil)

How to use client

You need to create http.Client with Transport changed, do:

client := &http.Client{
	Transport: gospdyquic.NewRoundTripper(false),
}
resp, err := client.Get("http://example.com/")

instead of

resp, err := http.Get("http://example.com/")

gospdyquic's People

Contributors

hodduc avatar serialx avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.