che-operator/vendor/github.com/docker/spdystream
Oleksandr Andriienko f555494a7d
feat: Newer operator sdk (#826)
* Define new dependencies. Update vendor folder. Use newer operator sdk v1.7.1.

Signed-off-by: Oleksandr Andriienko <oandriie@redhat.com>
2021-07-19 14:29:11 +03:00
..
spdy Update vendor 2019-03-19 15:59:09 +02:00
CONTRIBUTING.md Make che-operator non blocking (#212) 2020-04-10 17:19:14 +03:00
LICENSE Update vendor 2019-03-19 15:59:09 +02:00
LICENSE.docs Update vendor 2019-03-19 15:59:09 +02:00
MAINTAINERS Make che-operator non blocking (#212) 2020-04-10 17:19:14 +03:00
README.md Make che-operator non blocking (#212) 2020-04-10 17:19:14 +03:00
connection.go feat: Newer operator sdk (#826) 2021-07-19 14:29:11 +03:00
handlers.go feat: Newer operator sdk (#826) 2021-07-19 14:29:11 +03:00
priority.go Update vendor 2019-03-19 15:59:09 +02:00
stream.go Update vendor 2019-03-19 15:59:09 +02:00
utils.go Update vendor 2019-03-19 15:59:09 +02:00

README.md

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