goquic

package module
v0.0.0-...-fb44d4c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2020 License: BSD-3-Clause Imports: 30 Imported by: 5

README

goquic, QUIC support for Go

Docker Repository on Quay

This is a work-in-progress QUIC implementation for Go. This is based on libquic library, which is in turn based on original QUIC implementation on Chromium.

QUIC is an experimental protocol aimed at reducing web latency over that of TCP. On the surface, QUIC is very similar to TCP+TLS+SPDY implemented on UDP. Because TCP is implement in operating system kernels, and middlebox firmware, making significant changes to TCP is next to impossible. However, since QUIC is built on top of UDP, it suffers from no such limitations.

Key features of QUIC over existing TCP+TLS+SPDY include

  • Dramatically reduced connection establishment time
  • Improved congestion control
  • Multiplexing without head of line blocking
  • Forward error correction
  • Connection migration

Project Status

This library is highly experimental. Although libquic sources are from Chromium (which are tested), the Go bindings are still highly pre-alpha state.

Known issues:

  • No support for read streaming. All request must fit in memory.
  • Secure QUIC not fully tested. May not support ECDSA certificates.

Things to do:

  • Read streaming support

Preliminary Benchmarks

A very primitive benchmark testing have been done. Testing environments below:

Items Description
Optimization libquic built with -O3 parameters
CPU Intel(R) Core(TM) i7-4930K CPU @ 3.40GHz
Server Code https://github.com/devsisters/goquic/blob/master/example/server.go
Server Parms GOMAXPROCS=12 ./server -port 9090 -n 12
Client Code https://github.com/devsisters/quicbench/blob/master/quicbench.go
Client Parms ./quicbench -u="https://example.com:9090/" -c 200 -r 1000

The server code is modified to create 30B, 1kB, 5kB, 10kB HTTP body payload. Concurrency is 200 and each thread requests 1,000 requests. It is designed to measure ideal throughput of the server. Naturally the throughput goes down when concurrency increases.

Benchmark results:

Payload Size Requests per Second
30B Payload 12131.25 RPS
1kB Payload 11835.13 RPS
5kB Payload 7816.21 RPS
10kB Payload 5599.73 RPS

On 10kB case, calculating the total network throughput is 458Mbps.

How many connections per second can this server process?

./gobench -u="https://example.com:9090/" -c 200 -r 100 -qk=false

Turning off keepalive using qk option results in a pure new QUIC connection per request. The benchmark results are 2905.58 CPS.

Getting Started

Get source files

go get -u -d github.com/devsisters/goquic

-u option is needed, because building (or downloading) static libraries is necessary for building and installing goquic library.

Build static library files

Although prebuilt static library files already exists in the repository for convenience, it is always good practice to build library files from source. You should not trust any unverifiable third-party binaries.

To build the library files for your architecture and OS:

./build_libs.sh (for debug build)
GOQUIC_BUILD=Release ./build_libs.sh (for release build)

This will fetch libquic master and build all the binaries from source. The C/C++ files for Go bindings will be all built too.

To build static library files, you should have cmake, C/C++ compiler, and ninja-build system (or GNU make).

Currently Linux, Mac OS X and FreeBSD is supported.

How to build

If you are using Go >= 1.5, you can build goquic binaries without any extra work.

go build $GOPATH/src/github.com/devsisters/goquic/example/server.go

If you are using Go 1.4, you should open goquic.go and manually edit ${SRCDIR} with your real path (maybe /YOUR/GOPATH/src/github.com/devsisters/goquic).

SPDY/QUIC support

We have a experimental SPDY/QUIC implementation as a library. You can use this library to add SPDY/QUIC support for your existing Go HTTP server.

See our SPDY-QUIC server/client implementation here.

How to use server

When running a HTTP server, do:

goquic.ListenAndServe(":8080", 1, nil)

instead of

http.ListenAndServe(":8080", nil)

How to use client

You need to create http.Client with Transport changed, do:

client := &http.Client{
	Transport: goquic.NewRoundTripper(false),
}
resp, err := client.Get("http://example.com/")

instead of

