Documentation
¶
Index ¶
- Constants
- Variables
- func NewClient(ctx context.Context, link *pipe.Link, s ClientStrategy) (*client, error)
- func Serve(ctx context.Context, rw buf.ReaderWriter, d i.FlowHandler) error
- type AddressType
- type ClientManager
- type ClientStrategy
- type FrameMetadata
- type MuxWriter
- type SessionStatus
- type TargetNetwork
- type TransferType
Constants ¶
View Source
const ( OptionData bitmask.Byte = 0x01 OptionError bitmask.Byte = 0x02 )
Variables ¶
View Source
var ( MuxCoolAddressDst = nethelper.DomainAddress("v1.mux.cool") MuxCoolPortDst = nethelper.Port(9527) )
View Source
var DefaultClientStrategy = ClientStrategy{
MaxConnection: 16,
MaxConcurrency: 2,
}
Functions ¶
func Serve ¶
func Serve(ctx context.Context, rw buf.ReaderWriter, d i.FlowHandler) error
Types ¶
type AddressType ¶
type AddressType byte
const ( AddressTypeIPv4 AddressType = 1 AddressTypeDomain AddressType = 2 AddressTypeIPv6 AddressType = 3 )
type ClientManager ¶
type ClientManager struct {
Strategy ClientStrategy
// contains filtered or unexported fields
}
func NewClientManager ¶
func NewClientManager(strategy ClientStrategy, oh i.FlowHandler) *ClientManager
func (*ClientManager) Close ¶
func (m *ClientManager) Close() error
func (*ClientManager) Create ¶
func (p *ClientManager) Create() (*client, error)
func (*ClientManager) HandleReaderWriter ¶
func (m *ClientManager) HandleReaderWriter(ctx context.Context, dst net.Destination, rw buf.ReaderWriter) error
a worker is chosen to handle a link ctx is used to get outboundInfo and sessionID
func (*ClientManager) Start ¶
func (m *ClientManager) Start() error
type ClientStrategy ¶
type FrameMetadata ¶
type FrameMetadata struct {
GlobalID [8]byte //only present when xudp
// UdpUuid uuid.UUID //only present when udp
Target nethelper.Destination
SessionID uint16
Option bitmask.Byte
SessionStatus SessionStatus
}
type MuxWriter ¶
type MuxWriter struct {
// contains filtered or unexported fields
}
func NewMuxWriter ¶
func NewMuxWriter(id uint16, dest net.Destination, writer buf.Writer, transferType TransferType) *MuxWriter
build frames and write them to the writer. used by muxclient
func NewResponseMuxWriter ¶
func NewResponseMuxWriter(id uint16, writer buf.Writer, transferType TransferType) *MuxWriter
used by the mux.server to write back responses.
func (*MuxWriter) CloseWrite ¶
func (*MuxWriter) SendSessionStatusEnd ¶
this is when the end frame is sent
func (*MuxWriter) WriteMultiBuffer ¶
func (w *MuxWriter) WriteMultiBuffer(mb buf.MultiBuffer) error
WriteMultiBuffer implements buf.Writer.
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 TransferType ¶
type TransferType byte
const ( TransferTypeStream TransferType = 0 TransferTypePacket TransferType = 1 )
Click to show internal directories.
Click to hide internal directories.