Browse Source

s/len/length/ s/cap/capacity/ to avoid builtin shadowing

Iskander Sharipov 7 years ago
parent
commit
0cf3599db2
2 changed files with 5 additions and 5 deletions
  1. 3 3
      proxy/vmess/encoding/commands.go
  2. 2 2
      transport/internet/udp/hub.go

+ 3 - 3
proxy/vmess/encoding/commands.go

@@ -41,12 +41,12 @@ func MarshalCommand(command interface{}, writer io.Writer) error {
 	}
 
 	auth := Authenticate(buffer.Bytes())
-	len := buffer.Len() + 4
-	if len > 255 {
+	length := buffer.Len() + 4
+	if length > 255 {
 		return ErrCommandTooLarge
 	}
 
-	common.Must2(writer.Write([]byte{cmdID, byte(len), byte(auth >> 24), byte(auth >> 16), byte(auth >> 8), byte(auth)}))
+	common.Must2(writer.Write([]byte{cmdID, byte(length), byte(auth >> 24), byte(auth >> 16), byte(auth >> 8), byte(auth)}))
 	common.Must2(writer.Write(buffer.Bytes()))
 	return nil
 }

+ 2 - 2
transport/internet/udp/hub.go

@@ -17,9 +17,9 @@ type Payload struct {
 
 type HubOption func(h *Hub)
 
-func HubCapacity(cap int) HubOption {
+func HubCapacity(capacity int) HubOption {
 	return func(h *Hub) {
-		h.capacity = cap
+		h.capacity = capacity
 	}
 }