From 99c897992d338310ff8202cb8ff1df650e18fa67 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Wed, 21 Dec 2016 12:53:31 +0100 Subject: [PATCH] partially revert compression stream. --- common/protocol/headers.go | 11 +++++++++-- proxy/vmess/account.proto | 3 +++ proxy/vmess/outbound/outbound.go | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/common/protocol/headers.go b/common/protocol/headers.go index 0d9d2d96a..7050ac5d4 100644 --- a/common/protocol/headers.go +++ b/common/protocol/headers.go @@ -14,11 +14,18 @@ const ( RequestCommandUDP = RequestCommand(0x02) ) +// RequestOption is the options of a request. type RequestOption byte const ( - RequestOptionChunkStream = RequestOption(0x01) + // RequestOptionChunkStream indicates request payload is chunked. Each chunk consists of length, authentication and payload. + RequestOptionChunkStream = RequestOption(0x01) + + // RequestOptionConnectionReuse indicates client side expects to reuse the connection. RequestOptionConnectionReuse = RequestOption(0x02) + + // RequestOptionCompressedStream indicates request payload is compressed. + RequestOptionCompressedStream = RequestOption(0x04) ) func (v RequestOption) Has(option RequestOption) bool { @@ -66,7 +73,7 @@ func (v *RequestHeader) Destination() v2net.Destination { type ResponseOption byte const ( - ResponseOptionConnectionReuse = ResponseOption(1) + ResponseOptionConnectionReuse = ResponseOption(0x01) ) func (v *ResponseOption) Set(option ResponseOption) { diff --git a/proxy/vmess/account.proto b/proxy/vmess/account.proto index 1aff63266..900c28602 100644 --- a/proxy/vmess/account.proto +++ b/proxy/vmess/account.proto @@ -9,7 +9,10 @@ option java_outer_classname = "AccountProto"; import "v2ray.com/core/common/protocol/headers.proto"; message Account { + // ID of the account, in the form of an UUID, e.g., "66ad4540-b58c-4ad2-9926-ea63445a9b57". string id = 1; + // Number of alternative IDs. Client and server must share the same number. uint32 alter_id = 2; + // Security settings. Only applies to client side. v2ray.core.common.protocol.SecurityConfig security_settings = 3; } diff --git a/proxy/vmess/outbound/outbound.go b/proxy/vmess/outbound/outbound.go index 0daa74a72..40794b659 100644 --- a/proxy/vmess/outbound/outbound.go +++ b/proxy/vmess/outbound/outbound.go @@ -18,12 +18,14 @@ import ( "v2ray.com/core/transport/ray" ) +// VMessOutboundHandler is an outbound connection handler for VMess protocol. type VMessOutboundHandler struct { serverList *protocol.ServerList serverPicker protocol.ServerPicker meta *proxy.OutboundHandlerMeta } +// Dispatch implements OutboundHandler.Dispatch(). func (v *VMessOutboundHandler) Dispatch(target v2net.Destination, payload *buf.Buffer, ray ray.OutboundRay) { defer ray.OutboundInput().Release() defer ray.OutboundOutput().Close() @@ -150,6 +152,7 @@ func (v *VMessOutboundHandler) handleResponse(session *encoding.ClientSession, c return } +// Factory is a proxy factory for VMess outbound. type Factory struct{} func (v *Factory) StreamCapability() v2net.NetworkList {