resp, err := http.Get("http://example.com/")

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProofSignatureLabel = []byte{'Q', 'U', 'I', 'C', ' ', 'C', 'H', 'L', 'O', ' ', 'a', 'n', 'd', ' ', 's', 'e', 'r', 'v', 'e', 'r', ' ', 'c', 'o', 'n', 'f', 'i', 'g', ' ', 's', 'i', 'g', 'n', 'a', 't', 'u', 'r', 'e', 0x00}
View Source
var ProofSignatureLabelOld = []byte{'Q', 'U', 'I', 'C', ' ', 's', 'e', 'r', 'v', 'e', 'r', ' ', 'c', 'o', 'n', 'f', 'i', 'g', ' ', 's', 'i', 'g', 'n', 'a', 't', 'u', 'r', 'e', 0x00}

Generate "proof of authenticity" (See "Quic Crypto" docs for details) Length of the prefix used to calculate the signature: length of label + 0x00 byte

Functions

func AltProtoMiddleware

func AltProtoMiddleware(next http.Handler, port int) http.Handler

Provide "Alternate-Protocol" header for QUIC

func CreateGoQuicAlarm

func CreateGoQuicAlarm(go_quic_alarm_go_wrapper_c unsafe.Pointer, clock_c unsafe.Pointer, go_task_runner_key int64) int64

func CreateGoSession

func CreateGoSession(dispatcher_key int64, session_c unsafe.Pointer) int64

func CreateIncomingDynamicStream

func CreateIncomingDynamicStream(session_key int64, stream_id uint32, wrapper_c unsafe.Pointer) int64

func DeleteCryptoServerConfig

func DeleteCryptoServerConfig(config *QuicCryptoServerConfig)

func DeleteGoSession

func DeleteGoSession(dispatcher_key int64, go_session_key int64)

func GetProof

func GetProof(proof_source_key int64,
	server_ip_c unsafe.Pointer, server_ip_sz C.size_t,
	hostname_c unsafe.Pointer, hostname_sz_c C.size_t,
	server_config_c unsafe.Pointer, server_config_sz_c C.size_t,
	quicVersion int,
	chlo_hash_c unsafe.Pointer, chlo_hash_sz C.size_t,
	out_signature_c **C.char, out_signature_sz_c *C.size_t) C.int

func GoQuicAlarmCancelImpl

func GoQuicAlarmCancelImpl(go_quic_alarm_key int64)

func GoQuicAlarmDestroy

func GoQuicAlarmDestroy(go_quic_alarm_key int64)

func GoQuicAlarmSetImpl

func GoQuicAlarmSetImpl(go_quic_alarm_key int64, deadline int64)

func GoQuicSimpleServerStreamOnClose

func GoQuicSimpleServerStreamOnClose(quic_server_stream_key int64)

func GoQuicSimpleServerStreamOnDataAvailable

func GoQuicSimpleServerStreamOnDataAvailable(quic_server_stream_key int64, data unsafe.Pointer, data_len uint32, is_closed C.int)

func GoQuicSimpleServerStreamOnInitialHeadersComplete

func GoQuicSimpleServerStreamOnInitialHeadersComplete(quic_server_stream_key int64, headers_c *C.struct_GoSpdyHeader, peer_addr unsafe.Pointer, peer_addr_len uint32)

func GoQuicSpdyClientStreamOnClose

func GoQuicSpdyClientStreamOnClose(quic_client_stream_key int64)

func GoQuicSpdyClientStreamOnDataAvailable

func GoQuicSpdyClientStreamOnDataAvailable(quic_client_stream_key int64, data unsafe.Pointer, data_len uint32, is_closed C.int)

func GoQuicSpdyClientStreamOnInitialHeadersComplete

func GoQuicSpdyClientStreamOnInitialHeadersComplete(quic_client_stream_key int64, headers_c *C.struct_GoSpdyHeader)

func GoQuicSpdyClientStreamOnTrailingHeadersComplete

func GoQuicSpdyClientStreamOnTrailingHeadersComplete(quic_client_stream_key int64, headers_c *C.struct_GoSpdyHeader)

func ListenAndServe

func ListenAndServe(addr string, certFile string, keyFile string, numOfServers int, handler http.Handler) error

func ListenAndServeQuicSpdyOnly

