core: v2ray.com/core/common/mux Index | Files

package mux

import "v2ray.com/core/common/mux"

Index

Package Files

client.go errors.generated.go frame.go mux.go reader.go server.go session.go writer.go

Constants

const (
    OptionData  bitmask.Byte = 0x01
    OptionError bitmask.Byte = 0x02
)

func NewStreamReader Uses

func NewStreamReader(reader *buf.BufferedReader) buf.Reader

NewStreamReader creates a new StreamReader.

type ClientManager Uses

type ClientManager struct {
    Picker WorkerPicker
}

func (*ClientManager) Dispatch Uses

func (m *ClientManager) Dispatch(ctx context.Context, link *transport.Link) error

type ClientStrategy Uses

type ClientStrategy struct {
    MaxConcurrency uint32
    MaxConnection  uint32
}

type ClientWorker Uses

type ClientWorker struct {
    // contains filtered or unexported fields
}

func NewClientWorker Uses

func NewClientWorker(stream transport.Link, s ClientStrategy) (*ClientWorker, error)

NewClientWorker creates a new mux.Client.

func (*ClientWorker) ActiveConnections Uses

func (m *ClientWorker) ActiveConnections() uint32

func (*ClientWorker) Closed Uses

func (m *ClientWorker) Closed() bool

Closed returns true if this Client is closed.

func (*ClientWorker) Dispatch Uses

func (m *ClientWorker) Dispatch(ctx context.Context, link *transport.Link) bool

func (*ClientWorker) IsClosing Uses

func (m *ClientWorker) IsClosing() bool

func (*ClientWorker) IsFull Uses

func (m *ClientWorker) IsFull() bool

func (*ClientWorker) TotalConnections Uses

func (m *ClientWorker) TotalConnections() uint32

type ClientWorkerFactory Uses

type ClientWorkerFactory interface {
    Create() (*ClientWorker, error)
}

type DialingWorkerFactory Uses

type DialingWorkerFactory struct {
    Proxy    proxy.Outbound
    Dialer   internet.Dialer
    Strategy ClientStrategy
}

func (*DialingWorkerFactory) Create Uses

func (f *DialingWorkerFactory) Create() (*ClientWorker, error)

type FrameMetadata Uses

type FrameMetadata struct {
    Target        net.Destination
    SessionID     uint16
    Option        bitmask.Byte
    SessionStatus SessionStatus
}

func (*FrameMetadata) Unmarshal Uses

func (f *FrameMetadata) Unmarshal(reader io.Reader) error

Unmarshal reads FrameMetadata from the given reader.

func (*FrameMetadata) UnmarshalFromBuffer Uses

func (f *FrameMetadata) UnmarshalFromBuffer(b *buf.Buffer) error

UnmarshalFromBuffer reads a FrameMetadata from the given buffer. Visible for testing only.

func (FrameMetadata) WriteTo Uses

func (f FrameMetadata) WriteTo(b *buf.Buffer) error

type IncrementalWorkerPicker Uses

type IncrementalWorkerPicker struct {
    Factory ClientWorkerFactory
    // contains filtered or unexported fields
}

func (*IncrementalWorkerPicker) PickAvailable Uses

func (p *IncrementalWorkerPicker) PickAvailable() (*ClientWorker, error)

type PacketReader Uses

type PacketReader struct {
    // contains filtered or unexported fields
}

PacketReader is an io.Reader that reads whole chunk of Mux frames every time.

func NewPacketReader Uses

func NewPacketReader(reader io.Reader) *PacketReader

NewPacketReader creates a new PacketReader.

func (*PacketReader) ReadMultiBuffer Uses

func (r *PacketReader) ReadMultiBuffer() (buf.MultiBuffer, error)

ReadMultiBuffer implements buf.Reader.

type Server Uses

type Server struct {
    // contains filtered or unexported fields
}

func NewServer Uses

func NewServer(ctx context.Context) *Server

NewServer creates a new mux.Server.

func (*Server) Close Uses

func (s *Server) Close() error

Close implements common.Closable.

func (*Server) Dispatch Uses

func (s *Server) Dispatch(ctx context.Context, dest net.Destination) (*transport.Link, error)

Dispatch impliments routing.Dispatcher

func (*Server) Start Uses

func (s *Server) Start() error

Start implements common.Runnable.

func (*Server) Type Uses

func (s *Server) Type() interface{}

Type implements common.HasType.

type ServerWorker Uses

type ServerWorker struct {
    // contains filtered or unexported fields
}

func NewServerWorker Uses

func NewServerWorker(ctx context.Context, d routing.Dispatcher, link *transport.Link) (*ServerWorker, error)

func (*ServerWorker) ActiveConnections Uses

func (w *ServerWorker) ActiveConnections() uint32

func (*ServerWorker) Closed Uses

func (w *ServerWorker) Closed() bool

type Session Uses

type Session struct {
    ID uint16
    // contains filtered or unexported fields
}

Session represents a client connection in a Mux connection.

func (*Session) Close Uses

func (s *Session) Close() error

Close closes all resources associated with this session.

func (*Session) NewReader Uses

func (s *Session) NewReader(reader *buf.BufferedReader) buf.Reader

NewReader creates a buf.Reader based on the transfer type of this Session.

type SessionManager Uses

type SessionManager struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

func NewSessionManager Uses

func NewSessionManager() *SessionManager

func (*SessionManager) Add Uses

func (m *SessionManager) Add(s *Session)

func (*SessionManager) Allocate Uses

func (m *SessionManager) Allocate() *Session

func (*SessionManager) Close Uses

func (m *SessionManager) Close() error

func (*SessionManager) CloseIfNoSession Uses

func (m *SessionManager) CloseIfNoSession() bool

func (*SessionManager) Closed Uses

func (m *SessionManager) Closed() bool

func (*SessionManager) Count Uses

func (m *SessionManager) Count() int

func (*SessionManager) Get Uses

func (m *SessionManager) Get(id uint16) (*Session, bool)

func (*SessionManager) Remove Uses

func (m *SessionManager) Remove(id uint16)

func (*SessionManager) Size Uses

func (m *SessionManager) Size() int

type SessionStatus Uses

type SessionStatus byte
const (
    SessionStatusNew       SessionStatus = 0x01
    SessionStatusKeep      SessionStatus = 0x02
    SessionStatusEnd       SessionStatus = 0x03
    SessionStatusKeepAlive SessionStatus = 0x04
)

type TargetNetwork Uses

type TargetNetwork byte
const (
    TargetNetworkTCP TargetNetwork = 0x01
    TargetNetworkUDP TargetNetwork = 0x02
)

type WorkerPicker Uses

type WorkerPicker interface {
    PickAvailable() (*ClientWorker, error)
}

type Writer Uses

type Writer struct {
    // contains filtered or unexported fields
}

func NewResponseWriter Uses

func NewResponseWriter(id uint16, writer buf.Writer, transferType protocol.TransferType) *Writer

func NewWriter Uses

func NewWriter(id uint16, dest net.Destination, writer buf.Writer, transferType protocol.TransferType) *Writer

func (*Writer) Close Uses

func (w *Writer) Close() error

Close implements common.Closable.

func (*Writer) WriteMultiBuffer Uses

func (w *Writer) WriteMultiBuffer(mb buf.MultiBuffer) error

WriteMultiBuffer implements buf.Writer.

Package mux imports 23 packages (graph) and is imported by 8 packages. Updated 2019-03-08. Refresh now. Tools for package owners.