diff --git a/.vscode/settings.json b/.vscode/settings.json index 0e92553f7..b204aa453 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,8 +10,8 @@ "protoc": { "options": [ - "--proto_path=$GOPATH/src/", - "--proto_path=$GOPATH/src/github.com/google/protobuf/src" + "--proto_path=${env.GOPATH}/src/", + "--proto_path=${env.GOPATH}/src/github.com/google/protobuf/src" ] } -} \ No newline at end of file +} diff --git a/app/proxyman/config.pb.go b/app/proxyman/config.pb.go index e574ca5b6..26a1e9a09 100644 --- a/app/proxyman/config.pb.go +++ b/app/proxyman/config.pb.go @@ -345,7 +345,8 @@ func (m *OutboundHandlerConfig) GetComment() string { } type MultiplexingConfig struct { - Enabled bool `protobuf:"varint,1,opt,name=enabled" json:"enabled,omitempty"` + Enabled bool `protobuf:"varint,1,opt,name=enabled" json:"enabled,omitempty"` + Concurrency uint32 `protobuf:"varint,2,opt,name=concurrency" json:"concurrency,omitempty"` } func (m *MultiplexingConfig) Reset() { *m = MultiplexingConfig{} } @@ -360,6 +361,13 @@ func (m *MultiplexingConfig) GetEnabled() bool { return false } +func (m *MultiplexingConfig) GetConcurrency() uint32 { + if m != nil { + return m.Concurrency + } + return 0 +} + type SessionFrame struct { Id uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` Command SessionFrame_FrameCommand `protobuf:"varint,2,opt,name=command,enum=v2ray.core.app.proxyman.SessionFrame_FrameCommand" json:"command,omitempty"` @@ -419,61 +427,62 @@ func init() { func init() { proto.RegisterFile("v2ray.com/core/app/proxyman/config.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 891 bytes of a gzipped FileDescriptorProto + // 899 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x5d, 0x6f, 0x1b, 0x45, - 0x14, 0xed, 0xda, 0xa9, 0x9b, 0xdc, 0x24, 0xce, 0x76, 0x28, 0xad, 0x31, 0x20, 0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 0x19, 0x6c, 0x71, 0x78, 0x43, 0xd6, - 0x4b, 0xf4, 0x15, 0x74, 0x0a, 0xa6, 0x0d, 0xe5, 0x21, 0xb4, 0x0f, 0x1b, 0xc8, 0x47, 0x93, 0x13, - 0x75, 0x20, 0x4a, 0xc2, 0x38, 0x0e, 0x04, 0xf4, 0x0b, 0xbc, 0x45, 0x16, 0xf5, 0xce, 0x74, 0x28, - 0x38, 0x64, 0x72, 0xff, 0x1a, 0x99, 0x60, 0x44, 0x56, 0x1b, 0xf3, 0x09, 0xec, 0x68, 0xa3, 0x28, - 0x29, 0x67, 0x9a, 0x1a, 0xc3, 0x78, 0xae, 0x7b, 0x6b, 0xab, 0xca, 0x8b, 0x31, 0x48, 0xea, 0x31, - 0x48, 0xa6, 0x8e, 0xe5, 0xfd, 0xc1, 0x5d, 0xaf, 0x31, 0x0d, 0x12, 0xe8, 0x1b, 0x78, 0x4f, 0x79, - 0x07, 0x67, 0x42, 0xb1, 0x9c, 0x71, 0x52, 0xcc, 0x96, 0x46, 0xb2, 0x77, 0x73, 0x37, 0xda, 0x5b, - 0xc7, 0xfd, 0x80, 0x39, 0x09, 0x90, 0x83, 0x4b, 0x04, 0xfa, 0x1a, 0x7a, 0xf6, 0xb6, 0xe7, 0x33, - 0x49, 0xb4, 0xb6, 0x3a, 0xa9, 0xe0, 0x9c, 0xa6, 0x8e, 0xdd, 0xb1, 0xec, 0xc7, 0xad, 0x5e, 0x84, - 0xef, 0x3a, 0xcc, 0xc4, 0x43, 0xc6, 0x0b, 0xc4, 0xe0, 0xef, 0x08, 0xee, 0x84, 0xb9, 0xfc, 0x8e, - 0xf0, 0xac, 0x58, 0x04, 0x19, 0x43, 0xdb, 0x90, 0xdc, 0x25, 0xb8, 0x81, 0xed, 0x12, 0x4d, 0xe1, - 0x76, 0xb8, 0x86, 0xba, 0xb4, 0xc0, 0x87, 0xf4, 0xf1, 0x15, 0x21, 0xf9, 0x77, 0xcb, 0x0d, 0x65, - 0x76, 0xec, 0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 0xe0, 0x8f, 0x22, 0x3c, 0x73, 0xd6, 0x74, 0x47, 0xa3, 0xc6, - 0x7c, 0x96, 0x75, 0x12, 0xf7, 0x77, 0xec, 0x99, 0xb8, 0x96, 0x40, 0x5f, 0x42, 0xc7, 0x10, 0x95, - 0x53, 0x13, 0x7c, 0xf9, 0xa0, 0xa1, 0xb3, 0x0f, 0x79, 0x26, 0x05, 0xe3, 0x06, 0x07, 0xb8, 0xad, - 0x40, 0x92, 0xaa, 0x10, 0x24, 0x73, 0x56, 0x6c, 0xe1, 0x7a, 0x3b, 0x78, 0x04, 0x5b, 0xcb, 0x67, - 0xa1, 0x2e, 0x40, 0xb8, 0xc8, 0x8f, 0xf4, 0x3c, 0xbe, 0x81, 0x76, 0x60, 0x33, 0xec, 0xbf, 0xa7, - 0x54, 0xc6, 0xd1, 0x12, 0xe0, 0x90, 0x67, 0x71, 0xeb, 0xf1, 0x18, 0xde, 0x4d, 0x45, 0xd9, 0x54, - 0xd5, 0x24, 0x7a, 0xba, 0x5e, 0xaf, 0xff, 0x68, 0xdd, 0xfb, 0x79, 0x84, 0x49, 0x95, 0x8c, 0x2d, - 0x6a, 0x5f, 0x4a, 0xdf, 0xe3, 0x25, 0xe1, 0xa7, 0x1d, 0xf7, 0xfb, 0xe1, 0xe1, 0xbf, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x4c, 0xc8, 0xc1, 0x3b, 0x62, 0x09, 0x00, 0x00, + 0x14, 0xed, 0xda, 0xa9, 0x9b, 0xdc, 0x24, 0x8e, 0x3b, 0x94, 0xd6, 0x18, 0x10, 0xc6, 0x42, 0x10, + 0x51, 0xb4, 0x2e, 0xae, 0x10, 0x42, 0x42, 0x2a, 0xa9, 0x13, 0x44, 0x04, 0x21, 0x66, 0x5c, 0xf1, + 0x50, 0x21, 0x59, 0x93, 0xdd, 0xe9, 0x32, 0x62, 0x77, 0x66, 0x34, 0x33, 0x4e, 0xb2, 0x6f, 0xfc, + 0x1e, 0x7e, 0x05, 0x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 0xee, 0x83, 0x9a, 0xde, 0x3f, + 0xe0, 0xa9, 0x14, 0x8c, 0x1b, 0x1c, 0xe0, 0xb6, 0x46, 0x49, 0xca, 0x5c, 0x90, 0xd4, 0x99, 0xb5, + 0x85, 0xab, 0xed, 0xe0, 0x09, 0x6c, 0x2d, 0x9f, 0x85, 0xda, 0x00, 0xe1, 0x22, 0x3f, 0xd2, 0xb3, + 0xce, 0x2d, 0xb4, 0x03, 0x9b, 0x61, 0xff, 0x3d, 0xa5, 0xb2, 0x13, 0x2d, 0x01, 0x0e, 0x78, 0xda, + 0x69, 0x3c, 0x1d, 0xc3, 0xbb, 0x89, 0x28, 0xea, 0xaa, 0x9a, 0x44, 0xcf, 0xd7, 0xab, 0xf5, 0x1f, + 0x8d, 0x07, 0x3f, 0x8f, 0x30, 0x29, 0xe3, 0xb1, 0x45, 0xed, 0x49, 0xe9, 0xa7, 0xa0, 0x20, 0xfc, + 0xa4, 0xe5, 0x7e, 0x61, 0x3c, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0x70, 0x61, 0x1e, 0xe3, 0x84, + 0x09, 0x00, 0x00, } diff --git a/app/proxyman/config.proto b/app/proxyman/config.proto index 3505858f1..f3fda8128 100644 --- a/app/proxyman/config.proto +++ b/app/proxyman/config.proto @@ -83,20 +83,8 @@ message OutboundHandlerConfig { } message MultiplexingConfig { + // Whether or not Mux is enabled. bool enabled = 1; -} - -message SessionFrame { - uint32 id = 1; - - enum FrameCommand { - SessionNew = 0; - SessionKeep = 1; - SessionEnd = 2; - } - - FrameCommand command = 2; - - v2ray.core.common.net.Endpoint target = 3; - bytes payload = 4; + // Max number of concurrent connections that one Mux connection can handle. + uint32 concurrency = 2; } diff --git a/app/proxyman/mux/mux.go b/app/proxyman/mux/mux.go index 7a179e24a..ca9e3a4bf 100644 --- a/app/proxyman/mux/mux.go +++ b/app/proxyman/mux/mux.go @@ -10,6 +10,7 @@ import ( "v2ray.com/core/app" "v2ray.com/core/app/dispatcher" "v2ray.com/core/app/log" + "v2ray.com/core/app/proxyman" "v2ray.com/core/common/buf" "v2ray.com/core/common/net" "v2ray.com/core/common/signal" @@ -18,8 +19,7 @@ import ( ) const ( - maxParallel = 8 - maxTotal = 128 + maxTotal = 128 ) type manager interface { @@ -63,12 +63,14 @@ type ClientManager struct { clients []*Client proxy proxy.Outbound dialer proxy.Dialer + config *proxyman.MultiplexingConfig } -func NewClientManager(p proxy.Outbound, d proxy.Dialer) *ClientManager { +func NewClientManager(p proxy.Outbound, d proxy.Dialer, c *proxyman.MultiplexingConfig) *ClientManager { return &ClientManager{ proxy: p, dialer: d, + config: c, } } @@ -118,6 +120,7 @@ type Client struct { cancel context.CancelFunc manager *ClientManager session2Remove chan uint16 + concurrency uint32 } var muxCoolDestination = net.TCPDestination(net.DomainAddress("v1.mux.cool"), net.Port(9527)) @@ -135,6 +138,7 @@ func NewClient(p proxy.Outbound, dialer proxy.Dialer, m *ClientManager) (*Client manager: m, count: 0, session2Remove: make(chan uint16, 16), + concurrency: m.config.Concurrency, } go c.fetchOutput() go c.monitor() @@ -225,7 +229,7 @@ func (m *Client) Dispatch(ctx context.Context, outboundRay ray.OutboundRay) bool m.access.Lock() defer m.access.Unlock() - if len(m.sessions) >= maxParallel { + if len(m.sessions) >= int(m.concurrency) { return false } diff --git a/app/proxyman/outbound/handler.go b/app/proxyman/outbound/handler.go index 4e9a7cd71..036a46347 100644 --- a/app/proxyman/outbound/handler.go +++ b/app/proxyman/outbound/handler.go @@ -62,13 +62,18 @@ func NewHandler(ctx context.Context, config *proxyman.OutboundHandlerConfig) (*H } if h.senderSettings != nil && h.senderSettings.MultiplexSettings != nil && h.senderSettings.MultiplexSettings.Enabled { - h.mux = mux.NewClientManager(proxyHandler, h) + config := h.senderSettings.MultiplexSettings + if config.Concurrency < 1 || config.Concurrency > 1024 { + return nil, newError("invalid mux concurrency: ", config.Concurrency) + } + h.mux = mux.NewClientManager(proxyHandler, h, config) } h.proxy = proxyHandler return h, nil } +// Dispatch implements proxy.Outbound.Dispatch. func (h *Handler) Dispatch(ctx context.Context, outboundRay ray.OutboundRay) { if h.mux != nil { err := h.mux.Dispatch(ctx, outboundRay) diff --git a/tools/conf/v2ray.go b/tools/conf/v2ray.go index 68355fde3..6318fad60 100644 --- a/tools/conf/v2ray.go +++ b/tools/conf/v2ray.go @@ -80,7 +80,15 @@ func (v *InboundConnectionConfig) Build() (*proxyman.InboundHandlerConfig, error } type MuxConfig struct { - Enabled bool `json:"enabled"` + Enabled bool `json:"enabled"` + Concurrency uint16 `json:"concurrency"` +} + +func (c *MuxConfig) GetConcurrency() uint16 { + if c.Concurrency == 0 { + return 8 + } + return c.Concurrency } type OutboundConnectionConfig struct { @@ -120,7 +128,8 @@ func (v *OutboundConnectionConfig) Build() (*proxyman.OutboundHandlerConfig, err if v.MuxSettings != nil && v.MuxSettings.Enabled { senderSettings.MultiplexSettings = &proxyman.MultiplexingConfig{ - Enabled: true, + Enabled: true, + Concurrency: uint32(v.MuxSettings.GetConcurrency()), } } @@ -270,7 +279,8 @@ func (v *OutboundDetourConfig) Build() (*proxyman.OutboundHandlerConfig, error) if v.MuxSettings != nil && v.MuxSettings.Enabled { senderSettings.MultiplexSettings = &proxyman.MultiplexingConfig{ - Enabled: true, + Enabled: true, + Concurrency: uint32(v.MuxSettings.GetConcurrency()), } }