Documentation ¶
Index ¶
- Constants
- Variables
- func NewStreamReader(reader *buf.BufferedReader) buf.Reader
- type ClientManager
- type ClientStrategy
- type ClientWorker
- type ClientWorkerFactory
- type DialingWorkerFactory
- type FrameMetadata
- type IncrementalWorkerPicker
- type PacketReader
- type Server
- type ServerWorker
- type Session
- type SessionManager
- func (m *SessionManager) Add(s *Session) bool
- func (m *SessionManager) Allocate() *Session
- func (m *SessionManager) Close() error
- func (m *SessionManager) CloseIfNoSession() bool
- func (m *SessionManager) Closed() bool
- func (m *SessionManager) Count() int
- func (m *SessionManager) Get(id uint16) (*Session, bool)
- func (m *SessionManager) Remove(locked bool, id uint16)
- func (m *SessionManager) Size() int
- type SessionStatus
- type TargetNetwork
- type WorkerPicker
- type Writer
- type XUDP
Constants ¶
View Source
const ( OptionData bitmask.Byte = 0x01 OptionError bitmask.Byte = 0x02 )
View Source
const ( Initializing = 0 Active = 1 Expiring = 2 )
Variables ¶
View Source
var XUDPManager struct { sync.Mutex Map map[[8]byte]*XUDP }
Functions ¶
func NewStreamReader ¶
func NewStreamReader(reader *buf.BufferedReader) buf.Reader
NewStreamReader creates a new StreamReader.
Types ¶
type ClientManager ¶
type ClientManager struct { Enabled bool // wheather mux is enabled from user config Picker WorkerPicker }
type ClientStrategy ¶
type ClientWorker ¶
type ClientWorker struct {
// contains filtered or unexported fields
}
func NewClientWorker ¶
func NewClientWorker(stream transport.Link, s ClientStrategy) (*ClientWorker, error)
NewClientWorker creates a new mux.Client.
func (*ClientWorker) ActiveConnections ¶
func (m *ClientWorker) ActiveConnections() uint32
func (*ClientWorker) Closed ¶
func (m *ClientWorker) Closed() bool
Closed returns true if this Client is closed.
func (*ClientWorker) IsClosing ¶
func (m *ClientWorker) IsClosing() bool
func (*ClientWorker) IsFull ¶
func (m *ClientWorker) IsFull() bool
func (*ClientWorker) TotalConnections ¶
func (m *ClientWorker) TotalConnections() uint32
type ClientWorkerFactory ¶
type ClientWorkerFactory interface {
Create() (*ClientWorker, error)
}
type DialingWorkerFactory ¶
type DialingWorkerFactory struct { Proxy proxy.Outbound Dialer internet.Dialer Strategy ClientStrategy }
func (*DialingWorkerFactory) Create ¶
func (f *DialingWorkerFactory) Create() (*ClientWorker, error)
type FrameMetadata ¶
type FrameMetadata struct { Target net.Destination SessionID uint16 Option bitmask.Byte SessionStatus SessionStatus GlobalID [8]byte }
func (*FrameMetadata) Unmarshal ¶
func (f *FrameMetadata) Unmarshal(reader io.Reader) error
Unmarshal reads FrameMetadata from the given reader.
func (*FrameMetadata) UnmarshalFromBuffer ¶
func (f *FrameMetadata) UnmarshalFromBuffer(b *buf.Buffer) error
UnmarshalFromBuffer reads a FrameMetadata from the given buffer. Visible for testing only.
type IncrementalWorkerPicker ¶
type IncrementalWorkerPicker struct { Factory ClientWorkerFactory // contains filtered or unexported fields }
func (*IncrementalWorkerPicker) PickAvailable ¶
func (p *IncrementalWorkerPicker) PickAvailable() (*ClientWorker, error)
type PacketReader ¶
type PacketReader struct {
// contains filtered or unexported fields
}
PacketReader is an io.Reader that reads whole chunk of Mux frames every time.
func NewPacketReader ¶
func NewPacketReader(reader io.Reader, dest *net.Destination) *PacketReader
NewPacketReader creates a new PacketReader.
func (*PacketReader) ReadMultiBuffer ¶
func (r *PacketReader) ReadMultiBuffer() (buf.MultiBuffer, error)
ReadMultiBuffer implements buf.Reader.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) DispatchLink ¶
func (s *Server) DispatchLink(ctx context.Context, dest net.Destination, link *transport.Link) error
DispatchLink implements routing.Dispatcher
type ServerWorker ¶
type ServerWorker struct {
// contains filtered or unexported fields
}
func NewServerWorker ¶
func NewServerWorker(ctx context.Context, d routing.Dispatcher, link *transport.Link) (*ServerWorker, error)
func (*ServerWorker) ActiveConnections ¶
func (w *ServerWorker) ActiveConnections() uint32
func (*ServerWorker) Closed ¶
func (w *ServerWorker) Closed() bool
type Session ¶
Session represents a client connection in a Mux connection.
func (*Session) NewReader ¶
func (s *Session) NewReader(reader *buf.BufferedReader, dest *net.Destination) buf.Reader
NewReader creates a buf.Reader based on the transfer type of this Session.
type SessionManager ¶
func NewSessionManager ¶
func NewSessionManager() *SessionManager
func (*SessionManager) Add ¶
func (m *SessionManager) Add(s *Session) bool
func (*SessionManager) Allocate ¶
func (m *SessionManager) Allocate() *Session
func (*SessionManager) Close ¶
func (m *SessionManager) Close() error
func (*SessionManager) CloseIfNoSession ¶
func (m *SessionManager) CloseIfNoSession() bool
func (*SessionManager) Closed ¶
func (m *SessionManager) Closed() bool
func (*SessionManager) Count ¶
func (m *SessionManager) Count() int
func (*SessionManager) Remove ¶
func (m *SessionManager) Remove(locked bool, id uint16)
func (*SessionManager) Size ¶
func (m *SessionManager) Size() int
type SessionStatus ¶
type SessionStatus byte
const ( SessionStatusNew SessionStatus = 0x01 SessionStatusKeep SessionStatus = 0x02 SessionStatusEnd SessionStatus = 0x03 SessionStatusKeepAlive SessionStatus = 0x04 )
type TargetNetwork ¶
type TargetNetwork byte
const ( TargetNetworkTCP TargetNetwork = 0x01 TargetNetworkUDP TargetNetwork = 0x02 )
type WorkerPicker ¶
type WorkerPicker interface {
PickAvailable() (*ClientWorker, error)
}
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func NewResponseWriter ¶
func NewWriter ¶
func NewWriter(id uint16, dest net.Destination, writer buf.Writer, transferType protocol.TransferType, globalID [8]byte) *Writer
func (*Writer) WriteMultiBuffer ¶
func (w *Writer) WriteMultiBuffer(mb buf.MultiBuffer) error
WriteMultiBuffer implements buf.Writer.
Click to show internal directories.
Click to hide internal directories.