func ListenAndServeQuicSpdyOnly(addr string, certFile string, keyFile string, numOfServers int, handler http.Handler) error

func NewProofVerifyJob

func NewProofVerifyJob(proof_verifier_key int64, quicVersion int,
	hostname_c unsafe.Pointer, hostname_sz C.size_t,
	server_config_c unsafe.Pointer, server_config_sz C.size_t,
	chlo_hash_c unsafe.Pointer, chlo_hash_sz C.size_t,
	cert_sct_c unsafe.Pointer, cert_sct_sz C.size_t,
	signature_c unsafe.Pointer, signature_sz C.size_t) int64

func ProofVerifyJobAddCert

func ProofVerifyJobAddCert(job_key int64, cert_c unsafe.Pointer, cert_sz C.size_t)

func ProofVerifyJobVerifyProof

func ProofVerifyJobVerifyProof(job_key int64) C.int

func ReleaseClientWriter

func ReleaseClientWriter(go_client_writer_key int64)

func ReleaseProofSource

func ReleaseProofSource(proof_source_key int64)

func ReleaseProofVerifier

func ReleaseProofVerifier(proof_verifier_key int64)

func ReleaseQuicDispatcher

func ReleaseQuicDispatcher(task_runner_key int64)

func ReleaseServerWriter

func ReleaseServerWriter(go_server_writer_key int64)

func ReleaseTaskRunner

func ReleaseTaskRunner(task_runner_key int64)

func SetLogLevel

func SetLogLevel(level int)

func UnregisterQuicClientStreamFromSession

func UnregisterQuicClientStreamFromSession(quic_client_stream_key int64)

func UnregisterQuicServerStreamFromSession

func UnregisterQuicServerStreamFromSession(quic_server_stream_key int64)

func WriteToUDP

func WriteToUDP(go_writer_key int64, peer_ip unsafe.Pointer, peer_ip_sz C.size_t, peer_port uint16, buffer_c unsafe.Pointer, length_c C.size_t)

func WriteToUDPClient

func WriteToUDPClient(go_writer_key int64, peer_ip unsafe.Pointer, peer_ip_sz C.size_t, peer_port uint16, buffer_c unsafe.Pointer, length_c C.size_t)

Types

type AlarmHeap

type AlarmHeap struct {
	// contains filtered or unexported fields
}

func (*AlarmHeap) Len

func (ht *AlarmHeap) Len() int

func (*AlarmHeap) Less

func (ht *AlarmHeap) Less(i, j int) bool

func (*AlarmHeap) Pop

func (ht *AlarmHeap) Pop() interface{}

func (*AlarmHeap) Push

func (ht *AlarmHeap) Push(x interface{})

func (*AlarmHeap) Swap

func (ht *AlarmHeap) Swap(i, j int)

type BytesBufferPool

type BytesBufferPool struct {
	// contains filtered or unexported fields
}

func NewBytesBufferPool

func NewBytesBufferPool(poolsize int, bufsize int) (bp *BytesBufferPool)

func (*BytesBufferPool) Get

func (bp *BytesBufferPool) Get() (b []byte)

func (*BytesBufferPool) Put

func (bp *BytesBufferPool) Put(b []byte)

type ClientWriter

type ClientWriter struct {
	Ch chan UdpData
}

func NewClientWriter

func NewClientWriter(ch chan UdpData) *ClientWriter

type ClientWriterPtr

type ClientWriterPtr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*ClientWriterPtr) Del

func (p *ClientWriterPtr) Del(key int64)

func (*ClientWriterPtr) Get

func (p *ClientWriterPtr) Get(key int64) *ClientWriter

func (*ClientWriterPtr) Set

func (p *ClientWriterPtr) Set(pt *ClientWriter) int64

type Conn

type Conn struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func Dial

func Dial(network, address string) (c *Conn, err error)

func (*Conn) Close

func (c *Conn) Close() (err error)

func (*Conn) Connect

func (c *Conn) Connect() bool

func (*Conn) CreateStream

func (c *Conn) CreateStream() *SpdyClientStream

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) (err error)

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) (err error)

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) (err error)

func (*Conn) Writer

func (c *Conn) Writer() *ClientWriter

