ceph-csi/vendor/github.com/docker/spdystream
Niels de Vos 91774fc936 rebase: vendor dependencies for Vault API
Uses github.com/libopenstorage/secrets to communicate with Vault. This
removes the need for maintaining our own limited Vault APIs.

By adding the new dependency, several other packages got updated in the
process. Unused indirect dependencies have been removed from go.mod.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
2020-11-29 04:03:59 +00:00
..
spdy vendor update for E2E framework 2019-06-04 11:39:42 +05:30
connection.go rebase: vendor dependencies for Vault API 2020-11-29 04:03:59 +00:00
CONTRIBUTING.md Migrate from dep to go module 2020-03-17 10:44:07 +00:00
handlers.go rebase: vendor dependencies for Vault API 2020-11-29 04:03:59 +00:00
LICENSE vendor update for E2E framework 2019-06-04 11:39:42 +05:30
LICENSE.docs vendor update for E2E framework 2019-06-04 11:39:42 +05:30
MAINTAINERS Migrate from dep to go module 2020-03-17 10:44:07 +00:00
priority.go vendor update for E2E framework 2019-06-04 11:39:42 +05:30
README.md Migrate from dep to go module 2020-03-17 10:44:07 +00:00
stream.go vendor update for E2E framework 2019-06-04 11:39:42 +05:30
utils.go vendor update for E2E framework 2019-06-04 11:39:42 +05:30

SpdyStream

A multiplexed stream library using spdy

Usage

Client example (connecting to mirroring server without auth)

package main

import (
	"fmt"
	"github.com/docker/spdystream"
	"net"
	"net/http"
)

func main() {
	conn, err := net.Dial("tcp", "localhost:8080")
	if err != nil {
		panic(err)
	}
	spdyConn, err := spdystream.NewConnection(conn, false)
	if err != nil {
		panic(err)
	}
	go spdyConn.Serve(spdystream.NoOpStreamHandler)
	stream, err := spdyConn.CreateStream(http.Header{}, nil, false)
	if err != nil {
		panic(err)
	}

	stream.Wait()

	fmt.Fprint(stream, "Writing to stream")

	buf := make([]byte, 25)
	stream.Read(buf)
	fmt.Println(string(buf))

	stream.Close()
}

Server example (mirroring server without auth)

package main

import (
	"github.com/docker/spdystream"
	"net"
)

func main() {
	listener, err := net.Listen("tcp", "localhost:8080")
	if err != nil {
		panic(err)
	}
	for {
		conn, err := listener.Accept()
		if err != nil {
			panic(err)
		}
		spdyConn, err := spdystream.NewConnection(conn, true)
		if err != nil {
			panic(err)
		}
		go spdyConn.Serve(spdystream.MirrorStreamHandler)
	}
}

Copyright © 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/.