Documentation
¶
Overview ¶
Package quicstream supports stream, based on quic.
Index ¶
- Variables
- func ConnectionLoggerFromContext(ctx context.Context, log *zerolog.Logger) zerolog.Logger
- func IsSeriousError(err error) bool
- func WithMetricsCollector(ctx context.Context, collector MetricsCollector) context.Context
- func WritePrefix(ctx context.Context, w io.Writer, prefix HandlerPrefix) error
- type ConnInfo
- func MustConnInfo(addr *net.UDPAddr, tlsInsecure bool) ConnInfo
- func MustNewConnInfoFromFullString(s string) ConnInfo
- func NewConnInfo(addr *net.UDPAddr, tlsInsecure bool) (ConnInfo, error)
- func NewConnInfoFromFullString(s string) (ConnInfo, error)
- func NewConnInfoFromStringAddr(s string, tlsInsecure bool) (ci ConnInfo, _ error)
- func UnsafeConnInfo(addr *net.UDPAddr, tlsInsecure bool) ConnInfo
- type ConnInfoDialFunc
- type Connection
- type ConnectionPool
- type ErrorHandler
- type Handler
- type HandlerName
- type HandlerPrefix
- type MetricsCollector
- type OpenStreamFunc
- type PrefixHandler
- type Server
- type StreamFunc
- type Streamer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ConnectionIDContextKey = util.ContextKey("connection_id") StreamIDContextKey = util.ContextKey("stream_id") )
View Source
var ErrHandlerNotFound = util.NewIDError("handler not found")
View Source
var ErrNetwork = util.NewIDError("network error")
View Source
var ErrOpenStream = util.NewIDError("open stream")
View Source
var MetricsCollectorContextKey = util.ContextKey("network-metrics-collector")
MetricsCollectorContextKey is used to propagate the optional metrics collector through contexts that are shared by the networking stack.
View Source
var PrefixHandlerPrefixContextKey = util.ContextKey("prefix-handler-prefix")
Functions ¶
func IsSeriousError ¶
func WithMetricsCollector ¶
func WithMetricsCollector(ctx context.Context, collector MetricsCollector) context.Context
WithMetricsCollector returns a derived context containing the provided collector.
func WritePrefix ¶
Types ¶
type ConnInfo ¶
type ConnInfo struct {
// contains filtered or unexported fields
}
func (ConnInfo) MarshalText ¶
func (ConnInfo) TLSInsecure ¶
func (*ConnInfo) UnmarshalText ¶
type ConnInfoDialFunc ¶
func NewConnInfoDialFunc ¶
func NewConnInfoDialFunc( quicconfigf func() *quic.Config, tlsconfigf func() *tls.Config, ) ConnInfoDialFunc
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) Close ¶
func (c *Connection) Close() error
func (*Connection) Context ¶
func (c *Connection) Context() context.Context
func (*Connection) ID ¶
func (c *Connection) ID() string
func (*Connection) OpenStream ¶
func (c *Connection) OpenStream(ctx context.Context) (io.Reader, io.WriteCloser, func() error, error)
func (*Connection) Stream ¶
func (c *Connection) Stream(ctx context.Context, f StreamFunc) error
type ConnectionPool ¶
type ConnectionPool struct {
Stop func()
// contains filtered or unexported fields
}
func NewConnectionPool ¶
func NewConnectionPool( size uint64, dialf ConnInfoDialFunc, ) (*ConnectionPool, error)
func (*ConnectionPool) Close ¶
func (c *ConnectionPool) Close(ci ConnInfo) bool
func (*ConnectionPool) CloseAll ¶
func (c *ConnectionPool) CloseAll() error
type ErrorHandler ¶
type HandlerName ¶
type HandlerName string
func (HandlerName) Prefix ¶
func (h HandlerName) Prefix() HandlerPrefix
func (HandlerName) String ¶
func (h HandlerName) String() string
type HandlerPrefix ¶
type HandlerPrefix [32]byte
var ZeroPrefix HandlerPrefix
func HashPrefix ¶
func HashPrefix(s HandlerName) HandlerPrefix
func (HandlerPrefix) String ¶
func (p HandlerPrefix) String() string
type MetricsCollector ¶
type MetricsCollector interface {
RecordQuicBytesSent(uint64)
RecordQuicBytesReceived(uint64)
RecordQuicStreamOpened()
RecordQuicStreamClosed()
RecordQuicConnectionOpened()
RecordQuicConnectionClosed()
RecordMemberlistBroadcast()
RecordMemberlistMessageReceived()
SetMemberlistMembers(int)
}
MetricsCollector represents the subset of metrics hooks used by the network stack. Implementations are expected to be concurrency-safe.
func GetMetricsCollector ¶
func GetMetricsCollector(ctx context.Context) MetricsCollector
GetMetricsCollector extracts the MetricsCollector stored in the context, if any.
type OpenStreamFunc ¶
type PrefixHandler ¶
func NewPrefixHandler ¶
func NewPrefixHandler(errorHandler ErrorHandler) *PrefixHandler
func (*PrefixHandler) Add ¶
func (h *PrefixHandler) Add(name HandlerName, handler Handler) *PrefixHandler
func (*PrefixHandler) SetHandlerFunc ¶
func (h *PrefixHandler) SetHandlerFunc(f func(Handler) Handler)
type Server ¶
type Server struct {
*logging.Logging
*util.ContextDaemon
// contains filtered or unexported fields
}
type StreamFunc ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.