type DataStreamProcessor

type DataStreamProcessor interface {
	OnInitialHeadersComplete(header http.Header, peerAddress string)
	OnTrailingHeadersComplete(header http.Header)
	OnDataAvailable(data []byte, isClosed bool)
	OnClose()
}

(~= QuicSpdy(Server|Client)Stream)

type DispatcherStatistics

type DispatcherStatistics struct {
	SessionStatistics []SessionStatistics
}

type GoIPEndPoint

type GoIPEndPoint struct {
	// contains filtered or unexported fields
}

func CreateIPEndPoint

func CreateIPEndPoint(udpAddr *net.UDPAddr) *GoIPEndPoint

type GoQuicAlarm

type GoQuicAlarm struct {
	// contains filtered or unexported fields
}

func (*GoQuicAlarm) CancelImpl

func (alarm *GoQuicAlarm) CancelImpl()

func (*GoQuicAlarm) Destroy

func (alarm *GoQuicAlarm) Destroy()

Called by C++ side when the C++ wrapper object is destoryed

func (*GoQuicAlarm) Now

func (alarm *GoQuicAlarm) Now() int64

func (*GoQuicAlarm) OnAlarm

func (alarm *GoQuicAlarm) OnAlarm()

func (*GoQuicAlarm) SetImpl

func (alarm *GoQuicAlarm) SetImpl()

type GoQuicAlarmPtr

type GoQuicAlarmPtr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*GoQuicAlarmPtr) Del

func (p *GoQuicAlarmPtr) Del(key int64)

func (*GoQuicAlarmPtr) Get

func (p *GoQuicAlarmPtr) Get(key int64) *GoQuicAlarm

func (*GoQuicAlarmPtr) Set

func (p *GoQuicAlarmPtr) Set(pt *GoQuicAlarm) int64

type HeapItem

type HeapItem struct {
	// contains filtered or unexported fields
}

type IncomingDataStreamCreator

type IncomingDataStreamCreator interface {
	CreateIncomingDynamicStream(quicServerStream *QuicServerStream, streamId uint32) DataStreamProcessor
}

(~= QuicServerSession)

type OutgoingDataStreamCreator

type OutgoingDataStreamCreator interface {
	CreateOutgoingDynamicStream() DataStreamProcessor
}

(~= QuicClientSession)

type ProofSource

type ProofSource struct {
	Certificate tls.Certificate
	// contains filtered or unexported fields
}

func NewProofSource

func NewProofSource(cert tls.Certificate) *ProofSource

func (*ProofSource) GetProof

func (ps *ProofSource) GetProof(quicVersion int, addr net.IP, hostname []byte, serverConfig []byte, chloHash []byte) (outSignature []byte)

type ProofSourcePtr

type ProofSourcePtr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*ProofSourcePtr) Del

func (p *ProofSourcePtr) Del(key int64)

func (*ProofSourcePtr) Get

func (p *ProofSourcePtr) Get(key int64) *ProofSource

func (*ProofSourcePtr) Set

func (p *ProofSourcePtr) Set(pt *ProofSource) int64

type ProofVerifier

type ProofVerifier struct {
	// contains filtered or unexported fields
}

func CreateProofVerifier

func CreateProofVerifier() *ProofVerifier

type ProofVerifierPtr

type ProofVerifierPtr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*ProofVerifierPtr) Del

func (p *ProofVerifierPtr) Del(key int64)

func (*ProofVerifierPtr) Get

func (p *ProofVerifierPtr) Get(key int64) *ProofVerifier

func (*ProofVerifierPtr) Set

func (p *ProofVerifierPtr) Set(pt *ProofVerifier) int64

type ProofVerifyJob

type ProofVerifyJob struct {
	// contains filtered or unexported fields
}

func (*ProofVerifyJob) CheckSignature

func (job *ProofVerifyJob) CheckSignature(cert *x509.Certificate) error

func (*ProofVerifyJob) Verify

func (job *ProofVerifyJob) Verify() bool

type ProofVerifyJobPtr

type ProofVerifyJobPtr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*ProofVerifyJobPtr) Del

func (p *ProofVerifyJobPtr) Del(key int64)

