Documentation ¶
Index ¶
- Constants
- func NewStream(id frame.StreamId, priority frame.StreamPriority, streamType frame.StreamType, ...) stream
- type ConcurrentStreamMap
- type ExtAccept
- type Extension
- type ISession
- type IStream
- type Session
- func (s *Session) Accept() (str IStream, err error)
- func (s *Session) Close() error
- func (s *Session) GoAway(errorCode frame.ErrorCode, debug []byte) (err error)
- func (s *Session) Kill() error
- func (s *Session) LocalAddr() net.Addr
- func (s *Session) NetDial(_, _ string) (net.Conn, error)
- func (s *Session) NetListener() net.Listener
- func (s *Session) Open() (IStream, error)
- func (s *Session) OpenStream(priority frame.StreamPriority, streamType frame.StreamType, fin bool) (ret IStream, err error)
- func (s *Session) RemoteAddr() net.Addr
- func (s *Session) Wait() (frame.ErrorCode, error, []byte)
- type Stream
- func (s *Stream) Close() error
- func (s *Stream) HalfClose(buf []byte) (n int, err error)
- func (s *Stream) Id() frame.StreamId
- func (s *Stream) LocalAddr() net.Addr
- func (s *Stream) Read(buf []byte) (n int, err error)
- func (s *Stream) RemoteAddr() net.Addr
- func (s *Stream) Session() ISession
- func (s *Stream) SetDeadline(deadline time.Time) (err error)
- func (s *Stream) SetReadDeadline(dl time.Time) error
- func (s *Stream) SetWriteDeadline(dl time.Time) error
- func (s *Stream) StreamType() frame.StreamType
- func (s *Stream) Write(buf []byte) (n int, err error)
- type StreamMap
Constants ¶
const (
MinExtensionType = 0xFFFFFFFF - 0x100 // 512 extensions
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConcurrentStreamMap ¶
ConcurrentStreamMap is a map of stream ids -> streams guarded by a read/write lock
func NewConcurrentStreamMap ¶
func NewConcurrentStreamMap() *ConcurrentStreamMap
func (*ConcurrentStreamMap) Delete ¶
func (m *ConcurrentStreamMap) Delete(id frame.StreamId)
func (*ConcurrentStreamMap) Each ¶
func (m *ConcurrentStreamMap) Each(fn func(frame.StreamId, stream))
func (*ConcurrentStreamMap) Get ¶
func (m *ConcurrentStreamMap) Get(id frame.StreamId) (s stream, ok bool)
func (*ConcurrentStreamMap) Set ¶
func (m *ConcurrentStreamMap) Set(id frame.StreamId, str stream)
type ISession ¶
type ISession interface { Open() (IStream, error) OpenStream(frame.StreamPriority, frame.StreamType, bool) (IStream, error) Accept() (IStream, error) Kill() error GoAway(frame.ErrorCode, []byte) error LocalAddr() net.Addr RemoteAddr() net.Addr Close() error Wait() (frame.ErrorCode, error, []byte) NetListener() net.Listener NetDial(_, _ string) (net.Conn, error) }
type IStream ¶
type IStream interface { Write([]byte) (int, error) Read([]byte) (int, error) Close() error SetDeadline(time.Time) error SetReadDeadline(time.Time) error SetWriteDeadline(time.Time) error HalfClose([]byte) (int, error) Id() frame.StreamId StreamType() frame.StreamType Session() ISession RemoteAddr() net.Addr LocalAddr() net.Addr }
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session implements a simple streaming session manager. It has the following characteristics:
- When closing the Session, it does not linger, all pending write operations will fail immediately. - It completely ignores stream priority when processing and writing frames - It offers no customization of settings like window size/ping time
func (*Session) NetDial ¶
//////////////////////////////////////////// net adaptors ////////////////////////////////////////////
func (*Session) NetListener ¶
func (*Session) OpenStream ¶
func (s *Session) OpenStream(priority frame.StreamPriority, streamType frame.StreamType, fin bool) (ret IStream, err error)
func (*Session) RemoteAddr ¶
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) Close ¶
Close closes the stream in a manner that attempts to emulate a net.Conn's Close(): - It calls HalfClose() with an empty buffer to half-close the stream on the remote side - It calls closeWith() so that all future Read/Write operations will fail - If the stream receives another STREAM_DATA frame from the remote side, it will send a STREAM_RST with a CANCELED error code
func (*Stream) RemoteAddr ¶
func (*Stream) StreamType ¶
func (s *Stream) StreamType() frame.StreamType