Documentation ¶
Index ¶
- Constants
- Variables
- func GetCompressStreamReaderWriter(stream io.ReadWriteCloser, method string) (io.Reader, io.Writer)
- func IsValidCompressor(method string) bool
- func ReadMessage(stream io.Reader, res interface{}) error
- func WriteMessage(stream io.Writer, req interface{}) error
- type AuthRequest
- type AuthResponse
- type ConnAddr
- type ConnectRequest
- type HTTP2MuxSession
- func (q *HTTP2MuxSession) AcceptStream() (MuxStream, error)
- func (q *HTTP2MuxSession) Close() error
- func (q *HTTP2MuxSession) CloseStream(stream MuxStream) error
- func (s *HTTP2MuxSession) LocalAddr() net.Addr
- func (q *HTTP2MuxSession) NumStreams() int
- func (q *HTTP2MuxSession) OfferStream(stream TimeoutReadWriteCloser) error
- func (q *HTTP2MuxSession) OpenStream() (MuxStream, error)
- func (q *HTTP2MuxSession) Ping() (time.Duration, error)
- func (s *HTTP2MuxSession) RemoteAddr() net.Addr
- type MuxSession
- type MuxStream
- type MuxStreamConn
- type ProxyMuxSession
- type ProxyMuxStream
- func (s *ProxyMuxStream) Auth(req *AuthRequest) *AuthResponse
- func (s *ProxyMuxStream) Close() error
- func (s *ProxyMuxStream) Connect(network string, addr string, opt StreamOptions) error
- func (s *ProxyMuxStream) LatestIOTime() time.Time
- func (s *ProxyMuxStream) OnIO(read bool)
- func (s *ProxyMuxStream) Read(p []byte) (int, error)
- func (s *ProxyMuxStream) ReadFrom(r io.Reader) (n int64, err error)
- func (s *ProxyMuxStream) StreamID() uint32
- func (s *ProxyMuxStream) Write(p []byte) (int, error)
- func (s *ProxyMuxStream) WriteTo(w io.Writer) (n int64, err error)
- type QUICMuxSession
- func (q *QUICMuxSession) AcceptStream() (MuxStream, error)
- func (q *QUICMuxSession) Close() error
- func (q *QUICMuxSession) CloseStream(stream MuxStream) error
- func (s *QUICMuxSession) LocalAddr() net.Addr
- func (q *QUICMuxSession) NumStreams() int
- func (q *QUICMuxSession) OpenStream() (MuxStream, error)
- func (q *QUICMuxSession) Ping() (time.Duration, error)
- func (s *QUICMuxSession) RemoteAddr() net.Addr
- type StreamOptions
- type SyncCloser
- type TimeoutReadWriteCloser
- type WsConn
Constants ¶
View Source
const ( DefaultMuxCipherMethod = "chacha20poly1305" DefaultMuxInitialCipherCounter = uint64(47816489) AuthOK = 1 HTTPMuxSessionIDHeader = "X-Session-ID" HTTPMuxSessionACKIDHeader = "X-Session-ACK-ID" HTTPMuxPullPeriodHeader = "X-PullPeriod" )
View Source
const ( SnappyCompressor = "snappy" NoneCompressor = "none" )
Variables ¶
Functions ¶
func IsValidCompressor ¶
func ReadMessage ¶
func WriteMessage ¶
Types ¶
type AuthRequest ¶
type AuthRequest struct { Rand string User string CipherCounter uint64 CipherMethod string CompressMethod string P2PToken string P2PConnID string P2PPriAddr string P2PPubAddr string }
func ReadAuthRequest ¶
func ReadAuthRequest(stream io.Reader) (*AuthRequest, error)
type AuthResponse ¶
func (*AuthResponse) Error ¶
func (res *AuthResponse) Error() error
type ConnectRequest ¶
type ConnectRequest struct { //ProxySID uint32 Network string Addr string DialTimeout int ReadTimeout int Hops []string }
func ReadConnectRequest ¶
func ReadConnectRequest(stream io.Reader) (*ConnectRequest, error)
type HTTP2MuxSession ¶
type HTTP2MuxSession struct { net.Conn ServerHost string //Client *http.Client //Client *http2.Transport AcceptCh chan MuxStream // contains filtered or unexported fields }
func NewHTTP2ServerMuxSession ¶
func NewHTTP2ServerMuxSession(conn net.Conn) *HTTP2MuxSession
func (*HTTP2MuxSession) AcceptStream ¶
func (q *HTTP2MuxSession) AcceptStream() (MuxStream, error)
func (*HTTP2MuxSession) Close ¶
func (q *HTTP2MuxSession) Close() error
func (*HTTP2MuxSession) CloseStream ¶
func (q *HTTP2MuxSession) CloseStream(stream MuxStream) error
func (*HTTP2MuxSession) LocalAddr ¶
func (s *HTTP2MuxSession) LocalAddr() net.Addr
func (*HTTP2MuxSession) NumStreams ¶
func (q *HTTP2MuxSession) NumStreams() int
func (*HTTP2MuxSession) OfferStream ¶
func (q *HTTP2MuxSession) OfferStream(stream TimeoutReadWriteCloser) error
func (*HTTP2MuxSession) OpenStream ¶
func (q *HTTP2MuxSession) OpenStream() (MuxStream, error)
func (*HTTP2MuxSession) RemoteAddr ¶
func (s *HTTP2MuxSession) RemoteAddr() net.Addr
type MuxSession ¶
type MuxSession interface { OpenStream() (MuxStream, error) CloseStream(stream MuxStream) error AcceptStream() (MuxStream, error) Ping() (time.Duration, error) NumStreams() int Close() error RemoteAddr() net.Addr LocalAddr() net.Addr }
func NewHTTP2ClientMuxSession ¶
func NewHTTP2ClientMuxSession(conn net.Conn, host string) (MuxSession, error)
type MuxStream ¶
type MuxStream interface { io.ReadWriteCloser Connect(network string, addr string, opt StreamOptions) error Auth(req *AuthRequest) *AuthResponse StreamID() uint32 SetReadDeadline(t time.Time) error SetWriteDeadline(t time.Time) error LatestIOTime() time.Time }
type MuxStreamConn ¶
type MuxStreamConn struct {
MuxStream
}
func (*MuxStreamConn) LocalAddr ¶
func (s *MuxStreamConn) LocalAddr() net.Addr
func (*MuxStreamConn) RemoteAddr ¶
func (s *MuxStreamConn) RemoteAddr() net.Addr
func (*MuxStreamConn) SetDeadline ¶
func (s *MuxStreamConn) SetDeadline(t time.Time) error
type ProxyMuxSession ¶
func (*ProxyMuxSession) AcceptStream ¶
func (s *ProxyMuxSession) AcceptStream() (MuxStream, error)
func (*ProxyMuxSession) CloseStream ¶
func (s *ProxyMuxSession) CloseStream(stream MuxStream) error
func (*ProxyMuxSession) LocalAddr ¶
func (s *ProxyMuxSession) LocalAddr() net.Addr
func (*ProxyMuxSession) OpenStream ¶
func (s *ProxyMuxSession) OpenStream() (MuxStream, error)
func (*ProxyMuxSession) RemoteAddr ¶
func (s *ProxyMuxSession) RemoteAddr() net.Addr
type ProxyMuxStream ¶
type ProxyMuxStream struct { TimeoutReadWriteCloser // contains filtered or unexported fields }
func (*ProxyMuxStream) Auth ¶
func (s *ProxyMuxStream) Auth(req *AuthRequest) *AuthResponse
func (*ProxyMuxStream) Close ¶
func (s *ProxyMuxStream) Close() error
func (*ProxyMuxStream) Connect ¶
func (s *ProxyMuxStream) Connect(network string, addr string, opt StreamOptions) error
func (*ProxyMuxStream) LatestIOTime ¶
func (s *ProxyMuxStream) LatestIOTime() time.Time
func (*ProxyMuxStream) OnIO ¶
func (s *ProxyMuxStream) OnIO(read bool)
func (*ProxyMuxStream) ReadFrom ¶
func (s *ProxyMuxStream) ReadFrom(r io.Reader) (n int64, err error)
func (*ProxyMuxStream) StreamID ¶
func (s *ProxyMuxStream) StreamID() uint32
type QUICMuxSession ¶
type QUICMuxSession struct { quic.Connection // contains filtered or unexported fields }
func (*QUICMuxSession) AcceptStream ¶
func (q *QUICMuxSession) AcceptStream() (MuxStream, error)
func (*QUICMuxSession) Close ¶
func (q *QUICMuxSession) Close() error
func (*QUICMuxSession) CloseStream ¶
func (q *QUICMuxSession) CloseStream(stream MuxStream) error
func (*QUICMuxSession) LocalAddr ¶
func (s *QUICMuxSession) LocalAddr() net.Addr
func (*QUICMuxSession) NumStreams ¶
func (q *QUICMuxSession) NumStreams() int
func (*QUICMuxSession) OpenStream ¶
func (q *QUICMuxSession) OpenStream() (MuxStream, error)
func (*QUICMuxSession) RemoteAddr ¶
func (s *QUICMuxSession) RemoteAddr() net.Addr
type StreamOptions ¶
type SyncCloser ¶
type SyncCloser interface {
SyncClose() error
}
type TimeoutReadWriteCloser ¶
Click to show internal directories.
Click to hide internal directories.