spdy

package
v0.0.0-...-738e6fc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package spdy implements Google SPDY™ protocol.

Spec:

http://tools.ietf.org/html/draft-mbelshe-httpbis-spdy-00

http://dev.chromium.org/spdy/spdy-whitepaper

http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2

http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3

Index

Examples

Constants

View Source
const MAX_DATA_LEN int = 10240

Variables

This section is empty.

Functions

func Spdy

func Spdy(req *http.Request) bool

func TLSNextProtoFuncV2

func TLSNextProtoFuncV2(server *http.Server, tlsConn *tls.Conn, handler http.Handler)
Example
package main

import (
	"crypto/tls"
	"github.com/mkch/burrow/spdy"
	"log"
	"net/http"
)

func main() {
	ExampleTLSNextProtoFuncV2()
}

func main() {
	server := &http.Server{
		Addr: ":8080",
		TLSConfig: &tls.Config{
			NextProtos: []string{"spdy/2"},
		},
		TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){
			"spdy/2": spdy.TLSNextProtoFuncV2,
		},
	}

	http.HandleFunc("/hello", func(w http.ResponseWriter, req *http.Request) {
		w.Write([]byte("Hello, " + req.URL.String()))
		if spdy.Spdy(req) {
			w.Write([]byte(" from SPDY!"))
		}
	})

	err := server.ListenAndServeTLS("/path/to/host.crt", "/path/to/host.key")
	if err != nil {
		log.Fatal(err)
	}
}
Output:

func TLSNextProtoFuncV3

func TLSNextProtoFuncV3(server *http.Server, tlsConn *tls.Conn, handler http.Handler)

Types

type ResponseWriter

type ResponseWriter interface {
	http.ResponseWriter
	// Push initiates an "SPDY Serve Push".
	// The server response to GET request of url will be pushed to user-agent.
	// originalRequest is the original request of the ResponseWriter.
	// The Scheme and Host fields of url can be empty to use the scheme and host
	// of the original request.
	Push(url *url.URL, originalRequest *http.Request) error
}

Directories

Path Synopsis
Package framing implements Google SPDY™ protocol framing layer.
Package framing implements Google SPDY™ protocol framing layer.
fields
Package fields implements wire format decoding and encoding.
Package fields implements wire format decoding and encoding.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL