From 0cf3599db2633ac03e2ea37c514c2af7be0e8256 Mon Sep 17 00:00:00 2001 From: Iskander Sharipov Date: Mon, 1 Oct 2018 12:03:23 +0300 Subject: [PATCH] s/len/length/ s/cap/capacity/ to avoid builtin shadowing --- proxy/vmess/encoding/commands.go | 6 +++--- transport/internet/udp/hub.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/proxy/vmess/encoding/commands.go b/proxy/vmess/encoding/commands.go index 1b61f7773..11d93d670 100644 --- a/proxy/vmess/encoding/commands.go +++ b/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 } diff --git a/transport/internet/udp/hub.go b/transport/internet/udp/hub.go index 9ac25db33..2da7a5cf2 100644 --- a/transport/internet/udp/hub.go +++ b/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 } }