• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

spdy/H23-Oct-2018-1,7771,562

ws/H23-Oct-2018-266220

CONTRIBUTING.mdH A D23-Oct-2018442 149

LICENSEH A D23-Oct-201810.5 KiB192160

LICENSE.docsH A D23-Oct-201819.5 KiB426328

MAINTAINERSH A D23-Oct-2018771 2924

README.mdH A D23-Oct-20181.6 KiB7861

connection.goH A D23-Oct-201823.5 KiB960743

handlers.goH A D23-Oct-2018633 3730

priority.goH A D23-Oct-20181.7 KiB9983

priority_test.goH A D23-Oct-20182.5 KiB10993

spdy_bench_test.goH A D23-Oct-20182.3 KiB11488

spdy_test.goH A D23-Oct-201827.3 KiB1,173974

stream.goH A D23-Oct-20187.4 KiB328238

utils.goH A D23-Oct-2018185 1713

README.md

1# SpdyStream
2
3A multiplexed stream library using spdy
4
5## Usage
6
7Client example (connecting to mirroring server without auth)
8
9```go
10package main
11
12import (
13	"fmt"
14	"github.com/docker/spdystream"
15	"net"
16	"net/http"
17)
18
19func main() {
20	conn, err := net.Dial("tcp", "localhost:8080")
21	if err != nil {
22		panic(err)
23	}
24	spdyConn, err := spdystream.NewConnection(conn, false)
25	if err != nil {
26		panic(err)
27	}
28	go spdyConn.Serve(spdystream.NoOpStreamHandler)
29	stream, err := spdyConn.CreateStream(http.Header{}, nil, false)
30	if err != nil {
31		panic(err)
32	}
33
34	stream.Wait()
35
36	fmt.Fprint(stream, "Writing to stream")
37
38	buf := make([]byte, 25)
39	stream.Read(buf)
40	fmt.Println(string(buf))
41
42	stream.Close()
43}
44```
45
46Server example (mirroring server without auth)
47
48```go
49package main
50
51import (
52	"github.com/docker/spdystream"
53	"net"
54)
55
56func main() {
57	listener, err := net.Listen("tcp", "localhost:8080")
58	if err != nil {
59		panic(err)
60	}
61	for {
62		conn, err := listener.Accept()
63		if err != nil {
64			panic(err)
65		}
66		spdyConn, err := spdystream.NewConnection(conn, true)
67		if err != nil {
68			panic(err)
69		}
70		go spdyConn.Serve(spdystream.MirrorStreamHandler)
71	}
72}
73```
74
75## Copyright and license
76
77Copyright © 2014-2015 Docker, Inc. All rights reserved, except as follows. Code is released under the Apache 2.0 license. The README.md file, and files in the "docs" folder are licensed under the Creative Commons Attribution 4.0 International License under the terms and conditions set forth in the file "LICENSE.docs". You may obtain a duplicate copy of the same license, titled CC-BY-SA-4.0, at http://creativecommons.org/licenses/by/4.0/.
78