mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 10:03:42 +08:00 
			
		
		
		
	This might break compatibility with projects using this module that
are still on go1.16, which is EOL, so probably ok to ignore:
    github.com/docker/buildx/store imports
        github.com/gofrs/flock tested by
        github.com/gofrs/flock.test imports
        gopkg.in/check.v1 loaded from gopkg.in/check.v1@v1.0.0-20200227125254-8fa46927fb4f,
        but go 1.16 would select v1.0.0-20201130134442-10cb98267c6c
    To upgrade to the versions selected by go 1.16:
        go mod tidy -go=1.16 && go mod tidy -go=1.17
    If reproducibility with go 1.16 is not needed:
        go mod tidy -compat=1.17
    For other options, see:
        https://golang.org/doc/modules/pruning
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
		
	
SpdyStream
A multiplexed stream library using spdy
Usage
Client example (connecting to mirroring server without auth)
package main
import (
	"fmt"
	"github.com/moby/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/moby/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 and license
Copyright 2013-2021 Docker, inc. Released under the Apache 2.0 license.