func (*ProofVerifyJobPtr) Get

func (p *ProofVerifyJobPtr) Get(key int64) *ProofVerifyJob

func (*ProofVerifyJobPtr) Set

type QuicClient

type QuicClient struct {
	// contains filtered or unexported fields
}

TODO(hodduc) multi-stream support ?

func CreateQuicClient

func CreateQuicClient(addr *net.UDPAddr, conn QuicConn, createQuicClientSession func() OutgoingDataStreamCreator, taskRunner *TaskRunner, proofVerifier *ProofVerifier) (qc *QuicClient, err error)

func (*QuicClient) Close

func (qc *QuicClient) Close() (err error)

func (*QuicClient) CreateReliableQuicStream

func (qc *QuicClient) CreateReliableQuicStream() *QuicClientStream

func (*QuicClient) EncryptionBeingEstablished

func (qc *QuicClient) EncryptionBeingEstablished() bool

func (*QuicClient) IsConnected

func (qc *QuicClient) IsConnected() bool

func (*QuicClient) ProcessPacket

func (qc *QuicClient) ProcessPacket(self_address *net.UDPAddr, peer_address *net.UDPAddr, buffer []byte)

func (*QuicClient) SendConnectionClosePacket

func (qc *QuicClient) SendConnectionClosePacket()

func (*QuicClient) StartConnect

func (qc *QuicClient) StartConnect()

type QuicClientSession

type QuicClientSession struct {
	// contains filtered or unexported fields
}

func (*QuicClientSession) NumActiveRequests

func (s *QuicClientSession) NumActiveRequests() int

type QuicClientStream

type QuicClientStream struct {
	// contains filtered or unexported fields
}

implement QuicStream

func (*QuicClientStream) UserStream

func (stream *QuicClientStream) UserStream() DataStreamProcessor

func (*QuicClientStream) WriteHeader

func (stream *QuicClientStream) WriteHeader(header http.Header, is_body_empty bool)

func (*QuicClientStream) WriteOrBufferData

func (stream *QuicClientStream) WriteOrBufferData(body []byte, fin bool)

func (*QuicClientStream) WriteTrailers

func (stream *QuicClientStream) WriteTrailers(header http.Header)

type QuicClientStreamPtr

type QuicClientStreamPtr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*QuicClientStreamPtr) Del

func (p *QuicClientStreamPtr) Del(key int64)

func (*QuicClientStreamPtr) Get

func (*QuicClientStreamPtr) Set

type QuicConn

type QuicConn interface {
	Close() error
	SetDeadline(t time.Time) error
	SetReadDeadline(t time.Time) error
	SetWriteDeadline(t time.Time) error
	Writer() *ClientWriter
}

type QuicCryptoServerConfig

type QuicCryptoServerConfig struct {
	// contains filtered or unexported fields
}

Wrapper for QuicCryptoServerConfig C++ object

func NewCryptoServerConfig

func NewCryptoServerConfig(proofSource *ProofSource, stkSecret string, cfg *SerializedServerConfig) *QuicCryptoServerConfig

type QuicDispatcher

type QuicDispatcher struct {
	TaskRunner *TaskRunner
	// contains filtered or unexported fields
}

func CreateQuicDispatcher

func CreateQuicDispatcher(writer *ServerWriter, createQuicServerSession func() IncomingDataStreamCreator, taskRunner *TaskRunner, cryptoConfig *QuicCryptoServerConfig) *QuicDispatcher

func (*QuicDispatcher) ProcessPacket

func (d *QuicDispatcher) ProcessPacket(self_address *net.UDPAddr, peer_address *net.UDPAddr, buffer []byte)

func (*QuicDispatcher) Statistics

func (d *QuicDispatcher) Statistics() DispatcherStatistics

type QuicDispatcherPtr

type QuicDispatcherPtr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*QuicDispatcherPtr) Del

func (p *QuicDispatcherPtr) Del(key int64)

func (*QuicDispatcherPtr) Get

func (p *QuicDispatcherPtr) Get(key int64) *QuicDispatcher

func (*QuicDispatcherPtr) Set

type QuicEncryptedPacket

type QuicEncryptedPacket struct {
	// contains filtered or unexported fields
}

