Преглед на файлове

partially revert compression stream.

Darien Raymond преди 9 години
родител
ревизия
99c897992d
променени са 3 файла, в които са добавени 15 реда и са изтрити 2 реда
  1. 9 2
      common/protocol/headers.go
  2. 3 0
      proxy/vmess/account.proto
  3. 3 0
      proxy/vmess/outbound/outbound.go

+ 9 - 2
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) {

+ 3 - 0
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;
 }

+ 3 - 0
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 {