diff --git a/app/proxyman/mux/frame.go b/app/proxyman/mux/frame.go index 04eca155f..3d2ecc913 100644 --- a/app/proxyman/mux/frame.go +++ b/app/proxyman/mux/frame.go @@ -31,8 +31,21 @@ const ( AddressTypeIPv6 AddressType = 0x03 ) +/* +Frame format +2 bytes - length +2 bytes - session id +1 bytes - status +1 bytes - reserved + +1 byte - network +2 bytes - port +n bytes - address + +*/ + type FrameMetadata struct { - SessionId uint16 + SessionID uint16 SessionStatus SessionStatus Target net.Destination } @@ -41,7 +54,7 @@ func (f FrameMetadata) AsSupplier() buf.Supplier { return func(b []byte) (int, error) { b = serial.Uint16ToBytes(uint16(0), b) // place holder for length - b = serial.Uint16ToBytes(f.SessionId, b) + b = serial.Uint16ToBytes(f.SessionID, b) b = append(b, byte(f.SessionStatus), 0 /* reserved */) length := 4 @@ -84,7 +97,7 @@ func ReadFrameFrom(b []byte) (*FrameMetadata, error) { } f := &FrameMetadata{ - SessionId: serial.BytesToUint16(b[:2]), + SessionID: serial.BytesToUint16(b[:2]), SessionStatus: SessionStatus(b[2]), } diff --git a/app/proxyman/mux/mux.go b/app/proxyman/mux/mux.go index 023e466e3..51812f83d 100644 --- a/app/proxyman/mux/mux.go +++ b/app/proxyman/mux/mux.go @@ -2,9 +2,18 @@ package mux import "v2ray.com/core/common/net" +const ( + maxParallel = 8 + maxTotal = 128 +) + type mergerWorker struct { } +func (w *mergerWorker) isFull() bool { + return true +} + type Merger struct { sessions map[net.Destination]mergerWorker } diff --git a/app/proxyman/mux/writer.go b/app/proxyman/mux/writer.go index 5a0993934..1ae3cb668 100644 --- a/app/proxyman/mux/writer.go +++ b/app/proxyman/mux/writer.go @@ -1,7 +1,9 @@ package mux -import "v2ray.com/core/common/buf" -import "v2ray.com/core/common/serial" +import ( + "v2ray.com/core/common/buf" + "v2ray.com/core/common/serial" +) type muxWriter struct { meta *FrameMetadata