type QuicRoundTripper

type QuicRoundTripper struct {
	// contains filtered or unexported fields
}

func NewRoundTripper

func NewRoundTripper(keepConnection bool) *QuicRoundTripper

func (*QuicRoundTripper) RoundTrip

func (q *QuicRoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

type QuicServerSession

type QuicServerSession struct {
	// contains filtered or unexported fields
}

type QuicServerSessionPtr

type QuicServerSessionPtr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*QuicServerSessionPtr) Del

func (p *QuicServerSessionPtr) Del(key int64)

func (*QuicServerSessionPtr) Get

func (*QuicServerSessionPtr) Set

type QuicServerStream

type QuicServerStream struct {
	// contains filtered or unexported fields
}

implement QuicStream

func (*QuicServerStream) UserStream

func (stream *QuicServerStream) UserStream() DataStreamProcessor

func (*QuicServerStream) WriteHeader

func (stream *QuicServerStream) WriteHeader(header http.Header, is_body_empty bool)

func (*QuicServerStream) WriteOrBufferData

func (stream *QuicServerStream) WriteOrBufferData(body []byte, fin bool)

func (*QuicServerStream) WriteTrailers

func (stream *QuicServerStream) WriteTrailers(header http.Header)

type QuicServerStreamPtr

type QuicServerStreamPtr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*QuicServerStreamPtr) Del

func (p *QuicServerStreamPtr) Del(key int64)

func (*QuicServerStreamPtr) Get

func (*QuicServerStreamPtr) Set

type QuicSpdyServer

type QuicSpdyServer struct {
	Addr           string
	Handler        http.Handler
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration
	MaxHeaderBytes int
	Certificate    tls.Certificate
	Secret         string
	ServerConfig   *SerializedServerConfig
	// contains filtered or unexported fields
}

func NewServer

func NewServer(addr string, certFile string, keyFile string, numOfServers int, quicHandler http.Handler, nonQuicHandler http.Handler, tlsConfig *tls.Config) (*QuicSpdyServer, error)

func (*QuicSpdyServer) ListenAndServe

func (srv *QuicSpdyServer) ListenAndServe() error

func (*QuicSpdyServer) Serve

func (srv *QuicSpdyServer) Serve(listen_addr *net.UDPAddr, writer *ServerWriter, readChan chan UdpData, statChan chan statCallback) error

func (*QuicSpdyServer) Statistics

func (srv *QuicSpdyServer) Statistics() (*ServerStatistics, error)

type QuicStream

type QuicStream interface {
	UserStream() DataStreamProcessor
	WriteHeader(header http.Header, is_body_empty bool)
	WriteOrBufferData(body []byte, fin bool)
	WriteTrailers(header http.Header)
}

type SerializedServerConfig

type SerializedServerConfig struct {
	ServerConfig []byte
	Keys         []*ServerConfigPrivateKey
}

Serialized server config

func GenerateSerializedServerConfig

func GenerateSerializedServerConfig() *SerializedServerConfig

type ServerConfigPrivateKey

type ServerConfigPrivateKey struct {
	Key []byte
	Tag uint32
}

type ServerStatistics

type ServerStatistics struct {
	SessionStatistics []SessionStatistics
}

type ServerWriter

type ServerWriter struct {
	Ch chan UdpData
}

func NewServerWriter

func NewServerWriter(ch chan UdpData) *ServerWriter

type ServerWriterPtr

type ServerWriterPtr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*ServerWriterPtr) Del

func (p *ServerWriterPtr) Del(key int64)

func (*ServerWriterPtr) Get

func (p *ServerWriterPtr) Get(key int64) *ServerWriter

func (*ServerWriterPtr) Set

func (p *ServerWriterPtr) Set(pt *ServerWriter) int64

type SessionStatistics

type SessionStatistics struct {
	Cstat C.struct_ConnStat
}

type SimpleServerStream

type SimpleServerStream struct {
	// contains filtered or unexported fields
}

implement DataStreamProcessor for Server

func (*SimpleServerStream) OnClose

func (stream *SimpleServerStream) OnClose()

func (*SimpleServerStream) OnDataAvailable

