多路复用流库Spdystream.zip

时间:2022-08-05 20:25:53
【文件属性】:
文件名称:多路复用流库Spdystream.zip
文件大小:41KB
文件格式:ZIP
更新时间:2022-08-05 20:25:53
开源项目 Spdystream 是使用 spdy 的多路复用流库。用途示例: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)     } } 标签:Spdystream
【文件预览】:
spdystream-master
----utils.go(185B)
----spdy_test.go(27KB)
----spdy_bench_test.go(2KB)
----ws()
--------connection.go(1KB)
--------ws_test.go(5KB)
----handlers.go(633B)
----spdy()
--------dictionary.go(9KB)
--------spdy_test.go(17KB)
--------read.go(10KB)
--------types.go(8KB)
--------write.go(8KB)
----MAINTAINERS(771B)
----connection.go(23KB)
----priority.go(2KB)
----priority_test.go(2KB)
----CONTRIBUTING.md(442B)
----LICENSE(11KB)
----README.md(2KB)
----stream.go(7KB)
----LICENSE.docs(20KB)

网友评论