diff --git a/proxy/errors.go b/proxy/common/errors/errors.go similarity index 91% rename from proxy/errors.go rename to proxy/common/errors/errors.go index 4eb105696..edafcce7d 100644 --- a/proxy/errors.go +++ b/proxy/common/errors/errors.go @@ -1,4 +1,4 @@ -package proxy +package errors import ( "errors" diff --git a/proxy/socks/protocol/socks.go b/proxy/socks/protocol/socks.go index 38d8a0070..a1da8ec0d 100644 --- a/proxy/socks/protocol/socks.go +++ b/proxy/socks/protocol/socks.go @@ -7,7 +7,7 @@ import ( "github.com/v2ray/v2ray-core/common/alloc" "github.com/v2ray/v2ray-core/common/log" v2net "github.com/v2ray/v2ray-core/common/net" - "github.com/v2ray/v2ray-core/proxy" + proxyerrors "github.com/v2ray/v2ray-core/proxy/common/errors" "github.com/v2ray/v2ray-core/transport" ) @@ -66,7 +66,7 @@ func ReadAuthentication(reader io.Reader) (auth Socks5AuthenticationRequest, aut auth.version = buffer.Value[0] if auth.version != socksVersion { log.Warning("Unknown protocol version %d", auth.version) - err = proxy.InvalidProtocolVersion + err = proxyerrors.InvalidProtocolVersion return } diff --git a/proxy/socks/socks.go b/proxy/socks/socks.go index 493245903..53899d3ce 100644 --- a/proxy/socks/socks.go +++ b/proxy/socks/socks.go @@ -12,7 +12,7 @@ import ( "github.com/v2ray/v2ray-core/common/log" v2net "github.com/v2ray/v2ray-core/common/net" "github.com/v2ray/v2ray-core/common/retry" - "github.com/v2ray/v2ray-core/proxy" + proxyerrors "github.com/v2ray/v2ray-core/proxy/common/errors" jsonconfig "github.com/v2ray/v2ray-core/proxy/socks/config/json" "github.com/v2ray/v2ray-core/proxy/socks/protocol" ) @@ -128,7 +128,7 @@ func (server *SocksServer) handleSocks5(reader *v2net.TimeOutReader, writer io.W } if status != byte(0) { log.Warning("Invalid user account: %s", upRequest.AuthDetail()) - return proxy.InvalidAuthentication + return proxyerrors.InvalidAuthentication } } diff --git a/proxy/vmess/protocol/vmess.go b/proxy/vmess/protocol/vmess.go index 0c01ab775..f71a844b4 100644 --- a/proxy/vmess/protocol/vmess.go +++ b/proxy/vmess/protocol/vmess.go @@ -13,7 +13,7 @@ import ( v2io "github.com/v2ray/v2ray-core/common/io" "github.com/v2ray/v2ray-core/common/log" v2net "github.com/v2ray/v2ray-core/common/net" - "github.com/v2ray/v2ray-core/proxy" + proxyerrors "github.com/v2ray/v2ray-core/proxy/common/errors" "github.com/v2ray/v2ray-core/proxy/vmess/config" "github.com/v2ray/v2ray-core/proxy/vmess/protocol/user" "github.com/v2ray/v2ray-core/transport" @@ -77,7 +77,7 @@ func (r *VMessRequestReader) Read(reader io.Reader) (*VMessRequest, error) { userId, timeSec, valid := r.vUserSet.GetUser(buffer.Value[:nBytes]) if !valid { - return nil, proxy.InvalidAuthentication + return nil, proxyerrors.InvalidAuthentication } aesCipher, err := aes.NewCipher(userId.CmdKey()) @@ -104,7 +104,7 @@ func (r *VMessRequestReader) Read(reader io.Reader) (*VMessRequest, error) { if request.Version != Version { log.Warning("Invalid protocol version %d", request.Version) - return nil, proxy.InvalidProtocolVersion + return nil, proxyerrors.InvalidProtocolVersion } request.RequestIV = buffer.Value[1:17] // 16 bytes