import "github.com/v2ray/v2ray-core/common/mux"
client.go errors.generated.go frame.go mux.go reader.go server.go session.go writer.go
func NewStreamReader(reader *buf.BufferedReader) buf.Reader
NewStreamReader creates a new StreamReader.
type ClientManager struct { Enabled bool // wheather mux is enabled from user config Picker WorkerPicker }
type ClientWorker struct {
// contains filtered or unexported fields
}
func NewClientWorker(stream transport.Link, s ClientStrategy) (*ClientWorker, error)
NewClientWorker creates a new mux.Client.
func (m *ClientWorker) ActiveConnections() uint32
func (m *ClientWorker) Closed() bool
Closed returns true if this Client is closed.
func (m *ClientWorker) IsClosing() bool
func (m *ClientWorker) IsFull() bool
func (m *ClientWorker) TotalConnections() uint32
type ClientWorkerFactory interface { Create() (*ClientWorker, error) }
type DialingWorkerFactory struct { Proxy proxy.Outbound Dialer internet.Dialer Strategy ClientStrategy }
func (f *DialingWorkerFactory) Create() (*ClientWorker, error)
type FrameMetadata struct { Target net.Destination SessionID uint16 Option bitmask.Byte SessionStatus SessionStatus }
func (f *FrameMetadata) Unmarshal(reader io.Reader) error
Unmarshal reads FrameMetadata from the given reader.
func (f *FrameMetadata) UnmarshalFromBuffer(b *buf.Buffer) error
UnmarshalFromBuffer reads a FrameMetadata from the given buffer. Visible for testing only.
func (f FrameMetadata) WriteTo(b *buf.Buffer) error
type IncrementalWorkerPicker struct { Factory ClientWorkerFactory // contains filtered or unexported fields }
func (p *IncrementalWorkerPicker) PickAvailable() (*ClientWorker, error)
type PacketReader struct {
// contains filtered or unexported fields
}
PacketReader is an io.Reader that reads whole chunk of Mux frames every time.
func NewPacketReader(reader io.Reader) *PacketReader
NewPacketReader creates a new PacketReader.
func (r *PacketReader) ReadMultiBuffer() (buf.MultiBuffer, error)
ReadMultiBuffer implements buf.Reader.
type Server struct {
// contains filtered or unexported fields
}
NewServer creates a new mux.Server.
Close implements common.Closable.
Dispatch implements routing.Dispatcher
Start implements common.Runnable.
Type implements common.HasType.
type ServerWorker struct {
// contains filtered or unexported fields
}
func NewServerWorker(ctx context.Context, d routing.Dispatcher, link *transport.Link) (*ServerWorker, error)
func (w *ServerWorker) ActiveConnections() uint32
func (w *ServerWorker) Closed() bool
Session represents a client connection in a Mux connection.
Close closes all resources associated with this session.
NewReader creates a buf.Reader based on the transfer type of this Session.
func NewSessionManager() *SessionManager
func (m *SessionManager) Add(s *Session)
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(id uint16)
func (m *SessionManager) Size() int
const ( SessionStatusNew SessionStatus = 0x01 SessionStatusKeep SessionStatus = 0x02 SessionStatusEnd SessionStatus = 0x03 SessionStatusKeepAlive SessionStatus = 0x04 )
const ( TargetNetworkTCP TargetNetwork = 0x01 TargetNetworkUDP TargetNetwork = 0x02 )
type WorkerPicker interface { PickAvailable() (*ClientWorker, error) }
type Writer struct {
// contains filtered or unexported fields
}
func NewWriter(id uint16, dest net.Destination, writer buf.Writer, transferType protocol.TransferType) *Writer
Close implements common.Closable.
func (w *Writer) WriteMultiBuffer(mb buf.MultiBuffer) error
WriteMultiBuffer implements buf.Writer.
Package mux imports 23 packages (graph). Updated 2020-12-29. Refresh now. Tools for package owners.