func (stream *SimpleServerStream) OnDataAvailable(data []byte, isClosed bool)

func (*SimpleServerStream) OnInitialHeadersComplete

func (stream *SimpleServerStream) OnInitialHeadersComplete(header http.Header, peerAddress string)

func (*SimpleServerStream) OnTrailingHeadersComplete

func (stream *SimpleServerStream) OnTrailingHeadersComplete(header http.Header)

func (*SimpleServerStream) ProcessRequest

func (stream *SimpleServerStream) ProcessRequest()

type SpdyClientSession

type SpdyClientSession struct {
	// contains filtered or unexported fields
}

implement OutgoingDataStreamCreator for Client

func (*SpdyClientSession) CreateOutgoingDynamicStream

func (c *SpdyClientSession) CreateOutgoingDynamicStream() DataStreamProcessor

type SpdyClientStream

type SpdyClientStream struct {
	// contains filtered or unexported fields
}

implement DataStreamProcessor for Client

func (*SpdyClientStream) FinWrite

func (stream *SpdyClientStream) FinWrite() error

func (*SpdyClientStream) Header

func (stream *SpdyClientStream) Header() (http.Header, error)

func (*SpdyClientStream) OnClose

func (stream *SpdyClientStream) OnClose()

called on Stream closing. This may be called when both read/write side is closed or there is some error so that stream is force closed (in libquic side).

func (*SpdyClientStream) OnDataAvailable

func (stream *SpdyClientStream) OnDataAvailable(data []byte, isClosed bool)

func (*SpdyClientStream) OnInitialHeadersComplete

func (stream *SpdyClientStream) OnInitialHeadersComplete(header http.Header, peerAddress string)

func (*SpdyClientStream) OnTrailingHeadersComplete

func (stream *SpdyClientStream) OnTrailingHeadersComplete(header http.Header)

func (*SpdyClientStream) Read

func (stream *SpdyClientStream) Read(p []byte) (int, error)

func (*SpdyClientStream) Trailer

func (stream *SpdyClientStream) Trailer() http.Header

func (*SpdyClientStream) Write

func (stream *SpdyClientStream) Write(buf []byte) (int, error)

func (*SpdyClientStream) WriteHeader

func (stream *SpdyClientStream) WriteHeader(header http.Header, isBodyEmpty bool)

type SpdyServerSession

type SpdyServerSession struct {
	// contains filtered or unexported fields
}

implement IncomingDataStreamCreator for Server

func (*SpdyServerSession) CreateIncomingDynamicStream

func (s *SpdyServerSession) CreateIncomingDynamicStream(quicServerStream *QuicServerStream, streamId uint32) DataStreamProcessor

type TaskRunner

type TaskRunner struct {
	// contains filtered or unexported fields
}

This TaskRunner is NOT THREAD SAFE (and NEED NOT TO BE) so be careful All heap operations should be called in a mainloop, not seperated goroutine

func CreateTaskRunner

func CreateTaskRunner() *TaskRunner

func (*TaskRunner) CancelAlarm

func (t *TaskRunner) CancelAlarm(alarm *GoQuicAlarm)

func (*TaskRunner) DoTasks

func (t *TaskRunner) DoTasks()

func (*TaskRunner) RegisterAlarm

func (t *TaskRunner) RegisterAlarm(alarm *GoQuicAlarm)

func (*TaskRunner) RunAlarm

func (t *TaskRunner) RunAlarm(alarm *GoQuicAlarm)

func (*TaskRunner) UnregisterAlarm

func (t *TaskRunner) UnregisterAlarm(alarm *GoQuicAlarm)

func (*TaskRunner) WaitTimer

func (t *TaskRunner) WaitTimer() <-chan time.Time

type TaskRunnerPtr

type TaskRunnerPtr struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*TaskRunnerPtr) Del

func (p *TaskRunnerPtr) Del(key int64)

func (*TaskRunnerPtr) Get

func (p *TaskRunnerPtr) Get(key int64) *TaskRunner

func (*TaskRunnerPtr) Set

func (p *TaskRunnerPtr) Set(pt *TaskRunner) int64

type UdpData

type UdpData struct {
	Addr *net.UDPAddr
	Buf  []byte
	N    int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL